#ifndef INTERPRETER #define INTERPRETER #define MAX_BUF 256 #define SIG_MOD 0 #define FILE_MOD 1 typedef struct { char name[256]; int cmd; }Cmd;//配置关键词节点 #define CMD_DIR_LENGTH 3 //command 定义 #define INSTALL 0 #define RUN 1 #define QUIT 2 #define BAD_INPUT -1 typedef struct args { void *loc; int type; char name[256]; struct args* next; }args;//参数链表 typedef struct ctx { int index;//当前位置 int space_index[10];//当前行空格位置 int line;//当前行长度 int word;//当前解释词位置 args *arg;//当前环境下参数链表 char command[MAX_BUF];//当前行缓存 int statue;//当前状态 int fifofd[2]; }ctx;//上下文管理 int interpret(int mod, ctx *all_ctx,Cmd *cmd_dic); int init_interpreter(Cmd *cmd_dic,ctx *self,int fifo[2]); #define ARG_LENGTH 256 #endif