]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Filters added. They are unable to do anything interesting for now
authorPavel Machek <pavel@ucw.cz>
Fri, 15 Jan 1999 14:41:51 +0000 (14:41 +0000)
committerPavel Machek <pavel@ucw.cz>
Fri, 15 Jan 1999 14:41:51 +0000 (14:41 +0000)
(with exception of printing integers to screen), but they exist.

conf/Makefile
conf/cf-lex.l
conf/conf.h
conf/confbase.Y

index 270d556737f1ecbab47aa8720facb6c3e636a7a7..be1e1a47005a84a0f7028ed7245853f8a230a0b3 100644 (file)
@@ -1,10 +1,10 @@
-source=cf-parse.tab.c cf-lex.c
+source=cf-parse.tab.c cf-lex.c f-util.c
 root-rel=../
 
 include ../Rules
 
 conf-src=$(srcdir)/conf
-conf-fragments=$(conf-src)/confbase.Y @CONFS@ $(addsuffix /config.Y,$(static-dir-paths))
+conf-fragments=$(conf-src)/confbase.Y @CONFS@ $(addsuffix /config.Y,$(static-dir-paths)) $(conf-src)/filter.Y
 
 ifdef DEBUG
 BISON_DEBUG=-t
index 7c37a0082852e511b113374f7a50bfc073b339e5..ab7e6cef8e2ed868d2f41ca41d125b75550e0bbe 100644 (file)
@@ -245,6 +245,7 @@ cf_allocate(void)
   cfg_mem = lp_new(cfg_pool, 1024);
 }
 
+#if 1
 char *
 cfg_strdup(char *c)
 {
@@ -253,4 +254,5 @@ cfg_strdup(char *c)
   memcpy(z, c, l);
   return z;
 }
+#endif
 
index 1e80628ed2dd3eb13b9e779de85765df52abfa0d..19ed34e9504fa294240fb30bd2e4ea3ad4f0e57d 100644 (file)
@@ -36,6 +36,10 @@ struct symbol {
 #define SYM_VOID 0
 #define SYM_PROTO 1
 #define SYM_NUMBER 2
+#define SYM_STAT 3 /* statement */
+#define SYM_VARIABLE_INT 4
+#define SYM_FUNCTION 5
+#define SYM_FILTER 6
 
 void cf_lex_init_tables(void);
 int cf_lex(void);
index 0f00587a24acc165b7658e648bd91c6ef3e1a56d..b8749aafb28fdb85aba2d9131e15980a8fa257cc 100644 (file)
@@ -16,6 +16,7 @@ CF_HDR
 #include "nest/protocol.h"
 #include "nest/iface.h"
 #include "nest/route.h"
+#include "conf/filter.h"
 
 CF_DECLS
 
@@ -24,6 +25,7 @@ CF_DECLS
   ip_addr a;
   struct symbol *s;
   char *t;
+  struct f_instruction *x; 
 }
 
 %token END
@@ -32,7 +34,8 @@ CF_DECLS
 %token <s> SYM
 %token <t> TEXT
 
-%type <i> expr bool pxlen
+%type <i> cexpr bool pxlen
+%type <x> expr
 
 %left '+' '-'
 %left '*' '/' '%'
@@ -55,22 +58,22 @@ conf_entries:
 
 CF_ADDTO(conf, /* EMPTY */)
 
-/* Expressions */
+/* Constant expressions */
 
-expr:
+cexpr:
    NUM
- | expr '+' expr { $$ = $1 + $3; }
- | expr '-' expr { $$ = $1 - $3; }
- | expr '*' expr { $$ = $1 * $3; }
- | expr '/' expr { if ($3) $$ = $1 / $3; else cf_error("Division by zero"); }
- | expr '%' expr { if ($3) $$ = $1 % $3; else cf_error("Division by zero"); }
- | '(' expr ')' { $$ = $2; }
+ | cexpr '+' cexpr { $$ = $1 + $3; }
+ | cexpr '-' cexpr { $$ = $1 - $3; }
+ | cexpr '*' cexpr { $$ = $1 * $3; }
+ | cexpr '/' cexpr { if ($3) $$ = $1 / $3; else cf_error("Division by zero"); }
+ | cexpr '%' cexpr { if ($3) $$ = $1 % $3; else cf_error("Division by zero"); }
+ | '(' cexpr ')' { $$ = $2; }
  | SYM { if ($1->class != SYM_NUMBER) cf_error("Number expected"); else $$ = $1->aux; }
  ;
 
 CF_ADDTO(conf, definition)
 definition:
-   DEFINE SYM '=' expr {
+   DEFINE SYM '=' cexpr {
      if ($2->class != SYM_VOID) cf_error("Symbol already defined");
      $2->class = SYM_NUMBER;
      $2->aux = $4;
@@ -80,7 +83,7 @@ definition:
 /* Switches */
 
 bool:
-   expr {$$ = !!$1; }
+   cexpr {$$ = !!$1; }
  | ON { $$ = 1; }
  | YES { $$ = 1; }
  | OFF { $$ = 0; }