feat: switch to 64-bit integers and dynamic memory
Co-authored-by: aider (openrouter/deepseek/deepseek-v4-pro) <aider@aider.chat>
This commit is contained in:
+5
-5
@@ -1,11 +1,11 @@
|
||||
#include "forth.h"
|
||||
|
||||
Word* add_primitive(const char* name, void (*code)(Word*), uint8_t flags) {
|
||||
if (dict_idx >= DICT_SIZE) {
|
||||
printf("Dictionary full\n");
|
||||
return NULL;
|
||||
Word* w = malloc(sizeof(Word));
|
||||
if (!w) {
|
||||
fprintf(stderr, "Out of memory\n");
|
||||
exit(1);
|
||||
}
|
||||
Word* w = &dict[dict_idx++];
|
||||
w->prev = dict_head;
|
||||
dict_head = w;
|
||||
|
||||
@@ -21,7 +21,7 @@ Word* add_primitive(const char* name, void (*code)(Word*), uint8_t flags) {
|
||||
|
||||
Word* lookup_word(const char* name) {
|
||||
for (Word* w = dict_head; w != NULL; w = w->prev) {
|
||||
if (w->flags & (1 << 6)) continue; // Skip hidden words
|
||||
if (w->flags & (1 << 6)) continue;
|
||||
if (strcmp(w->name, name) == 0) return w;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user