From 0fbd598a9ca8c076a3981e27991811db6006643a Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Sun, 2 Jul 2023 15:10:08 +0200 Subject: [PATCH] TMP --- conf/conf.h | 5 +---- conf/confbase.Y | 10 ---------- filter/config.Y | 19 +++++++++++++++++++ 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/conf/conf.h b/conf/conf.h index a4bc1f29..b6d1598f 100644 --- a/conf/conf.h +++ b/conf/conf.h @@ -128,8 +128,7 @@ struct symbol { struct ea_class *attribute; /* For SYM_ATTRIBUTE */ struct f_val *val; /* For SYM_CONSTANT */ uint offset; /* For SYM_VARIABLE */ - struct channel_config *ch_config; /* For SYM_COUNTER */ - struct stats_term_config *term; /* For SYM_COUNTER_TERM */ + struct volatile_config *volat; /* For SYM_VOLATILE */ }; char name[0]; @@ -164,8 +163,6 @@ struct bytestring { #define SYM_FILTER 4 #define SYM_TABLE 5 #define SYM_ATTRIBUTE 6 -#define SYM_COUNTER 7 -#define SYM_COUNTER_TERM 8 #define SYM_VARIABLE 0x100 /* 0x100-0x1ff are variable types */ #define SYM_VARIABLE_RANGE SYM_VARIABLE ... (SYM_VARIABLE | 0xff) diff --git a/conf/confbase.Y b/conf/confbase.Y index 8e5da9e3..293f9f85 100644 --- a/conf/confbase.Y +++ b/conf/confbase.Y @@ -153,16 +153,6 @@ conf: ';' ; /* Constant expressions */ -conf: definition ; - -definition: - DEFINE symbol '=' term ';' { - struct f_val val; - if (f_eval(f_linearize($4, 1), &val) > F_RETURN) cf_error("Runtime error"); - cf_define_symbol($2, SYM_CONSTANT | val.type, val, lp_val_copy(cfg_mem, &val)); - } - ; - expr: NUM | '(' term ')' { $$ = f_eval_int(f_linearize($2, 1)); } diff --git a/filter/config.Y b/filter/config.Y index 25018a0b..e590da57 100644 --- a/filter/config.Y +++ b/filter/config.Y @@ -361,6 +361,25 @@ conf: FILTER STACKS expr expr ';' { } ; + +conf: definition ; +definition: + DEFINE symbol '=' term ';' { + struct f_line *line = f_linearize($4, 1); + struct filter_iterator fit; + FILTER_ITERATE_INIT(&fit, + if + + struct f_val val; + if (f_eval(, &val) > F_RETURN) cf_error("Runtime error"); + cf_define_symbol($2, SYM_CONSTANT | val.type, val, lp_val_copy(cfg_mem, &val)); + } + | DEFINE symbol '=' COUNT ROUTE r_args ';' { + cf_define_symbol($2, SYM_VOLATILE, volat, f_volatile_counter($6)); + } + ; + + conf: filter_def ; filter_def: FILTER symbol { $2 = cf_define_symbol($2, SYM_FILTER, filter, NULL); cf_push_scope( $2 ); }