]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Filter: Some people can't pronounce "postfixify" correctly. Let's try "linearize...
authorJan Maria Matejka <mq@ucw.cz>
Wed, 22 May 2019 15:16:32 +0000 (15:16 +0000)
committerJan Maria Matejka <mq@ucw.cz>
Wed, 22 May 2019 15:20:02 +0000 (15:20 +0000)
This is just a naming change.

conf/confbase.Y
filter/config.Y
filter/decl.m4
filter/f-inst.c
filter/f-inst.h
filter/f-util.c
nest/config.Y
proto/static/config.Y

index 9978aec80bd2e9cc45358babeb3eaef67e2a775c..bcfd3f1a4a79b45bd0e5365446f68e77430132f9 100644 (file)
@@ -147,14 +147,14 @@ conf: definition ;
 definition:
    DEFINE CF_SYM_VOID '=' term ';' {
      struct f_val *val = cfg_alloc(sizeof(struct f_val));
-     if (f_eval(f_postfixify($4), cfg_mem, val) > F_RETURN) cf_error("Runtime error");
+     if (f_eval(f_linearize($4), cfg_mem, val) > F_RETURN) cf_error("Runtime error");
      cf_define_symbol($2, SYM_CONSTANT | val->type, val, val);
    }
  ;
 
 expr:
    NUM
- | '(' term ')' { $$ = f_eval_int(f_postfixify($2)); }
+ | '(' term ')' { $$ = f_eval_int(f_linearize($2)); }
  | CF_SYM_KNOWN {
      if ($1->class != (SYM_CONSTANT | T_INT)) cf_error("Number constant expected");
      $$ = SYM_VAL($1).i; }
index 5f9b83562e90bb21b5cebeec79c1046bbb36925d..3898748cb6e2593ccc2cb0cd63a4c90af5d96e9e 100644 (file)
@@ -481,7 +481,7 @@ filter_def:
 
 conf: filter_eval ;
 filter_eval:
-   EVAL term { f_eval_int(f_postfixify($2)); }
+   EVAL term { f_eval_int(f_linearize($2)); }
  ;
 
 conf: custom_attr ;
@@ -600,7 +600,7 @@ function_params:
 
 function_body:
    decls '{' cmds '}' {
-     $$ = f_postfixify($3);
+     $$ = f_linearize($3);
      $$->vars = decls_count;
    }
  ;
@@ -661,7 +661,7 @@ set_atom:
  | VPN_RD { $$.type = T_RD; $$.val.ec = $1; }
  | ENUM   { $$.type = pair_a($1); $$.val.i = pair_b($1); }
  | '(' term ')' {
-     if (f_eval(f_postfixify($2), cfg_mem, &($$)) > F_RETURN) cf_error("Runtime error");
+     if (f_eval(f_linearize($2), cfg_mem, &($$)) > F_RETURN) cf_error("Runtime error");
      if (!f_valid_set_type($$.type)) cf_error("Set-incompatible type");
    }
  | CF_SYM_KNOWN {
@@ -673,13 +673,13 @@ set_atom:
 
 switch_atom:
    NUM   { $$.type = T_INT; $$.val.i = $1; }
- | '(' term ')' { $$.type = T_INT; $$.val.i = f_eval_int(f_postfixify($2)); }
+ | '(' term ')' { $$.type = T_INT; $$.val.i = f_eval_int(f_linearize($2)); }
  | fipa  { $$ = $1; }
  | ENUM  { $$.type = pair_a($1); $$.val.i = pair_b($1); }
  ;
 
 cnum:
-   term { $$ = f_eval_int(f_postfixify($1)); }
+   term { $$ = f_eval_int(f_linearize($1)); }
 
 pair_item:
    '(' cnum ',' cnum ')'               { $$ = f_new_pair_item($2, $2, $4, $4); }
@@ -766,7 +766,7 @@ switch_body: /* EMPTY */ { $$ = NULL; }
  | switch_body switch_items ':' cmds  {
      /* Fill data fields */
      struct f_tree *t;
-     struct f_line *line = f_postfixify($4);
+     struct f_line *line = f_linearize($4);
      for (t = $2; t; t = t->left)
        t->data = line;
      $$ = f_merge_items($1, $2);
@@ -775,7 +775,7 @@ switch_body: /* EMPTY */ { $$ = NULL; }
      struct f_tree *t = f_new_tree();
      t->from.type = t->to.type = T_VOID;
      t->right = t;
-     t->data = f_postfixify($3);
+     t->data = f_linearize($3);
      $$ = f_merge_items($1, t);
  }
  ;
index c9b5c8c58abb81d13fc547755ecb13ee67068729..d849753512d38e772ddb6612f8e7cc772681fc68 100644 (file)
@@ -12,7 +12,7 @@ m4_divert(-1)m4_dnl
 #      5       enum fi_code to string
 #      6       dump line item
 #      7       dump line item callers
-#      8       postfixify
+#      8       linearize
 #      9       same (filter comparator)
 #      1       union in struct f_inst
 #      3       constructors
@@ -23,7 +23,7 @@ m4_divert(-1)m4_dnl
 #      102     constructor arguments
 #      103     constructor body
 #      104     dump line item content
-#      105     postfixify body
+#      105     linearize body
 #      106     comparator body
 #      107     struct f_line_item content
 #      108     interpreter body
@@ -45,7 +45,7 @@ m4_define(FID_ENUM, `FID_ZONE(4, Code enum)')
 m4_define(FID_ENUM_STR, `FID_ZONE(5, Code enum to string)')
 m4_define(FID_DUMP, `FID_ZONE(6, Dump line)')
 m4_define(FID_DUMP_CALLER, `FID_ZONE(7, Dump line caller)')
-m4_define(FID_POSTFIXIFY, `FID_ZONE(8, Postfixify)')
+m4_define(FID_LINEARIZE, `FID_ZONE(8, Linearize)')
 m4_define(FID_SAME, `FID_ZONE(9, Comparison)')
 m4_define(FID_INTERPRET, `FID_ZONE(10, Interpret)')
 
@@ -53,7 +53,7 @@ m4_define(FID_STRUCT_IN, `m4_divert(101)')
 m4_define(FID_NEW_ARGS, `m4_divert(102)')
 m4_define(FID_NEW_BODY, `m4_divert(103)')
 m4_define(FID_DUMP_BODY, `m4_divert(104)m4_define([[FID_DUMP_BODY_EXISTS]])')
-m4_define(FID_POSTFIXIFY_BODY, `m4_divert(105)m4_define([[FID_POSTFIXIFY_BODY_EXISTS]])')
+m4_define(FID_LINEARIZE_BODY, `m4_divert(105)m4_define([[FID_LINEARIZE_BODY_EXISTS]])')
 m4_define(FID_SAME_BODY, `m4_divert(106)')
 m4_define(FID_LINE_IN, `m4_divert(107)')
 m4_define(FID_INTERPRET_BODY, `m4_divert(108)')
@@ -112,7 +112,7 @@ m4_undivert(104)
 }
 FID_ALL_TARGETS
 
-FID_POSTFIXIFY
+FID_LINEARIZE
 case INST_NAME(): {
 #define what (&(what_->i_]]INST_NAME()[[))
 #define item (&(dest->items[pos].i_]]INST_NAME()[[))
@@ -123,7 +123,7 @@ case INST_NAME(): {
   dest->items[pos].lineno = what_->lineno;
   break;
 }
-m4_undefine([[FID_POSTFIXIFY_BODY_EXISTS]])
+m4_undefine([[FID_LINEARIZE_BODY_EXISTS]])
 
 FID_SAME
 case INST_NAME():
@@ -170,7 +170,7 @@ FID_NEW_ARGS
 FID_NEW_BODY
 what->$2 = $2;
 m4_ifelse($3,,,[[
-FID_POSTFIXIFY_BODY
+FID_LINEARIZE_BODY
 item->$3 = what->$2;
 ]])
 m4_ifelse($4,,,[[
@@ -195,8 +195,8 @@ FID_NEW_ARGS
 FID_NEW_BODY
 what->f$1 = f$1;
 for (const struct f_inst *child = f$1; child; child = child->next) what_->size += child->size;
-FID_POSTFIXIFY_BODY
-pos = postfixify(dest, what->f$1, pos);m4_dnl
+FID_LINEARIZE_BODY
+pos = linearize(dest, what->f$1, pos);m4_dnl
 FID_ALL()')
 
 m4_define(ARG, `ARG_ANY($1)
@@ -226,8 +226,8 @@ FID_NEW_BODY
 what->f$1 = f$1;
 FID_DUMP_BODY
 f_dump_line(item->fl$1, indent + 1);
-FID_POSTFIXIFY_BODY
-item->fl$1 = f_postfixify(what->f$1);
+FID_LINEARIZE_BODY
+item->fl$1 = f_linearize(what->f$1);
 FID_SAME_BODY
 if (!f_same(f1->fl$1, f2->fl$1)) return 0;
 FID_INTERPRET_BODY
@@ -310,9 +310,9 @@ FID_WR_PUT(7)
   debug("%sFilter line %p dump done\n", INDENT, dest);
 }
 
-/* Postfixify */
+/* Linearize */
 static uint
-postfixify(struct f_line *dest, const struct f_inst *what_, uint pos)
+linearize(struct f_line *dest, const struct f_inst *what_, uint pos)
 {
   for ( ; what_; what_ = what_->next) {
     switch (what_->fi_code) {
@@ -324,7 +324,7 @@ FID_WR_PUT(8)
 }
 
 struct f_line *
-f_postfixify_concat(const struct f_inst * const inst[], uint count)
+f_linearize_concat(const struct f_inst * const inst[], uint count)
 {
   uint len = 0;
   for (uint i=0; i<count; i++)
@@ -334,7 +334,7 @@ f_postfixify_concat(const struct f_inst * const inst[], uint count)
   struct f_line *out = cfg_allocz(sizeof(struct f_line) + sizeof(struct f_line_item)*len);
 
   for (uint i=0; i<count; i++)
-    out->len = postfixify(out, inst[i], out->len);
+    out->len = linearize(out, inst[i], out->len);
 
 #if DEBUGGING
   f_dump_line(out, 0);
index 4a4f6016019cfca66aa91370cc6d33f357e7bf2e..d0bfa95bbaa4c967903e6365bbf6e1427556f748 100644 (file)
     , const struct f_val val
     FID_NEW_BODY
       what->val = val;
-    FID_POSTFIXIFY_BODY
+    FID_LINEARIZE_BODY
       item->val = what->val;
     FID_SAME_BODY
       if (!val_same(&(f1->val), &(f2->val))) return 0;
       , const struct symbol *sym
     FID_NEW_BODY
       what->sym = sym;
-    FID_POSTFIXIFY_BODY
+    FID_LINEARIZE_BODY
       item->valp = (item->sym = what->sym)->val;
     FID_SAME_BODY
       if (strcmp(f1->sym->name, f2->sym->name) || !val_same(f1->sym->val, f2->sym->val)) return 0;
       LINE(3,1);
   }
   INST(FI_PRINT_AND_DIE, 0, 0) {
-    FID_POSTFIXIFY_BODY
+    FID_LINEARIZE_BODY
     {
       uint opos = pos;
       FID_ALL
 
     ARG_ANY(1);
 
-      FID_POSTFIXIFY_BODY
+      FID_LINEARIZE_BODY
       if (opos < pos)
        dest->items[pos].flags |= FIF_PRINTED;
     }
index 21cec4543ca46c081623756cc12845806b0fa3f5..f0dcec6493c8d632b496e67892d916adb3c58276 100644 (file)
@@ -17,7 +17,7 @@
  *     translates into f_new_inst_FI_code(...) and the types are checked in
  *     compile time.
  *
- *     2  Postfixify before interpreting
+ *     2  Linearize before interpreting
  *     The infix tree is always interpreted in the same order. Therefore we
  *     sort the instructions one after another into struct f_line. Results
  *     and arguments of these instructions are implicitly put on a value
@@ -73,9 +73,9 @@ struct f_line {
 };
 
 /* Convert the f_inst infix tree to the f_line structures */
-struct f_line *f_postfixify_concat(const struct f_inst * const inst[], uint count);
-static inline struct f_line *f_postfixify(const struct f_inst *root)
-{ return f_postfixify_concat(&root, 1); }
+struct f_line *f_linearize_concat(const struct f_inst * const inst[], uint count);
+static inline struct f_line *f_linearize(const struct f_inst *root)
+{ return f_linearize_concat(&root, 1); }
 
 void f_dump_line(const struct f_line *, uint indent);
 
index 79201fbace4aa5664516821599037ae5775588c8..5500f282d1ffd0ec2e0e91dd0da4c3809be00695 100644 (file)
@@ -58,7 +58,7 @@ struct filter *f_new_where(const struct f_inst *where)
   };
 
   struct filter *f = cfg_allocz(sizeof(struct filter));
-  f->root = f_postfixify(&i);
+  f->root = f_linearize(&i);
   return f;
 }
 
index fe6424891dcfcd3023d9f24807359fcff3a96ce0..e4dedc66fa1c78e94622bddcd26c5df05c9547c6 100644 (file)
@@ -112,7 +112,7 @@ rtrid:
 
 idval:
    NUM { $$ = $1; }
- | '(' term ')' { $$ = f_eval_int(f_postfixify($2)); }
+ | '(' term ')' { $$ = f_eval_int(f_linearize($2)); }
  | IP4 { $$ = ip4_to_u32($1); }
  | CF_SYM_KNOWN {
      if ($1->class == (SYM_CONSTANT | T_INT) || $1->class == (SYM_CONSTANT | T_QUAD))
@@ -733,7 +733,7 @@ CF_CLI(DUMP PROTOCOLS,,, [[Dump protocol information]])
 { protos_dump_all(); cli_msg(0, ""); } ;
 
 CF_CLI(EVAL, term, <expr>, [[Evaluate an expression]])
-{ cmd_eval(f_postfixify($2)); } ;
+{ cmd_eval(f_linearize($2)); } ;
 
 CF_CLI_HELP(ECHO, ..., [[Control echoing of log messages]])
 CF_CLI(ECHO, echo_mask echo_size, (all | off | { debug|trace|info|remote|warning|error|auth [, ...] }) [<buffer-size>], [[Control echoing of log messages]]) {
index 3e9ac57882fae180ce85903604f8d94c1c251989..6e4108799443943584f09d6c547f4c7e7723fb57 100644 (file)
@@ -40,7 +40,7 @@ static_route_finish(void)
   if (net_type_match(this_srt->net, NB_DEST) == !this_srt->dest)
     cf_error("Unexpected or missing nexthop/type");
 
-  this_srt->cmds = f_postfixify(this_srt_cmds);
+  this_srt->cmds = f_linearize(this_srt_cmds);
 }
 
 CF_DECLS