#include "forth.h" Word* add_primitive(const char* name, void (*code)(Word*), uint8_t flags) { Word* w = forth_alloc_word(); w->prev = dict_head; dict_head = w; size_t len = forth_strlen(name); if (len > MAX_NAME_LEN) len = MAX_NAME_LEN; w->flags = flags | (uint8_t)len; forth_memcpy(w->name, name, len); w->name[len] = '\0'; w->code = code; w->body = NULL; return w; } Word* lookup_word(const char* name) { for (Word* w = dict_head; w != NULL; w = w->prev) { if (w->flags & (1 << 6)) continue; if (forth_strcmp(w->name, name) == 0) return w; } return NULL; } Word* lookup_word_internal(const char* name) { for (Word* w = dict_head; w != NULL; w = w->prev) { if (forth_strcmp(w->name, name) == 0) return w; } return NULL; }