2024-07-20 16:53:13 +02:00
|
|
|
#ifndef EVENTS_H
|
|
|
|
#define EVENTS_H
|
|
|
|
|
|
|
|
#define MAX_VARIABLES 32
|
2024-07-20 17:44:44 +02:00
|
|
|
#define MESSAGE_BUFFER_SZ 1024
|
|
|
|
#define TOKEN_MAX_SZ 1024
|
2024-07-20 16:53:13 +02:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int *variables[MAX_VARIABLES];
|
|
|
|
char *var_names[MAX_VARIABLES];
|
|
|
|
unsigned int vars;
|
|
|
|
} EventHandler;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
T_NULL,
|
|
|
|
T_VAR_EDIT,
|
|
|
|
T_AMOUNT
|
|
|
|
} Token;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
OP_NULL,
|
|
|
|
OP_SET,
|
|
|
|
OP_ADD,
|
|
|
|
OP_SUB,
|
|
|
|
OP_DIV,
|
|
|
|
OP_MUL,
|
|
|
|
OP_MOD,
|
|
|
|
OP_AMOUNT
|
|
|
|
} Operation;
|
|
|
|
|
|
|
|
void events_init_handler(EventHandler *handler);
|
|
|
|
int events_bind_variable(EventHandler *handler, int *var, char *name);
|
|
|
|
char *events_parse_string(EventHandler *handler, char *message);
|
|
|
|
|
|
|
|
#endif
|