Polaris: FormatExpr.h Source File

FormatExpr.h

Go to the documentation of this file.
00001 ///
00002 #ifndef _FORMAT_EXPR_H
00003 #define _FORMAT_EXPR_H
00004 ///
00005 /// \class FormatExpr 
00006 /// \brief Expression describing the s_control of an I/O statement.
00007 /// \defgroup Polaris
00008 /// \ingroup Polaris
00009 ///  Expression
00010 /// \see Expression/FormatExpr.h
00011 /// \see Expression/FormatExpr.h
00012 /// \see Expression/Expression.cc
00013 ///
00014 /// \endcode
00015 /// \section Description Description
00016 /// A FormatExpr is used to describe the s_control of an I/O statement.
00017 /// The FormatExpr is used when the rhs of a an s_control_type pair is a
00018 /// pointer to a Format class, i.e. representing a FORMAT statement
00019 /// label, such as in WRITE(*, 100), where the 100 would be represented
00020 /// as a FormatExpr pointing to the Format object with tag '100'.
00021 ///
00022 /// The Format expression does not exist in Delta.  It is used when
00023 /// a write statement uses the line number of a format statement.
00024 /// The FormatExpr contains a single format field which contains
00025 /// a pointer to a Format class object.
00026 ///
00027 #ifdef POLARIS_GNU_PRAGMAS
00028 #pragma interface
00029 #endif
00030 ///
00031 #ifndef _EXPRESSION_H
00032 #include "Expression.h"
00033 #endif
00034 ///
00035 #include "../Format.h"
00036 ///
00037 class FormatExpr : public Expression {
00038  public:
00039     inline FormatExpr(const Format & format);
00040     inline FormatExpr(const FormatExpr & e);
00041     virtual ~FormatExpr();
00042 
00043     inline virtual         FormatExpr & operator = (const FormatExpr & e);
00044 
00045     const Format &        format() const;
00046     Format &        format();
00047     void            format(Format & format);
00048     ///< Access the format associated with this expression.
00049 
00050     virtual void    relink_eptrs(ProgramUnit & p);
00051     ///< Change pointer in FormatExpr to point into the given ProgramUnit
00052 
00053     virtual Expression *clone() const;
00054     virtual void    print_debug(ostream & o, Boolean debug) const;
00055     virtual int     structures_OK() const;
00056     virtual void    convert(BinRep & exprSet, Symtab & symtab);
00057     virtual const ExprSignature & update_signature();
00058     virtual int     node_compare(const Expression & ex) const;
00059     ///< See Expression.h.
00060  
00061     virtual int     exchange_expr( VDL & vdl );
00062     ///< Create a node in the "expression" member and return the index.
00063 
00064  protected:
00065     Format * _format_ptr;
00066 
00067 };
00068 
00069 
00070 ///< inline implementations
00071 
00072 inline
00073 FormatExpr::FormatExpr(const Format & format)
00074 : Expression(FORMAT_OP, make_type(VOID_TYPE)) 
00075 {
00076     _format_ptr = CASTAWAY(Format *) &format;
00077 }
00078 
00079 inline
00080 FormatExpr::FormatExpr(const FormatExpr & e)
00081 : Expression(e) 
00082 {
00083     _format_ptr = e._format_ptr;
00084 }
00085 
00086 inline
00087 FormatExpr &
00088 FormatExpr::operator = (const FormatExpr & e)
00089 {
00090     _format_ptr = e._format_ptr;
00091     return *this;
00092 }
00093 
00094 #endif
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:05:53 2005