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