Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

annotation.h

Go to the documentation of this file.
00001 // AUTOMATICALLY GENERATED -- DO NOT EDIT!         -*- c++ -*-
00002 
00003 #ifndef annotation_h
00004 #define annotation_h
00005 
00006 #include "type_rep.h"
00007 #include <ptree.h>
00008 
00009 //
00010 // INTERFACE definition follows 
00011 //
00012 
00013 
00014 class Symbol;
00015 class Variable_symbol;
00016 class Function_signature;
00017 
00019 class Annotation {
00020     Type    type;
00021     Symbol* symbol;
00022     int     flags;
00023  public:
00024     Type    get_type() const { return type; }
00025     Symbol* get_symbol() const { return symbol; }
00026 
00027     enum Flag {
00028         af_DirectCall            // suppress virtual function call for this call
00029     };
00030 
00031 public:  
00032   Annotation(Type type, Symbol* sym);
00033   
00034   virtual ~Annotation();
00035   
00036   void set_symbol(Symbol* symbol);
00037   
00038   void set_type(Type type);
00039   
00040   void add_flag(Flag f);
00041   
00042   bool has_flag(Flag f);
00043   
00044   void remove_flag(Flag f);
00045 };
00046 
00047 template<class T>
00048 class Annotated : public T, public Annotation {
00049  public:
00050     template<class U>
00051     Annotated(Type type, Symbol* sym, U arg, Ptree* a, Ptree* b)
00052         : T(arg, a, b), Annotation(type, sym) { }
00053 
00054 public:  
00055   Annotated(Type type, Symbol* sym);
00056   
00057   Annotated(Type type, Symbol* sym, T& src);
00058   
00059   Annotated(Type type, Symbol* sym, Ptree* a, Ptree* b);
00060   
00061   Annotated(Type type, Symbol* sym, Ptree* a, Ptree* b, Ptree* c);
00062 };
00063 
00064 class Annotated_funcall_maker {
00065     Ptree* function;
00066     Type result_type;
00067     Ptree* tree;
00068 
00069 public:  
00070   /*********************** Annotated_funcall_maker *******************************/
00071   Annotated_funcall_maker(Ptree* function, Type result_type);
00072   
00073   ~Annotated_funcall_maker();
00074   
00075   void add_arg(Ptree* arg);
00076   
00077   Ptree* make_funcall();
00078 };
00079 
00080 /**************************** Accessors **************************/
00081 Ptree* make_static_leaf(const char* txt);
00082 
00083 Ptree* make_dup_leaf(const char* txt);
00084 
00085 Ptree* make_dup_leaf(std::string txt);
00086 
00087 Annotated<LeafThis>* make_this(Type type);
00088 
00089 Annotated<LeafName>* make_name(const char* txt, Type type, Symbol* sym);
00090 
00091 Annotated<LeafName>* make_name(std::string str, Type type, Symbol* sym);
00092 
00093 Annotated<LeafName>* make_name(Function_signature* fsig);
00094 
00095 Annotated<LeafName>* make_name(Variable_symbol* vsym);
00096 
00097 Annotated<PtreeFstyleCastExpr>* make_cast_expr_unchecked(Ptree* expr, const Type& target_type);
00098 
00100 Annotated<PtreeFstyleCastExpr>* make_cast_expr(Ptree* expr, Type target_type);
00101 
00104 Annotated<PtreeFstyleCastExpr>* make_derived_to_base_cast(Ptree* expr, Type target_type);
00105 
00109 Annotated<PtreeCommaExpr>* make_comma_expr(Ptree* lhs, Ptree* rhs);
00110 
00111 Annotated<PtreeDeclaration>* make_declaration(Variable_symbol* vsym);
00112 
00115 void fill_in_overload_annotation(Ptree* tree, Symbol* sym, Type t);
00116 
00117 /* Handy function */
00118 Ptree* make_unary_funcall(Ptree* function, Type result, Ptree* arg);
00119 
00120 /* meta information -> black
00121    names -> red
00122    types -> green
00123    node content -> blue */
00124 void print_annotated_tree(std::ostream& out, std::string indent, Ptree* tree, bool colors);
00125 
00126 //
00127 // IMPLEMENTATION includes follow (for use by inline functions)
00128 //
00129 
00130 
00131 #include <cstring>
00132 #include <cstdio>
00133 #include <typeinfo>
00134 #include <encoding.h>
00135 #include "symbol_table.h"
00136 #include "variable.h"
00137 #include "function.h"
00138 #include "except.h"
00139 
00140 //
00141 // IMPLEMENTATION of inline functions (and needed classes)
00142 //
00143 
00144 
00145 
00146 inline void
00147 Annotation::set_symbol(Symbol* symbol)
00148 {
00149     this->symbol = symbol;
00150 }
00151 
00152 
00153 inline void
00154 Annotation::set_type(Type type)
00155 {
00156     this->type = type;
00157 }
00158 
00159 
00160 inline void
00161 Annotation::add_flag(Flag f)
00162 {
00163     flags |= 1 << f;
00164 }
00165 
00166 
00167 inline bool
00168 Annotation::has_flag(Flag f)
00169 {
00170     return flags & (1 << f);
00171 }
00172 
00173 
00174 inline void
00175 Annotation::remove_flag(Flag f)
00176 {
00177     flags &= ~(1 << f);
00178 }
00179 
00180 //
00181 // IMPLEMENTATION of function templates
00182 //
00183 
00184 
00185 
00186 
00187 template<class T> Annotated<T>::Annotated(Type type, Symbol* sym)
00188     : T(), Annotation(type, sym)
00189 { }
00190 
00191 
00192 
00193 template<class T> Annotated<T>::Annotated(Type type, Symbol* sym, T& src)
00194     : T(src),                  // hehe
00195       Annotation(type, sym)
00196 { }
00197 
00198 
00199 
00200 template<class T> Annotated<T>::Annotated(Type type, Symbol* sym, Ptree* a, Ptree* b)
00201     : T(a, b), Annotation(type, sym)
00202 { }
00203 
00204 
00205 
00206 template<class T> Annotated<T>::Annotated(Type type, Symbol* sym, Ptree* a, Ptree* b, Ptree* c)
00207     : T(a, b, c), Annotation(type, sym)
00208 { }
00209 
00210 #endif // annotation_h

Generated on Mon Feb 10 17:32:43 2003 for VFiasco Semantics Compiler by doxygen1.2.15