all repos — hex @ b44e5fd120743a570fb75c503e949b569c1a2641

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

Implemented symbol symbols
Fabio Cevasco h3rald@h3rald.com
Mon, 23 Dec 2024 13:01:42 +0100
commit

b44e5fd120743a570fb75c503e949b569c1a2641

parent

0c3becebfd515a08ac8d4f054798590685b71d6c

1 files changed, 18 insertions(+), 0 deletions(-)

jump to
M src/symbols.csrc/symbols.c

@@ -118,6 +118,24 @@ HEX_FREE(ctx, item);

return 0; } +int hex_symbol_symbols(hex_context_t *ctx) +{ + hex_item_t **quotation = (hex_item_t **)malloc(ctx->registry.size * sizeof(hex_item_t *)); + for (size_t i=0; i<ctx->registry.size; i++) + { + char *id = malloc(strlen(ctx->registry.entries[i].key) * sizeof(char *)); + strcpy(id, ctx->registry.entries[i].key); + quotation[i] = (hex_item_t *)malloc(sizeof(hex_item_t)); + quotation[i] = hex_string_item(ctx, id); + } + if (hex_push_quotation(ctx, quotation, ctx->registry.size) != 0) + { + hex_free_list(ctx, quotation, list.quotation_size); + return 1; + } + return 0; +} + int hex_symbol_type(hex_context_t *ctx) {