model_server/project_pdf/src/path.h.cxx
// construct the physical path form this node up to the root node
// If failed, it returned FALSE; otherwise, it will return TRUE.
//
// pme: is an node in the route which contains both the object projMap and the path for this projMap
//      the path will be set here if succedds
// fn: the path of home project
construct the physical path form this node up to the root node
If failed, it returned FALSE; otherwise, it will return TRUE.


construct the physical path form this node up to the root node If failed it returned FALSE ; otherwise it will return TRUE .
static bool construct_one_ptn_const_path(pm_entry *pme, genString &fn)
{
    Initialize(construct_one_ptn_const_path);
    if (!fn.length()) {
        genString s;
        get_one_real_const_ptn_str(pme->pm,s);
        if (s.length()) {
            pme->path = strdup(s.str());
            return TRUE;
        }
        return FALSE;
    }
    wkPtnRule *cur_ptn_rule = pme->pm->get_phy_rule(0);
    char const *ptn_def = cur_ptn_rule->get_ptn_def();
    int level = count_level(ptn_def);
    char *p = (char *)fn.str();
    if (leading_char(p,'/'))
        p++;
    for(int i=0;i<level;i++) {
        char *q = strchr(p,'/');
        if (!q) {
            if (i != level - 1)
                return FALSE; 
            p += strlen(p);
        }
        else
            p = q + 1;
    }
    genString cur_path;
    if (*p) {
        *(p-1) = '\0';
        cur_path = fn.str();
        fn = p;
    } else {
        cur_path = fn.str();
        fn = 0;
    }
    int match_count = pme->pm->get_phy_match_count();
    init_working_buffer(match_count);
    int cur_len;
    int status;
    int full_match_flag = 0;
    int sidx = 0;
    status = new_split_ptn_path(cur_path, cur_ptn_rule, &cur_len, &full_match_flag, sidx);
    if (!status)
        return FALSE; 
    pme->path = strdup(cur_path);
    return TRUE;
}
static bool construct_one_ptn_const_path ( pm_entry * pme , genString & fn ) { Initialize ( construct_one_ptn_const_path ) ; if ( ! fn . length ( ) ) { genString s ; get_one_real_const_ptn_str ( pme -> pm , s ) ; if ( s . length ( ) ) { pme -> path = strdup ( s . str ( ) ) ; return TRUE ; } return FALSE ; } wkPtnRule * cur_ptn_rule = pme -> pm -> get_phy_rule ( 0 ) ; char const * ptn_def = cur_ptn_rule -> get_ptn_def ( ) ; int level = count_level ( ptn_def ) ; char * p = ( char * ) fn . str ( ) ; if ( leading_char ( p , ' ' ) ) p ++ ; for ( int i = 0 ; i < level ; i ++ ) { char * q = strchr ( p , ' ' ) ; if ( ! q ) { if ( i != level - 1 ) return FALSE ; p += strlen ( p ) ; } else p = q + 1 ; } genString cur_path ; if ( * p ) { * ( p - 1 ) = ' \0 ' ; cur_path = fn . str ( ) ; fn = p ; } else { cur_path = fn . str ( ) ; fn = 0 ; } int match_count = pme -> pm -> get_phy_match_count ( ) ; init_working_buffer ( match_count ) ; int cur_len ; int status ; int full_match_flag = 0 ; int sidx = 0 ; status = new_split_ptn_path ( cur_path , cur_ptn_rule , & cur_len , & full_match_flag , sidx ) ; if ( ! status ) return FALSE ; pme -> path = strdup ( cur_path ) ; return TRUE ; }
construct the physical path form this node up to the root node
If failed, it returned FALSE; otherwise, it will return TRUE.
construct the physical path form this node up to the root node If failed it returned FALSE ; otherwise it will return TRUE .
// not the last one // match failed