model_server/xref/src/Xref.h.cxx
// perm   = 0 for writable, 1 for read only,
// 2 for read-only unreal file (do not save later)
perm   = 0 for writable, 1 for read only,
2 for read-only unreal file (do not save later)
perm = 0 for writable 1 for read only 2 for read - only unreal file ( do not save later )
Xref::Xref(char const *xref_file, int perm, projNode* pr)
{
    Initialize(Xref::Xref );
    if (perm == -1) {
        crash_recovery = 0;
        perm_flag = 1;
        unreal_flag = 0;
        writable_on_disk = 1;
        is_root = 0;
        return;
    }
    if (perm==0 && pr && !pr->is_writable())
        perm = 1;
    crash_recovery = 0;
    xref_name = xref_file;
    genString sym_file;
    genString ind_file;
    genString link_file;
    Xref::sym_file(xref_file, sym_file);
    Xref::ind_file(xref_file, ind_file);
    Xref::link_file(xref_file, link_file);
    lxref = XrefTableNull; my_proj = pr;
    perm_flag = perm!=0 ; 
    unreal_flag = (perm==2);   
    int test = OS_dependent::access(sym_file,W_OK);	
    if ((test != 0) && (errno != ENOENT)) {
        writable_on_disk = 1; 
        perm_flag = 1;        
    } else {
        writable_on_disk = 0; 
    }
    if (unreal_flag) writable_on_disk = 1;  
    is_root = 1;
    if (my_proj == projNode::get_control_project())
        home_flag = 1;
    else
        home_flag = 0;
}
Xref :: Xref ( char const * xref_file , int perm , projNode * pr ) { Initialize ( Xref :: Xref ) ; if ( perm == -1 ) { crash_recovery = 0 ; perm_flag = 1 ; unreal_flag = 0 ; writable_on_disk = 1 ; is_root = 0 ; return ; } if ( perm == 0 && pr && ! pr -> is_writable ( ) ) perm = 1 ; crash_recovery = 0 ; xref_name = xref_file ; genString sym_file ; genString ind_file ; genString link_file ; Xref :: sym_file ( xref_file , sym_file ) ; Xref :: ind_file ( xref_file , ind_file ) ; Xref :: link_file ( xref_file , link_file ) ; lxref = XrefTableNull ; my_proj = pr ; perm_flag = perm != 0 ; unreal_flag = ( perm == 2 ) ; int test = OS_dependent :: access ( sym_file , W_OK ) ; if ( ( test != 0 ) && ( errno != ENOENT ) ) { writable_on_disk = 1 ; perm_flag = 1 ; } else { writable_on_disk = 0 ; } if ( unreal_flag ) writable_on_disk = 1 ; is_root = 1 ; if ( my_proj == projNode :: get_control_project ( ) ) home_flag = 1 ; else home_flag = 0 ; }
perm   = 0 for writable, 1 for read only,
2 for read-only unreal file (do not save later)
perm = 0 for writable 1 for read only 2 for read - only unreal file ( do not save later )
// XrefTable_temp //  lxref = new XrefTable(this, sym_file, ind_file, link_file, perm ); // 1 for readonly, 0 for writeable //  readonly temporary file, discard later //  if (lxref && lxref->get_header() == 0) { //    delete lxref; //    lxref = NULL; //  } //  writable_on_disk = lxref ? !((test == 0) || (errno == ENOENT)) : 1; // read only // read only // disk write access // if unreal do not write to it