diff options
| author | Shinya Sato <shinnya.sato@gmail.com> | 2022-07-25 17:15:34 +0900 |
|---|---|---|
| committer | Shinya Sato <shinnya.sato@gmail.com> | 2022-07-25 17:15:34 +0900 |
| commit | a65ef22b5a36cd211883e094daf1ecf74bd40d66 (patch) | |
| tree | 7a3d4f2f75a6f267e9008bb651159b91c39166e5 /src/id_table.c | |
| parent | 4753a3914675dd8a3dfb8233062f90b65520ba4e (diff) | |
| parent | 8ec1385229c73246d89441f15a140d3eeeec093d (diff) | |
| download | inpla-a65ef22b5a36cd211883e094daf1ecf74bd40d66.tar.gz inpla-a65ef22b5a36cd211883e094daf1ecf74bd40d66.zip | |
Merge branch 'develop'
Diffstat (limited to '')
| -rw-r--r-- | src/id_table.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/id_table.c b/src/id_table.c index 3dea99c..07706f9 100644 --- a/src/id_table.c +++ b/src/id_table.c @@ -11,16 +11,16 @@ static int NextAgentId, NextGnameId; void IdTable_init() { int i; - NextAgentId = START_ID_OF_AGENT -1; + NextAgentId = START_ID_OF_USER_AGENT -1; NextGnameId = START_ID_OF_GNAME -1; // 0 : ID_INT(used in expressions) - // 1 .. START_ID_OF_AGENT-1 : built-in agents - // START_IS_OF_AGENT .. NUM_AGENTS-1: user defined agents + // 1 .. START_ID_OF_USER_AGENT-1 : built-in agents + // START_ID_OF_USER_AGENT .. NUM_AGENTS-1: user defined agents // NUM_AGENTS(=ID_NAME) .. : names for (i=0; i<=END_ID_OF_AGENT; i++) { IdTable[i].name = NULL; - IdTable[i].aux.arity = -1; + IdTable[i].aux.arity = -1; // means ERROR } for (i=START_ID_OF_GNAME; i<IDTABLE_SIZE; i++) { IdTable[i].name = NULL; @@ -51,6 +51,8 @@ void IdTable_init() { IdTable[ID_DIV2].aux.arity = 2; IdTable[ID_MOD].aux.arity = 2; IdTable[ID_MOD2].aux.arity = 2; + IdTable[ID_PERCENT].aux.arity = 1; + IdTable[ID_ERASER].aux.arity = 0; IdTable[ID_DUP].aux.arity = 2; @@ -79,6 +81,7 @@ void IdTable_init() { IdTable[ID_DIV2].name = "_Div"; IdTable[ID_MOD].name = "Mod"; IdTable[ID_MOD2].name = "_Mod"; + IdTable[ID_PERCENT].name = "%"; IdTable[ID_ERASER].name = "Eraser"; IdTable[ID_DUP].name = "Dup"; @@ -92,7 +95,7 @@ int IdTable_getid_builtin_funcAgent(Ast *agent) { // puts("!!"); int id = -1; - if (agent->id != AST_AGENT) { + if ((agent->id != AST_AGENT) && (agent->id != AST_PERCENT)) { return -1; } @@ -175,9 +178,9 @@ VALUE IdTable_get_heap(int id) int IdTable_new_agentid() { NextAgentId++; - if (NextAgentId > ID_NAME) { - printf("ERROR: The number of agents exceeded the size (%d) for agents in IDTABLE\n", - ID_NAME); + if (NextAgentId > END_ID_OF_USER_AGENT) { + printf("ERROR: The number of agents exceeded the limitation size (%d).\n", + END_ID_OF_USER_AGENT); exit(-1); } return(NextAgentId); |
