summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>2000-05-15 12:19:26 +0000
committerPavel Machek <pavel@ucw.cz>2000-05-15 12:19:26 +0000
commitcbfd671f114a96095f021662ad1cf0eaa6d089c1 (patch)
tree9995484ebaf0e8d9078e085210802e9477e9f807
parentcc590a11a7a285463dff89d0bd677d0762dd8e45 (diff)
Allow accessing defined symbols.
-rw-r--r--filter/config.Y9
-rw-r--r--filter/test.conf7
2 files changed, 15 insertions, 1 deletions
diff --git a/filter/config.Y b/filter/config.Y
index 9aa827e5..0d1d716f 100644
--- a/filter/config.Y
+++ b/filter/config.Y
@@ -348,6 +348,15 @@ term:
| SYM {
$$ = f_new_inst();
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_PAIR:
case SYM_VARIABLE | T_PREFIX:
diff --git a/filter/test.conf b/filter/test.conf
index 37cff13e..d734d57c 100644
--- a/filter/test.conf
+++ b/filter/test.conf
@@ -65,13 +65,16 @@ function bla()
return 15;
}
+define four=4;
+define onetwo=1.2.3.4;
+
function __startup()
int i;
prefix px;
ip p;
{
print "Testing filter language:";
- i = 4;
+ i = four;
i = 1230 + i;
i = ( i + 0 );
print " arithmetics: 1234 = ", i;
@@ -111,6 +114,8 @@ ip p;
paths();
+ print "1.2.3.4 = ", onetwo;
+
print "done";
quitbird;
# print "*** FAIL: this is unreachable";