Commit f851f0d7 authored by Jan Maria Matejka's avatar Jan Maria Matejka
Browse files

Config: Dropping CF_ADDTO.

parent 1771f70d
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -113,12 +113,13 @@ conf_entries:
 | conf_entries conf
 ;

CF_ADDTO(conf, ';')
conf: ';' ;


/* Constant expressions */

CF_ADDTO(conf, definition)
conf: definition ;

definition:
   DEFINE SYM '=' term ';' {
     struct f_val *val = cfg_alloc(sizeof(struct f_val));
+1 −10
Original line number Diff line number Diff line
@@ -34,15 +34,10 @@ m4_define(CF_keywd, `m4_ifdef([[CF_tok_$1]],,[[m4_define([[CF_tok_$1]],1)m4_defi
m4_define(CF_KEYWORDS, `m4_define([[CF_toks]],[[]])CF_iterate([[CF_keywd]], [[$@]])m4_ifelse(CF_toks,,,%token[[]]CF_toks
)DNL')

# Dynamic syntax rules
m4_define(CF_dyn_rules,)
m4_define(CF_ADDTO, `m4_define([[CF_rule_$1]],m4_ifdef([[CF_rule_$1]],CF_rule_$1 | ,[[m4_define([[CF_dyn_rules]],CF_dyn_rules[[CF_RULE($1)
]])]])$2)DNL')

# CLI commands
m4_define(CF_CLI, `m4_define([[CF_cmd]], cmd_[[]]m4_translit($1, [[ ]], _))DNL
m4_divert(2)CF_KEYWORDS(m4_translit($1, [[ ]], [[,]]))
m4_divert(3)CF_ADDTO(cli_cmd, CF_cmd)
m4_divert(3)cli_cmd: CF_cmd
CF_cmd: $1 $2 END')
m4_define(CF_CLI_CMD, `')
m4_define(CF_CLI_HELP, `')
@@ -62,10 +57,6 @@ m4_undivert(2)DNL
%%
m4_undivert(3)DNL

/* Dynamic rules */

m4_define(CF_RULE, [[$1: CF_rule_$1 ;]])
CF_dyn_rules
%%
m4_undivert(4)DNL
')
+4 −11
Original line number Diff line number Diff line
@@ -438,7 +438,7 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, UNSET, RETURN,

CF_GRAMMAR

CF_ADDTO(conf, filter_def)
conf: filter_def ;
filter_def:
   FILTER SYM { $2 = cf_define_symbol($2, SYM_FILTER, NULL); cf_push_scope( $2 ); }
     filter_body {
@@ -449,12 +449,12 @@ filter_def:
   }
 ;

CF_ADDTO(conf, filter_eval)
conf: filter_eval ;
filter_eval:
   EVAL term { f_eval_int($2); }
 ;

CF_ADDTO(conf, bt_test_suite)
conf: bt_test_suite ;
bt_test_suite:
 BT_TEST_SUITE '(' SYM ',' text ')' {
  if (!($3->class & SYM_FUNCTION))
@@ -588,7 +588,7 @@ function_body:
   }
 ;

CF_ADDTO(conf, function_def)
conf: function_def ;
function_def:
   FUNCTION SYM { DBG( "Beginning of function %s\n", $2->name );
     $2 = cf_define_symbol($2, SYM_FUNCTION, NULL);
@@ -804,13 +804,6 @@ constructor:
 ;


/*
 *  Maybe there are no dynamic attributes defined by protocols.
 *  For such cases, we force the dynamic_attr list to contain
 *  at least an invalid token, so it is syntantically correct.
 */
CF_ADDTO(dynamic_attr, INVALID_TOKEN { $$ = (struct f_dynamic_attr) {}; })

rtadot: /* EMPTY, we are not permitted RTA. prefix */
 ;

+8 −9
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ CF_GRAMMAR

/* Setting of router ID */

CF_ADDTO(conf, rtrid)
conf: rtrid ;

rtrid:
   ROUTER ID idval ';' { new_config->router_id = $3; }
@@ -124,7 +124,7 @@ idval:
   }
 ;

CF_ADDTO(conf, gr_opts)
conf: gr_opts ;

gr_opts: GRACEFUL RESTART WAIT expr ';' { new_config->gr_wait = $4; } ;

@@ -149,7 +149,7 @@ CF_ENUM(T_ENUM_NETTYPE, NET_, IP4, IP6, VPN4, VPN6, ROA4, ROA6, FLOW4, FLOW6, IP

/* Creation of routing tables */

CF_ADDTO(conf, table)
conf: table ;

table_sorted:
	  { $$ = 0; }
@@ -166,7 +166,7 @@ table: net_type TABLE SYM table_sorted {

/* Definition of protocols */

CF_ADDTO(conf, proto { proto_postconfig(); })
conf: proto { proto_postconfig(); } ;

proto_start:
   PROTOCOL { $$ = SYM_PROTO; }
@@ -282,7 +282,7 @@ limit_spec:
 ;


CF_ADDTO(conf, debug_default)
conf: debug_default ;

debug_default:
   DEBUG PROTOCOLS debug_mask { new_config->proto_default_debug = $3; }
@@ -291,7 +291,7 @@ debug_default:

/* MRTDUMP PROTOCOLS is in systep/unix/config.Y */

CF_ADDTO(conf, timeformat_base)
conf: timeformat_base ;

timeformat_which:
   ROUTE { $$ = &new_config->tf_route; }
@@ -367,7 +367,7 @@ tos:

/* Direct device route protocol */

CF_ADDTO(proto, dev_proto '}')
proto: dev_proto '}' ;

dev_proto_start: proto_start DIRECT {
     this_proto = proto_config_new(&proto_device, $1);
@@ -782,8 +782,7 @@ proto_patt2:
 | TEXT { $$.ptr = $1; $$.patt = 1; }
 ;

CF_ADDTO(dynamic_attr, IGP_METRIC
	{ $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_GEN_IGP_METRIC); })
dynamic_attr: IGP_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_GEN_IGP_METRIC); } ;


CF_CODE
+2 −2
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ CF_KEYWORDS(BABEL, INTERFACE, METRIC, RXCOST, HELLO, UPDATE, INTERVAL, PORT,

CF_GRAMMAR

CF_ADDTO(proto, babel_proto)
proto: babel_proto ;

babel_proto_start: proto_start BABEL
{
@@ -125,7 +125,7 @@ babel_iface_opt_list:
babel_iface:
  babel_iface_start iface_patt_list_nopx babel_iface_opt_list babel_iface_finish;

CF_ADDTO(dynamic_attr, BABEL_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_BABEL_METRIC); })
dynamic_attr: BABEL_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_BABEL_METRIC); } ;

CF_CLI_HELP(SHOW BABEL, ..., [[Show information about Babel protocol]]);

Loading