aboutsummaryrefslogtreecommitdiff
path: root/src/id_table.h
diff options
context:
space:
mode:
authorShinya Sato <shinnya.sato@gmail.com>2022-02-09 14:35:38 +0900
committerShinya Sato <shinnya.sato@gmail.com>2022-02-09 14:35:38 +0900
commitbe334c15c2718a66378666358eaefabbda21bff9 (patch)
tree71e6b93d0d5df6c8fb5c13258b8511e0455a55c2 /src/id_table.h
parent03d7d92b4c401b553bc64da535b0621da67f6cc4 (diff)
downloadinpla-be334c15c2718a66378666358eaefabbda21bff9.tar.gz
inpla-be334c15c2718a66378666358eaefabbda21bff9.zip
v0.7.2
Diffstat (limited to '')
-rw-r--r--src/id_table.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/id_table.h b/src/id_table.h
index ae97c75..02ac9e6 100644
--- a/src/id_table.h
+++ b/src/id_table.h
@@ -1,6 +1,7 @@
#ifndef _ID_TABLE_
#define _ID_TABLE_
-
+#include "ast.h"
+#include "mytype.h"
// When NUM_AGENT is 256:
// 0 .. 255: AGENT
@@ -52,11 +53,11 @@
#define END_ID_OF_AGENT 255
#define NUM_AGENTS END_ID_OF_AGENT+1 // 256
-#define ID_NAME NUM_AGENTS // 256
+#define ID_NAME NUM_AGENTS // starts from 256 (NUM_AGENTS)
#define START_ID_OF_GNAME ID_NAME+1
-#define NUM_NAMES NUM_AGENTS // 256
+#define NUM_GNAMES NUM_AGENTS // 256: the same as the size of AGENT
//#define IS_AGENTID(a) (a < ID_NAME)
@@ -74,16 +75,27 @@
**************************************/
typedef struct {
char *name;
- int arity;
+ union {
+ int arity;
+ VALUE heap;
+ } aux;
} IdTableT;
-#define IDTABLE_SIZE (NUM_AGENTS + NUM_NAMES) // AGENT + NAME
+
+#define IDTABLE_SIZE (NUM_AGENTS + NUM_GNAMES) // AGENT + GNAME
void IdTable_init();
+
void IdTable_set_name(int id, char *symname);
-void IdTable_set_arity(int id, int arity);
char *IdTable_get_name(int id);
+
+void IdTable_set_arity(int id, int arity);
int IdTable_get_arity(int id);
+
+void IdTable_set_heap(int id, VALUE heap);
+VALUE IdTable_get_heap(int id);
+
+
int IdTable_new_agentid();
int IdTable_new_gnameid();