00001 /*-------------------------------------------------------------------- 00002 * output_viewer.h 00003 * 00004 * The output_viewer displays C output generated by s2c. 00005 * There should be `line' annotations embedded as comments in the C 00006 * file, so that the viewer can map the output lines back to Suif. 00007 * 00008 */ 00009 00010 #ifndef OUTPUT_VIEWER_H 00011 #define OUTPUT_VIEWER_H 00012 00013 #include "code_tree.h" 00014 #include "base_viewer.h" 00015 00016 class scope_node; 00017 typedef list<scope_node*> scope_node_list; 00018 00019 /* 00020 * output viewer 00021 */ 00022 class output_viewer : public text_base_viewer { 00023 typedef text_base_viewer inherited; 00024 00025 static const String empty_file; 00026 00027 String current_file; 00028 00029 vmessage* infobar; 00030 code_tree* outtree; 00031 FileBlock* current_fse; 00032 scope_node_list* proc_scopes; 00033 00034 static void do_open_cmd( event& e, output_viewer* viewer ); 00035 static code_range map_tree_node( SuifObject* tn, output_viewer* viewer ); 00036 00037 virtual void erase_mappings(); 00038 virtual bool print_output( String filename ); 00039 virtual void update_infobar(); 00040 virtual void show( vnode* vn ); 00041 00042 public: 00043 output_viewer(); 00044 virtual ~output_viewer(); 00045 00046 virtual void create_window(); 00047 00048 virtual char* class_name() { return "Output Viewer"; } 00049 virtual void handle_event( event& e ); 00050 00051 virtual void clear(); 00052 virtual void view( FileBlock* fb, String out_file = String() ); 00053 virtual void view( SuifObject* node, bool select = true ); 00054 00055 //@@@ /* state of viewer */ 00056 //@@@ code_tree* output_tree() { return outtree; } 00057 00058 static window* constructor() { 00059 return new output_viewer; 00060 } 00061 }; 00062 00063 #endif