00001 /***************************************************************************** 00002 * Copyright (C) 1997-2010, Mark Hummel 00003 * This file is part of Vrq. 00004 * 00005 * Vrq is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * Vrq is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301 USA 00019 ***************************************************************************** 00020 */ 00021 /****************************************************************************** 00022 * 00023 * 00024 * csimpletype.h 00025 * - abstract class for simple built in data types 00026 * 00027 * 00028 ****************************************************************************** 00029 */ 00030 00031 #ifndef CSIMPLETYPE_H 00032 #define CSIMPLETYPE_H 00033 00034 #include "cobject.h" 00035 #include "cdatatype.h" 00036 00040 class CSimpleType : public CDataType 00041 { 00042 public: 00043 private: 00044 int signedAttr; 00045 int unsignedAttr; 00046 public: 00051 CSimpleType( VarDataType_t vt ); 00057 CSimpleType( VarDataType_t vt, list<CNode*>& rangeList ); 00062 virtual CDataType* Clone( CObstack* heap ); 00067 virtual int GetSignedAttr() const { return signedAttr; } 00072 virtual int GetUnsignedAttr() const { return unsignedAttr; } 00077 virtual void SetSignedAttr( int v ) { signedAttr = v; } 00082 virtual void SetUnsignedAttr( int v ) { unsignedAttr = v; } 00087 virtual int GetSigned() const; 00092 virtual int GetTwoState() const; 00097 virtual NodeType_t GetNodeType( void ) const; 00105 virtual int IsBaseWidthConstant( void ) const { return TRUE; } 00113 virtual int IsBaseWidthVolatile( void ) const { return FALSE; } 00120 virtual int IsBaseWidthEvaluateable( void ) const {return TRUE; } 00125 virtual INT32 GetBaseWidth( void ) const; 00130 virtual CNode* GetBaseWidthExp() const; 00136 virtual int IsVector() const; 00142 virtual int IsPacked() const; 00148 virtual CNode* GetPackedMsb() const; 00154 virtual CNode* GetPackedLsb() const; 00160 virtual CNode* GetPackedRange() const; 00165 virtual INT32 GetPackedWidth( void ) const; 00170 virtual CNode* GetPackedWidthExp() const; 00175 virtual int PackedWidthDirection( void ) const; 00180 virtual INT32 GetNumberOfPackedDimensions( void ) const; 00186 virtual CNode* GetPackedMsi( INT32 dim ) const; 00192 virtual CNode* GetPackedLsi( INT32 dim ) const; 00198 virtual CNode* GetPackedRange( INT32 dim ) const; 00203 virtual void Dump( FILE* f ) const; 00204 protected: 00211 void Copy( CObstack* heap, const CSimpleType& o ); 00216 int GetVectorWidth() const; 00217 private: 00218 /* 00219 * disable copy constructor 00220 */ 00221 CSimpleType( const CSimpleType& o ); 00222 00223 }; 00224 00225 #endif // CSIMPLETYPE_H 00226