*build* buildzoo *schema* "/home/demeter/master/test/build/zoo/cd.cd" *main* (@ const int MAXPATH = 256; char Dem_input[MAXPATH]; // Input file is first argument if( argc >= 2 ) strcpy( Dem_input, argv[1] ); else { strcpy( Dem_input, "demeter-input" ); // default input } // parse it in cout << "Parsing in object in: " << Dem_input << ". \n"; Zoo* iZoo = new Zoo(); if ( ( Zoo* ) iZoo -> g_parse( Dem_input ) == NULL ) { cerr << "Parser error." << endl; exit(1); } cout << endl; //---------------------------------------- // Drawing an object //---------------------------------------- cout << "Drawing the parsed object:\n"; iZoo -> g_draw(); cout << "\nEnd of drawing.\n" << endl; //---------------------------------------- // Copying an object //---------------------------------------- cout << "Copying the object.\n"; Zoo* nZoo = ( Zoo* ) iZoo -> g_copy(); cout << endl; //---------------------------------------- // Displaying the copied object as a tree //---------------------------------------- cout << "Displaying the copied object as a tree:\n"; nZoo -> g_displayAsTree(); cout << "\nEnd of display.\n" << endl; //---------------------------------------- // Comparing two objects //---------------------------------------- cout << "Comparing the two objects:\n"; if ( iZoo -> g_equal( nZoo ) == 1 ) cout << "copied and original object are equal\n" << endl; else cout << "copied and original object are NOT equal\n" << endl; //---------------------------------------- // Printing an object //---------------------------------------- cout << "Pretty printing the parsed object:\n"; char* tmp_filename = "notmod/tmp/demeter-output"; ofstream outFile( tmp_filename ); if ( !outFile ) { cerr << "UNKNOWN error: unable to open " << tmp_filename << " for output" << endl; exit( 1 ); } cout << iZoo << endl; iZoo -> g_print( outFile ); outFile.close(); cout << "\nEnd of printing.\n" << endl; //---------------------------------------- // Selftest of generic parser/printer //---------------------------------------- cout << "Selftest of generic parser/printer:\n"; Zoo* iZoo_printed = new Zoo(); iZoo_printed = (Zoo*)iZoo_printed->g_parse( tmp_filename ); if( iZoo->g_equal( iZoo_printed ) == 1 ) { cout << "g_parse and g_parse( g_print( g_parse ) ) are equal.\n" << "Selftest passed.\n"; } else { cout << "g_parse and g_parse( g_print( g_parse ) ) are NOT equal.\n" << "Selftest failed.\n"; } cout << endl; //---------------------------------------- // Your own code follows after this //---------------------------------------- iZoo->routine_jobs(); cout << "\n*** FINISHED ***" << endl; return ( 0 ); @) *comp-path* "/home/demeter/master/test/build" *component* zoo *end*