git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/embryo@72865
7cbeb6ba-43b4-40fd-8cce-
4c39aea84d33
static constvalue *
insert_constval(constvalue * prev, constvalue * next, char *name,
static constvalue *
insert_constval(constvalue * prev, constvalue * next, char *name,
memset(cur, 0, sizeof(constvalue));
strcpy(cur->name, name);
cur->value = val;
memset(cur, 0, sizeof(constvalue));
strcpy(cur->name, name);
cur->value = val;
cur->next = next;
prev->next = cur;
return cur;
}
constvalue *
cur->next = next;
prev->next = cur;
return cur;
}
constvalue *
-append_constval(constvalue * table, char *name, cell val, short index)
+append_constval(constvalue * table, char *name, cell val, short idx)
{
constvalue *cur, *prev;
{
constvalue *cur, *prev;
for (prev = table, cur = table->next; cur;
prev = cur, cur = cur->next)
/* nothing */ ;
for (prev = table, cur = table->next; cur;
prev = cur, cur = cur->next)
/* nothing */ ;
- return insert_constval(prev, NULL, name, val, index);
+ return insert_constval(prev, NULL, name, val, idx);
-find_constval(constvalue * table, char *name, short index)
+find_constval(constvalue * table, char *name, short idx)
{
constvalue *ptr = table->next;
while (ptr)
{
{
constvalue *ptr = table->next;
while (ptr)
{
- if (strcmp(name, ptr->name) == 0 && ptr->index == index)
+ if (strcmp(name, ptr->name) == 0 && ptr->index == idx)
return ptr;
ptr = ptr->next;
} /* while */
return ptr;
ptr = ptr->next;
} /* while */
doexpr(int comma, int chkeffect, int allowarray, int mark_endexpr,
int *tag, int chkfuncresult)
{
doexpr(int comma, int chkeffect, int allowarray, int mark_endexpr,
int *tag, int chkfuncresult)
{
- int constant, index, ident;
+ int constant, idx, ident;
int localstaging = FALSE;
cell val;
int localstaging = FALSE;
cell val;
localstaging = TRUE;
assert(stgidx == 0);
} /* if */
localstaging = TRUE;
assert(stgidx == 0);
} /* if */
errorset(sEXPRMARK);
do
{
/* on second round through, mark the end of the previous expression */
errorset(sEXPRMARK);
do
{
/* on second round through, mark the end of the previous expression */
endexpr(TRUE);
sideeffect = FALSE;
ident = expression(&constant, &val, tag, chkfuncresult);
endexpr(TRUE);
sideeffect = FALSE;
ident = expression(&constant, &val, tag, chkfuncresult);
errorset(sEXPRRELEASE);
if (localstaging)
{
errorset(sEXPRRELEASE);
if (localstaging)
{
stgset(FALSE); /* stop staging */
} /* if */
}
stgset(FALSE); /* stop staging */
} /* if */
}
int
constexpr(cell * val, int *tag)
{
int
constexpr(cell * val, int *tag)
{
cell cidx;
stgset(TRUE); /* start stage-buffering */
cell cidx;
stgset(TRUE); /* start stage-buffering */
- stgget(&index, &cidx); /* mark position in code generator */
+ stgget(&idx, &cidx); /* mark position in code generator */
errorset(sEXPRMARK);
expression(&constant, val, tag, FALSE);
errorset(sEXPRMARK);
expression(&constant, val, tag, FALSE);
- stgdel(index, cidx); /* scratch generated code */
+ stgdel(idx, cidx); /* scratch generated code */
stgset(FALSE); /* stop stage-buffering */
if (constant == 0)
error(8); /* must be constant expression */
stgset(FALSE); /* stop stage-buffering */
if (constant == 0)
error(8); /* must be constant expression */
static void
test(int label, int parens, int invert)
{
static void
test(int label, int parens, int invert)
{
cell cidx;
value lval = { NULL, 0, 0, 0, 0, NULL };
int localstaging = FALSE;
cell cidx;
value lval = { NULL, 0, 0, 0, 0, NULL };
int localstaging = FALSE;
stgset(TRUE); /* start staging */
localstaging = TRUE;
#if !defined NDEBUG
stgset(TRUE); /* start staging */
localstaging = TRUE;
#if !defined NDEBUG
- stgget(&index, &cidx); /* should start at zero if started
+ stgget(&idx, &cidx); /* should start at zero if started
- stgget(&index, &cidx); /* mark position (of last expression) in
+ stgget(&idx, &cidx); /* mark position (of last expression) in
* code generator */
if (hier14(&lval))
rvalue(&lval);
* code generator */
if (hier14(&lval))
rvalue(&lval);
if (lval.ident == iCONSTEXPR)
{ /* constant expression */
intest = (int)(long)popstk(); /* restore stack */
if (lval.ident == iCONSTEXPR)
{ /* constant expression */
intest = (int)(long)popstk(); /* restore stack */
if (lval.constval)
{ /* code always executed */
error(206); /* redundant test: always non-zero */
if (lval.constval)
{ /* code always executed */
error(206); /* redundant test: always non-zero */
{
int wq[wqSIZE], skiplab;
cell save_decl;
{
int wq[wqSIZE], skiplab;
cell save_decl;
- int save_nestlevel, index;
+ int save_nestlevel, idx;
int *ptr;
save_decl = declared;
int *ptr;
save_decl = declared;
assert(!staging);
stgset(TRUE); /* start staging */
assert(stgidx == 0);
assert(!staging);
stgset(TRUE); /* start staging */
assert(stgidx == 0);
stgmark(sSTARTREORDER);
stgmark((char)(sEXPRSTART + 0)); /* mark start of 2nd expression
* in stage */
stgmark(sSTARTREORDER);
stgmark((char)(sEXPRSTART + 0)); /* mark start of 2nd expression
* in stage */
needtoken(')');
} /* if */
stgmark(sENDREORDER); /* mark end of reversed evaluation */
needtoken(')');
} /* if */
stgmark(sENDREORDER); /* mark end of reversed evaluation */
stgset(FALSE); /* stop staging */
statement(NULL, FALSE);
jumplabel(wq[wqLOOP]);
stgset(FALSE); /* stop staging */
statement(NULL, FALSE);
jumplabel(wq[wqLOOP]);
static void
doassert(void)
{
static void
doassert(void)
{
cell cidx;
value lval = { NULL, 0, 0, 0, 0, NULL };
cell cidx;
value lval = { NULL, 0, 0, 0, 0, NULL };
else
{
stgset(TRUE); /* start staging */
else
{
stgset(TRUE); /* start staging */
- stgget(&index, &cidx); /* mark position in code generator */
+ stgget(&idx, &cidx); /* mark position in code generator */
do
{
if (hier14(&lval))
rvalue(&lval);
do
{
if (hier14(&lval))
rvalue(&lval);
- stgdel(index, cidx); /* just scrap the code */
+ stgdel(idx, cidx); /* just scrap the code */
}
while (matchtoken(','));
stgset(FALSE); /* stop staging */
}
while (matchtoken(','));
stgset(FALSE); /* stop staging */
preproc_expr(cell * val, int *tag)
{
int result;
preproc_expr(cell * val, int *tag)
{
int result;
cell code_index;
char *term;
cell code_index;
char *term;
* compilations. Reset the staging index, but keep the code
* index.
*/
* compilations. Reset the staging index, but keep the code
* index.
*/
- if (stgget(&index, &code_index))
+ if (stgget(&idx, &code_index))
{
error(57); /* unfinished expression */
stgdel(0, code_index);
{
error(57); /* unfinished expression */
stgdel(0, code_index);
int tok, ret;
cell val;
char *str;
int tok, ret;
cell val;
char *str;
cell code_index;
while (*lptr <= ' ' && *lptr != '\0')
cell code_index;
while (*lptr <= ' ' && *lptr != '\0')
/* on a pending expression, force to return a silent ';' token and force to
* re-read the line
*/
/* on a pending expression, force to return a silent ';' token and force to
* re-read the line
*/
- if (!sc_needsemicolon && stgget(&index, &code_index))
+ if (!sc_needsemicolon && stgget(&idx, &code_index))
{
lptr = term_expr;
return CMD_TERM;
{
lptr = term_expr;
return CMD_TERM;
static void _embryo_byte_swap_16 (unsigned short *v);
static void _embryo_byte_swap_32 (unsigned int *v);
#endif
static void _embryo_byte_swap_16 (unsigned short *v);
static void _embryo_byte_swap_32 (unsigned int *v);
#endif
-static int _embryo_native_call (Embryo_Program *ep, Embryo_Cell index, Embryo_Cell *result, Embryo_Cell *params);
-static int _embryo_func_get (Embryo_Program *ep, int index, char *funcname);
-static int _embryo_var_get (Embryo_Program *ep, int index, char *varname, Embryo_Cell *ep_addr);
+static int _embryo_native_call (Embryo_Program *ep, Embryo_Cell idx, Embryo_Cell *result, Embryo_Cell *params);
+static int _embryo_func_get (Embryo_Program *ep, int idx, char *funcname);
+static int _embryo_var_get (Embryo_Program *ep, int idx, char *varname, Embryo_Cell *ep_addr);
static int _embryo_program_init (Embryo_Program *ep, void *code);
#ifdef WORDS_BIGENDIAN
static int _embryo_program_init (Embryo_Program *ep, void *code);
#ifdef WORDS_BIGENDIAN
-_embryo_native_call(Embryo_Program *ep, Embryo_Cell index, Embryo_Cell *result, Embryo_Cell *params)
+_embryo_native_call(Embryo_Program *ep, Embryo_Cell idx, Embryo_Cell *result, Embryo_Cell *params)
{
Embryo_Header *hdr;
Embryo_Func_Stub *func_entry;
Embryo_Native f;
hdr = (Embryo_Header *)ep->base;
{
Embryo_Header *hdr;
Embryo_Func_Stub *func_entry;
Embryo_Native f;
hdr = (Embryo_Header *)ep->base;
- func_entry = GETENTRY(hdr, natives, index);
+ func_entry = GETENTRY(hdr, natives, idx);
if ((func_entry->address <= 0) ||
(func_entry->address > ep->native_calls_size))
{
if ((func_entry->address <= 0) ||
(func_entry->address > ep->native_calls_size))
{
-_embryo_func_get(Embryo_Program *ep, int index, char *funcname)
+_embryo_func_get(Embryo_Program *ep, int idx, char *funcname)
{
Embryo_Header *hdr;
Embryo_Func_Stub *func;
hdr = (Embryo_Header *)ep->code;
{
Embryo_Header *hdr;
Embryo_Func_Stub *func;
hdr = (Embryo_Header *)ep->code;
- if (index >= (Embryo_Cell)NUMENTRIES(hdr, publics, natives))
+ if (idx >= (Embryo_Cell)NUMENTRIES(hdr, publics, natives))
return EMBRYO_ERROR_INDEX;
return EMBRYO_ERROR_INDEX;
- func = GETENTRY(hdr, publics, index);
+ func = GETENTRY(hdr, publics, idx);
strcpy(funcname, GETENTRYNAME(hdr, func));
return EMBRYO_ERROR_NONE;
}
static int
strcpy(funcname, GETENTRYNAME(hdr, func));
return EMBRYO_ERROR_NONE;
}
static int
-_embryo_var_get(Embryo_Program *ep, int index, char *varname, Embryo_Cell *ep_addr)
+_embryo_var_get(Embryo_Program *ep, int idx, char *varname, Embryo_Cell *ep_addr)
{
Embryo_Header *hdr;
Embryo_Func_Stub *var;
hdr=(Embryo_Header *)ep->base;
{
Embryo_Header *hdr;
Embryo_Func_Stub *var;
hdr=(Embryo_Header *)ep->base;
- if (index >= (Embryo_Cell)NUMENTRIES(hdr, pubvars, tags))
+ if (idx >= (Embryo_Cell)NUMENTRIES(hdr, pubvars, tags))
return EMBRYO_ERROR_INDEX;
return EMBRYO_ERROR_INDEX;
- var = GETENTRY(hdr, pubvars, index);
+ var = GETENTRY(hdr, pubvars, idx);
strcpy(varname, GETENTRYNAME(hdr, var));
*ep_addr = var->address;
return EMBRYO_ERROR_NONE;
strcpy(varname, GETENTRYNAME(hdr, var));
*ep_addr = var->address;
return EMBRYO_ERROR_NONE;