static RULE * global_rule( RULE * r ) { if ( r->module == root_module() ) return r; { OBJECT * name = global_rule_name( r ); RULE * result = define_rule( r->module, name, root_module() ); object_free( name ); return result; } }
/* * global_rule() - given a rule, produce the corresponding entry in the global module */ static RULE* global_rule( RULE* r ) { if ( r->module == root_module() ) { return r; } else { char* name = global_rule_name( r ); RULE* result = define_rule( r->module, name, root_module() ); freestr(name); return result; } }
RULE * new_rule_body( module_t * m, OBJECT * rulename, argument_list * args, FUNCTION * 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 ( function_rulename( procedure ) == 0 ) function_set_rulename( procedure, global_rule_name( local ) ); 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_t* 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 ); return local; }