feat: add comma, fix allot, and support bare-metal custom memory
Co-authored-by: aider (openrouter/moonshotai/kimi-k2.6) <aider@aider.chat>
This commit is contained in:
+22
-1
@@ -1,13 +1,21 @@
|
||||
#include "forth.h"
|
||||
|
||||
// Static storage for bare-metal portability
|
||||
#ifndef FORTH_CUSTOM_MEMORY
|
||||
static int64_t data_stack_storage[FORTH_DATA_STACK_SIZE];
|
||||
int64_t *data_stack = data_stack_storage;
|
||||
#else
|
||||
int64_t *data_stack;
|
||||
#endif
|
||||
int32_t data_sp = -1;
|
||||
int32_t data_cap = FORTH_DATA_STACK_SIZE;
|
||||
|
||||
#ifndef FORTH_CUSTOM_MEMORY
|
||||
static Cell ret_stack_storage[FORTH_RET_STACK_SIZE];
|
||||
Cell *ret_stack = ret_stack_storage;
|
||||
#else
|
||||
Cell *ret_stack;
|
||||
#endif
|
||||
int32_t rp = -1;
|
||||
int32_t ret_cap = FORTH_RET_STACK_SIZE;
|
||||
Cell* ip = NULL;
|
||||
@@ -16,8 +24,12 @@ Word* dict_head = NULL;
|
||||
|
||||
int state = 0;
|
||||
|
||||
#ifndef FORTH_CUSTOM_MEMORY
|
||||
static Cell compile_buf_storage[FORTH_COMPILE_BUF_SIZE];
|
||||
Cell *compile_buf = compile_buf_storage;
|
||||
#else
|
||||
Cell *compile_buf;
|
||||
#endif
|
||||
int32_t compile_idx = 0;
|
||||
int32_t compile_cap = FORTH_COMPILE_BUF_SIZE;
|
||||
char compiling_name[MAX_NAME_LEN + 1] = {0};
|
||||
@@ -26,15 +38,24 @@ char* input_buf = NULL;
|
||||
size_t input_buf_cap = 0;
|
||||
char* input_ptr = NULL;
|
||||
|
||||
#ifndef FORTH_CUSTOM_MEMORY
|
||||
static int64_t compile_stack_storage[FORTH_COMPILE_STACK_SIZE];
|
||||
int64_t *compile_stack = compile_stack_storage;
|
||||
#else
|
||||
int64_t *compile_stack;
|
||||
#endif
|
||||
int32_t compile_sp = -1;
|
||||
int32_t compile_stack_cap = FORTH_COMPILE_STACK_SIZE;
|
||||
|
||||
#ifndef FORTH_CUSTOM_MEMORY
|
||||
static Cell user_mem_storage[FORTH_USER_MEM_CELLS];
|
||||
Cell *user_mem = user_mem_storage;
|
||||
int64_t user_mem_size = FORTH_USER_MEM_CELLS;
|
||||
Cell* here = user_mem_storage;
|
||||
#else
|
||||
Cell *user_mem;
|
||||
Cell* here;
|
||||
#endif
|
||||
int64_t user_mem_size = FORTH_USER_MEM_CELLS;
|
||||
|
||||
Word* w_exit = NULL;
|
||||
Word* w_docolon = NULL;
|
||||
|
||||
Reference in New Issue
Block a user