From 6b3075d90d945d5e7e8fd4d28284ffd99dbeb82e Mon Sep 17 00:00:00 2001 From: Shinya Sato Date: Fri, 24 Sep 2021 16:42:54 +0900 Subject: v0.4.1 --- src/name_table.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/name_table.h (limited to 'src/name_table.h') diff --git a/src/name_table.h b/src/name_table.h new file mode 100644 index 0000000..c7f885d --- /dev/null +++ b/src/name_table.h @@ -0,0 +1,50 @@ +#ifndef _NAME_TABLE_ +#define _NAME_TABLE_ + +#include "mytype.h" +#include "id_table.h" + + +/************************************** + NAME TABLE +**************************************/ + +typedef struct NameList { + char *name; // KEY + IDTYPE id; + + // `heap' stores a heap only of a global name, + // that is, is kept having NULL for other nodes, such as agents. + VALUE heap; + + struct NameList *next; +} NameList; + +#define NAME_HASHSIZE 127 +static NameList *NameHashTable[NAME_HASHSIZE]; /* ハッシュテーブル本体 */ + +// It should be called at first, and never called after that. +void NameTable_init(); + + +void NameTable_set_heap_id(char *key, VALUE heap, IDTYPE id); + + +// Erace key entry from NameHashTable +void NameTable_erase(char *key); + + +VALUE NameTable_get_heap(char *key); +IDTYPE NameTable_get_set_id(char *key); + +void NameTable_puts_all(); +void NameTable_free_all(); + +int NameTable_ckech_if_term_has_gname(VALUE term); + +int term_has_keynode(VALUE keynode, VALUE term); +int keynode_exists_in_another_term(VALUE keynode, VALUE *connected_from); +void global_replace_keynode_in_another_term(VALUE keynode, VALUE term); + + +#endif -- cgit v1.2.3