#ifndef CMD_H
#define CMD_H
#define NULL 0
#define TOKEN 1
#define TOKEN_LEAF 2
#define VALUE 3
#define VALUE_LEAF 4
struct cmd
{
int type;
char *name;
char *tip;
void (*func)();
struct cmd *next;
};
#define DECLEAR_CMD(CMD) \
extern struct cmd CMD[];
#define BEGIN_CMD_DEFINE(CMD) \
struct cmd CMD[]={
#define END_CMD_DEFINE \
{0,NULL,NULL,NULL,NULL} \
};
#define IMPLEMENT_CMD_TOKEN(NAME,TIP,NEXT) \
{TOKEN,NAME,TIP,NULL,NEXT},
#define IMPLEMENT_CMD_TOKEN_LEAF(NAME,TIP,FUNC) \
{TOKEN_LEAF,NAME,TIP,FUNC,NULL},
#define IMPLEMENT_CMD_VALUE(NAME,TIP,NEXT) \
{VALUE,NAME,TIP,NULL,NEXT},
#define IMPLEMENT_CMD_VALUE_LEAF(NAME,TIP,FUNC) \
{VALUE_LEAF,NAME,TIP,FUNC,NULL},
void cmd_root_set(struct cmd *root);
int cmd_process(int argc,char *argv[]);
#endif /* CMD_H */