Revert "Update to SQUIRREL 3.0.4"
[supertux.git] / external / squirrel / squirrel / sqopcodes.h
1 /*      see copyright notice in squirrel.h */\r
2 #ifndef _SQOPCODES_H_\r
3 #define _SQOPCODES_H_\r
4 \r
5 #define MAX_FUNC_STACKSIZE 0xFF\r
6 #define MAX_LITERALS ((SQInteger)0x7FFFFFFF)\r
7 \r
8 enum BitWiseOP {\r
9         BW_AND = 0,\r
10         BW_OR = 2,      \r
11         BW_XOR = 3,\r
12         BW_SHIFTL = 4,\r
13         BW_SHIFTR = 5,\r
14         BW_USHIFTR = 6\r
15 };\r
16 \r
17 enum CmpOP {\r
18         CMP_G = 0,\r
19         CMP_GE = 2,     \r
20         CMP_L = 3,\r
21         CMP_LE = 4\r
22 };\r
23 enum SQOpcode\r
24 {\r
25         _OP_LINE=                               0x00,   \r
26         _OP_LOAD=                               0x01,\r
27         _OP_LOADINT=                    0x02,\r
28         _OP_LOADFLOAT=                  0x03,\r
29         _OP_DLOAD=                              0x04,\r
30         _OP_TAILCALL=                   0x05,   \r
31         _OP_CALL=                               0x06,   \r
32         _OP_PREPCALL=                   0x07,   \r
33         _OP_PREPCALLK=                  0x08,   \r
34         _OP_GETK=                               0x09,   \r
35         _OP_MOVE=                               0x0A,   \r
36         _OP_NEWSLOT=                    0x0B,   \r
37         _OP_DELETE=                             0x0C,   \r
38         _OP_SET=                                0x0D,   \r
39         _OP_GET=                                0x0E,\r
40         _OP_EQ=                                 0x0F,\r
41         _OP_NE=                                 0x10,\r
42         _OP_ARITH=                              0x11,\r
43         _OP_BITW=                               0x12,\r
44         _OP_RETURN=                             0x13,   \r
45         _OP_LOADNULLS=                  0x14,   \r
46         _OP_LOADROOTTABLE=              0x15,\r
47         _OP_LOADBOOL=                   0x16,\r
48         _OP_DMOVE=                              0x17,   \r
49         _OP_JMP=                                0x18,   \r
50         _OP_JNZ=                                0x19,   \r
51         _OP_JZ=                                 0x1A,   \r
52         _OP_LOADFREEVAR=                0x1B,   \r
53         _OP_VARGC=                              0x1C,   \r
54         _OP_GETVARGV=                   0x1D,   \r
55         _OP_NEWTABLE=                   0x1E,   \r
56         _OP_NEWARRAY=                   0x1F,   \r
57         _OP_APPENDARRAY=                0x20,   \r
58         _OP_GETPARENT=                  0x21,   \r
59         _OP_COMPARITH=                  0x22,   \r
60         _OP_COMPARITHL=                 0x23,   \r
61         _OP_INC=                                0x24,   \r
62         _OP_INCL=                               0x25,   \r
63         _OP_PINC=                               0x26,   \r
64         _OP_PINCL=                              0x27,   \r
65         _OP_CMP=                                0x28,\r
66         _OP_EXISTS=                             0x29,   \r
67         _OP_INSTANCEOF=                 0x2A,\r
68         _OP_AND=                                0x2B,\r
69         _OP_OR=                                 0x2C,\r
70         _OP_NEG=                                0x2D,\r
71         _OP_NOT=                                0x2E,\r
72         _OP_BWNOT=                              0x2F,   \r
73         _OP_CLOSURE=                    0x30,   \r
74         _OP_YIELD=                              0x31,   \r
75         _OP_RESUME=                             0x32,\r
76         _OP_FOREACH=                    0x33,\r
77         _OP_POSTFOREACH=                0x34,\r
78         _OP_DELEGATE=                   0x35,\r
79         _OP_CLONE=                              0x36,\r
80         _OP_TYPEOF=                             0x37,\r
81         _OP_PUSHTRAP=                   0x38,\r
82         _OP_POPTRAP=                    0x39,\r
83         _OP_THROW=                              0x3A,\r
84         _OP_CLASS=                              0x3B,\r
85         _OP_NEWSLOTA=                   0x3C,\r
86 };                                                        \r
87 \r
88 struct SQInstructionDesc {        \r
89         const SQChar *name;               \r
90 };                                                        \r
91 \r
92 struct SQInstruction \r
93 {\r
94         SQInstruction(){};\r
95         SQInstruction(SQOpcode _op,SQInteger a0=0,SQInteger a1=0,SQInteger a2=0,SQInteger a3=0)\r
96         {       op = _op;\r
97                 _arg0 = (unsigned char)a0;_arg1 = (SQInt32)a1;\r
98                 _arg2 = (unsigned char)a2;_arg3 = (unsigned char)a3;\r
99         }\r
100     \r
101         \r
102         SQInt32 _arg1;\r
103         unsigned char op;\r
104         unsigned char _arg0;\r
105         unsigned char _arg2;\r
106         unsigned char _arg3;\r
107 };\r
108 \r
109 #include "squtils.h"\r
110 typedef sqvector<SQInstruction> SQInstructionVec;\r
111 \r
112 #define NEW_SLOT_ATTRIBUTES_FLAG        0x01\r
113 #define NEW_SLOT_STATIC_FLAG            0x02\r
114 \r
115 #endif // _SQOPCODES_H_\r