Polaris: Data.h Source File

Data.h

Go to the documentation of this file.
00001 ///
00002 ///
00003 #ifndef _DATA_H
00004 #define _DATA_H
00005 ///
00006 /// \class Data 
00007 /// \brief Holds a complete DATA statement
00008 /// \defgroup C
00009 /// \ingroup C++ CVDL
00010 ///  Polaris
00011 /// \see base/Data.h
00012 /// \see Data.cc
00013 /// \see Data.h
00014 ///
00015 /// \endcode
00016 /// \section Description Description
00017 /// The Data class is meant to provide a method to represent a
00018 /// Fortran DATA statement.  Data holds two lists of data,
00019 /// variables and values, each of which is represented as a
00020 /// list of Expressions (a CommaExpr).  The Expressions in the variable
00021 /// list MUST be one of three forms: IDExpr (for individual variables),
00022 /// ArrayRefExpr (for an element of an array), DoExpr (for an implied
00023 /// loop).  The Expressions in the value list are represented
00024 /// primarily with constant Expressions.  In addition, repeated factors
00025 /// are represented using a BinaryExpr with the REPSTAR_OP operator
00026 /// (which can also be used in conjunction with CommaExpr). Thus the
00027 /// DATA constant /3*(1, -0.5)/ can be represented.
00028 ///
00029 #ifdef POLARIS_GNU_PRAGMAS
00030 #pragma interface
00031 #endif
00032 ///
00033 #include "ClassNames.h"
00034 #include "Listable.h"
00035 #include "StringElem.h"
00036 #include "Expression/Expression.h"
00037 #include "Expression/CommaExpr.h"
00038 ///
00039 class BinRep;
00040 
00041 class Data : public Listable {
00042 friend ostream & operator << (ostream &o, const Data &d);
00043 private:
00044     CommaExpr *_variable_list;
00045     CommaExpr *_value_list;
00046     
00047 public:
00048     Data();
00049                
00050     Data(const BinRep &binstr, ExprTable &etable);
00051     inline Data(const Data &d);
00052     virtual ~Data();
00053 
00054     virtual Listable *listable_clone() const;
00055     virtual Data     *clone() const;
00056     virtual void      print(ostream &) const;
00057 
00058     void              relink_ptrs( ProgramUnit &p);
00059     ///< Change the pointers in the DATA statement
00060     ///< (variables) to point into the given ProgramUnit.
00061     
00062     const CommaExpr  &variable_list() const;
00063     CommaExpr        &variable_list();
00064     void              variable_list(CommaExpr *varlist);
00065     const CommaExpr  &value_list() const;
00066     CommaExpr        &value_list();
00067     void              value_list(CommaExpr *vallist);
00068 };
00069 
00070 inline
00071 Data::Data(const Data &d)
00072 {
00073     #ifdef CLASS_INSTANCE_REGISTRY
00074     register_instance(DATA_CLASS, sizeof(Data), this);
00075     #endif
00076 
00077     this->_variable_list = (CommaExpr *) d._variable_list->clone();
00078     this->_value_list    = (CommaExpr *) d._value_list->clone();
00079 }
00080 
00081 ///< Description:
00082 ///<   Takes as input an expression, which is assumed to
00083 ///<   be a "CommaExpr" of variables that will be initialized in the DATA
00084 ///<   statement.  The expressions on the comma-list can be either IDExpr's,
00085 ///<   ArrayRefExpr's, or DoExpr's - no other expressions may appear in a 
00086 ///<   DATA statement.  This routine marks all the symbols it finds as 
00087 ///<   "initialized" because they appear in the DATA statement.
00088 void mark_initialized( CommaExpr &expr ) ;
00089 
00090 #endif
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:05:43 2005