Allow accessing defined symbols.

This commit is contained in:
Pavel Machek 2000-05-15 12:19:26 +00:00
parent cc590a11a7
commit cbfd671f11
2 changed files with 15 additions and 1 deletions

View file

@ -348,6 +348,15 @@ term:
| SYM { | SYM {
$$ = f_new_inst(); $$ = f_new_inst();
switch ($1->class) { switch ($1->class) {
case SYM_NUMBER:
$$ = f_new_inst();
$$->code = 'c';
$$->aux = T_INT;
$$->a2.i = $1->aux;
break;
case SYM_IPA:
{ NEW_F_VAL; $$ = f_new_inst(); $$->code = 'C'; $$->a1.p = val; val->type = T_IP; val->val.px.ip = * (ip_addr *) ($1->def); }
break;
case SYM_VARIABLE | T_INT: case SYM_VARIABLE | T_INT:
case SYM_VARIABLE | T_PAIR: case SYM_VARIABLE | T_PAIR:
case SYM_VARIABLE | T_PREFIX: case SYM_VARIABLE | T_PREFIX:

View file

@ -65,13 +65,16 @@ function bla()
return 15; return 15;
} }
define four=4;
define onetwo=1.2.3.4;
function __startup() function __startup()
int i; int i;
prefix px; prefix px;
ip p; ip p;
{ {
print "Testing filter language:"; print "Testing filter language:";
i = 4; i = four;
i = 1230 + i; i = 1230 + i;
i = ( i + 0 ); i = ( i + 0 );
print " arithmetics: 1234 = ", i; print " arithmetics: 1234 = ", i;
@ -111,6 +114,8 @@ ip p;
paths(); paths();
print "1.2.3.4 = ", onetwo;
print "done"; print "done";
quitbird; quitbird;
# print "*** FAIL: this is unreachable"; # print "*** FAIL: this is unreachable";