Fixes.
h3rald h3rald@h3rald.com
Tue, 26 Nov 2024 14:59:01 +0100
M
hex.c
→
hex.c
@@ -84,12 +84,28 @@ "clear",
"pop"}; //////////////////////////////////////// -// Registry Implementation // +// Context Implementation // //////////////////////////////////////// -void hex_free_element(hex_item_t element); -void hex_free_token(hex_token_t *token); -void hex_free_list(hex_item_t **quotation, int size); +hex_context_t hex_init() +{ + hex_context_t context; + context.argc = 0; + context.argv = NULL; + context.error = NULL; + context.registry.size = 0; + context.stack.top = -1; + context.stack_trace.start = 0; + context.stack_trace.size = 0; + context.settings.debugging_enabled = 0; + context.settings.errors_enabled = 1; + context.settings.stack_trace_enabled = 1; + return context; +} + +//////////////////////////////////////// +// Registry Implementation // +//////////////////////////////////////// int hex_valid_user_symbol(const char *symbol) {
M
hex.h
→
hex.h
@@ -92,7 +92,7 @@
// TODO: refactor and use this typedef struct hex_stack_t { - hex_item_t item[HEX_STACK_SIZE]; + hex_item_t entries[HEX_STACK_SIZE]; int top; } hex_stack_t;@@ -125,6 +125,7 @@ } hex_context_t;
// Functions +hex_context_t hex_init(); void hex_free_element(hex_item_t element); void hex_free_token(hex_token_t *token); void hex_free_list(hex_item_t **quotation, int size);