diff options
Diffstat (limited to 'filter')
-rw-r--r-- | filter/config.Y | 14 | ||||
-rw-r--r-- | filter/decl.m4 | 30 | ||||
-rw-r--r-- | filter/f-inst.c | 8 | ||||
-rw-r--r-- | filter/f-inst.h | 8 | ||||
-rw-r--r-- | filter/f-util.c | 2 |
5 files changed, 31 insertions, 31 deletions
diff --git a/filter/config.Y b/filter/config.Y index 5f9b8356..3898748c 100644 --- a/filter/config.Y +++ b/filter/config.Y @@ -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); } ; diff --git a/filter/decl.m4 b/filter/decl.m4 index c9b5c8c5..d8497535 100644 --- a/filter/decl.m4 +++ b/filter/decl.m4 @@ -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); diff --git a/filter/f-inst.c b/filter/f-inst.c index 4a4f6016..d0bfa95b 100644 --- a/filter/f-inst.c +++ b/filter/f-inst.c @@ -295,7 +295,7 @@ , 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; @@ -316,7 +316,7 @@ , 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; @@ -339,14 +339,14 @@ 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; } diff --git a/filter/f-inst.h b/filter/f-inst.h index 21cec454..f0dcec64 100644 --- a/filter/f-inst.h +++ b/filter/f-inst.h @@ -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); diff --git a/filter/f-util.c b/filter/f-util.c index 79201fba..5500f282 100644 --- a/filter/f-util.c +++ b/filter/f-util.c @@ -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; } |