- Got rid of newmodule.c
[python/dscho.git] / Include / opcode.h
blob2e2024618f7a22780ead344fc474371ab76c494d
1 #ifndef Py_OPCODE_H
2 #define Py_OPCODE_H
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
8 /* Instruction opcodes for compiled code */
10 #define STOP_CODE 0
11 #define POP_TOP 1
12 #define ROT_TWO 2
13 #define ROT_THREE 3
14 #define DUP_TOP 4
15 #define ROT_FOUR 5
17 #define UNARY_POSITIVE 10
18 #define UNARY_NEGATIVE 11
19 #define UNARY_NOT 12
20 #define UNARY_CONVERT 13
22 #define UNARY_INVERT 15
24 #define BINARY_POWER 19
26 #define BINARY_MULTIPLY 20
27 #define BINARY_DIVIDE 21
28 #define BINARY_MODULO 22
29 #define BINARY_ADD 23
30 #define BINARY_SUBTRACT 24
31 #define BINARY_SUBSCR 25
32 #define BINARY_FLOOR_DIVIDE 26
33 #define BINARY_TRUE_DIVIDE 27
34 #define INPLACE_FLOOR_DIVIDE 28
35 #define INPLACE_TRUE_DIVIDE 29
37 #define SLICE 30
38 /* Also uses 31-33 */
40 #define STORE_SLICE 40
41 /* Also uses 41-43 */
43 #define DELETE_SLICE 50
44 /* Also uses 51-53 */
46 #define INPLACE_ADD 55
47 #define INPLACE_SUBTRACT 56
48 #define INPLACE_MULTIPLY 57
49 #define INPLACE_DIVIDE 58
50 #define INPLACE_MODULO 59
51 #define STORE_SUBSCR 60
52 #define DELETE_SUBSCR 61
54 #define BINARY_LSHIFT 62
55 #define BINARY_RSHIFT 63
56 #define BINARY_AND 64
57 #define BINARY_XOR 65
58 #define BINARY_OR 66
59 #define INPLACE_POWER 67
60 #define GET_ITER 68
62 #define PRINT_EXPR 70
63 #define PRINT_ITEM 71
64 #define PRINT_NEWLINE 72
65 #define PRINT_ITEM_TO 73
66 #define PRINT_NEWLINE_TO 74
67 #define INPLACE_LSHIFT 75
68 #define INPLACE_RSHIFT 76
69 #define INPLACE_AND 77
70 #define INPLACE_XOR 78
71 #define INPLACE_OR 79
72 #define BREAK_LOOP 80
74 #define LOAD_LOCALS 82
75 #define RETURN_VALUE 83
76 #define IMPORT_STAR 84
77 #define EXEC_STMT 85
78 #define YIELD_VALUE 86
80 #define POP_BLOCK 87
81 #define END_FINALLY 88
82 #define BUILD_CLASS 89
84 #define HAVE_ARGUMENT 90 /* Opcodes from here have an argument: */
86 #define STORE_NAME 90 /* Index in name list */
87 #define DELETE_NAME 91 /* "" */
88 #define UNPACK_SEQUENCE 92 /* Number of sequence items */
89 #define FOR_ITER 93
91 #define STORE_ATTR 95 /* Index in name list */
92 #define DELETE_ATTR 96 /* "" */
93 #define STORE_GLOBAL 97 /* "" */
94 #define DELETE_GLOBAL 98 /* "" */
95 #define DUP_TOPX 99 /* number of items to duplicate */
96 #define LOAD_CONST 100 /* Index in const list */
97 #define LOAD_NAME 101 /* Index in name list */
98 #define BUILD_TUPLE 102 /* Number of tuple items */
99 #define BUILD_LIST 103 /* Number of list items */
100 #define BUILD_MAP 104 /* Always zero for now */
101 #define LOAD_ATTR 105 /* Index in name list */
102 #define COMPARE_OP 106 /* Comparison operator */
103 #define IMPORT_NAME 107 /* Index in name list */
104 #define IMPORT_FROM 108 /* Index in name list */
106 #define JUMP_FORWARD 110 /* Number of bytes to skip */
107 #define JUMP_IF_FALSE 111 /* "" */
108 #define JUMP_IF_TRUE 112 /* "" */
109 #define JUMP_ABSOLUTE 113 /* Target byte offset from beginning of code */
111 #define LOAD_GLOBAL 116 /* Index in name list */
113 #define CONTINUE_LOOP 119 /* Start of loop (absolute) */
114 #define SETUP_LOOP 120 /* Target address (absolute) */
115 #define SETUP_EXCEPT 121 /* "" */
116 #define SETUP_FINALLY 122 /* "" */
118 #define LOAD_FAST 124 /* Local variable number */
119 #define STORE_FAST 125 /* Local variable number */
120 #define DELETE_FAST 126 /* Local variable number */
122 #define SET_LINENO 127 /* Current line number */
124 #define RAISE_VARARGS 130 /* Number of raise arguments (1, 2 or 3) */
125 /* CALL_FUNCTION_XXX opcodes defined below depend on this definition */
126 #define CALL_FUNCTION 131 /* #args + (#kwargs<<8) */
127 #define MAKE_FUNCTION 132 /* #defaults */
128 #define BUILD_SLICE 133 /* Number of items */
130 #define MAKE_CLOSURE 134 /* #free vars */
131 #define LOAD_CLOSURE 135 /* Load free variable from closure */
132 #define LOAD_DEREF 136 /* Load and dereference from closure cell */
133 #define STORE_DEREF 137 /* Store into cell */
135 /* The next 3 opcodes must be contiguous and satisfy
136 (CALL_FUNCTION_VAR - CALL_FUNCTION) & 3 == 1 */
137 #define CALL_FUNCTION_VAR 140 /* #args + (#kwargs<<8) */
138 #define CALL_FUNCTION_KW 141 /* #args + (#kwargs<<8) */
139 #define CALL_FUNCTION_VAR_KW 142 /* #args + (#kwargs<<8) */
141 /* Support for opargs more than 16 bits long */
142 #define EXTENDED_ARG 143
145 enum cmp_op {PyCmp_LT=Py_LT, PyCmp_LE=Py_LE, PyCmp_EQ=Py_EQ, PyCmp_NE=Py_NE, PyCmp_GT=Py_GT, PyCmp_GE=Py_GE,
146 PyCmp_IN, PyCmp_NOT_IN, PyCmp_IS, PyCmp_IS_NOT, PyCmp_EXC_MATCH, PyCmp_BAD};
148 #define HAS_ARG(op) ((op) >= HAVE_ARGUMENT)
150 #ifdef __cplusplus
152 #endif
153 #endif /* !Py_OPCODE_H */