mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
TMP
This commit is contained in:
parent
d648c6b602
commit
0fbd598a9c
@ -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)
|
||||
|
@ -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)); }
|
||||
|
@ -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 ); }
|
||||
|
Loading…
Reference in New Issue
Block a user