54 lines
773 B
C
54 lines
773 B
C
#ifndef CMDLIST_h
|
|
#define CMDLIST_h
|
|
|
|
typedef struct CMD_t {
|
|
char* cmd;
|
|
void (*fn)(char* line);
|
|
} CMD_t;
|
|
|
|
typedef struct CMDList_s {
|
|
void* a;
|
|
void* b;
|
|
void* c;
|
|
void* d;
|
|
void* e;
|
|
void* f;
|
|
void* g;
|
|
void* h;
|
|
void* i;
|
|
void* j;
|
|
void* k;
|
|
void* l;
|
|
void* m;
|
|
void* n;
|
|
void* o;
|
|
void* p;
|
|
void* q;
|
|
void* r;
|
|
void* s;
|
|
void* t;
|
|
void* u;
|
|
void* v;
|
|
void* w;
|
|
void* x;
|
|
void* y;
|
|
void* z;
|
|
CMD_t* cmd;
|
|
} CMDList_t;
|
|
|
|
|
|
|
|
|
|
// initilises a CMDList_t with all null pointers
|
|
extern CMDList_t* CMDList_init();
|
|
|
|
// free up the full tree from memory
|
|
extern int CMDList_deinit(CMDList_t *list);
|
|
|
|
// add a command in the command tree
|
|
extern int CMDList_add(CMDList_t *list, CMD_t* cmd);
|
|
|
|
// search command in the tree
|
|
extern CMD_t* CMDList_get(CMDList_t *list, char* cmd);
|
|
|
|
#endif |