if_diff/src/if_diff_CBS.cxx
//============================================================================
// Add relation entries for the given relation name, list of source symbols,
// list of target symbols, and attribute list.
//============================================================================
Add relation entries for the given relation name, list of source symbols,
list of target symbols, and attribute list.
Add relation entries for the given relation name list of source symbols list of target symbols and attribute list .
static void rel_create(const char *name, uintList *source,
      	               uintList *target, attributeList *attributes)
{
  for (int i = 0; i < source->size(); i++) {
    unsigned int src = (*source)[i];
    idfSymbol &sym = get_symbol(src);
    idfRelationDictionary &r = sym.getRelations();
    idfRelationshipDictionary &rel = get_relationships(r, name);
    for (int j = 0; j < target->size(); j++) {
      unsigned int tgt = (*target)[j];
      idfAttributeDictionary *ad = NULL;
      if (attributes != NULL) {
      	ad = rel.lookup(tgt);
      	boolean new_ad = (ad == NULL);
      	if (new_ad) {
      	  ad = new idfAttributeDictionary;
      	  new_ad = true;
      	}
      	genString context;
      	context.printf("REL [%d] %s [%d]", src, name, tgt);
      	add_attributes(*ad, attributes, context.str(), name);
      	if (new_ad) {
	  boolean already_there = !rel.add(tgt, ad);
	  if (already_there) {
      	    rel.reassign(tgt, ad);
	  }
      	}
      }
      else {
	boolean already_there = !rel.add(tgt, ad);
	if (already_there) {
      	  if (!idf_configuration.contains("Duplicate relation records are redundant.")) {
	    genString msg;
	    msg.printf("REL [%d] %s [%d] is already present", src, name, tgt);
	    idf_report(msg, source_error);
      	  }
	}
      }
    }
  }
}
static void rel_create ( const char * name , uintList * source , uintList * target , attributeList * attributes ) { for ( int i = 0 ; i < source -> size ( ) ; i ++ ) { unsigned int src = ( * source ) [ i ] ; idfSymbol & sym = get_symbol ( src ) ; idfRelationDictionary & r = sym . getRelations ( ) ; idfRelationshipDictionary & rel = get_relationships ( r , name ) ; for ( int j = 0 ; j < target -> size ( ) ; j ++ ) { unsigned int tgt = ( * target ) [ j ] ; idfAttributeDictionary * ad = NULL ; if ( attributes != NULL ) { ad = rel . lookup ( tgt ) ; boolean new_ad = ( ad == NULL ) ; if ( new_ad ) { ad = new idfAttributeDictionary ; new_ad = true ; } genString context ; context . printf ( " " , src , name , tgt ) ; add_attributes ( * ad , attributes , context . str ( ) , name ) ; if ( new_ad ) { boolean already_there = ! rel . add ( tgt , ad ) ; if ( already_there ) { rel . reassign ( tgt , ad ) ; } } } else { boolean already_there = ! rel . add ( tgt , ad ) ; if ( already_there ) { if ( ! idf_configuration . contains ( " " ) ) { genString msg ; msg . printf ( " " , src , name , tgt ) ; idf_report ( msg , source_error ) ; } } } } } }
Add relation entries for the given relation name, list of source symbols,
list of target symbols, and attribute list.
Add relation entries for the given relation name list of source symbols list of target symbols and attribute list .
// The relation was already there, but with no attributes.