예제 #1
0
파일: rules.c 프로젝트: Albermg7/boost
RULE* import_rule( RULE* source, module_t* m, char* name )
{
    RULE* dest = define_rule( source->module, name, m );
    set_rule_body( dest, source->arguments, source->procedure );
    set_rule_actions( dest, source->actions );
    return dest;
}
예제 #2
0
파일: rules.c 프로젝트: Albermg7/boost
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;
}
예제 #3
0
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;
    }
}
예제 #4
0
파일: rules.c 프로젝트: Albermg7/boost
/*
 * 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;
    }
}
예제 #5
0
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;
}
예제 #6
0
파일: rules.c 프로젝트: Albermg7/boost
/*
 * 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;
}