00001 #ifdef J_BREEZE 00002 #include "j_breeze.h" 00003 #else 00004 #include "c_breeze.h" 00005 #endif // 00006 00007 // "abstract" class to generate input for vcg. 00008 // subclass this class so generate special output eg. callgraph, class 00009 // hierarchy, etc. 00010 class vcgWalker: public Walker { 00011 00012 protected: // -- local types 00013 00014 typedef list<string> strings; 00015 00016 ostream& graph; // the output file 00017 00018 strings exclude; // nodes to exclude from the graph; read in from file. 00019 #ifdef J_BREEZE 00020 type_list current_type; 00021 #endif // 00022 bool currently_excluded; // whether we are currently in a context (type, 00023 // proc etc) that is to be excluded 00024 00025 public: // -- constructors and destructors 00026 00027 vcgWalker(ostream& ostr, const string& comment, string excludefilename); 00028 virtual ~vcgWalker(void) { finalize_graph(); } 00029 00030 protected: 00031 #ifdef J_BREEZE 00032 // is type to be excluded? 00033 bool excluded(typeNode *type); 00034 #else 00035 // is type to be excluded? 00036 bool excluded(procNode *proc); 00037 bool excluded(Coord coord); 00038 #endif // 00039 00040 private: 00041 #ifdef J_BREEZE 00042 virtual void at_type(typeNode *type, Order order); 00043 #else 00044 virtual void at_proc(procNode *proc, Order order); 00045 #endif // 00046 00047 protected: // -- other methods 00048 00049 inline void start_graph() { 00050 graph << "graph: {" << endl; 00051 } 00052 00053 virtual void finalize_graph() { 00054 // Close the graph. 00055 graph << endl; 00056 graph << "} // end of graph" << endl; 00057 } // finalize_graph 00058 00059 00060 void print_comment(const string& comment = ""); 00061 00062 void print_graph_attribute(const string& attribute, const string& value); 00063 00064 void print_node_attribute(const string& attribute, const string& value); 00065 void print_node_attribute(const string& attribute, int value); 00066 00067 void print_node_value(const string& attribute, const string& value); 00068 }; // vcgWalker 00069 00070