scratch/proglangs/nsforth/dict.h
2024-12-26 14:02:40 -03:00

17 lines
789 B
C

#ifndef _DICT_H_
#define _DICT_H_
#include "defs.h"
#define DELETED_ENTRY_MARK ((void *)-1)
#define IS_ENTRY(ent) ((ent)->word_name != NULL && (ent)->word_name != DELETED_ENTRY_MARK)
#define dict_delete(ent) ((ent)->word_name = DELETED_ENTRY_MARK)
//#define dict_enter_scope(sym_t) ((sym_t = dict_new_enviroment(sym_t)))
//#define dict_leave_scope(sym_t) ((sym_t = sym_t->prev))
struct dict_table *dict_new_env(struct dict_table *prev_env);
void dict_destroy_env(struct dict_table *env);
struct dict_ent *dict_insert(struct dict_table *env, const char *word_name, uint8_t flags, dict_fn nat_fn, struct comp_word *fn_def);
struct dict_ent *dict_lookup(struct dict_table *env, const char *word_name);
//struct dict_ent *dict_lookup_scoped(struct dict_table *env, char *word_name);
#endif