if_diff/src/if_diff_CBS.cxx
//============================================================================
// Add attributes to the given attribute dictionary.
// Addition of an already-present attribute is an error, reported
// with the context given in msg_context.
//============================================================================
Add attributes to the given attribute dictionary.
Addition of an already-present attribute is an error, reported
with the context given in msg_context.
Add attributes to the given attribute dictionary . Addition of an already - present attribute is an error reported with the context given in msg_context .
static void add_attributes(idfAttributeDictionary &ad,
                           attributeList *attributes,
                           const char *msg_context,
      	      	      	   const char *relation)
{
  if (attributes) {
    idfStringSet *ssp = relation != NULL
                          ? idf_configuration.lookup("Attribute of relation () can have multiple values.")
                          : 0;
    for (int i = 0; i < attributes->size(); i++) {
      const char *n = (*attributes)[i]->name;
      if (n == NULL) {
        n = "";
      }
      const char *v = (*attributes)[i]->value;
      if (v == NULL) {
        v = "";
      }
      genString s;
      genString alt_name;
      if (ssp != NULL && (s.printf("%s of %s", n, relation), ssp->contains(s))) {
      	alt_name.printf("%s(%s)", n, v);
      	n = alt_name.str();
      	v = "";
      }
      boolean already_there = !ad.add(n, strdup(v));
      if (already_there) {
      	const char *old_val = ad.lookup(n);
        genString msg;
      	if (idf_strmatch(old_val, v)) {
      	  if (!idf_configuration.contains("Duplicate attributes are redundant.")) {
            msg.printf("%s: duplicate attribute %s, value %s", msg_context, n, v);
            idf_report(msg, source_error);
      	  }
      	}
      	else {
      	  msg.printf("%s: conflicting values for attribute %s, %s vs. %s",
	    msg_context, n, old_val != NULL ? old_val : "<NULL>", v);
          idf_report(msg, source_error);
      	}
      }
    }
  }
}
static void add_attributes ( idfAttributeDictionary & ad , attributeList * attributes , const char * msg_context , const char * relation ) { if ( attributes ) { idfStringSet * ssp = relation != NULL ? idf_configuration . lookup ( " " ) : 0 ; for ( int i = 0 ; i < attributes -> size ( ) ; i ++ ) { const char * n = ( * attributes ) [ i ] -> name ; if ( n == NULL ) { n = " " ; } const char * v = ( * attributes ) [ i ] -> value ; if ( v == NULL ) { v = " " ; } genString s ; genString alt_name ; if ( ssp != NULL && ( s . printf ( " " , n , relation ) , ssp -> contains ( s ) ) ) { alt_name . printf ( " " , n , v ) ; n = alt_name . str ( ) ; v = " " ; } boolean already_there = ! ad . add ( n , strdup ( v ) ) ; if ( already_there ) { const char * old_val = ad . lookup ( n ) ; genString msg ; if ( idf_strmatch ( old_val , v ) ) { if ( ! idf_configuration . contains ( " " ) ) { msg . printf ( " " , msg_context , n , v ) ; idf_report ( msg , source_error ) ; } } else { msg . printf ( " " , msg_context , n , old_val != NULL ? old_val : " " , v ) ; idf_report ( msg , source_error ) ; } } } } }
Add attributes to the given attribute dictionary.
Add attributes to the given attribute dictionary .
// Provide for attributes such as the argument attribute of type, which // can have several values for the same pair of symbols.  Treat these // as independent attributes.  For example, if  //       [1] is type of [2] with argument value 1   and //       [1] is type of [2] with argument value 2 // then it's entered into the attribute dictionary //    not as "argument"->"1" and "argument"->"2" //    but as "argument(1)->"" and "argument(2)"->""