No segfault message but still not working.
h3rald h3rald@h3rald.com
Thu, 26 Dec 2024 15:40:07 +0100
1 files changed,
11 insertions(+),
5 deletions(-)
jump to
M
src/interpreter.c
→
src/interpreter.c
@@ -8,21 +8,27 @@ ////////////////////////////////////////
hex_context_t *hex_init() { - hex_context_t *context = malloc(sizeof(hex_context_t *)); + hex_context_t *context = malloc(sizeof(hex_context_t)); context->argc = 0; context->argv = NULL; - context->registry = malloc(sizeof(hex_registry_t *)); + context->registry = malloc(sizeof(hex_registry_t)); + context->registry->entries = malloc(HEX_REGISTRY_SIZE * sizeof(hex_registry_entry_t *)); context->registry->size = 0; - context->docs = malloc(sizeof(hex_doc_dictionary_t *)); + context->docs = malloc(sizeof(hex_doc_dictionary_t)); + context->docs->entries = malloc(HEX_NATIVE_SYMBOLS * sizeof(hex_doc_entry_t)); context->docs->size = 0; - context->stack = malloc(sizeof(hex_stack_t *)); + context->stack = malloc(sizeof(hex_stack_t)); + context->stack->entries = malloc(HEX_STACK_SIZE * sizeof(hex_item_t)); context->stack->top = -1; + context->stack_trace = malloc(sizeof(hex_stack_trace_t)); + context->stack_trace->entries = malloc(HEX_STACK_TRACE_SIZE * sizeof(hex_token_t)); context->stack_trace->start = 0; context->stack_trace->size = 0; - context->settings = malloc(sizeof(hex_settings_t *)); + context->settings = malloc(sizeof(hex_settings_t)); context->settings->debugging_enabled = 0; context->settings->errors_enabled = 1; context->settings->stack_trace_enabled = 1; + context->symbol_table = malloc(sizeof(hex_symbol_table_t)); context->symbol_table->count = 0; context->symbol_table->symbols = malloc(HEX_MAX_USER_SYMBOLS * sizeof(char *)); return context;