RULE* new_rule_actions( module_t* m, char* rulename, char* command, LIST* bindlist, int flags ) { RULE* local = define_rule( m, rulename, m ); RULE* global = global_rule( local ); set_rule_actions( local, actions_new( command, bindlist, flags ) ); set_rule_actions( global, local->actions ); return local; }
/* * new_rule_body() - make a new rule named rulename in the given * module, with the given argument list and procedure. If exported is * true, the rule is exported to the global module as * modulename.rulename. */ RULE* new_rule_body( module* m, char* rulename, argument_list* args, PARSE* procedure, int exported ) { RULE* local = define_rule( m, rulename, m ); local->exported = exported; set_rule_body( local, args, procedure ); /* Mark the procedure with the global rule name, regardless of * whether the rule is exported. That gives us something * reasonably identifiable that we can use, e.g. in profiling * output. Only do this once, since this could be called multiple * times with the same procedure. */ if ( procedure->rulename == 0 ) procedure->rulename = global_rule_name( local ); /* export the rule to the global module if neccessary */ if ( exported ) { RULE* global = global_rule( local ); set_rule_body( global, args, procedure ); } return local; }