-
Notifications
You must be signed in to change notification settings - Fork 0
/
command_objects.h
33 lines (29 loc) · 1 KB
/
command_objects.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef __COMMAND_OBJECTS_H__
#define __COMMAND_OBJECTS_H__
#include <sys/types.h>
#define TOKEN_MAX_NUM 30
// 명령어 타입을 enum 형태로 표현한다.
enum shell_command_type{
TYPE_HELP, TYPE_DIR, TYPE_QUIT, TYPE_HISTORY,
TYPE_DUMP, TYPE_EDIT, TYPE_FILL, TYPE_RESET,
TYPE_OPCODE, TYPE_OPCODELIST, TYPE_ASSEMBLE,
TYPE_TYPE, TYPE_SYMBOL, TYPE_PROGADDR, TYPE_RUN, TYPE_BP,
TYPE_BP_CLEAR, TYPE_LOADER, TYPE_BP_LIST
};
// command 를 구조체로 구조화 하여 표현.
typedef struct command {
char* raw_command;
char* tokens[TOKEN_MAX_NUM + 5];
size_t token_cnt;
enum shell_command_type type;
} Command;
// shell 의 상태를 표현함.
typedef enum SHELL_STATUS {
INPUT_READ_SUCCESS, TOO_LONG_WRONG_INPUT,
TOKENIZING_SUCCESS, TOO_MANY_TOKEN,
INVALID_INPUT, VALID_COMMAND, INVALID_COMMAND,
INVALID_COMMAND_TYPE, VALID_COMMAND_TYPE,
INVALID_PARAMETERS, VALID_PARAMETERS,
MISSING_REQUIRE_PARAMETER, EXECUTE_SUCCESS, QUIT, EXECUTE_FAIL
} shell_status;
#endif