00001 /*------------------------------------------------------------------- 00002 * suif_print.h 00003 * 00004 */ 00005 00006 #ifndef SUIF_PRINT_H 00007 #define SUIF_PRINT_H 00008 00009 #include "visual/visual.h" 00010 #include "suifkernel/suifkernel_forwarders.h" 00011 #include "suifnodes/suif_forwarders.h" 00012 #include "suifkernel/group_walker.h" 00013 #include "suif_utils.h" 00014 #include "common/suif_list.h" 00015 #include "iokernel/object_wrapper.h" 00016 00017 class formater : public default_zot_print_helper , protected SelectiveWalker { 00018 typedef default_zot_print_helper inherited; 00019 public: 00020 vtty* _text; 00021 int _depth; 00022 bool _first; 00023 bool _want_tag; 00024 int _detail; 00025 vnode* _vnode; 00026 bool _want_fold; 00027 list<vnode *>vnode_list; 00028 00029 public: 00030 formater(SuifEnv *suif, vtty *text, 00031 int depth=-1 /* =-1 =>print the whole tree */, 00032 int detail = PRINT_BRIEF); 00033 00034 ApplyStatus operator() (SuifObject *zot) { return Continue; } 00035 void set_current_filter( const LString **filter ) { _current_filter = filter;} 00036 00037 virtual void print_zot(const SuifObject *the_zot, fstream& the_ion); 00038 virtual void print_zot_ref( const SuifObject *the_zot, fstream& the_ion); 00039 00040 virtual int get_depth() { return _depth; } 00041 00042 virtual void print_zot_prefix(const SuifObject *the_zot, fstream& the_ion); 00043 00044 static const LString *mark_filter[]; 00045 static const LString *null_filter[]; 00046 00047 bool start_of_object(ostream& output, const ObjectWrapper &obj,int derefs); 00048 void end_of_object(ostream& output, const ObjectWrapper &obj); 00049 00050 protected: 00051 virtual vnode* make_tag_begin( const SuifObject* the_zot, bool want_fold = false ); 00052 virtual void make_tag_end( vnode* vn ); 00053 00054 virtual void handle_zot(SuifObject* the_zot ); 00055 virtual void handle_for_statement( ForStatement* the_zot ); 00056 virtual void handle_scope_statement( ScopeStatement* the_zot ); 00057 virtual void handle_while_statement( WhileStatement* the_zot ); 00058 virtual void handle_zot_with_tag( const SuifObject* the_zot ); 00059 00060 static void print_helper( vtty *text, vnode *tn_vnode, 00061 int depth, int detail, 00062 void *pr); 00063 virtual bool prepend_tag( const SuifObject* ); 00064 virtual bool filter_tag( const SuifObject* ); 00065 const LString **_current_filter; 00066 static LString *tag_list[]; 00067 00068 }; 00069 00070 #endif // SUIF_PRINT_H