fixes some 64-bit related bugs.
Filter code used 'aux' integer field of 'symbol' struct to store ptr to next symbol and both 'aux2' and 'def' fields for value. Changed to just 'def' for value and 'aux2' for ptr to next symbol. Also another minor bugfix.
This commit is contained in:
parent
165a622727
commit
083c43e22e
4 changed files with 27 additions and 25 deletions
|
@ -79,15 +79,11 @@ type:
|
||||||
|
|
||||||
one_decl:
|
one_decl:
|
||||||
type SYM {
|
type SYM {
|
||||||
$2 = cf_define_symbol($2, SYM_VARIABLE | $1, NULL);
|
struct f_val * val = cfg_alloc(sizeof(struct f_val));
|
||||||
|
val->type = $1;
|
||||||
|
$2 = cf_define_symbol($2, SYM_VARIABLE | $1, val);
|
||||||
DBG( "New variable %s type %x\n", $2->name, $1 );
|
DBG( "New variable %s type %x\n", $2->name, $1 );
|
||||||
$2->aux = 0;
|
$2->aux2 = NULL;
|
||||||
{
|
|
||||||
struct f_val * val;
|
|
||||||
val = cfg_alloc(sizeof(struct f_val));
|
|
||||||
val->type = $1;
|
|
||||||
$2->aux2 = val;
|
|
||||||
}
|
|
||||||
$$=$2;
|
$$=$2;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
@ -96,7 +92,7 @@ one_decl:
|
||||||
decls: /* EMPTY */ { $$ = NULL; }
|
decls: /* EMPTY */ { $$ = NULL; }
|
||||||
| one_decl ';' decls {
|
| one_decl ';' decls {
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
$$->aux = (int) $3;
|
$$->aux2 = $3;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -104,7 +100,7 @@ decls: /* EMPTY */ { $$ = NULL; }
|
||||||
declsn: one_decl { $$ = $1; }
|
declsn: one_decl { $$ = $1; }
|
||||||
| declsn ';' one_decl {
|
| declsn ';' one_decl {
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
$$->aux = (int) $3;
|
$$->aux2 = $3;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -167,8 +163,7 @@ function_def:
|
||||||
cf_push_scope($2);
|
cf_push_scope($2);
|
||||||
} function_params function_body {
|
} function_params function_body {
|
||||||
$2->def = $5;
|
$2->def = $5;
|
||||||
$2->aux = (int) $4;
|
$2->aux2 = $4;
|
||||||
$2->aux2 = $5;
|
|
||||||
DBG("Hmm, we've got one function here - %s\n", $2->name);
|
DBG("Hmm, we've got one function here - %s\n", $2->name);
|
||||||
cf_pop_scope();
|
cf_pop_scope();
|
||||||
}
|
}
|
||||||
|
@ -313,14 +308,14 @@ function_call:
|
||||||
$$ = f_new_inst();
|
$$ = f_new_inst();
|
||||||
$$->code = P('c','a');
|
$$->code = P('c','a');
|
||||||
$$->a1.p = inst;
|
$$->a1.p = inst;
|
||||||
$$->a2.p = $1->aux2;
|
$$->a2.p = $1->def;
|
||||||
sym = (void *) $1->aux;
|
sym = $1->aux2;
|
||||||
while (sym || inst) {
|
while (sym || inst) {
|
||||||
if (!sym || !inst)
|
if (!sym || !inst)
|
||||||
cf_error("Wrong number of arguments for function %s.", $1->name);
|
cf_error("Wrong number of arguments for function %s.", $1->name);
|
||||||
DBG( "You should pass parameter called %s\n", sym->name);
|
DBG( "You should pass parameter called %s\n", sym->name);
|
||||||
inst->a1.p = sym;
|
inst->a1.p = sym;
|
||||||
sym = (void *) sym->aux;
|
sym = sym->aux2;
|
||||||
inst = inst->next;
|
inst = inst->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -377,7 +372,7 @@ term:
|
||||||
case SYM_VARIABLE | T_PATH:
|
case SYM_VARIABLE | T_PATH:
|
||||||
case SYM_VARIABLE | T_CLIST:
|
case SYM_VARIABLE | T_CLIST:
|
||||||
$$->code = 'C';
|
$$->code = 'C';
|
||||||
$$->a1.p = $1->aux2;
|
$$->a1.p = $1->def;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cf_error("%s: variable expected.", $1->name );
|
cf_error("%s: variable expected.", $1->name );
|
||||||
|
@ -420,14 +415,14 @@ term:
|
||||||
$$ = f_new_inst();
|
$$ = f_new_inst();
|
||||||
$$->code = P('c','a');
|
$$->code = P('c','a');
|
||||||
$$->a1.p = inst;
|
$$->a1.p = inst;
|
||||||
$$->a2.p = $1->aux2;
|
$$->a2.p = $1->def;
|
||||||
sym = (void *) $1->aux;
|
sym = $1->aux2;
|
||||||
while (sym || inst) {
|
while (sym || inst) {
|
||||||
if (!sym || !inst)
|
if (!sym || !inst)
|
||||||
cf_error("Wrong number of arguments for function %s.", $1->name);
|
cf_error("Wrong number of arguments for function %s.", $1->name);
|
||||||
DBG( "You should pass parameter called %s\n", sym->name);
|
DBG( "You should pass parameter called %s\n", sym->name);
|
||||||
inst->a1.p = sym;
|
inst->a1.p = sym;
|
||||||
sym = (void *) sym->aux;
|
sym = sym->aux2;
|
||||||
inst = inst->next;
|
inst = inst->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -437,16 +437,23 @@ interpret(struct f_inst *what)
|
||||||
case T_PATH_MASK:
|
case T_PATH_MASK:
|
||||||
if (sym->class != (SYM_VARIABLE | v2.type))
|
if (sym->class != (SYM_VARIABLE | v2.type))
|
||||||
runtime( "Assigning to variable of incompatible type" );
|
runtime( "Assigning to variable of incompatible type" );
|
||||||
* (struct f_val *) sym->aux2 = v2;
|
* (struct f_val *) sym->def = v2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
bug( "Set to invalid type" );
|
bug( "Set to invalid type" );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c': /* integer (or simple type) constant */
|
/* some constants have value in a2, some in *a1.p, strange. */
|
||||||
|
case 'c': /* integer (or simple type) constant, or string, or set */
|
||||||
res.type = what->aux;
|
res.type = what->aux;
|
||||||
res.val.i = what->a2.i;
|
|
||||||
|
if (res.type == T_SET)
|
||||||
|
res.val.t = what->a2.p;
|
||||||
|
else if (res.type == T_STRING)
|
||||||
|
res.val.s = what->a2.p;
|
||||||
|
else
|
||||||
|
res.val.i = what->a2.i;
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
res = * ((struct f_val *) what->a1.p);
|
res = * ((struct f_val *) what->a1.p);
|
||||||
|
|
|
@ -165,8 +165,8 @@ rdump(void *res)
|
||||||
char x[16];
|
char x[16];
|
||||||
resource *r = res;
|
resource *r = res;
|
||||||
|
|
||||||
bsprintf(x, "%%%ds%%08x ", indent);
|
bsprintf(x, "%%%ds%%p ", indent);
|
||||||
debug(x, "", (int) r);
|
debug(x, "", r);
|
||||||
if (r)
|
if (r)
|
||||||
{
|
{
|
||||||
debug("%s ", r->class->name);
|
debug("%s ", r->class->name);
|
||||||
|
|
Loading…
Reference in a new issue