all repos — hex @ ce541423a6f1ef5da5f7a781ed284e2b67235335

A tiny, minimalist, slightly-esoteric concatenative programming lannguage.

Fixes.
h3rald h3rald@h3rald.com
Tue, 26 Nov 2024 14:59:01 +0100
commit

ce541423a6f1ef5da5f7a781ed284e2b67235335

parent

a94604c63a794cf83139f86bbc91b2b1ae4b7286

2 files changed, 22 insertions(+), 5 deletions(-)

jump to
M hex.chex.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.hhex.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);