// // Create a XAstReader object, and pointer to AST root node // Read Gxl file and build the AST // XAstReader *reader = new XAstReader; list < TreeNode * >*TreeNodeList; TreeNodeList = reader->readlist (GxlInputFile); TreeNodeList->sort (TreeNodeCmp ()); // // Dump Nodes // list < TreeNode * >::iterator TNLIter; long nodeId; string nodeCode; cout << "\n" << "\n\n" << "\n\n"; // Visit one node for time for (TNLIter = TreeNodeList->begin (); TNLIter != TreeNodeList->end (); TNLIter++) { TreeNode *from = *TNLIter; nodeId = from->getId (); nodeCode = a2b::NodeCode2string (from->getCode ()); cout << "\n" << "\t\n"; cout << "\n"; // // Build List of edge.to TreeNode // list < string > toList; // 1. Build List of string's codes if (from->hasEdges ()) { TreeNode *to; cout << "\n"; to = from->firstEdge (); toList.push_back (a2b::EdgeCode2string (from->currentEdgeCode ())); while (from->hasNextEdge ()) { to = from->nextEdge (); toList. push_back (a2b::EdgeCode2string (from->currentEdgeCode ())); } } // 2. Sort list toList.sort (); // 3. Dump ordered list of edges while (!toList.empty ()) { string code = toList.front (); TreeNode *to = from->edgeName (a2b::string2EdgeCode (code)); cout << "getId () << "\" to=\"nd" << to->getId () << "\">" << "" << "\n"; toList.pop_front (); } cout << "\n"; } cout << "\n";