coins.sym
Class EnumTypeImpl

java.lang.Object
  extended bycoins.sym.SymImpl
      extended bycoins.sym.TypeImpl
          extended bycoins.sym.EnumTypeImpl
All Implemented Interfaces:
java.lang.Cloneable, EnumType, HasStringObject, Sym, Sym0, Type

public class EnumTypeImpl
extends TypeImpl
implements EnumType


Field Summary
protected  IrList fElemList
           
protected  Sym fTag
           
 
Fields inherited from class coins.sym.TypeImpl
fCompleteType, fConst, fOrigin, fRestrict, fTypeCore, fTypeKind, fVolatile
 
Fields inherited from class coins.sym.SymImpl
fDbgLevel, fDefinedIn, fFlagBox, fKind, fName, fNextSym, fRecordedIn, fSourceInf, fSymInf, fType, fUniqueNameSym, fWork, machineParam, sourceLanguage, symRoot
 
Fields inherited from interface coins.sym.Type
KIND_ADDRESS, KIND_ALIGNMENT, KIND_BASE_LIM, KIND_BOOL, KIND_CHAR, KIND_DEFINED, KIND_DOUBLE, KIND_ENUM, KIND_FLOAT, KIND_FLOAT_LOWER_LIM, KIND_FLOAT_UPPER_LIM, KIND_INT, KIND_INT_UPPER_LIM, KIND_LONG, KIND_LONG_DOUBLE, KIND_LONG_LONG, KIND_OFFSET, KIND_POINTER, KIND_RANKS, KIND_REGION, KIND_SHORT, KIND_STRING, KIND_STRUCT, KIND_SUBP, KIND_U_CHAR, KIND_U_INT, KIND_U_LONG, KIND_U_LONG_LONG, KIND_U_SHORT, KIND_UNDEF, KIND_UNION, KIND_UNSIGNED_LOWER_LIM, KIND_VECTOR, KIND_VOID, KIND_WCHAR
 
Fields inherited from interface coins.sym.Sym
KIND_NAME, VISIBILITY
 
Fields inherited from interface coins.sym.Sym0
FLAG_ADDRESS_TAKEN, FLAG_CASTLESS_SUBP, FLAG_COMMON, FLAG_COMPLEX_STRUCT, FLAG_DERIVED_SYM, FLAG_GENERATED_SYM, FLAG_INCOMPLETE_TYPE, FLAG_POINTER_OPERATION, FLAG_REGION_ELEM, FLAG_RESERVED_NAME, FLAG_SIZEOF_TAKEN, FLAG_UNFIXED_SIZE, FLAG_UNIFORM_SIZE, FLAG_VALUE_IS_ASSIGNED, KIND_AREG, KIND_BOOL_CONST, KIND_CHAR_CONST, KIND_CONST_FIRST, KIND_CONST_LAST, KIND_ELEM, KIND_EXP_ID, KIND_FLOAT_CONST, KIND_INT_CONST, KIND_LABEL, KIND_MREG, KIND_NAMED_CONST, KIND_OTHER, KIND_PARAM, KIND_REMOVED, KIND_STRING_CONST, KIND_TAG, KIND_TYPE, KIND_VAR, SYM_COMPILE_UNIT, SYM_EXTERN, SYM_PRIVATE, SYM_PROTECTED, SYM_PUBLIC
 
Constructor Summary
EnumTypeImpl(SymRoot pSymRoot, java.lang.String pTypeName, IrList pElemList)
          EnumTypeImpl constructor Make an instance of EnumType in symRoot.symTableCurrent.
 
Method Summary
 void addElem(NamedConst pElem)
          addElem Add element to this enum type.
 void finishEnumType(boolean pSeparately)
          Finish to define this enum type.
 Type getCompleteType()
          getCompleteType Get complete type corresponding to this type.
 IrList getElemList()
          getElemList: Get the list of struct/union elements.
 int getEnumSeqNumber()
           
 Sym getTag()
           
 boolean isCompatibleWith(Type pType)
          isCompatibleWith The origin type of this type and pType are compared to be equal or not.
 void setEnumSeqNumber(int pNumber)
           
 void setTag(Sym pTag)
           
 java.lang.String toStringDetail()
          toStringDetail Get detailed attributes of this symbol in text which is not interned.
 
Methods inherited from class coins.sym.TypeImpl
getAlignment, getAlignmentGap, getDimension, getElemListString, getElemListString, getEnumListString, getFinalOrigin, getOrigin, getPointedType, getSizeExp, getSizeValue, getTypeKind, getTypeRank, getUnqualifiedType, isBasicType, isConst, isFloating, isInteger, isRestrict, isScalar, isSizeEvaluable, isUnsigned, isVolatile, makeConstType, makeRestrictType, makeVolatileType, searchTypeCompatibleWithThis, setOrigin, setSizeExp, setSizeValue, setStaticTable, toString, toStringShort
 
Methods inherited from class coins.sym.SymImpl
bareStringConst, baseType, boolConst, charConst, charConst, charConst, definedType, definedType, defineElem, defineLabel, defineParam, defineRegionVar, defineSubp, defineVar, defineVar, derivedSym, enumType, enumType, floatConst, floatConst, getDefinedColumn, getDefinedFile, getDefinedIn, getDefinedInName, getDefinedLine, getFlag, getInf, getName, getNameOrNull, getNextSym, getOrAddInf, getOriginalSym, getOriginalSym, getPureName, getRecordedIn, getSourceInf, getSymKind, getSymKindName, getSymType, getUniqueName, getWork, intConst, intConst, intObject, isGlobal, isHIR, isRemoved, isSym, linkSym, makeCstring, makeCstringWithTrailing0, makeEnumTypeName, makeExpString, makeJavaString, makeStructUnionTypeName, makeSubpTypeName, makeSubpTypeName, makeVectorTypeName, makeVectorTypeName, makeVectorTypeName, namedConst, namedConst, pointerType, pointerType, pointerType, pointerType, pointerType, print, print, regionType, regionType, remove, setDefinedFile, setDefinedIn, setDefinedLine, setFlag, setOriginalSym, setParameters, setRecordedIn, setSourceInf, setSymKind, setSymType, setUniqueNameSym, setWork, stringConst, stringConstFromQuotedString, structType, structType, subpType, subpType, symbol, unionType, unionType, vectorType, vectorType, vectorType, vectorType, vectorTypeUnfixed, vectorTypeUnfixed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface coins.sym.Type
getAlignment, getAlignmentGap, getDimension, getElemListString, getFinalOrigin, getOrigin, getPointedType, getSizeExp, getSizeValue, getTypeKind, getTypeRank, getUnqualifiedType, isBasicType, isConst, isFloating, isInteger, isRestrict, isScalar, isSizeEvaluable, isUnsigned, isVolatile, makeConstType, makeRestrictType, makeVolatileType, setOrigin, setSizeExp, setSizeValue
 
Methods inherited from interface coins.sym.Sym
baseType, boolConst, charConst, defineVar, derivedSym, floatConst, getDefinedColumn, getDefinedInName, getDefinedLine, getInf, getNameOrNull, getOrAddInf, getOriginalSym, getOriginalSym, getPureName, getSymKindName, getWork, intConst, intObject, isRemoved, makeCstring, makeCstringWithTrailing0, makeEnumTypeName, makeJavaString, makeStructUnionTypeName, makeSubpTypeName, makeVectorTypeName, makeVectorTypeName, makeVectorTypeName, namedConst, pointerType, pointerType, pointerType, regionType, remove, setDefinedFile, setDefinedIn, setDefinedLine, setRecordedIn, setSymKind, setSymType, setUniqueNameSym, setWork, stringConstFromQuotedString, symbol, toStringShort, vectorType, vectorType, vectorType, vectorTypeUnfixed
 
Methods inherited from interface coins.sym.Sym0
charConst, definedType, defineElem, defineLabel, defineParam, defineSubp, defineVar, enumType, floatConst, getDefinedFile, getDefinedIn, getFlag, getName, getNextSym, getRecordedIn, getSymKind, getSymType, getUniqueName, intConst, isGlobal, namedConst, pointerType, setFlag, stringConst, structType, subpType, unionType, vectorType, vectorTypeUnfixed
 

Field Detail

fElemList

protected IrList fElemList

fTag

protected Sym fTag
Constructor Detail

EnumTypeImpl

public EnumTypeImpl(SymRoot pSymRoot,
                    java.lang.String pTypeName,
                    IrList pElemList)
EnumTypeImpl constructor Make an instance of EnumType in symRoot.symTableCurrent. It is not recommended to use this constructor directly but use enumType method of HIR because there are several restrictions in using this constructor.

Parameters:
pSymRoot - SymRoot instance to be passed to the resultant type.
pTypeName - Name of the enum type. It shoul be where tagName is the tag name the enum. If it has no tag name, generate it by generateTag() of SymTable.
pElemList - List of elements of the enum. If it is not known, then give null and later addElem() and finishEnumType().
Method Detail

getEnumSeqNumber

public int getEnumSeqNumber()
Specified by:
getEnumSeqNumber in interface EnumType

setEnumSeqNumber

public void setEnumSeqNumber(int pNumber)
Specified by:
setEnumSeqNumber in interface EnumType

getElemList

public IrList getElemList()
Description copied from interface: Type
getElemList: Get the list of struct/union elements. The elements of the list is an instance of Elem. If this type is neither struct nore union, then null is returned.

Specified by:
getElemList in interface Type
Overrides:
getElemList in class TypeImpl

addElem

public void addElem(NamedConst pElem)
Description copied from interface: EnumType
addElem Add element to this enum type. addElem is called after instantiating EnumType without giving element list. After successive call of addElem, finishEnumType should be called. See enum of Sym.

Specified by:
addElem in interface EnumType
Parameters:
pElem - Element of this enum type.

finishEnumType

public void finishEnumType(boolean pSeparately)
Description copied from interface: EnumType
Finish to define this enum type. After successive call of addElem, finishEnumType should be called. See enum of Sym.

Specified by:
finishEnumType in interface EnumType
Parameters:
pSeparately - true after successive call of addElem, false if element list is given in bundle.

getTag

public Sym getTag()
Specified by:
getTag in interface EnumType

setTag

public void setTag(Sym pTag)
Specified by:
setTag in interface EnumType

isCompatibleWith

public boolean isCompatibleWith(Type pType)
Description copied from interface: Type
isCompatibleWith The origin type of this type and pType are compared to be equal or not. Strict type compatibility check sh ould be done in the semantic analyzer of each language. This method can not afford to do strict semantic check considering language specifications.

Specified by:
isCompatibleWith in interface Type
Overrides:
isCompatibleWith in class TypeImpl
Returns:
true if this type is compatible with pType.

getCompleteType

public Type getCompleteType()
Description copied from interface: Type
getCompleteType Get complete type corresponding to this type. If this is a complete type, return this type. If this is incomplete, find complete type corresponding to this type. If no complete type is found for this type, return null. If the type is neither VectorType, StructType, UnionType, nore EnumType, then return this type.

Specified by:
getCompleteType in interface Type
Overrides:
getCompleteType in class TypeImpl

toStringDetail

public java.lang.String toStringDetail()
Description copied from interface: Sym
toStringDetail Get detailed attributes of this symbol in text which is not interned.

Specified by:
toStringDetail in interface Sym
Overrides:
toStringDetail in class TypeImpl