this shouldn't be in svn
[supertux.git] / src / squirrel / squirrel / sqopcodes.h
index 81abae0..2d0ffa6 100644 (file)
@@ -3,7 +3,7 @@
 #define _SQOPCODES_H_\r
 \r
 #define MAX_FUNC_STACKSIZE 0xFF\r
-#define MAX_LITERALS 0xFFFFFFFF\r
+#define MAX_LITERALS ((SQInteger)0x7FFFFFFF)\r
 \r
 enum BitWiseOP {\r
        BW_AND = 0,\r
@@ -23,63 +23,66 @@ enum CmpOP {
 enum SQOpcode\r
 {\r
        _OP_LINE=                               0x00,   \r
-       _OP_LOAD=                               0x01,   \r
-       _OP_TAILCALL=                   0x02,   \r
-       _OP_CALL=                               0x03,   \r
-       _OP_PREPCALL=                   0x04,   \r
-       _OP_PREPCALLK=                  0x05,   \r
-       _OP_GETK=                               0x06,   \r
-       _OP_MOVE=                               0x07,   \r
-       _OP_NEWSLOT=                    0x08,   \r
-       _OP_DELETE=                             0x09,   \r
-       _OP_SET=                                0x0A,   \r
-       _OP_GET=                                0x0B,\r
-       _OP_EQ=                                 0x0C,\r
-       _OP_NE=                                 0x0D,\r
-       _OP_ARITH=                              0x0E,\r
-       _OP_BITW=                               0x0F,\r
-       _OP_RETURN=                             0x10,   \r
-       _OP_LOADNULLS=                  0x11,   \r
-       _OP_LOADROOTTABLE=              0x12,   \r
-       _OP_DMOVE=                              0x13,   \r
-       _OP_JMP=                                0x14,   \r
-       _OP_JNZ=                                0x15,   \r
-       _OP_JZ=                                 0x16,   \r
-       _OP_LOADFREEVAR=                0x17,   \r
-       _OP_VARGC=                              0x18,   \r
-       _OP_GETVARGV=                   0x19,   \r
-       _OP_NEWTABLE=                   0x1A,   \r
-       _OP_NEWARRAY=                   0x1B,   \r
-       _OP_APPENDARRAY=                0x1C,   \r
-       _OP_GETPARENT=                  0x1D,   \r
-       _OP_COMPARITH=                  0x1E,   \r
-       _OP_COMPARITHL=                 0x1F,   \r
-       _OP_INC=                                0x20,   \r
-       _OP_INCL=                               0x21,   \r
-       _OP_PINC=                               0x22,   \r
-       _OP_PINCL=                              0x23,   \r
-       _OP_CMP=                                0x24,\r
-       _OP_EXISTS=                             0x25,   \r
-       _OP_INSTANCEOF=                 0x26,\r
-       _OP_AND=                                0x27,\r
-       _OP_OR=                                 0x28,\r
-       _OP_NEG=                                0x29,\r
-       _OP_NOT=                                0x2A,\r
-       _OP_BWNOT=                              0x2B,   \r
-       _OP_CLOSURE=                    0x2C,   \r
-       _OP_YIELD=                              0x2D,   \r
-       _OP_RESUME=                             0x2E,\r
-       _OP_FOREACH=                    0x2F,\r
-       _OP_DELEGATE=                   0x30,\r
-       _OP_CLONE=                              0x31,\r
-       _OP_TYPEOF=                             0x32,\r
-       _OP_PUSHTRAP=                   0x33,\r
-       _OP_POPTRAP=                    0x34,\r
-       _OP_THROW=                              0x35,\r
-       _OP_CLASS=                              0x36,\r
-       _OP_NEWSLOTA=                   0x37,\r
-       _OP_LOADBOOL=                   0x38\r
+       _OP_LOAD=                               0x01,\r
+       _OP_LOADINT=                    0x02,\r
+       _OP_DLOAD=                              0x03,\r
+       _OP_TAILCALL=                   0x04,   \r
+       _OP_CALL=                               0x05,   \r
+       _OP_PREPCALL=                   0x06,   \r
+       _OP_PREPCALLK=                  0x07,   \r
+       _OP_GETK=                               0x08,   \r
+       _OP_MOVE=                               0x09,   \r
+       _OP_NEWSLOT=                    0x0A,   \r
+       _OP_DELETE=                             0x0B,   \r
+       _OP_SET=                                0x0C,   \r
+       _OP_GET=                                0x0D,\r
+       _OP_EQ=                                 0x0E,\r
+       _OP_NE=                                 0x0F,\r
+       _OP_ARITH=                              0x10,\r
+       _OP_BITW=                               0x11,\r
+       _OP_RETURN=                             0x12,   \r
+       _OP_LOADNULLS=                  0x13,   \r
+       _OP_LOADROOTTABLE=              0x14,\r
+       _OP_LOADBOOL=                   0x15,\r
+       _OP_DMOVE=                              0x16,   \r
+       _OP_JMP=                                0x17,   \r
+       _OP_JNZ=                                0x18,   \r
+       _OP_JZ=                                 0x19,   \r
+       _OP_LOADFREEVAR=                0x1A,   \r
+       _OP_VARGC=                              0x1B,   \r
+       _OP_GETVARGV=                   0x1C,   \r
+       _OP_NEWTABLE=                   0x1D,   \r
+       _OP_NEWARRAY=                   0x1E,   \r
+       _OP_APPENDARRAY=                0x1F,   \r
+       _OP_GETPARENT=                  0x20,   \r
+       _OP_COMPARITH=                  0x21,   \r
+       _OP_COMPARITHL=                 0x22,   \r
+       _OP_INC=                                0x23,   \r
+       _OP_INCL=                               0x24,   \r
+       _OP_PINC=                               0x25,   \r
+       _OP_PINCL=                              0x26,   \r
+       _OP_CMP=                                0x27,\r
+       _OP_EXISTS=                             0x28,   \r
+       _OP_INSTANCEOF=                 0x29,\r
+       _OP_AND=                                0x2A,\r
+       _OP_OR=                                 0x2B,\r
+       _OP_NEG=                                0x2C,\r
+       _OP_NOT=                                0x2D,\r
+       _OP_BWNOT=                              0x2E,   \r
+       _OP_CLOSURE=                    0x2F,   \r
+       _OP_YIELD=                              0x30,   \r
+       _OP_RESUME=                             0x31,\r
+       _OP_FOREACH=                    0x32,\r
+       _OP_DELEGATE=                   0x33,\r
+       _OP_CLONE=                              0x34,\r
+       _OP_TYPEOF=                             0x35,\r
+       _OP_PUSHTRAP=                   0x36,\r
+       _OP_POPTRAP=                    0x37,\r
+       _OP_THROW=                              0x38,\r
+       _OP_CLASS=                              0x39,\r
+       _OP_NEWSLOTA=                   0x3A\r
 };                                                       \r
+\r
 struct SQInstructionDesc {       \r
        const SQChar *name;               \r
 };                                                       \r
@@ -87,14 +90,14 @@ struct SQInstructionDesc {
 struct SQInstruction \r
 {\r
        SQInstruction(){};\r
-       SQInstruction(SQOpcode _op,int a0=0,int a1=0,int a2=0,int a3=0)\r
+       SQInstruction(SQOpcode _op,SQInteger a0=0,SQInteger a1=0,SQInteger a2=0,SQInteger a3=0)\r
        {       op = _op;\r
-               _arg0 = a0;_arg1 = a1;\r
-               _arg2 = a2;_arg3 = a3;\r
+               _arg0 = (unsigned char)a0;_arg1 = (SQInt32)a1;\r
+               _arg2 = (unsigned char)a2;_arg3 = (unsigned char)a3;\r
        }\r
     \r
        \r
-       unsigned int _arg1;\r
+       SQInt32 _arg1;\r
        unsigned char op;\r
        unsigned char _arg0;\r
        unsigned char _arg2;\r
@@ -104,4 +107,7 @@ struct SQInstruction
 #include "squtils.h"\r
 typedef sqvector<SQInstruction> SQInstructionVec;\r
 \r
+#define NEW_SLOT_ATTRIBUTES_FLAG       0x01\r
+#define NEW_SLOT_STATIC_FLAG           0x02\r
+\r
 #endif // _SQOPCODES_H_\r