diff options
| author | Shinya Sato <shinnya.sato@gmail.com> | 2022-02-09 14:35:55 +0900 |
|---|---|---|
| committer | Shinya Sato <shinnya.sato@gmail.com> | 2022-02-09 14:35:55 +0900 |
| commit | f867b11f97b105ccb563e1157fe480ad63712df0 (patch) | |
| tree | 71e6b93d0d5df6c8fb5c13258b8511e0455a55c2 /src/id_table.h | |
| parent | 224274a8c7d00588ecb2471b425e249e38af90fc (diff) | |
| parent | be334c15c2718a66378666358eaefabbda21bff9 (diff) | |
| download | inpla-f867b11f97b105ccb563e1157fe480ad63712df0.tar.gz inpla-f867b11f97b105ccb563e1157fe480ad63712df0.zip | |
Merge branch 'develop'
Diffstat (limited to 'src/id_table.h')
| -rw-r--r-- | src/id_table.h | 24 |
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(); |
