sqopcodes.h

00001 /*  see copyright notice in squirrel.h */
00002 #ifndef _SQOPCODES_H_
00003 #define _SQOPCODES_H_
00004 
00005 #define MAX_FUNC_STACKSIZE 0xFF
00006 #define MAX_LITERALS ((SQInteger)0x7FFFFFFF)
00007 
00008 enum BitWiseOP {
00009   BW_AND = 0,
00010   BW_OR = 2,
00011   BW_XOR = 3,
00012   BW_SHIFTL = 4,
00013   BW_SHIFTR = 5,
00014   BW_USHIFTR = 6
00015 };
00016 
00017 enum CmpOP {
00018   CMP_G = 0,
00019   CMP_GE = 2,
00020   CMP_L = 3,
00021   CMP_LE = 4
00022 };
00023 enum SQOpcode
00024 {
00025   _OP_LINE=       0x00,
00026   _OP_LOAD=       0x01,
00027   _OP_LOADINT=      0x02,
00028   _OP_LOADFLOAT=      0x03,
00029   _OP_DLOAD=        0x04,
00030   _OP_TAILCALL=     0x05,
00031   _OP_CALL=       0x06,
00032   _OP_PREPCALL=     0x07,
00033   _OP_PREPCALLK=      0x08,
00034   _OP_GETK=       0x09,
00035   _OP_MOVE=       0x0A,
00036   _OP_NEWSLOT=      0x0B,
00037   _OP_DELETE=       0x0C,
00038   _OP_SET=        0x0D,
00039   _OP_GET=        0x0E,
00040   _OP_EQ=         0x0F,
00041   _OP_NE=         0x10,
00042   _OP_ARITH=        0x11,
00043   _OP_BITW=       0x12,
00044   _OP_RETURN=       0x13,
00045   _OP_LOADNULLS=      0x14,
00046   _OP_LOADROOTTABLE=    0x15,
00047   _OP_LOADBOOL=     0x16,
00048   _OP_DMOVE=        0x17,
00049   _OP_JMP=        0x18,
00050   _OP_JNZ=        0x19,
00051   _OP_JZ=         0x1A,
00052   _OP_LOADFREEVAR=    0x1B,
00053   _OP_VARGC=        0x1C,
00054   _OP_GETVARGV=     0x1D,
00055   _OP_NEWTABLE=     0x1E,
00056   _OP_NEWARRAY=     0x1F,
00057   _OP_APPENDARRAY=    0x20,
00058   _OP_GETPARENT=      0x21,
00059   _OP_COMPARITH=      0x22,
00060   _OP_COMPARITHL=     0x23,
00061   _OP_INC=        0x24,
00062   _OP_INCL=       0x25,
00063   _OP_PINC=       0x26,
00064   _OP_PINCL=        0x27,
00065   _OP_CMP=        0x28,
00066   _OP_EXISTS=       0x29,
00067   _OP_INSTANCEOF=     0x2A,
00068   _OP_AND=        0x2B,
00069   _OP_OR=         0x2C,
00070   _OP_NEG=        0x2D,
00071   _OP_NOT=        0x2E,
00072   _OP_BWNOT=        0x2F,
00073   _OP_CLOSURE=      0x30,
00074   _OP_YIELD=        0x31,
00075   _OP_RESUME=       0x32,
00076   _OP_FOREACH=      0x33,
00077   _OP_POSTFOREACH=    0x34,
00078   _OP_DELEGATE=     0x35,
00079   _OP_CLONE=        0x36,
00080   _OP_TYPEOF=       0x37,
00081   _OP_PUSHTRAP=     0x38,
00082   _OP_POPTRAP=      0x39,
00083   _OP_THROW=        0x3A,
00084   _OP_CLASS=        0x3B,
00085   _OP_NEWSLOTA=     0x3C,
00086   _OP_SCOPE_END=    0x3D,
00087 };
00088 
00089 struct SQInstructionDesc {
00090   const SQChar *name;
00091 };
00092 
00093 struct SQInstruction
00094 {
00095   SQInstruction(){};
00096   SQInstruction(SQOpcode _op,SQInteger a0=0,SQInteger a1=0,SQInteger a2=0,SQInteger a3=0)
00097   { op = _op;
00098     _arg0 = (unsigned char)a0;_arg1 = (SQInt32)a1;
00099     _arg2 = (unsigned char)a2;_arg3 = (unsigned char)a3;
00100   }
00101 
00102 
00103   SQInt32 _arg1;
00104   unsigned char op;
00105   unsigned char _arg0;
00106   unsigned char _arg2;
00107   unsigned char _arg3;
00108 };
00109 
00110 #include "squtils.h"
00111 typedef sqvector<SQInstruction> SQInstructionVec;
00112 
00113 #define NEW_SLOT_ATTRIBUTES_FLAG  0x01
00114 #define NEW_SLOT_STATIC_FLAG    0x02
00115 
00116 #endif // _SQOPCODES_H_

Generated on Mon Mar 23 00:25:17 2009 for OpenTTD by  doxygen 1.5.6