WONKY



LOG | FILES | OVERVIEW


#ifndef WONKY_ERROR_H
#define WONKY_ERROR_H WONKY_ERROR_H
#include <gcc_error.hh>
#include <lexer.h>
#include <stdio.h>
#include <stdarg.h>
#include <queue.h>
#include <gcc_string.h>
#include <common.h>
#include <compile.h>
#include <type.h>
#include <translation_unit.h>
#include <source_file.h>
#include <wonky_string.h>
#include <wonky_stream.h>

struct Wonky_Message
{
	enum Wonky_Message_Type type;
	enum Wonky_Message_Source source;
	struct wonky_str *message;
	ssize_t line; /*negative values means not to print the line and column*/
	ssize_t column; 
	char *filename; /*could be NULL*/
	size_t filename_size;
};

struct Wonky_Message* get_wonky_message(enum Wonky_Message_Type type,enum Wonky_Message_Source source,ssize_t line,ssize_t column,char *filename,size_t filename_size,const char *msg_fmt,...);
struct Wonky_Message* get_wonky_message_vargs(enum Wonky_Message_Type type,enum Wonky_Message_Source source,ssize_t line,ssize_t column,char *filename,size_t filename_size,const char *msg_fmt,va_list args);

void push_generic_error(struct Program *program,const char *err_fmt,...);
void push_generic_error_vargs(struct Program *program,const char *err_fmt,va_list args);

void push_generic_note(struct Program *program,const char *note_fmt,...);
void push_generic_note_vargs(struct Program *program,const char *note_fmt,va_list args);

void push_message_struct(struct Program *program,struct Wonky_Message *msg);

void push_token_pointer_error(struct Token_Pointer *ptr,const char *err_fmt,...);
void push_token_pointer_error_vargs(struct Token_Pointer *ptr,const char *err_fmt,va_list args);

void push_translation_error(const char *fmt,struct Translation_Data *translation_data,...);
void push_translation_error_vargs(const char *fmt,struct Translation_Data *translation_data,va_list args);
void push_translation_note(const char *fmt,struct Translation_Data *translation_data,...);
void push_translation_note_vargs(const char *fmt,struct Translation_Data *translation_data,va_list args);

void print_message(struct wonky_stream *out,struct Wonky_Message *msg);

void delete_message(struct Program *program,struct Wonky_Message *msg);
void delete_error(struct Program *program,struct Wonky_Message *error);

#endif