2024-03-25 20:33:02 +00:00
|
|
|
#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;
|
2024-03-26 18:31:33 +00:00
|
|
|
int where;
|
2024-03-25 20:33:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct status
|
|
|
|
{
|
|
|
|
struct vec messages;
|
|
|
|
};
|
|
|
|
|
2024-03-26 18:31:33 +00:00
|
|
|
void message_init(struct message* self,
|
|
|
|
Status kind,
|
|
|
|
char const* what,
|
|
|
|
int where);
|
2024-03-25 20:33:02 +00:00
|
|
|
void message_free(struct message* self);
|
|
|
|
|
|
|
|
void status_init(struct status* self);
|
|
|
|
void status_free(struct status* self);
|
|
|
|
|
2024-03-26 18:31:33 +00:00
|
|
|
void status_push(struct status* self,
|
2024-03-25 20:33:02 +00:00
|
|
|
Status kind,
|
2024-03-26 18:31:33 +00:00
|
|
|
int where,
|
2024-03-25 20:33:02 +00:00
|
|
|
char const* format,
|
|
|
|
...);
|
|
|
|
|
|
|
|
void status_dump(struct status* self);
|
|
|
|
|
|
|
|
bool status_is_ok(struct status* self);
|
|
|
|
|
|
|
|
#endif
|