coins.sym
Interface Const

All Superinterfaces:
Sym, Sym0
All Known Subinterfaces:
BoolConst, CharConst, FloatConst, IntConst, NamedConst, StringConst
All Known Implementing Classes:
BoolConstImpl, CharConstImpl, ConstImpl, FloatConstImpl, IntConstImpl, NamedConstImpl, StringConstImpl

public interface Const
extends Sym

Const interface

  Const (constant) class interface.
  A constant in source program is recorded as a Const instance
  by using its character string representation as its name.
  There are access methods to get the value of constants and
  to record a constant giving its value.
  Constants are usually represented by symbol table instance
  in order to represent attributes attached to them.
  Subclasses of Const is not so fine as type, foe example,
  int, short, long, unsigned int, unsigned short, unsigned long
  all belongs to IntConst. To see the type of Const object,
  use getSymType() of SymInterface.


Field Summary
 
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_SUBP, KIND_TAG, KIND_TYPE, KIND_VAR, SYM_COMPILE_UNIT, SYM_EXTERN, SYM_PRIVATE, SYM_PROTECTED, SYM_PUBLIC
 
Method Summary
 char charValue()
          charValue
 double doubleValue()
          doubleValue
 java.lang.Object evaluateAsObject()
           Get the value of this constant symbol.
 float floatValue()
          floatValue
 Const getConstSym()
          getConstSym
 int intValue()
          intValue Get the value of this constant.
 long longValue()
          longValue
 short shortValue()
          shortValue
 
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, toStringDetail, 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
 

Method Detail

intValue

public int intValue()
intValue Get the value of this constant. If type conversion is required, the returned value is the result of conversion. "this" should be a constant of type integer, short integer, long integer, or character of either signed or unsigned.

Returns:
the integer value of this constant.

shortValue

public short shortValue()
shortValue
  Get the value of this constant.
  If type conversion is required, the returned value is the
  result of conversion.
  "this" should be a constant of type integer, short integer,
  long integer, or character of either signed or unsigned.

Returns:
the short int value of this constant.

longValue

public long longValue()
longValue
  Get the value of this constant.
  If type conversion is required, the returned value is the
  result of conversion.
  "this" should be a constant of type integer, short integer,
  long integer, or character of either signed or unsigned.

Returns:
the long int value of this constant.

charValue

public char charValue()
charValue
  Get the value of this constant.
  If type conversion is required, the returned value is the
  result of conversion.
  "this" should be a constant of type integer, short integer,
  long integer, or character of either signed or unsigned.

Returns:
the char value of this constant.

floatValue

public float floatValue()
floatValue
  Get floating value of this constant.
  If type conversion is required, the returned value is the
  result of conversion.
  "this" should be a constant of type float, or double.

Returns:
the float value of this constant.

doubleValue

public double doubleValue()
doubleValue
  Get double value of this constant.
  If type conversion is required, the returned value is the
  result of conversion.
  "this" should be a constant of type float, or double.

Returns:
the double value of this constant.

getConstSym

public Const getConstSym()
getConstSym
  If      boolean true  then return symRoot.intConst1
  else if boolean false then return symRoot.intConst0
  else if enumeration constant then return corresponding IntConst
  else return this.


evaluateAsObject

public java.lang.Object evaluateAsObject()
 Get the value of this constant symbol.
 This method is overrided as follows:
 class       returned value
 IntConst     Long
 FloatConst   Double
 StringConst  String
 Var          Initail value (ExpListExp, etc.) if qualified by const,
              else null.

Returns:
the constant value of appropriate type.