model_server/project_pdf/src/pdf_scope.h.cxx
// pairs for logic names and project names -- END
pairs for logic names and project names -- END
pairs for logic names and project names -- END
static void check_dup_illegal_unit_name()
{
    Initialize(check_dup_illegal_unit_name);
    char **log_name;
    int  top_proj_num = 0;
    projNode *proj;
    int i;
    for (i=1; proj = projList::search_list->get_proj(i); i++)
        top_proj_num++;
    if (scope_name_heads.size())
        log_name = (char **)psetmalloc(sizeof(char *) *  top_proj_num);
    int idx = 0;
    for (i=1; proj = projList::search_list->get_proj(i); i++)
    {
        if (proj->get_map() == 0) 
            continue;
        genString phy_name;
        genString ln;
        proj->ln_to_fn_imp(proj->get_ln(), phy_name, DIR_TYPE, 0, 1);
        proj->fn_to_ln(phy_name, ln, DIR_TYPE, 0, 1);
        if (scope_name_heads.size())
            log_name[idx++] = strdup(ln.str());
        PAIR_LOGIC_PROJECT_NAMES *p = pair_ln_pn_heads.grow();
        p->pn = OSapi_strdup(proj->get_ln());
        p->ln = OSapi_strdup(ln.str());
    }
    top_proj_num = idx;
    if (!scope_name_heads.size())
        return;
    OSapi_qsort(log_name, top_proj_num, sizeof(char *), name_cmp);
    idx = 0;
    for (i=1; i<top_proj_num; i++)
    {
        if (strcmp(log_name[i], log_name[idx]))
            log_name[++idx] = log_name[i];
        else
            free(log_name[i]);
    }
    top_proj_num = idx+1;
    for (i=0;i<scope_name_heads.size();i++)
    {
        scope_name_entry *p = scope_name_heads[i];
        fill_unit_name_wildcard(p, log_name, top_proj_num);
        if (p->scope_name == 0)
            continue;
        int last_err  = 0;
        int last_warn = 0;
        genString last_name = " ";
        int j;
        for (j=0;j<p->num_of_units;j++)
        {
            if (p->unit_log_name[j])
            {
                if (strcmp(last_name.str(), p->unit_log_name[j]) == 0)
                {
                    if (!last_err && !last_warn)
                    {
                        create_one_path_parser_error(PATH_PARSE_DUP_UNIT_NAME_WRN, p->scope_name,
                                                     p->unit_log_name[j], p->line_num, 0, 0);
                        last_warn = 1;
                    }
                    free(p->unit_log_name[j]);
                    p->unit_log_name[j] = 0;
                    continue;
                }
                last_name = p->unit_log_name[j];
            }
            else
            {
                last_err  = 0;
                last_warn = 0;
                last_name = "";
            }
        }
        int found = 0;
        for (j=0;j<p->num_of_units;j++)
        {
            if (p->unit_log_name[j])
            {
                found = 1;
                break;
            }
        }
        if (!found)
        {
            create_one_path_parser_error(PATH_PARSE_DUP_SCOPE_NAME_WRN, p->scope_name, 0,
                                         p->line_num, 0, 2);
            scope_name_cleanup(p);
        }
    }
    for(i=0;i<top_proj_num;i++)
        free(log_name[i]);
    psetfree(log_name);
}
static void check_dup_illegal_unit_name ( ) { Initialize ( check_dup_illegal_unit_name ) ; char * * log_name ; int top_proj_num = 0 ; projNode * proj ; int i ; for ( i = 1 ; proj = projList :: search_list -> get_proj ( i ) ; i ++ ) top_proj_num ++ ; if ( scope_name_heads . size ( ) ) log_name = ( char * * ) psetmalloc ( sizeof ( char * ) * top_proj_num ) ; int idx = 0 ; for ( i = 1 ; proj = projList :: search_list -> get_proj ( i ) ; i ++ ) { if ( proj -> get_map ( ) == 0 ) continue ; genString phy_name ; genString ln ; proj -> ln_to_fn_imp ( proj -> get_ln ( ) , phy_name , DIR_TYPE , 0 , 1 ) ; proj -> fn_to_ln ( phy_name , ln , DIR_TYPE , 0 , 1 ) ; if ( scope_name_heads . size ( ) ) log_name [ idx ++ ] = strdup ( ln . str ( ) ) ; PAIR_LOGIC_PROJECT_NAMES * p = pair_ln_pn_heads . grow ( ) ; p -> pn = OSapi_strdup ( proj -> get_ln ( ) ) ; p -> ln = OSapi_strdup ( ln . str ( ) ) ; } top_proj_num = idx ; if ( ! scope_name_heads . size ( ) ) return ; OSapi_qsort ( log_name , top_proj_num , sizeof ( char * ) , name_cmp ) ; idx = 0 ; for ( i = 1 ; i < top_proj_num ; i ++ ) { if ( strcmp ( log_name [ i ] , log_name [ idx ] ) ) log_name [ ++ idx ] = log_name [ i ] ; else free ( log_name [ i ] ) ; } top_proj_num = idx + 1 ; for ( i = 0 ; i < scope_name_heads . size ( ) ; i ++ ) { scope_name_entry * p = scope_name_heads [ i ] ; fill_unit_name_wildcard ( p , log_name , top_proj_num ) ; if ( p -> scope_name == 0 ) continue ; int last_err = 0 ; int last_warn = 0 ; genString last_name = " " ; int j ; for ( j = 0 ; j < p -> num_of_units ; j ++ ) { if ( p -> unit_log_name [ j ] ) { if ( strcmp ( last_name . str ( ) , p -> unit_log_name [ j ] ) == 0 ) { if ( ! last_err && ! last_warn ) { create_one_path_parser_error ( PATH_PARSE_DUP_UNIT_NAME_WRN , p -> scope_name , p -> unit_log_name [ j ] , p -> line_num , 0 , 0 ) ; last_warn = 1 ; } free ( p -> unit_log_name [ j ] ) ; p -> unit_log_name [ j ] = 0 ; continue ; } last_name = p -> unit_log_name [ j ] ; } else { last_err = 0 ; last_warn = 0 ; last_name = " " ; } } int found = 0 ; for ( j = 0 ; j < p -> num_of_units ; j ++ ) { if ( p -> unit_log_name [ j ] ) { found = 1 ; break ; } } if ( ! found ) { create_one_path_parser_error ( PATH_PARSE_DUP_SCOPE_NAME_WRN , p -> scope_name , 0 , p -> line_num , 0 , 2 ) ; scope_name_cleanup ( p ) ; } } for ( i = 0 ; i < top_proj_num ; i ++ ) free ( log_name [ i ] ) ; psetfree ( log_name ) ; }
pairs for logic names and project names -- END
pairs for logic names and project names -- END
// for thr control project // save project name and logic name // same name // cleanup