From fa57140c3e3a56f23a37351a66d51f2cf3464561 Mon Sep 17 00:00:00 2001 From: Quentin Ladevie Date: Fri, 16 Aug 2024 18:05:11 +0200 Subject: Add support for visual studio pro Initial code for command parsing --- src/main.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index e7278c8..3e9ee07 100644 --- a/src/main.c +++ b/src/main.c @@ -13,6 +13,37 @@ typedef int16_t i16; typedef int32_t i32; typedef int64_t i64; + +enum CMD_TYPE { + CMD_CONTINUE, + CMD_MAX, +}; + +struct token { + const char* start; + u8 size; +}; + +struct command { + enum CMD_TYPE cmd_type; +}; + +void tokenize(const char* cmd, struct token* tokens) { + const char* start = cmd; + const char* cur = cmd; + struct token* cur_token = tokens[0]; + while(*cur != '\0') { + + } +} + +enum CMD_TYPE command_parser(const char* cmd) { + struct token* tokens = (struct token*)VirtualAlloc(NULL, sizeof(struct token) * 32, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); + tokenize(cmd, tokens); + + return CMD_MAX; +} + void print(const char* format, ...) { va_list args; va_start(args, format); @@ -129,6 +160,7 @@ int mainCRTStartup() { ReadConsole(h_input, input_buffer, sizeof(input_buffer), &input_size, NULL); // print("%s%s", "ReadConsole :", input_buffer); + command_parser(input_buffer); if (input_buffer[0] == 'g') { ContinueDebugEvent( dbg_event.dwProcessId, -- cgit v1.3