graph3d
Class CodeGenerator

java.lang.Object
  |
  +--graph3d.CodeGenerator
All Implemented Interfaces:
mathc.CodeGenerator

public class CodeGenerator
extends java.lang.Object
implements mathc.CodeGenerator


Inner Class Summary
static class CodeGenerator.DataSizeExceededException
          Thrown, if the data buffer size required by this code generator exceeds the jgraph stack machine data buffer size.
 
Inner classes inherited from class mathc.CodeGenerator
mathc.CodeGenerator.Exception
 
Method Summary
 void acos()
          ACOS (trigonometrical acosine function) opcode.
 void and()
          AND (logical and) opcode.
 void asin()
          ASIN (trigonometrical asine function) opcode.
 void atan()
          ATAN (trigonometrical atan function) opcode.
 void b2i()
          B2J (convert bool to int) opcode.
 int beginFunction(java.lang.String name, mathc.FunctionDefinition function)
          The method creates a new function.
 void beq()
          BEQ (boolean equality) opcode.
 void bne()
          BNE (boolean not equal) opcode.
 void bret()
          BRET (return boolean) opcode.
 void call(mathc.FunctionDescriptor proto)
          CALL (call function) opcode.
 void cos()
          COS (trigonometrical cosine function) opcode.
 void dup()
          DUP (duplicate item on stack top) opcode.
 void dup2()
          DUP2 (duplicate item on stack top) opcode.
 int endFunction()
          The method indicates the end of a function definition.
 void exch_11()
          EXCH (exchange 2 1-cell items on opstack top) opcode.
 void exch_12()
          EXCH (exchange 1-cell and 2-cell item on opstack top) opcode.
 void exch_21()
          EXCH (exchange 2-cell and 1-cell item on opstack top) opcode.
 void exch_22()
          EXCH (exchange 2 2-cell items on opstack top) opcode.
 void f2i()
          F2I (convert float to int) opcode.
 void fadd()
          FADD (float add) opcode.
 void fdiv()
          FDIV (float divide) opcode.
 void feq()
          FEQ (float equality) opcode.
 void fge()
          FGE (float greater or equals) opcode.
 void fgt()
          FGT (float greater than) opcode.
 void fle()
          FLE (float less or equals) opcode.
 void flt()
          FLT (float less than) opcode.
 void flush()
          Flushes the internal function list.
 void fmul()
          FMUL (float multiply) opcode.
 void fne()
          FNE (float inequality) opcode.
 void fneg()
          FNEG (float negate) opcode.
 void fpow()
          FPOW (float power) opcode.
 void fret()
          FRET (return float) opcode.
 void fsub()
          FSUB (float subtract) opcode.
 java.util.Vector getFunctions()
          Returns a vector of functions registered by the generator.
static CodeGenerator getInstance()
           
 void i2b()
          I2B (convert int to bool) opcode.
 void i2f()
          I2F (convert int to float) opcode.
 void iadd()
          IADD (integer add) opcode.
 void idiv()
          IDIV (integer divide) opcode.
 void ieq()
          IEQ (integer equality) opcode.
 void ige()
          IGE (integer greater or equals) opcode.
 void igt()
          IGT (integer greater than) opcode.
 void ile()
          ILE (integer less or equals) opcode.
 void ilt()
          ILT (integer less than) opcode.
 void imod()
          IMOD (modulo) opcode.
 void imul()
          IMUL (integer multiply) opcode.
 void ine()
          INE (integer not equal) opcode.
 void ineg()
          INEG (integer negate) opcode.
 void ipow()
          IPOW (integer power) opcode.
 void iret()
          IRET (return integer) opcode.
 void isub()
          ISUB (integer subtract) opcode.
 void j(int hlabel)
          J (uncoditional jump) opcode.
 void jf(int hlabel)
          J (jump if false) opcode.
 void jt(int hlabel)
          J (jump if true) opcode.
 int newLabel()
          The method returns a handle to a new label.
 void not()
          NOT (logical negate) opcode.
 void or()
          OR (logical or) opcode.
 void pop()
          POP opcode.
 void pop2()
          POP2 opcode.
 void pushf()
          PUSHF (push false) opcode.
 void pushfc(double value)
          PUSHFC (push float constant) opcode.
 void pushfl(int hlocal)
          PUSHFL (push float local var) opcode.
 void pushic(int value)
          PUSHIC (push int constant) opcode.
 void pushil(int hlocal)
          PUSHIL (push int local var) opcode.
 void pusht()
          PUSHT (push true) opcode.
 void pushxc(int hconst)
          PUSHXC (push executable) opcode.
 void pushxl(int hlocal)
          PUSHXL (push function local var) opcode.
 void setLabel(int hlabel)
          Sets a label.
 void sin()
          SIN (trignometrical sine function) opcode.
 void stbl(int hlocal)
          STBL (store boolean local var) opcode.
 void stfl(int hlocal)
          STFL (store float local var) opcode.
 void stil(int hlocal)
          STIL (store int local var) opcode.
 void stxl(int hlocal)
          STXL (store function local var) opcode.
 void tan()
          TAN (trigonometrical tan function) opcode.
 void xeq()
          XEQ (function equality) opcode.
 void xne()
          XNE (function not equal) opcode.
 void xor()
          XOR (logical exclusive or) opcode.
 void xret()
          XRET (return function) opcode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static CodeGenerator getInstance()
Returns:
the CodeGenerator instance

flush

public void flush()
Flushes the internal function list.

getFunctions

public java.util.Vector getFunctions()
Returns a vector of functions registered by the generator.
Returns:
a vector containing all functions known by the code generator

beginFunction

public int beginFunction(java.lang.String name,
                         mathc.FunctionDefinition function)
The method creates a new function. It returns a handle to this function.
Specified by:
beginFunction in interface mathc.CodeGenerator
Parameters:
name - the function's name
proto - the function's prototype
Returns:
a handle to the function

endFunction

public int endFunction()
                throws mathc.CodeGenerator.Exception
The method indicates the end of a function definition. Here, the code generator actually will create the function's code.
Specified by:
endFunction in interface mathc.CodeGenerator

newLabel

public int newLabel()
The method returns a handle to a new label.
Specified by:
newLabel in interface mathc.CodeGenerator

setLabel

public void setLabel(int hlabel)
Sets a label.
Specified by:
setLabel in interface mathc.CodeGenerator
Parameters:
hlabel - a label handle

pushfc

public void pushfc(double value)
            throws mathc.CodeGenerator.Exception
PUSHFC (push float constant) opcode.
Specified by:
pushfc in interface mathc.CodeGenerator
Parameters:
value - a float constant

pushic

public void pushic(int value)
            throws mathc.CodeGenerator.Exception
PUSHIC (push int constant) opcode.
Specified by:
pushic in interface mathc.CodeGenerator
Parameters:
value - an int value

pushxc

public void pushxc(int hconst)
            throws mathc.CodeGenerator.Exception
PUSHXC (push executable) opcode.
Specified by:
pushxc in interface mathc.CodeGenerator
Parameters:
hconst - a function handle

pushfl

public void pushfl(int hlocal)
            throws mathc.CodeGenerator.Exception
PUSHFL (push float local var) opcode.
Specified by:
pushfl in interface mathc.CodeGenerator
Parameters:
hlocal - a float local var address

pushil

public void pushil(int hlocal)
            throws mathc.CodeGenerator.Exception
PUSHIL (push int local var) opcode.
Specified by:
pushil in interface mathc.CodeGenerator
Parameters:
hlocal - an int local var address

pushxl

public void pushxl(int hlocal)
            throws mathc.CodeGenerator.Exception
PUSHXL (push function local var) opcode.
Specified by:
pushxl in interface mathc.CodeGenerator
Parameters:
hlocal - a function local var address

pusht

public void pusht()
           throws mathc.CodeGenerator.Exception
PUSHT (push true) opcode.
Specified by:
pusht in interface mathc.CodeGenerator

pushf

public void pushf()
           throws mathc.CodeGenerator.Exception
PUSHF (push false) opcode.
Specified by:
pushf in interface mathc.CodeGenerator

stbl

public void stbl(int hlocal)
          throws mathc.CodeGenerator.Exception
STBL (store boolean local var) opcode.
Specified by:
stbl in interface mathc.CodeGenerator
Parameters:
hlocal - a boolean local var address

stfl

public void stfl(int hlocal)
          throws mathc.CodeGenerator.Exception
STFL (store float local var) opcode.
Specified by:
stfl in interface mathc.CodeGenerator
Parameters:
hlocal - a float local var address

stil

public void stil(int hlocal)
          throws mathc.CodeGenerator.Exception
STIL (store int local var) opcode.
Specified by:
stil in interface mathc.CodeGenerator
Parameters:
hlocal - an int local var address

stxl

public void stxl(int hlocal)
          throws mathc.CodeGenerator.Exception
STXL (store function local var) opcode.
Specified by:
stxl in interface mathc.CodeGenerator
Parameters:
hlocal - a function local var address

pop

public void pop()
         throws mathc.CodeGenerator.Exception
POP opcode.
Specified by:
pop in interface mathc.CodeGenerator

pop2

public void pop2()
          throws mathc.CodeGenerator.Exception
POP2 opcode.
Specified by:
pop2 in interface mathc.CodeGenerator

dup

public void dup()
         throws mathc.CodeGenerator.Exception
DUP (duplicate item on stack top) opcode.
Specified by:
dup in interface mathc.CodeGenerator

dup2

public void dup2()
          throws mathc.CodeGenerator.Exception
DUP2 (duplicate item on stack top) opcode.
Specified by:
dup2 in interface mathc.CodeGenerator

exch_11

public void exch_11()
             throws mathc.CodeGenerator.Exception
EXCH (exchange 2 1-cell items on opstack top) opcode.
Specified by:
exch_11 in interface mathc.CodeGenerator

exch_22

public void exch_22()
             throws mathc.CodeGenerator.Exception
EXCH (exchange 2 2-cell items on opstack top) opcode.
Specified by:
exch_22 in interface mathc.CodeGenerator

exch_12

public void exch_12()
             throws mathc.CodeGenerator.Exception
EXCH (exchange 1-cell and 2-cell item on opstack top) opcode.
Specified by:
exch_12 in interface mathc.CodeGenerator

exch_21

public void exch_21()
             throws mathc.CodeGenerator.Exception
EXCH (exchange 2-cell and 1-cell item on opstack top) opcode.
Specified by:
exch_21 in interface mathc.CodeGenerator

call

public void call(mathc.FunctionDescriptor proto)
          throws mathc.CodeGenerator.Exception
CALL (call function) opcode.
Specified by:
call in interface mathc.CodeGenerator

bret

public void bret()
          throws mathc.CodeGenerator.Exception
BRET (return boolean) opcode.
Specified by:
bret in interface mathc.CodeGenerator

fret

public void fret()
          throws mathc.CodeGenerator.Exception
FRET (return float) opcode.
Specified by:
fret in interface mathc.CodeGenerator

iret

public void iret()
          throws mathc.CodeGenerator.Exception
IRET (return integer) opcode.
Specified by:
iret in interface mathc.CodeGenerator

xret

public void xret()
          throws mathc.CodeGenerator.Exception
XRET (return function) opcode.
Specified by:
xret in interface mathc.CodeGenerator

j

public void j(int hlabel)
       throws mathc.CodeGenerator.Exception
J (uncoditional jump) opcode.
Specified by:
j in interface mathc.CodeGenerator
Parameters:
hlabel - a handle to the jump target label

jt

public void jt(int hlabel)
        throws mathc.CodeGenerator.Exception
J (jump if true) opcode.
Specified by:
jt in interface mathc.CodeGenerator
Parameters:
hlabel - a handle to the jump target label

jf

public void jf(int hlabel)
        throws mathc.CodeGenerator.Exception
J (jump if false) opcode.
Specified by:
jf in interface mathc.CodeGenerator
Parameters:
hlabel - a handle to the jump target label

b2i

public void b2i()
         throws mathc.CodeGenerator.Exception
B2J (convert bool to int) opcode.
Specified by:
b2i in interface mathc.CodeGenerator

f2i

public void f2i()
         throws mathc.CodeGenerator.Exception
F2I (convert float to int) opcode.
Specified by:
f2i in interface mathc.CodeGenerator

i2b

public void i2b()
         throws mathc.CodeGenerator.Exception
I2B (convert int to bool) opcode.
Specified by:
i2b in interface mathc.CodeGenerator

i2f

public void i2f()
         throws mathc.CodeGenerator.Exception
I2F (convert int to float) opcode.
Specified by:
i2f in interface mathc.CodeGenerator

beq

public void beq()
         throws mathc.CodeGenerator.Exception
BEQ (boolean equality) opcode.
Specified by:
beq in interface mathc.CodeGenerator

bne

public void bne()
         throws mathc.CodeGenerator.Exception
BNE (boolean not equal) opcode.
Specified by:
bne in interface mathc.CodeGenerator

fadd

public void fadd()
          throws mathc.CodeGenerator.Exception
FADD (float add) opcode.
Specified by:
fadd in interface mathc.CodeGenerator

fsub

public void fsub()
          throws mathc.CodeGenerator.Exception
FSUB (float subtract) opcode.
Specified by:
fsub in interface mathc.CodeGenerator

fmul

public void fmul()
          throws mathc.CodeGenerator.Exception
FMUL (float multiply) opcode.
Specified by:
fmul in interface mathc.CodeGenerator

fdiv

public void fdiv()
          throws mathc.CodeGenerator.Exception
FDIV (float divide) opcode.
Specified by:
fdiv in interface mathc.CodeGenerator

fpow

public void fpow()
          throws mathc.CodeGenerator.Exception
FPOW (float power) opcode.
Specified by:
fpow in interface mathc.CodeGenerator

fneg

public void fneg()
          throws mathc.CodeGenerator.Exception
FNEG (float negate) opcode.
Specified by:
fneg in interface mathc.CodeGenerator

fgt

public void fgt()
         throws mathc.CodeGenerator.Exception
FGT (float greater than) opcode.
Specified by:
fgt in interface mathc.CodeGenerator

fge

public void fge()
         throws mathc.CodeGenerator.Exception
FGE (float greater or equals) opcode.
Specified by:
fge in interface mathc.CodeGenerator

flt

public void flt()
         throws mathc.CodeGenerator.Exception
FLT (float less than) opcode.
Specified by:
flt in interface mathc.CodeGenerator

fle

public void fle()
         throws mathc.CodeGenerator.Exception
FLE (float less or equals) opcode.
Specified by:
fle in interface mathc.CodeGenerator

feq

public void feq()
         throws mathc.CodeGenerator.Exception
FEQ (float equality) opcode.
Specified by:
feq in interface mathc.CodeGenerator

fne

public void fne()
         throws mathc.CodeGenerator.Exception
FNE (float inequality) opcode.
Specified by:
fne in interface mathc.CodeGenerator

iadd

public void iadd()
          throws mathc.CodeGenerator.Exception
IADD (integer add) opcode.
Specified by:
iadd in interface mathc.CodeGenerator

isub

public void isub()
          throws mathc.CodeGenerator.Exception
ISUB (integer subtract) opcode.
Specified by:
isub in interface mathc.CodeGenerator

imul

public void imul()
          throws mathc.CodeGenerator.Exception
IMUL (integer multiply) opcode.
Specified by:
imul in interface mathc.CodeGenerator

idiv

public void idiv()
          throws mathc.CodeGenerator.Exception
IDIV (integer divide) opcode.
Specified by:
idiv in interface mathc.CodeGenerator

imod

public void imod()
          throws mathc.CodeGenerator.Exception
IMOD (modulo) opcode.
Specified by:
imod in interface mathc.CodeGenerator

ipow

public void ipow()
          throws mathc.CodeGenerator.Exception
IPOW (integer power) opcode.
Specified by:
ipow in interface mathc.CodeGenerator

ineg

public void ineg()
          throws mathc.CodeGenerator.Exception
INEG (integer negate) opcode.
Specified by:
ineg in interface mathc.CodeGenerator

igt

public void igt()
         throws mathc.CodeGenerator.Exception
IGT (integer greater than) opcode.
Specified by:
igt in interface mathc.CodeGenerator

ige

public void ige()
         throws mathc.CodeGenerator.Exception
IGE (integer greater or equals) opcode.
Specified by:
ige in interface mathc.CodeGenerator

ilt

public void ilt()
         throws mathc.CodeGenerator.Exception
ILT (integer less than) opcode.
Specified by:
ilt in interface mathc.CodeGenerator

ile

public void ile()
         throws mathc.CodeGenerator.Exception
ILE (integer less or equals) opcode.
Specified by:
ile in interface mathc.CodeGenerator

ieq

public void ieq()
         throws mathc.CodeGenerator.Exception
IEQ (integer equality) opcode.
Specified by:
ieq in interface mathc.CodeGenerator

ine

public void ine()
         throws mathc.CodeGenerator.Exception
INE (integer not equal) opcode.
Specified by:
ine in interface mathc.CodeGenerator

xeq

public void xeq()
         throws mathc.CodeGenerator.Exception
XEQ (function equality) opcode.
Specified by:
xeq in interface mathc.CodeGenerator

xne

public void xne()
         throws mathc.CodeGenerator.Exception
XNE (function not equal) opcode.
Specified by:
xne in interface mathc.CodeGenerator

and

public void and()
         throws mathc.CodeGenerator.Exception
AND (logical and) opcode.
Specified by:
and in interface mathc.CodeGenerator

or

public void or()
        throws mathc.CodeGenerator.Exception
OR (logical or) opcode.
Specified by:
or in interface mathc.CodeGenerator

xor

public void xor()
         throws mathc.CodeGenerator.Exception
XOR (logical exclusive or) opcode.
Specified by:
xor in interface mathc.CodeGenerator

not

public void not()
         throws mathc.CodeGenerator.Exception
NOT (logical negate) opcode.
Specified by:
not in interface mathc.CodeGenerator

sin

public void sin()
         throws mathc.CodeGenerator.Exception
SIN (trignometrical sine function) opcode.
Specified by:
sin in interface mathc.CodeGenerator

cos

public void cos()
         throws mathc.CodeGenerator.Exception
COS (trigonometrical cosine function) opcode.
Specified by:
cos in interface mathc.CodeGenerator

tan

public void tan()
         throws mathc.CodeGenerator.Exception
TAN (trigonometrical tan function) opcode.
Specified by:
tan in interface mathc.CodeGenerator

asin

public void asin()
          throws mathc.CodeGenerator.Exception
ASIN (trigonometrical asine function) opcode.
Specified by:
asin in interface mathc.CodeGenerator

acos

public void acos()
          throws mathc.CodeGenerator.Exception
ACOS (trigonometrical acosine function) opcode.
Specified by:
acos in interface mathc.CodeGenerator

atan

public void atan()
          throws mathc.CodeGenerator.Exception
ATAN (trigonometrical atan function) opcode.
Specified by:
atan in interface mathc.CodeGenerator