frysk.value
Class Type

java.lang.Object
  extended by frysk.value.Type
Direct Known Subclasses:
ArithmeticType, ArrayType, CompositeType, ConstType, FunctionType, PackedType, ReferenceType, RestrictType, SharedType, TypeDef, UnknownType, VoidType, VolatileType

public abstract class Type
extends Object

Holds the type of a Value and also defines possible operations. Classes extended from this type will have to define the individual operation that are defined on those types. e.g. addition operation may be defined for the integer type.


Method Summary
 Value addressOf(Value var1, ByteOrder order, int wordSize)
          Evaluates the address of a variable.
 boolean completeFollowSym(String incomplete, List candidates)
          Complete the type's next token; return false if nothing completed.
 boolean completeMember(String incomplete, List candidates)
          Complete the type's member; return false if nothing completed.
 Value dereference(Value var1, ByteBuffer taskMem)
          Implements dereference operation for a pointer type.
 ArithmeticUnit getALU(ArrayType type, int wordSize)
           
 ArithmeticUnit getALU(FloatingPointType type, int wordSize)
           
 ArithmeticUnit getALU(int wordSize)
           
 ArithmeticUnit getALU(IntegerType type, int wordSize)
           
 ArithmeticUnit getALU(PointerType type, int wordSize)
           
 ArithmeticUnit getALU(Type type, int wordSize)
           
 String getName()
           
 int getSize()
           
 Type getSliceType()
          Get the type of slice.
 Type getType()
          Return the element type for array or pointer type.
 Type getUltimateType()
          Return the ultimate type (ignoring any decorator and other attributes).
 Value index(Value var1, Value var2, ByteBuffer taskMem)
          Implements subscript operation for a pointer or array type.
 Value member(Value var1, String member)
          Implements dot operation on a composite type.
 Type pack(int bitSize, int bitOffset)
          Pack this TYPE into bigSize and bitOffset.
 Value slice(Value var, Value i, Value j, ByteBuffer taskMem)
          Implements slice operation for a pointer or array type - slice the array from index I to index J.
 String toPrint()
          Print this Type to a StringBuffer and return the String.
abstract  void toPrint(StringBuilder stringBuilder, int indent)
          Print this Type after indenting INDENT spaces.
 void toPrintBrief(StringBuilder stringBuilder, int indent)
          Print this Type, possibly briefly, after indenting INDENT spaces.
 String toString()
          For debugging and tracing; just dump the Type's name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getSize

public int getSize()

getName

public String getName()

getUltimateType

public Type getUltimateType()
Return the ultimate type (ignoring any decorator and other attributes).


toString

public String toString()
For debugging and tracing; just dump the Type's name.

Overrides:
toString in class Object

toPrint

public abstract void toPrint(StringBuilder stringBuilder,
                             int indent)
Print this Type after indenting INDENT spaces.

Parameters:
stringBuilder - TODO

toPrintBrief

public void toPrintBrief(StringBuilder stringBuilder,
                         int indent)
Print this Type, possibly briefly, after indenting INDENT spaces.

Parameters:
stringBuilder - TODO

toPrint

public final String toPrint()
Print this Type to a StringBuffer and return the String.


getALU

public ArithmeticUnit getALU(Type type,
                             int wordSize)

getALU

public ArithmeticUnit getALU(IntegerType type,
                             int wordSize)

getALU

public ArithmeticUnit getALU(FloatingPointType type,
                             int wordSize)

getALU

public ArithmeticUnit getALU(PointerType type,
                             int wordSize)

getALU

public ArithmeticUnit getALU(ArrayType type,
                             int wordSize)

getALU

public ArithmeticUnit getALU(int wordSize)

addressOf

public Value addressOf(Value var1,
                       ByteOrder order,
                       int wordSize)
Evaluates the address of a variable.


dereference

public Value dereference(Value var1,
                         ByteBuffer taskMem)
Implements dereference operation for a pointer type.


member

public Value member(Value var1,
                    String member)
Implements dot operation on a composite type.


index

public Value index(Value var1,
                   Value var2,
                   ByteBuffer taskMem)
Implements subscript operation for a pointer or array type.


slice

public Value slice(Value var,
                   Value i,
                   Value j,
                   ByteBuffer taskMem)
Implements slice operation for a pointer or array type - slice the array from index I to index J.


getSliceType

public Type getSliceType()
Get the type of slice.


getType

public Type getType()
Return the element type for array or pointer type.


pack

public Type pack(int bitSize,
                 int bitOffset)
Pack this TYPE into bigSize and bitOffset.


completeMember

public boolean completeMember(String incomplete,
                              List candidates)
Complete the type's member; return false if nothing completed.


completeFollowSym

public boolean completeFollowSym(String incomplete,
                                 List candidates)
Complete the type's next token; return false if nothing completed.