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