81abae0dd89a95b888a5fced79024f37acb4dbcc
[supertux.git] / src / 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 0xFFFFFFFF\r
7 \r
8 enum BitWiseOP {\r
9         BW_AND = 0,\r
10         BW_OR = 2,      //like ADD\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,     //like ADD\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_TAILCALL=                   0x02,   \r
28         _OP_CALL=                               0x03,   \r
29         _OP_PREPCALL=                   0x04,   \r
30         _OP_PREPCALLK=                  0x05,   \r
31         _OP_GETK=                               0x06,   \r
32         _OP_MOVE=                               0x07,   \r
33         _OP_NEWSLOT=                    0x08,   \r
34         _OP_DELETE=                             0x09,   \r
35         _OP_SET=                                0x0A,   \r
36         _OP_GET=                                0x0B,\r
37         _OP_EQ=                                 0x0C,\r
38         _OP_NE=                                 0x0D,\r
39         _OP_ARITH=                              0x0E,\r
40         _OP_BITW=                               0x0F,\r
41         _OP_RETURN=                             0x10,   \r
42         _OP_LOADNULLS=                  0x11,   \r
43         _OP_LOADROOTTABLE=              0x12,   \r
44         _OP_DMOVE=                              0x13,   \r
45         _OP_JMP=                                0x14,   \r
46         _OP_JNZ=                                0x15,   \r
47         _OP_JZ=                                 0x16,   \r
48         _OP_LOADFREEVAR=                0x17,   \r
49         _OP_VARGC=                              0x18,   \r
50         _OP_GETVARGV=                   0x19,   \r
51         _OP_NEWTABLE=                   0x1A,   \r
52         _OP_NEWARRAY=                   0x1B,   \r
53         _OP_APPENDARRAY=                0x1C,   \r
54         _OP_GETPARENT=                  0x1D,   \r
55         _OP_COMPARITH=                  0x1E,   \r
56         _OP_COMPARITHL=                 0x1F,   \r
57         _OP_INC=                                0x20,   \r
58         _OP_INCL=                               0x21,   \r
59         _OP_PINC=                               0x22,   \r
60         _OP_PINCL=                              0x23,   \r
61         _OP_CMP=                                0x24,\r
62         _OP_EXISTS=                             0x25,   \r
63         _OP_INSTANCEOF=                 0x26,\r
64         _OP_AND=                                0x27,\r
65         _OP_OR=                                 0x28,\r
66         _OP_NEG=                                0x29,\r
67         _OP_NOT=                                0x2A,\r
68         _OP_BWNOT=                              0x2B,   \r
69         _OP_CLOSURE=                    0x2C,   \r
70         _OP_YIELD=                              0x2D,   \r
71         _OP_RESUME=                             0x2E,\r
72         _OP_FOREACH=                    0x2F,\r
73         _OP_DELEGATE=                   0x30,\r
74         _OP_CLONE=                              0x31,\r
75         _OP_TYPEOF=                             0x32,\r
76         _OP_PUSHTRAP=                   0x33,\r
77         _OP_POPTRAP=                    0x34,\r
78         _OP_THROW=                              0x35,\r
79         _OP_CLASS=                              0x36,\r
80         _OP_NEWSLOTA=                   0x37,\r
81         _OP_LOADBOOL=                   0x38\r
82 };                                                        \r
83 struct SQInstructionDesc {        \r
84         const SQChar *name;               \r
85 };                                                        \r
86 \r
87 struct SQInstruction \r
88 {\r
89         SQInstruction(){};\r
90         SQInstruction(SQOpcode _op,int a0=0,int a1=0,int a2=0,int a3=0)\r
91         {       op = _op;\r
92                 _arg0 = a0;_arg1 = a1;\r
93                 _arg2 = a2;_arg3 = a3;\r
94         }\r
95     \r
96         \r
97         unsigned int _arg1;\r
98         unsigned char op;\r
99         unsigned char _arg0;\r
100         unsigned char _arg2;\r
101         unsigned char _arg3;\r
102 };\r
103 \r
104 #include "squtils.h"\r
105 typedef sqvector<SQInstruction> SQInstructionVec;\r
106 \r
107 #endif // _SQOPCODES_H_\r