model_server/xref/src/xrefSymbol.h.cxx
// return 0 if lin already exist
// else return an empty spot (reuse old deleted links)
return 0 if lin already exist
else return an empty spot (reuse old deleted links)
return 0 if lin already exist else return an empty spot ( reuse old deleted links )
Link* xrefSymbol::get_spot_to_insert_link(Link* lin , XrefTable* Xr)
{
  Initialize(xrefSymbol::get_spot_to_insert_link(Link*));
#ifdef _PSET_DEBUG
  this->is_consistent(1);
#endif
  if (!lin) return 0;
  uint s_ind = get_symbol_index();
  Link* lnk = get_start_link(s_ind, Xr);
  if (!lnk) return 0;
  int not_junk = 1;
  Link* junk_link = 0;
  bool uniqlinkflag = lin->num_link() || unique_link(lin->lt());
  while (lnk && !last_link(lnk)) {
    if (*lnk == *lin) return 0;
    if (uniqlinkflag && lnk->lt() == lin->lt()) return lnk;
    if (lnk->lt() == lt_junk && not_junk) {
      junk_link = lnk;
      not_junk = 0;
    }
    lnk = get_next_link(lnk, s_ind, Xr);
  }
  if (junk_link) return junk_link;
  lnk = make_new_link(s_ind, Xr);
  lnk->make_last_link();
  dump_link(this, 0, lnk, "get num spot");
  return lnk;
}
Link * xrefSymbol :: get_spot_to_insert_link ( Link * lin , XrefTable * Xr ) { Initialize ( xrefSymbol :: get_spot_to_insert_link ( Link * ) ) ; #ifdef _PSET_DEBUG this -> is_consistent ( 1 ) ; #endif if ( ! lin ) return 0 ; uint s_ind = get_symbol_index ( ) ; Link * lnk = get_start_link ( s_ind , Xr ) ; if ( ! lnk ) return 0 ; int not_junk = 1 ; Link * junk_link = 0 ; bool uniqlinkflag = lin -> num_link ( ) || unique_link ( lin -> lt ( ) ) ; while ( lnk && ! last_link ( lnk ) ) { if ( * lnk == * lin ) return 0 ; if ( uniqlinkflag && lnk -> lt ( ) == lin -> lt ( ) ) return lnk ; if ( lnk -> lt ( ) == lt_junk && not_junk ) { junk_link = lnk ; not_junk = 0 ; } lnk = get_next_link ( lnk , s_ind , Xr ) ; } if ( junk_link ) return junk_link ; lnk = make_new_link ( s_ind , Xr ) ; lnk -> make_last_link ( ) ; dump_link ( this , 0 , lnk , " " ) ; return lnk ; }
return 0 if lin already exist
else return an empty spot (reuse old deleted links)
return 0 if lin already exist else return an empty spot ( reuse old deleted links )
// for numeric link, reuse same location (only one is legal)