moka/lib/status.h

45 lines
792 B
C

#ifndef MK_STATUS_H
#define MK_STATUS_H
#include "commons.h"
#include "vec.h"
#define STATUS_KIND(G) \
G(STATUS_ERROR),\
G(STATUS_WARNING)
MK_ENUM_H(Status, STATUS_KIND);
struct message
{
Status kind;
char* what;
int where;
};
struct status
{
struct vec messages;
};
void message_init(struct message* self,
Status kind,
char const* what,
int where);
void message_free(struct message* self);
void status_init(struct status* self);
void status_free(struct status* self);
void status_push(struct status* self,
Status kind,
int where,
char const* format,
...);
void status_dump(struct status* self);
bool status_is_ok(struct status* self);
#endif