aboutsummaryrefslogtreecommitdiff
path: root/src/name_table.h
blob: c7f885d083e0cc024e4137fe28caf20d5bbedcaa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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