if_diff/src/idfReport.cxx
//============================================================================
// Dump the ASTs, indicating mismatches and differences.
// Outputs the AST given by 'node' as a sequence of one or more lines.
// Each line is indented using the 'prefix' string.
//============================================================================
Dump the ASTs, indicating mismatches and differences.
Outputs the AST given by 'node' as a sequence of one or more lines.
Each line is indented using the 'prefix' string.
Dump the ASTs indicating mismatches and differences . Outputs the AST given by ' node ' as a sequence of one or more lines . Each line is indented using the ' prefix ' string .
static void report_AST(idfAst *node, char *prefix,
      	               const idfModel &model1, const idfModel &model2)
{
    idfAst *match = node->getMatch();
    boolean mismatch = is_mismatched(*node);
    if (mismatch) {
	report_counts[difference_note] += 1;
    }
    (*ostrm) << (!mismatch ? " " : "X");
    if (prefix != NULL) {
	(*ostrm) << prefix;
    }
    const char *kind = node->getKind();
    if (kind == NULL) {
      kind = "<kind missing>";
    }
    (*ostrm) << kind;
    if (node->getIdentifier() > 0) {
      (*ostrm) << " [" << node->getIdentifier() << "]";
    }
    genString loc;
    idf_location_list_str(node->getLocation(), loc);
    if (loc.length() > 0) {
      (*ostrm) << ' ' << loc.str();
    }
    if (node->getChildren().getNumber() == 0) {
      const char *value = node->getValue();
      if (strcmp(kind, "constant") == 0 || value != NULL) {
	if (value == NULL) {
	  value = "<value missing>";
	}
	(*ostrm) << " {\"" << value << "\"}" << endl;
      }
      else {
	(*ostrm) << " {}" << endl;
      }
      report_AST_node(*node, prefix, model1, model2, AST_report);
    }
    else {
      (*ostrm) << " {";
      (*ostrm) << endl;
      report_AST_node(*node, prefix, model1, model2, AST_report);
      genString pref = prefix;
      pref += "  ";
      report_AST_siblings(node->getChildren(), pref, model1, model2);
      (*ostrm) << ' ';
      if (prefix != NULL) {
      	(*ostrm) << prefix;
      }
      (*ostrm) << "}" << endl;
    }
}
static void report_AST ( idfAst * node , char * prefix , const idfModel & model1 , const idfModel & model2 ) { idfAst * match = node -> getMatch ( ) ; boolean mismatch = is_mismatched ( * node ) ; if ( mismatch ) { report_counts [ difference_note ] += 1 ; } ( * ostrm ) << ( ! mismatch ? " " : " " ) ; if ( prefix != NULL ) { ( * ostrm ) << prefix ; } const char * kind = node -> getKind ( ) ; if ( kind == NULL ) { kind = " " ; } ( * ostrm ) << kind ; if ( node -> getIdentifier ( ) > 0 ) { ( * ostrm ) << " " << node -> getIdentifier ( ) << " " ; } genString loc ; idf_location_list_str ( node -> getLocation ( ) , loc ) ; if ( loc . length ( ) > 0 ) { ( * ostrm ) << ' ' << loc . str ( ) ; } if ( node -> getChildren ( ) . getNumber ( ) == 0 ) { const char * value = node -> getValue ( ) ; if ( strcmp ( kind , " " ) == 0 || value != NULL ) { if ( value == NULL ) { value = " " ; } ( * ostrm ) << " \" " << value << " \" " << endl ; } else { ( * ostrm ) << " " << endl ; } report_AST_node ( * node , prefix , model1 , model2 , AST_report ) ; } else { ( * ostrm ) << " " ; ( * ostrm ) << endl ; report_AST_node ( * node , prefix , model1 , model2 , AST_report ) ; genString pref = prefix ; pref += " " ; report_AST_siblings ( node -> getChildren ( ) , pref , model1 , model2 ) ; ( * ostrm ) << ' ' ; if ( prefix != NULL ) { ( * ostrm ) << prefix ; } ( * ostrm ) << " " << endl ; } }
Dump the ASTs, indicating mismatches and differences.
Dump the ASTs indicating mismatches and differences .
// Output child nodes, with revised indentation prefix.