forked from enlightenment/efl
embryo: Avoid shadowing of the global index variable
SVN revision: 72865
This commit is contained in:
parent
d8a9a480ee
commit
76070c522c
|
@ -3010,7 +3010,7 @@ destructsymbols(symbol * root, int level)
|
||||||
|
|
||||||
static constvalue *
|
static constvalue *
|
||||||
insert_constval(constvalue * prev, constvalue * next, char *name,
|
insert_constval(constvalue * prev, constvalue * next, char *name,
|
||||||
cell val, short index)
|
cell val, short idx)
|
||||||
{
|
{
|
||||||
constvalue *cur;
|
constvalue *cur;
|
||||||
|
|
||||||
|
@ -3019,14 +3019,14 @@ insert_constval(constvalue * prev, constvalue * next, char *name,
|
||||||
memset(cur, 0, sizeof(constvalue));
|
memset(cur, 0, sizeof(constvalue));
|
||||||
strcpy(cur->name, name);
|
strcpy(cur->name, name);
|
||||||
cur->value = val;
|
cur->value = val;
|
||||||
cur->index = index;
|
cur->index = idx;
|
||||||
cur->next = next;
|
cur->next = next;
|
||||||
prev->next = cur;
|
prev->next = cur;
|
||||||
return cur;
|
return cur;
|
||||||
}
|
}
|
||||||
|
|
||||||
constvalue *
|
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;
|
||||||
|
|
||||||
|
@ -3034,17 +3034,17 @@ append_constval(constvalue * table, char *name, cell val, short index)
|
||||||
for (prev = table, cur = table->next; cur;
|
for (prev = table, cur = table->next; cur;
|
||||||
prev = cur, cur = cur->next)
|
prev = cur, cur = cur->next)
|
||||||
/* nothing */ ;
|
/* nothing */ ;
|
||||||
return insert_constval(prev, NULL, name, val, index);
|
return insert_constval(prev, NULL, name, val, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
constvalue *
|
constvalue *
|
||||||
find_constval(constvalue * table, char *name, short index)
|
find_constval(constvalue * table, char *name, short idx)
|
||||||
{
|
{
|
||||||
constvalue *ptr = table->next;
|
constvalue *ptr = table->next;
|
||||||
|
|
||||||
while (ptr)
|
while (ptr)
|
||||||
{
|
{
|
||||||
if (strcmp(name, ptr->name) == 0 && ptr->index == index)
|
if (strcmp(name, ptr->name) == 0 && ptr->index == idx)
|
||||||
return ptr;
|
return ptr;
|
||||||
ptr = ptr->next;
|
ptr = ptr->next;
|
||||||
} /* while */
|
} /* while */
|
||||||
|
@ -3326,7 +3326,7 @@ static void
|
||||||
doexpr(int comma, int chkeffect, int allowarray, int mark_endexpr,
|
doexpr(int comma, int chkeffect, int allowarray, int mark_endexpr,
|
||||||
int *tag, int chkfuncresult)
|
int *tag, int chkfuncresult)
|
||||||
{
|
{
|
||||||
int constant, index, ident;
|
int constant, idx, ident;
|
||||||
int localstaging = FALSE;
|
int localstaging = FALSE;
|
||||||
cell val;
|
cell val;
|
||||||
|
|
||||||
|
@ -3336,12 +3336,12 @@ doexpr(int comma, int chkeffect, int allowarray, int mark_endexpr,
|
||||||
localstaging = TRUE;
|
localstaging = TRUE;
|
||||||
assert(stgidx == 0);
|
assert(stgidx == 0);
|
||||||
} /* if */
|
} /* if */
|
||||||
index = stgidx;
|
idx = stgidx;
|
||||||
errorset(sEXPRMARK);
|
errorset(sEXPRMARK);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
/* on second round through, mark the end of the previous expression */
|
/* on second round through, mark the end of the previous expression */
|
||||||
if (index != stgidx)
|
if (idx != stgidx)
|
||||||
endexpr(TRUE);
|
endexpr(TRUE);
|
||||||
sideeffect = FALSE;
|
sideeffect = FALSE;
|
||||||
ident = expression(&constant, &val, tag, chkfuncresult);
|
ident = expression(&constant, &val, tag, chkfuncresult);
|
||||||
|
@ -3356,7 +3356,7 @@ doexpr(int comma, int chkeffect, int allowarray, int mark_endexpr,
|
||||||
errorset(sEXPRRELEASE);
|
errorset(sEXPRRELEASE);
|
||||||
if (localstaging)
|
if (localstaging)
|
||||||
{
|
{
|
||||||
stgout(index);
|
stgout(idx);
|
||||||
stgset(FALSE); /* stop staging */
|
stgset(FALSE); /* stop staging */
|
||||||
} /* if */
|
} /* if */
|
||||||
}
|
}
|
||||||
|
@ -3366,14 +3366,14 @@ doexpr(int comma, int chkeffect, int allowarray, int mark_endexpr,
|
||||||
int
|
int
|
||||||
constexpr(cell * val, int *tag)
|
constexpr(cell * val, int *tag)
|
||||||
{
|
{
|
||||||
int constant, index;
|
int constant, idx;
|
||||||
cell cidx;
|
cell cidx;
|
||||||
|
|
||||||
stgset(TRUE); /* start stage-buffering */
|
stgset(TRUE); /* start stage-buffering */
|
||||||
stgget(&index, &cidx); /* mark position in code generator */
|
stgget(&idx, &cidx); /* mark position in code generator */
|
||||||
errorset(sEXPRMARK);
|
errorset(sEXPRMARK);
|
||||||
expression(&constant, val, tag, FALSE);
|
expression(&constant, val, tag, FALSE);
|
||||||
stgdel(index, cidx); /* scratch generated code */
|
stgdel(idx, cidx); /* scratch generated code */
|
||||||
stgset(FALSE); /* stop stage-buffering */
|
stgset(FALSE); /* stop stage-buffering */
|
||||||
if (constant == 0)
|
if (constant == 0)
|
||||||
error(8); /* must be constant expression */
|
error(8); /* must be constant expression */
|
||||||
|
@ -3395,7 +3395,7 @@ constexpr(cell * val, int *tag)
|
||||||
static void
|
static void
|
||||||
test(int label, int parens, int invert)
|
test(int label, int parens, int invert)
|
||||||
{
|
{
|
||||||
int index, tok;
|
int idx, tok;
|
||||||
cell cidx;
|
cell cidx;
|
||||||
value lval = { NULL, 0, 0, 0, 0, NULL };
|
value lval = { NULL, 0, 0, 0, 0, NULL };
|
||||||
int localstaging = FALSE;
|
int localstaging = FALSE;
|
||||||
|
@ -3405,9 +3405,9 @@ test(int label, int parens, int invert)
|
||||||
stgset(TRUE); /* start staging */
|
stgset(TRUE); /* start staging */
|
||||||
localstaging = TRUE;
|
localstaging = TRUE;
|
||||||
#if !defined NDEBUG
|
#if !defined NDEBUG
|
||||||
stgget(&index, &cidx); /* should start at zero if started
|
stgget(&idx, &cidx); /* should start at zero if started
|
||||||
* locally */
|
* locally */
|
||||||
assert(index == 0);
|
assert(idx == 0);
|
||||||
#endif
|
#endif
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
|
@ -3417,7 +3417,7 @@ test(int label, int parens, int invert)
|
||||||
needtoken('(');
|
needtoken('(');
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
stgget(&index, &cidx); /* mark position (of last expression) in
|
stgget(&idx, &cidx); /* mark position (of last expression) in
|
||||||
* code generator */
|
* code generator */
|
||||||
if (hier14(&lval))
|
if (hier14(&lval))
|
||||||
rvalue(&lval);
|
rvalue(&lval);
|
||||||
|
@ -3437,7 +3437,7 @@ test(int label, int parens, int invert)
|
||||||
if (lval.ident == iCONSTEXPR)
|
if (lval.ident == iCONSTEXPR)
|
||||||
{ /* constant expression */
|
{ /* constant expression */
|
||||||
intest = (int)(long)popstk(); /* restore stack */
|
intest = (int)(long)popstk(); /* restore stack */
|
||||||
stgdel(index, cidx);
|
stgdel(idx, cidx);
|
||||||
if (lval.constval)
|
if (lval.constval)
|
||||||
{ /* code always executed */
|
{ /* code always executed */
|
||||||
error(206); /* redundant test: always non-zero */
|
error(206); /* redundant test: always non-zero */
|
||||||
|
@ -3549,7 +3549,7 @@ dofor(void)
|
||||||
{
|
{
|
||||||
int wq[wqSIZE], skiplab;
|
int wq[wqSIZE], skiplab;
|
||||||
cell save_decl;
|
cell save_decl;
|
||||||
int save_nestlevel, index;
|
int save_nestlevel, idx;
|
||||||
int *ptr;
|
int *ptr;
|
||||||
|
|
||||||
save_decl = declared;
|
save_decl = declared;
|
||||||
|
@ -3595,7 +3595,7 @@ dofor(void)
|
||||||
assert(!staging);
|
assert(!staging);
|
||||||
stgset(TRUE); /* start staging */
|
stgset(TRUE); /* start staging */
|
||||||
assert(stgidx == 0);
|
assert(stgidx == 0);
|
||||||
index = stgidx;
|
idx = stgidx;
|
||||||
stgmark(sSTARTREORDER);
|
stgmark(sSTARTREORDER);
|
||||||
stgmark((char)(sEXPRSTART + 0)); /* mark start of 2nd expression
|
stgmark((char)(sEXPRSTART + 0)); /* mark start of 2nd expression
|
||||||
* in stage */
|
* in stage */
|
||||||
|
@ -3614,7 +3614,7 @@ dofor(void)
|
||||||
needtoken(')');
|
needtoken(')');
|
||||||
} /* if */
|
} /* if */
|
||||||
stgmark(sENDREORDER); /* mark end of reversed evaluation */
|
stgmark(sENDREORDER); /* mark end of reversed evaluation */
|
||||||
stgout(index);
|
stgout(idx);
|
||||||
stgset(FALSE); /* stop staging */
|
stgset(FALSE); /* stop staging */
|
||||||
statement(NULL, FALSE);
|
statement(NULL, FALSE);
|
||||||
jumplabel(wq[wqLOOP]);
|
jumplabel(wq[wqLOOP]);
|
||||||
|
@ -3807,7 +3807,7 @@ doswitch(void)
|
||||||
static void
|
static void
|
||||||
doassert(void)
|
doassert(void)
|
||||||
{
|
{
|
||||||
int flab1, index;
|
int flab1, idx;
|
||||||
cell cidx;
|
cell cidx;
|
||||||
value lval = { NULL, 0, 0, 0, 0, NULL };
|
value lval = { NULL, 0, 0, 0, 0, NULL };
|
||||||
|
|
||||||
|
@ -3824,12 +3824,12 @@ doassert(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stgset(TRUE); /* start staging */
|
stgset(TRUE); /* start staging */
|
||||||
stgget(&index, &cidx); /* mark position in code generator */
|
stgget(&idx, &cidx); /* mark position in code generator */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (hier14(&lval))
|
if (hier14(&lval))
|
||||||
rvalue(&lval);
|
rvalue(&lval);
|
||||||
stgdel(index, cidx); /* just scrap the code */
|
stgdel(idx, cidx); /* just scrap the code */
|
||||||
}
|
}
|
||||||
while (matchtoken(','));
|
while (matchtoken(','));
|
||||||
stgset(FALSE); /* stop staging */
|
stgset(FALSE); /* stop staging */
|
||||||
|
|
|
@ -721,7 +721,7 @@ static int
|
||||||
preproc_expr(cell * val, int *tag)
|
preproc_expr(cell * val, int *tag)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int index;
|
int idx;
|
||||||
cell code_index;
|
cell code_index;
|
||||||
char *term;
|
char *term;
|
||||||
|
|
||||||
|
@ -730,7 +730,7 @@ preproc_expr(cell * val, int *tag)
|
||||||
* compilations. Reset the staging index, but keep the code
|
* compilations. Reset the staging index, but keep the code
|
||||||
* index.
|
* index.
|
||||||
*/
|
*/
|
||||||
if (stgget(&index, &code_index))
|
if (stgget(&idx, &code_index))
|
||||||
{
|
{
|
||||||
error(57); /* unfinished expression */
|
error(57); /* unfinished expression */
|
||||||
stgdel(0, code_index);
|
stgdel(0, code_index);
|
||||||
|
@ -819,7 +819,7 @@ command(void)
|
||||||
int tok, ret;
|
int tok, ret;
|
||||||
cell val;
|
cell val;
|
||||||
char *str;
|
char *str;
|
||||||
int index;
|
int idx;
|
||||||
cell code_index;
|
cell code_index;
|
||||||
|
|
||||||
while (*lptr <= ' ' && *lptr != '\0')
|
while (*lptr <= ' ' && *lptr != '\0')
|
||||||
|
@ -834,7 +834,7 @@ command(void)
|
||||||
/* on a pending expression, force to return a silent ';' token and force to
|
/* on a pending expression, force to return a silent ';' token and force to
|
||||||
* re-read the line
|
* re-read the line
|
||||||
*/
|
*/
|
||||||
if (!sc_needsemicolon && stgget(&index, &code_index))
|
if (!sc_needsemicolon && stgget(&idx, &code_index))
|
||||||
{
|
{
|
||||||
lptr = term_expr;
|
lptr = term_expr;
|
||||||
return CMD_TERM;
|
return CMD_TERM;
|
||||||
|
|
|
@ -43,9 +43,9 @@
|
||||||
static void _embryo_byte_swap_16 (unsigned short *v);
|
static void _embryo_byte_swap_16 (unsigned short *v);
|
||||||
static void _embryo_byte_swap_32 (unsigned int *v);
|
static void _embryo_byte_swap_32 (unsigned int *v);
|
||||||
#endif
|
#endif
|
||||||
static int _embryo_native_call (Embryo_Program *ep, Embryo_Cell index, Embryo_Cell *result, Embryo_Cell *params);
|
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 index, char *funcname);
|
static int _embryo_func_get (Embryo_Program *ep, int idx, char *funcname);
|
||||||
static int _embryo_var_get (Embryo_Program *ep, int index, char *varname, Embryo_Cell *ep_addr);
|
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);
|
static int _embryo_program_init (Embryo_Program *ep, void *code);
|
||||||
|
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
|
@ -70,14 +70,14 @@ _embryo_byte_swap_32(unsigned int *v)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_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_Header *hdr;
|
||||||
Embryo_Func_Stub *func_entry;
|
Embryo_Func_Stub *func_entry;
|
||||||
Embryo_Native f;
|
Embryo_Native f;
|
||||||
|
|
||||||
hdr = (Embryo_Header *)ep->base;
|
hdr = (Embryo_Header *)ep->base;
|
||||||
func_entry = GETENTRY(hdr, natives, index);
|
func_entry = GETENTRY(hdr, natives, idx);
|
||||||
if ((func_entry->address <= 0) ||
|
if ((func_entry->address <= 0) ||
|
||||||
(func_entry->address > ep->native_calls_size))
|
(func_entry->address > ep->native_calls_size))
|
||||||
{
|
{
|
||||||
|
@ -96,32 +96,32 @@ _embryo_native_call(Embryo_Program *ep, Embryo_Cell index, Embryo_Cell *result,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_embryo_func_get(Embryo_Program *ep, int index, char *funcname)
|
_embryo_func_get(Embryo_Program *ep, int idx, char *funcname)
|
||||||
{
|
{
|
||||||
Embryo_Header *hdr;
|
Embryo_Header *hdr;
|
||||||
Embryo_Func_Stub *func;
|
Embryo_Func_Stub *func;
|
||||||
|
|
||||||
hdr = (Embryo_Header *)ep->code;
|
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));
|
strcpy(funcname, GETENTRYNAME(hdr, func));
|
||||||
return EMBRYO_ERROR_NONE;
|
return EMBRYO_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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_Header *hdr;
|
||||||
Embryo_Func_Stub *var;
|
Embryo_Func_Stub *var;
|
||||||
|
|
||||||
hdr=(Embryo_Header *)ep->base;
|
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));
|
strcpy(varname, GETENTRYNAME(hdr, var));
|
||||||
*ep_addr = var->address;
|
*ep_addr = var->address;
|
||||||
return EMBRYO_ERROR_NONE;
|
return EMBRYO_ERROR_NONE;
|
||||||
|
|
Loading…
Reference in New Issue