coins.sym
Interface Var

All Superinterfaces:
Sym, Sym0
All Known Subinterfaces:
Elem, Param
All Known Implementing Classes:
ElemImpl, ParamImpl, VarImpl

public interface Var
extends Sym

Var interface Variable interface Var Variable Param Formal parameter Elem struct/union element Field Class field Deleted methods (##2) getType, setType, setSize, setDimension


Field Summary
static java.lang.String[] STORAGECLASS
           
static int VAR_AUTO
           
static int VAR_REGISTER
           
static int VAR_STATIC
           
 
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
 java.lang.Object evaluateAsObject()
          Available flags Sym.FLAG_SIZEOF_TAKEN Sym.FLAG_ADDRESS_TAKEN Sym.FLAG_POINTER_OPERATION Sym.FLAG_AREG_ALLOCATED Sym.FLAG_DERIVED_SYM Sym.FLAG_GENERATED_SYM
 int getDimension()
          getDimension Get the dimension of this variable.
 Exp getInitialValue()
          getInitialValue Get the expression of initial value for this variable.
 Var getNext()
          getNext Get the next variable having the same scope and the same kind.
 long getSize()
          getSize isSizeEvaluable Get the size of this variable in byte if it is evaluable.
 int getStorageClass()
          getStorageClass Get the storage class of the variable.
 int getVisibility()
          getVisibility Get the visibility attribute of the variable.
 boolean isSizeEvaluable()
           
 void setInitialValue(Exp pInitialValue)
          setInitialValue Set the expression of initial value for this variable.
 void setNext(Var pNext)
          setNext Set the variable specified by parameter as the one next to this symbol, and make the original next variable of this symbol as the one next to pNext (that is, insert pNext after this symbol).
 void setStorageClass(int pStorageClass)
          setStorageClass Set the storage class of the variable.
 void setVisibility(int pVisibility)
          setVisibility Set the visibility attribute of the variable.
 
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
 

Field Detail

VAR_STATIC

public static final int VAR_STATIC
See Also:
Constant Field Values

VAR_AUTO

public static final int VAR_AUTO
See Also:
Constant Field Values

VAR_REGISTER

public static final int VAR_REGISTER
See Also:
Constant Field Values

STORAGECLASS

public static final java.lang.String[] STORAGECLASS
Method Detail

getNext

public Var getNext()
getNext Get the next variable having the same scope and the same kind. The order of symbols is the same as the order of creation by defineUnique, define, redefine or setting by setNext. "this" should be a variable.

Returns:
the variable next to this one in the same scope and the same kind, e.g. the next local variable in the same construct, the next formal parameter of the same subprogram, the next element of the same structure, the next field of the same class, etc. return null if this is the last one in the same construct.

setNext

public void setNext(Var pNext)
setNext Set the variable specified by parameter as the one next to this symbol, and make the original next variable of this symbol as the one next to pNext (that is, insert pNext after this symbol). (Default ordering is the order of creation by DefineUnique, Define, Redefine.) "this" is a variable.

Parameters:
pNext - variable to be set as the next one. It should be defined in the same construct as this variable.

getSize

public long getSize()
getSize isSizeEvaluable Get the size of this variable in byte if it is evaluable. "this" may be any variable. getSize rerturn the size of the type of this variable if it is evaluable. If it is not evaluable, return 0. isSizeEvaluable return true if the size of the type of this variable is evaluable, false otherwise.


isSizeEvaluable

public boolean isSizeEvaluable()

getDimension

public int getDimension()
getDimension Get the dimension of this variable. "this" is a variable.

Returns:
the dimension of this variable if this is an array variable. 1: 1-dimensinal array, 2: 2-dimensional array, ,,, . If this is not array variable, return 0.

getInitialValue

public Exp getInitialValue()
getInitialValue Get the expression of initial value for this variable. "this" may be any variable that may have initial value. getInitialValue return initial value expression subtree if initial value is given, return null if no initial value is specified.


setInitialValue

public void setInitialValue(Exp pInitialValue)
setInitialValue Set the expression of initial value for this variable. "this" may be any variable that may have initial value.

Parameters:
pInitialValue - initial value expression subtree. setInitialValue Set initial value expression for this variable.

getStorageClass

public int getStorageClass()
getStorageClass Get the storage class of the variable. "this" may be any variable. getStorageClass; return the storage class of the variable (VAR_STATIC, VAR_AUTO, VAR_REGISTER)

Returns:
the storage class.

setStorageClass

public void setStorageClass(int pStorageClass)
setStorageClass Set the storage class of the variable. "this" may be any variable.

Parameters:
pStorageClass - storage class to be set to this variable (VAR_STATIC, VAR_AUTO, VAR_REGISTER)

getVisibility

public int getVisibility()
getVisibility Get the visibility attribute of the variable. (SYM_EXTERN, SYM_PUBLIC, SYM_PROTECTED, SYM_PRIVATE, SYM_COMPILE_UNIT)

Returns:
the visibility attribute.

setVisibility

public void setVisibility(int pVisibility)
setVisibility Set the visibility attribute of the variable. "this" may be any variable.

Parameters:
pVisibility - visibility attribute to be set to this variable (SYM_EXTERN, SYM_PUBLIC, SYM_PROTECTED, SYM_PRIVATE, SYM_COMPILE_UNIT)

evaluateAsObject

public java.lang.Object evaluateAsObject()
Available flags Sym.FLAG_SIZEOF_TAKEN Sym.FLAG_ADDRESS_TAKEN Sym.FLAG_POINTER_OPERATION Sym.FLAG_AREG_ALLOCATED Sym.FLAG_DERIVED_SYM Sym.FLAG_GENERATED_SYM