From cbfd671f114a96095f021662ad1cf0eaa6d089c1 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Mon, 15 May 2000 12:19:26 +0000 Subject: Allow accessing defined symbols. --- filter/config.Y | 9 +++++++++ filter/test.conf | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/filter/config.Y b/filter/config.Y index 9aa827e..0d1d716 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 37cff13..d734d57 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"; -- cgit v1.2.3