|
||
vcg.hGo to the documentation of this file.00001 // $Id: vcg.h,v 1.5 2003/08/07 23:13:37 pnav Exp $ 00002 00003 // ---------------------------------------------------------------------- 00004 // 00005 // J-Breeze 00006 // Java Compiler Framework 00007 // 00008 // Copyright (c) 2001 University of Texas at Austin 00009 // 00010 // Teck B. Tok 00011 // Samuel Z. Guyer 00012 // Daniel A. Jimenez 00013 // Calvin Lin 00014 // 00015 // Permission is hereby granted, free of charge, to any person 00016 // obtaining a copy of this software and associated documentation 00017 // files (the "Software"), to deal in the Software without 00018 // restriction, including without limitation the rights to use, copy, 00019 // modify, merge, publish, distribute, and/or sublicense copies 00020 // of the Software, and to permit persons to whom the Software is 00021 // furnished to do so, subject to the following conditions: 00022 // 00023 // The above copyright notice and this permission notice shall be 00024 // included in all copies or substantial portions of the Software. 00025 // 00026 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00027 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00028 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00029 // NONINFRINGEMENT. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT 00030 // AUSTIN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 00031 // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 00032 // OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00033 // THE SOFTWARE. 00034 // 00035 // J-Breeze extends from C-Breeze (copyright University of Texas at 00036 // Austin), part of whose design is inspired by the C-to-C Translator 00037 // from MIT Laboratory for Computer Science. 00038 // 00039 // ---------------------------------------------------------------------- 00040 00041 #ifdef J_BREEZE 00042 #include "j_breeze.h" 00043 #else 00044 #include "c_breeze.h" 00045 #endif 00046 00047 // "abstract" class to generate input for vcg. 00048 // subclass this class so generate special output eg. callgraph, class 00049 // hierarchy, etc. 00050 class vcgWalker: public Walker { 00051 00052 protected: // -- local types 00053 00054 typedef list<string> strings; 00055 00056 ostream& graph; // the output file 00057 00058 strings exclude; // nodes to exclude from the graph; read in from file. 00059 #ifdef J_BREEZE 00060 type_list current_type; 00061 #endif 00062 bool currently_excluded; // whether we are currently in a context (type, 00063 // proc etc) that is to be excluded 00064 00065 public: // -- constructors and destructors 00066 00067 vcgWalker(ostream& ostr, const string& comment, string excludefilename); 00068 virtual ~vcgWalker(void) { finalize_graph(); } 00069 00070 protected: 00071 #ifdef J_BREEZE 00072 // is type to be excluded? 00073 bool excluded(typeNode *type); 00074 #else 00075 // is type to be excluded? 00076 bool excluded(procNode *proc); 00077 bool excluded(Coord coord); 00078 #endif 00079 00080 private: 00081 #ifdef J_BREEZE 00082 virtual void at_type(typeNode *type, Order order); 00083 #else 00084 virtual void at_proc(procNode *proc, Order order); 00085 #endif 00086 00087 protected: // -- other methods 00088 00089 inline void start_graph() { 00090 graph << "graph: {" << endl; 00091 } 00092 00093 virtual void finalize_graph() { 00094 // Close the graph. 00095 graph << endl; 00096 graph << "} // end of graph" << endl; 00097 } // finalize_graph 00098 00099 00100 void print_comment(const string& comment=""); 00101 00102 void print_graph_attribute(const string& attribute, const string& value); 00103 00104 void print_node_attribute(const string& attribute, const string& value); 00105 void print_node_attribute(const string& attribute, int value); 00106 00107 void print_node_value(const string& attribute, const string& value); 00108 }; // vcgWalker 00109 00110 |
Generated on August 27, 2003
Back to the C-Breeze home page