Norimasa Okamoto
/
pymite
python-on-a-chip online compiler
- http://pymbed.appspot.com/
- https://code.google.com/p/python-on-a-chip/
- http://www.youtube.com/watch?v=Oyqc2bFRW9I
- https://bitbucket.org/va009039/pymbed/
more info: python-on-a-chip
vm/interp.h@15:94ca5c8003e5, 2016-04-14 (annotated)
- Committer:
- va009039
- Date:
- Thu Apr 14 22:32:57 2016 +0000
- Revision:
- 15:94ca5c8003e5
- Parent:
- 1:28afb064a41c
update Nucleo-F401RE.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 0:65f1469d6bfb | 1 | /* |
va009039 | 0:65f1469d6bfb | 2 | # This file is Copyright 2002 Dean Hall. |
va009039 | 0:65f1469d6bfb | 3 | # This file is part of the PyMite VM. |
va009039 | 0:65f1469d6bfb | 4 | # This file is licensed under the MIT License. |
va009039 | 0:65f1469d6bfb | 5 | # See the LICENSE file for details. |
va009039 | 0:65f1469d6bfb | 6 | */ |
va009039 | 0:65f1469d6bfb | 7 | |
va009039 | 0:65f1469d6bfb | 8 | |
va009039 | 0:65f1469d6bfb | 9 | #ifndef __INTERP_H__ |
va009039 | 0:65f1469d6bfb | 10 | #define __INTERP_H__ |
va009039 | 0:65f1469d6bfb | 11 | |
va009039 | 0:65f1469d6bfb | 12 | |
va009039 | 0:65f1469d6bfb | 13 | /** |
va009039 | 0:65f1469d6bfb | 14 | * \file |
va009039 | 0:65f1469d6bfb | 15 | * \brief VM Interpreter |
va009039 | 0:65f1469d6bfb | 16 | * |
va009039 | 0:65f1469d6bfb | 17 | * VM interpreter header. |
va009039 | 0:65f1469d6bfb | 18 | */ |
va009039 | 0:65f1469d6bfb | 19 | |
va009039 | 0:65f1469d6bfb | 20 | |
va009039 | 0:65f1469d6bfb | 21 | #include "thread.h" |
va009039 | 0:65f1469d6bfb | 22 | |
va009039 | 0:65f1469d6bfb | 23 | |
va009039 | 0:65f1469d6bfb | 24 | #define INTERP_LOOP_FOREVER 0 |
va009039 | 0:65f1469d6bfb | 25 | #define INTERP_RETURN_ON_NO_THREADS 1 |
va009039 | 0:65f1469d6bfb | 26 | |
va009039 | 0:65f1469d6bfb | 27 | |
va009039 | 0:65f1469d6bfb | 28 | /** Frame pointer ; currently for single thread */ |
va009039 | 0:65f1469d6bfb | 29 | #define PM_FP (gVmGlobal.pthread->pframe) |
va009039 | 0:65f1469d6bfb | 30 | /** Instruction pointer */ |
va009039 | 0:65f1469d6bfb | 31 | #define PM_IP (PM_FP->fo_ip) |
va009039 | 0:65f1469d6bfb | 32 | /** Argument stack pointer */ |
va009039 | 0:65f1469d6bfb | 33 | #define PM_SP (PM_FP->fo_sp) |
va009039 | 0:65f1469d6bfb | 34 | |
va009039 | 0:65f1469d6bfb | 35 | /** top of stack */ |
va009039 | 0:65f1469d6bfb | 36 | #define TOS (*(PM_SP - 1)) |
va009039 | 0:65f1469d6bfb | 37 | /** one under TOS */ |
va009039 | 0:65f1469d6bfb | 38 | #define TOS1 (*(PM_SP - 2)) |
va009039 | 0:65f1469d6bfb | 39 | /** two under TOS */ |
va009039 | 0:65f1469d6bfb | 40 | #define TOS2 (*(PM_SP - 3)) |
va009039 | 0:65f1469d6bfb | 41 | /** three under TOS */ |
va009039 | 0:65f1469d6bfb | 42 | #define TOS3 (*(PM_SP - 4)) |
va009039 | 0:65f1469d6bfb | 43 | /** index into stack; 0 is top, 1 is next */ |
va009039 | 0:65f1469d6bfb | 44 | #define STACK(n) (*(PM_SP - ((n) + 1))) |
va009039 | 0:65f1469d6bfb | 45 | /** pops an obj from the stack */ |
va009039 | 0:65f1469d6bfb | 46 | #define PM_POP() (*(--PM_SP)) |
va009039 | 0:65f1469d6bfb | 47 | /** pushes an obj on the stack */ |
va009039 | 0:65f1469d6bfb | 48 | #define PM_PUSH(pobj) (*(PM_SP++) = (pobj)) |
va009039 | 0:65f1469d6bfb | 49 | /** gets the argument (S16) from the instruction stream */ |
va009039 | 0:65f1469d6bfb | 50 | #define GET_ARG() mem_getWord(PM_FP->fo_memspace, &PM_IP) |
va009039 | 0:65f1469d6bfb | 51 | |
va009039 | 0:65f1469d6bfb | 52 | /** pushes an obj in the only stack slot of the native frame */ |
va009039 | 0:65f1469d6bfb | 53 | #define NATIVE_SET_TOS(pobj) (gVmGlobal.nativeframe.nf_stack = \ |
va009039 | 0:65f1469d6bfb | 54 | (pobj)) |
va009039 | 0:65f1469d6bfb | 55 | /** gets the nth local var from the native frame locals */ |
va009039 | 0:65f1469d6bfb | 56 | #define NATIVE_GET_LOCAL(n) (gVmGlobal.nativeframe.nf_locals[n]) |
va009039 | 0:65f1469d6bfb | 57 | /** gets a pointer to the frame that called this native fxn */ |
va009039 | 0:65f1469d6bfb | 58 | #define NATIVE_GET_PFRAME() (*ppframe) |
va009039 | 0:65f1469d6bfb | 59 | /** gets the number of args passed to the native fxn */ |
va009039 | 0:65f1469d6bfb | 60 | #define NATIVE_GET_NUM_ARGS() (gVmGlobal.nativeframe.nf_numlocals) |
va009039 | 0:65f1469d6bfb | 61 | |
va009039 | 0:65f1469d6bfb | 62 | |
va009039 | 0:65f1469d6bfb | 63 | /** |
va009039 | 0:65f1469d6bfb | 64 | * COMPARE_OP enum. |
va009039 | 0:65f1469d6bfb | 65 | * Used by the COMPARE_OP bytecode to determine |
va009039 | 0:65f1469d6bfb | 66 | * which type of compare to perform. |
va009039 | 0:65f1469d6bfb | 67 | * Must match those defined in Python. |
va009039 | 0:65f1469d6bfb | 68 | */ |
va009039 | 0:65f1469d6bfb | 69 | typedef enum PmCompare_e |
va009039 | 0:65f1469d6bfb | 70 | { |
va009039 | 0:65f1469d6bfb | 71 | COMP_LT = 0, /**< less than */ |
va009039 | 0:65f1469d6bfb | 72 | COMP_LE, /**< less than or equal */ |
va009039 | 0:65f1469d6bfb | 73 | COMP_EQ, /**< equal */ |
va009039 | 0:65f1469d6bfb | 74 | COMP_NE, /**< not equal */ |
va009039 | 0:65f1469d6bfb | 75 | COMP_GT, /**< greater than */ |
va009039 | 0:65f1469d6bfb | 76 | COMP_GE, /**< greater than or equal */ |
va009039 | 0:65f1469d6bfb | 77 | COMP_IN, /**< is in */ |
va009039 | 0:65f1469d6bfb | 78 | COMP_NOT_IN, /**< is not in */ |
va009039 | 0:65f1469d6bfb | 79 | COMP_IS, /**< is */ |
va009039 | 0:65f1469d6bfb | 80 | COMP_IS_NOT, /**< is not */ |
va009039 | 0:65f1469d6bfb | 81 | COMP_EXN_MATCH /**< do exceptions match */ |
va009039 | 0:65f1469d6bfb | 82 | } PmCompare_t, *pPmCompare_t; |
va009039 | 0:65f1469d6bfb | 83 | |
va009039 | 0:65f1469d6bfb | 84 | /** |
va009039 | 0:65f1469d6bfb | 85 | * Byte code enumeration |
va009039 | 0:65f1469d6bfb | 86 | */ |
va009039 | 0:65f1469d6bfb | 87 | typedef enum PmBcode_e |
va009039 | 0:65f1469d6bfb | 88 | { |
va009039 | 1:28afb064a41c | 89 | #ifdef HAVE_PYTHON27 |
va009039 | 1:28afb064a41c | 90 | STOP_CODE=0, /* 0x00 */ |
va009039 | 1:28afb064a41c | 91 | POP_TOP=1, /* 0x01 */ |
va009039 | 1:28afb064a41c | 92 | ROT_TWO=2, /* 0x02 */ |
va009039 | 1:28afb064a41c | 93 | ROT_THREE=3, /* 0x03 */ |
va009039 | 1:28afb064a41c | 94 | DUP_TOP=4, /* 0x04 */ |
va009039 | 1:28afb064a41c | 95 | ROT_FOUR=5, /* 0x05 */ |
va009039 | 1:28afb064a41c | 96 | UNUSED_06=6, |
va009039 | 1:28afb064a41c | 97 | UNUSED_07=7, |
va009039 | 1:28afb064a41c | 98 | UNUSED_08=8, |
va009039 | 1:28afb064a41c | 99 | NOP=9, /* 0x09 */ |
va009039 | 1:28afb064a41c | 100 | UNARY_POSITIVE=10, /* 0x0a */ |
va009039 | 1:28afb064a41c | 101 | UNARY_NEGATIVE=11, /* 0x0b */ |
va009039 | 1:28afb064a41c | 102 | UNARY_NOT=12, /* 0x0c */ |
va009039 | 1:28afb064a41c | 103 | UNARY_CONVERT=13, /* 0x0d */ |
va009039 | 1:28afb064a41c | 104 | UNUSED_0E=14, |
va009039 | 1:28afb064a41c | 105 | UNARY_INVERT=15, /* 0x0f */ |
va009039 | 1:28afb064a41c | 106 | UNUSED_10=16, |
va009039 | 1:28afb064a41c | 107 | UNUSED_11=17, |
va009039 | 1:28afb064a41c | 108 | UNUSED_12=18, |
va009039 | 1:28afb064a41c | 109 | BINARY_POWER=19, /* 0x13 */ |
va009039 | 1:28afb064a41c | 110 | BINARY_MULTIPLY=20, /* 0x14 */ |
va009039 | 1:28afb064a41c | 111 | BINARY_DIVIDE=21, /* 0x15 */ |
va009039 | 1:28afb064a41c | 112 | BINARY_MODULO=22, /* 0x16 */ |
va009039 | 1:28afb064a41c | 113 | BINARY_ADD=23, /* 0x17 */ |
va009039 | 1:28afb064a41c | 114 | BINARY_SUBTRACT=24, /* 0x18 */ |
va009039 | 1:28afb064a41c | 115 | BINARY_SUBSCR=25, /* 0x19 */ |
va009039 | 1:28afb064a41c | 116 | BINARY_FLOOR_DIVIDE=26, /* 0x1a */ |
va009039 | 1:28afb064a41c | 117 | BINARY_TRUE_DIVIDE=27, /* 0x1b */ |
va009039 | 1:28afb064a41c | 118 | INPLACE_FLOOR_DIVIDE=28, /* 0x1c */ |
va009039 | 1:28afb064a41c | 119 | INPLACE_TRUE_DIVIDE=29, /* 0x1d */ |
va009039 | 1:28afb064a41c | 120 | SLICE_0=30, /* 0x1e */ |
va009039 | 1:28afb064a41c | 121 | SLICE_1=31, /* 0x1f */ |
va009039 | 1:28afb064a41c | 122 | SLICE_2=32, /* 0x20 */ |
va009039 | 1:28afb064a41c | 123 | SLICE_3=33, /* 0x21 */ |
va009039 | 1:28afb064a41c | 124 | UNUSED_22=34, |
va009039 | 1:28afb064a41c | 125 | UNUSED_23=35, |
va009039 | 1:28afb064a41c | 126 | UNUSED_24=36, |
va009039 | 1:28afb064a41c | 127 | UNUSED_25=37, |
va009039 | 1:28afb064a41c | 128 | UNUSED_26=38, |
va009039 | 1:28afb064a41c | 129 | UNUSED_27=39, |
va009039 | 1:28afb064a41c | 130 | STORE_SLICE_0=40, /* 0x28 */ |
va009039 | 1:28afb064a41c | 131 | STORE_SLICE_1=41, /* 0x29 */ |
va009039 | 1:28afb064a41c | 132 | STORE_SLICE_2=42, /* 0x2a */ |
va009039 | 1:28afb064a41c | 133 | STORE_SLICE_3=43, /* 0x2b */ |
va009039 | 1:28afb064a41c | 134 | UNUSED_2C=44, |
va009039 | 1:28afb064a41c | 135 | UNUSED_2D=45, |
va009039 | 1:28afb064a41c | 136 | UNUSED_2E=46, |
va009039 | 1:28afb064a41c | 137 | UNUSED_2F=47, |
va009039 | 1:28afb064a41c | 138 | UNUSED_30=48, |
va009039 | 1:28afb064a41c | 139 | UNUSED_31=49, |
va009039 | 1:28afb064a41c | 140 | DELETE_SLICE_0=50, /* 0x32 */ |
va009039 | 1:28afb064a41c | 141 | DELETE_SLICE_1=51, /* 0x33 */ |
va009039 | 1:28afb064a41c | 142 | DELETE_SLICE_2=52, /* 0x34 */ |
va009039 | 1:28afb064a41c | 143 | DELETE_SLICE_3=53, /* 0x35 */ |
va009039 | 1:28afb064a41c | 144 | STORE_MAP=54, /* 0x36 */ |
va009039 | 1:28afb064a41c | 145 | INPLACE_ADD=55, /* 0x37 */ |
va009039 | 1:28afb064a41c | 146 | INPLACE_SUBTRACT=56, /* 0x38 */ |
va009039 | 1:28afb064a41c | 147 | INPLACE_MULTIPLY=57, /* 0x39 */ |
va009039 | 1:28afb064a41c | 148 | INPLACE_DIVIDE=58, /* 0x3a */ |
va009039 | 1:28afb064a41c | 149 | INPLACE_MODULO=59, /* 0x3b */ |
va009039 | 1:28afb064a41c | 150 | STORE_SUBSCR=60, /* 0x3c */ |
va009039 | 1:28afb064a41c | 151 | DELETE_SUBSCR=61, /* 0x3d */ |
va009039 | 1:28afb064a41c | 152 | BINARY_LSHIFT=62, /* 0x3e */ |
va009039 | 1:28afb064a41c | 153 | BINARY_RSHIFT=63, /* 0x3f */ |
va009039 | 1:28afb064a41c | 154 | BINARY_AND=64, /* 0x40 */ |
va009039 | 1:28afb064a41c | 155 | BINARY_XOR=65, /* 0x41 */ |
va009039 | 1:28afb064a41c | 156 | BINARY_OR=66, /* 0x42 */ |
va009039 | 1:28afb064a41c | 157 | INPLACE_POWER=67, /* 0x43 */ |
va009039 | 1:28afb064a41c | 158 | GET_ITER=68, /* 0x44 */ |
va009039 | 1:28afb064a41c | 159 | UNUSED_45=69, |
va009039 | 1:28afb064a41c | 160 | PRINT_EXPR=70, /* 0x46 */ |
va009039 | 1:28afb064a41c | 161 | PRINT_ITEM=71, /* 0x47 */ |
va009039 | 1:28afb064a41c | 162 | PRINT_NEWLINE=72, /* 0x48 */ |
va009039 | 1:28afb064a41c | 163 | PRINT_ITEM_TO=73, /* 0x49 */ |
va009039 | 1:28afb064a41c | 164 | PRINT_NEWLINE_TO=74, /* 0x4a */ |
va009039 | 1:28afb064a41c | 165 | INPLACE_LSHIFT=75, /* 0x4b */ |
va009039 | 1:28afb064a41c | 166 | INPLACE_RSHIFT=76, /* 0x4c */ |
va009039 | 1:28afb064a41c | 167 | INPLACE_AND=77, /* 0x4d */ |
va009039 | 1:28afb064a41c | 168 | INPLACE_XOR=78, /* 0x4e */ |
va009039 | 1:28afb064a41c | 169 | INPLACE_OR=79, /* 0x4f */ |
va009039 | 1:28afb064a41c | 170 | BREAK_LOOP=80, /* 0x50 */ |
va009039 | 1:28afb064a41c | 171 | WITH_CLEANUP=81, /* 0x51 */ |
va009039 | 1:28afb064a41c | 172 | LOAD_LOCALS=82, /* 0x52 */ |
va009039 | 1:28afb064a41c | 173 | RETURN_VALUE=83, /* 0x53 */ |
va009039 | 1:28afb064a41c | 174 | IMPORT_STAR=84, /* 0x54 */ |
va009039 | 1:28afb064a41c | 175 | EXEC_STMT=85, /* 0x55 */ |
va009039 | 1:28afb064a41c | 176 | YIELD_VALUE=86, /* 0x56 */ |
va009039 | 1:28afb064a41c | 177 | POP_BLOCK=87, /* 0x57 */ |
va009039 | 1:28afb064a41c | 178 | END_FINALLY=88, /* 0x58 */ |
va009039 | 1:28afb064a41c | 179 | BUILD_CLASS=89, /* 0x59 */ |
va009039 | 1:28afb064a41c | 180 | |
va009039 | 1:28afb064a41c | 181 | /* Opcodes from here have an argument */ |
va009039 | 1:28afb064a41c | 182 | HAVE_ARGUMENT=90, /* 0x5a */ |
va009039 | 1:28afb064a41c | 183 | STORE_NAME=90, /* 0x5a */ |
va009039 | 1:28afb064a41c | 184 | DELETE_NAME=91, /* 0x5b */ |
va009039 | 1:28afb064a41c | 185 | UNPACK_SEQUENCE=92, /* 0x5c */ |
va009039 | 1:28afb064a41c | 186 | FOR_ITER=93, /* 0x5d */ |
va009039 | 1:28afb064a41c | 187 | LIST_APPEND=94, /* 0x5e */ |
va009039 | 1:28afb064a41c | 188 | STORE_ATTR=95, /* 0x5f */ |
va009039 | 1:28afb064a41c | 189 | DELETE_ATTR=96, /* 0x60 */ |
va009039 | 1:28afb064a41c | 190 | STORE_GLOBAL=97, /* 0x61 */ |
va009039 | 1:28afb064a41c | 191 | DELETE_GLOBAL=98, /* 0x62 */ |
va009039 | 1:28afb064a41c | 192 | DUP_TOPX=99, /* 0x63 */ |
va009039 | 1:28afb064a41c | 193 | LOAD_CONST=100, /* 0x64 */ |
va009039 | 1:28afb064a41c | 194 | LOAD_NAME=101, /* 0x65 */ |
va009039 | 1:28afb064a41c | 195 | BUILD_TUPLE=102, /* 0x66 */ |
va009039 | 1:28afb064a41c | 196 | BUILD_LIST=103, /* 0x67 */ |
va009039 | 1:28afb064a41c | 197 | BUILD_SET=104, /* 0x68 */ |
va009039 | 1:28afb064a41c | 198 | BUILD_MAP=105, /* 0x69 */ |
va009039 | 1:28afb064a41c | 199 | LOAD_ATTR=106, /* 0x6a */ |
va009039 | 1:28afb064a41c | 200 | COMPARE_OP=107, /* 0x6b */ |
va009039 | 1:28afb064a41c | 201 | IMPORT_NAME=108, /* 0x6c */ |
va009039 | 1:28afb064a41c | 202 | IMPORT_FROM=109, /* 0x6d */ |
va009039 | 1:28afb064a41c | 203 | JUMP_FORWARD=110, /* 0x6e */ |
va009039 | 1:28afb064a41c | 204 | JUMP_IF_FALSE_OR_POP=111, /* 0x6f */ |
va009039 | 1:28afb064a41c | 205 | JUMP_IF_TRUE_OR_POP=112, /* 0x70 */ |
va009039 | 1:28afb064a41c | 206 | JUMP_ABSOLUTE=113, /* 0x71 */ |
va009039 | 1:28afb064a41c | 207 | POP_JUMP_IF_FALSE=114, /* 0x72 */ |
va009039 | 1:28afb064a41c | 208 | POP_JUMP_IF_TRUE=115, /* 0x73 */ |
va009039 | 1:28afb064a41c | 209 | LOAD_GLOBAL=116, /* 0x74 */ |
va009039 | 1:28afb064a41c | 210 | UNUSED_75=117, |
va009039 | 1:28afb064a41c | 211 | UNUSED_76=118, |
va009039 | 1:28afb064a41c | 212 | CONTINUE_LOOP=119, /* 0x77 */ |
va009039 | 1:28afb064a41c | 213 | SETUP_LOOP=120, /* 0x78 */ |
va009039 | 1:28afb064a41c | 214 | SETUP_EXCEPT=121, /* 0x79 */ |
va009039 | 1:28afb064a41c | 215 | SETUP_FINALLY=122, /* 0x7a */ |
va009039 | 1:28afb064a41c | 216 | UNUSED_7B=123, |
va009039 | 1:28afb064a41c | 217 | LOAD_FAST=124, /* 0x7c */ |
va009039 | 1:28afb064a41c | 218 | STORE_FAST=125, /* 0x7d */ |
va009039 | 1:28afb064a41c | 219 | DELETE_FAST=126, /* 0x7e */ |
va009039 | 1:28afb064a41c | 220 | UNUSED_7F=127, |
va009039 | 1:28afb064a41c | 221 | UNUSED_80=128, |
va009039 | 1:28afb064a41c | 222 | UNUSED_81=129, |
va009039 | 1:28afb064a41c | 223 | RAISE_VARARGS=130, /* 0x82 */ |
va009039 | 1:28afb064a41c | 224 | CALL_FUNCTION=131, /* 0x83 */ |
va009039 | 1:28afb064a41c | 225 | MAKE_FUNCTION=132, /* 0x84 */ |
va009039 | 1:28afb064a41c | 226 | BUILD_SLICE=133, /* 0x85 */ |
va009039 | 1:28afb064a41c | 227 | MAKE_CLOSURE=134, /* 0x86 */ |
va009039 | 1:28afb064a41c | 228 | LOAD_CLOSURE=135, /* 0x87 */ |
va009039 | 1:28afb064a41c | 229 | LOAD_DEREF=136, /* 0x88 */ |
va009039 | 1:28afb064a41c | 230 | STORE_DEREF=137, /* 0x89 */ |
va009039 | 1:28afb064a41c | 231 | UNUSED_8A=138, |
va009039 | 1:28afb064a41c | 232 | UNUSED_8B=139, |
va009039 | 1:28afb064a41c | 233 | CALL_FUNCTION_VAR=140, /* 0x8c */ |
va009039 | 1:28afb064a41c | 234 | CALL_FUNCTION_KW=141, /* 0x8d */ |
va009039 | 1:28afb064a41c | 235 | CALL_FUNCTION_VAR_KW=142, /* 0x8e */ |
va009039 | 1:28afb064a41c | 236 | SETUP_WITH=143, /* 0x8f */ |
va009039 | 1:28afb064a41c | 237 | UNUSED_90=144, |
va009039 | 1:28afb064a41c | 238 | EXTENDED_ARG=145, /* 0x91 */ |
va009039 | 1:28afb064a41c | 239 | SET_ADD=146, /* 0x92 */ |
va009039 | 1:28afb064a41c | 240 | MAP_ADD=147, /* 0x93 */ |
va009039 | 1:28afb064a41c | 241 | UNUSED_94=148, |
va009039 | 1:28afb064a41c | 242 | UNUSED_95=149, |
va009039 | 1:28afb064a41c | 243 | UNUSED_96=150, |
va009039 | 1:28afb064a41c | 244 | UNUSED_97=151, |
va009039 | 1:28afb064a41c | 245 | UNUSED_98=152, |
va009039 | 1:28afb064a41c | 246 | UNUSED_99=153, |
va009039 | 1:28afb064a41c | 247 | UNUSED_9A=154, |
va009039 | 1:28afb064a41c | 248 | UNUSED_9B=155, |
va009039 | 1:28afb064a41c | 249 | UNUSED_9C=156, |
va009039 | 1:28afb064a41c | 250 | UNUSED_9D=157, |
va009039 | 1:28afb064a41c | 251 | UNUSED_9E=158, |
va009039 | 1:28afb064a41c | 252 | UNUSED_9F=159, |
va009039 | 1:28afb064a41c | 253 | UNUSED_A0=160, |
va009039 | 1:28afb064a41c | 254 | UNUSED_A1=161, |
va009039 | 1:28afb064a41c | 255 | UNUSED_A2=162, |
va009039 | 1:28afb064a41c | 256 | UNUSED_A3=163, |
va009039 | 1:28afb064a41c | 257 | UNUSED_A4=164, |
va009039 | 1:28afb064a41c | 258 | UNUSED_A5=165, |
va009039 | 1:28afb064a41c | 259 | UNUSED_A6=166, |
va009039 | 1:28afb064a41c | 260 | UNUSED_A7=167, |
va009039 | 1:28afb064a41c | 261 | UNUSED_A8=168, |
va009039 | 1:28afb064a41c | 262 | UNUSED_A9=169, |
va009039 | 1:28afb064a41c | 263 | UNUSED_AA=170, |
va009039 | 1:28afb064a41c | 264 | UNUSED_AB=171, |
va009039 | 1:28afb064a41c | 265 | UNUSED_AC=172, |
va009039 | 1:28afb064a41c | 266 | UNUSED_AD=173, |
va009039 | 1:28afb064a41c | 267 | UNUSED_AE=174, |
va009039 | 1:28afb064a41c | 268 | UNUSED_AF=175, |
va009039 | 1:28afb064a41c | 269 | UNUSED_B0=176, |
va009039 | 1:28afb064a41c | 270 | UNUSED_B1=177, |
va009039 | 1:28afb064a41c | 271 | UNUSED_B2=178, |
va009039 | 1:28afb064a41c | 272 | UNUSED_B3=179, |
va009039 | 1:28afb064a41c | 273 | UNUSED_B4=180, |
va009039 | 1:28afb064a41c | 274 | UNUSED_B5=181, |
va009039 | 1:28afb064a41c | 275 | UNUSED_B6=182, |
va009039 | 1:28afb064a41c | 276 | UNUSED_B7=183, |
va009039 | 1:28afb064a41c | 277 | UNUSED_B8=184, |
va009039 | 1:28afb064a41c | 278 | UNUSED_B9=185, |
va009039 | 1:28afb064a41c | 279 | UNUSED_BA=186, |
va009039 | 1:28afb064a41c | 280 | UNUSED_BB=187, |
va009039 | 1:28afb064a41c | 281 | UNUSED_BC=188, |
va009039 | 1:28afb064a41c | 282 | UNUSED_BD=189, |
va009039 | 1:28afb064a41c | 283 | UNUSED_BE=190, |
va009039 | 1:28afb064a41c | 284 | UNUSED_BF=191, |
va009039 | 1:28afb064a41c | 285 | UNUSED_C0=192, |
va009039 | 1:28afb064a41c | 286 | UNUSED_C1=193, |
va009039 | 1:28afb064a41c | 287 | UNUSED_C2=194, |
va009039 | 1:28afb064a41c | 288 | UNUSED_C3=195, |
va009039 | 1:28afb064a41c | 289 | UNUSED_C4=196, |
va009039 | 1:28afb064a41c | 290 | UNUSED_C5=197, |
va009039 | 1:28afb064a41c | 291 | UNUSED_C6=198, |
va009039 | 1:28afb064a41c | 292 | UNUSED_C7=199, |
va009039 | 1:28afb064a41c | 293 | UNUSED_C8=200, |
va009039 | 1:28afb064a41c | 294 | UNUSED_C9=201, |
va009039 | 1:28afb064a41c | 295 | UNUSED_CA=202, |
va009039 | 1:28afb064a41c | 296 | UNUSED_CB=203, |
va009039 | 1:28afb064a41c | 297 | UNUSED_CC=204, |
va009039 | 1:28afb064a41c | 298 | UNUSED_CD=205, |
va009039 | 1:28afb064a41c | 299 | UNUSED_CE=206, |
va009039 | 1:28afb064a41c | 300 | UNUSED_CF=207, |
va009039 | 1:28afb064a41c | 301 | UNUSED_D0=208, |
va009039 | 1:28afb064a41c | 302 | UNUSED_D1=209, |
va009039 | 1:28afb064a41c | 303 | UNUSED_D2=210, |
va009039 | 1:28afb064a41c | 304 | UNUSED_D3=211, |
va009039 | 1:28afb064a41c | 305 | UNUSED_D4=212, |
va009039 | 1:28afb064a41c | 306 | UNUSED_D5=213, |
va009039 | 1:28afb064a41c | 307 | UNUSED_D6=214, |
va009039 | 1:28afb064a41c | 308 | UNUSED_D7=215, |
va009039 | 1:28afb064a41c | 309 | UNUSED_D8=216, |
va009039 | 1:28afb064a41c | 310 | UNUSED_D9=217, |
va009039 | 1:28afb064a41c | 311 | UNUSED_DA=218, |
va009039 | 1:28afb064a41c | 312 | UNUSED_DB=219, |
va009039 | 1:28afb064a41c | 313 | UNUSED_DC=220, |
va009039 | 1:28afb064a41c | 314 | UNUSED_DD=221, |
va009039 | 1:28afb064a41c | 315 | UNUSED_DE=222, |
va009039 | 1:28afb064a41c | 316 | UNUSED_DF=223, |
va009039 | 1:28afb064a41c | 317 | UNUSED_E0=224, |
va009039 | 1:28afb064a41c | 318 | UNUSED_E1=225, |
va009039 | 1:28afb064a41c | 319 | UNUSED_E2=226, |
va009039 | 1:28afb064a41c | 320 | UNUSED_E3=227, |
va009039 | 1:28afb064a41c | 321 | UNUSED_E4=228, |
va009039 | 1:28afb064a41c | 322 | UNUSED_E5=229, |
va009039 | 1:28afb064a41c | 323 | UNUSED_E6=230, |
va009039 | 1:28afb064a41c | 324 | UNUSED_E7=231, |
va009039 | 1:28afb064a41c | 325 | UNUSED_E8=232, |
va009039 | 1:28afb064a41c | 326 | UNUSED_E9=233, |
va009039 | 1:28afb064a41c | 327 | UNUSED_EA=234, |
va009039 | 1:28afb064a41c | 328 | UNUSED_EB=235, |
va009039 | 1:28afb064a41c | 329 | UNUSED_EC=236, |
va009039 | 1:28afb064a41c | 330 | UNUSED_ED=237, |
va009039 | 1:28afb064a41c | 331 | UNUSED_EE=238, |
va009039 | 1:28afb064a41c | 332 | UNUSED_EF=239, |
va009039 | 1:28afb064a41c | 333 | UNUSED_F0=240, |
va009039 | 1:28afb064a41c | 334 | UNUSED_F1=241, |
va009039 | 1:28afb064a41c | 335 | UNUSED_F2=242, |
va009039 | 1:28afb064a41c | 336 | UNUSED_F3=243, |
va009039 | 1:28afb064a41c | 337 | UNUSED_F4=244, |
va009039 | 1:28afb064a41c | 338 | UNUSED_F5=245, |
va009039 | 1:28afb064a41c | 339 | UNUSED_F6=246, |
va009039 | 1:28afb064a41c | 340 | UNUSED_F7=247, |
va009039 | 1:28afb064a41c | 341 | UNUSED_F8=248, |
va009039 | 1:28afb064a41c | 342 | UNUSED_F9=249, |
va009039 | 1:28afb064a41c | 343 | UNUSED_FA=250, |
va009039 | 1:28afb064a41c | 344 | UNUSED_FB=251, |
va009039 | 1:28afb064a41c | 345 | UNUSED_FC=252, |
va009039 | 1:28afb064a41c | 346 | UNUSED_FD=253, |
va009039 | 1:28afb064a41c | 347 | UNUSED_FE=254, |
va009039 | 1:28afb064a41c | 348 | UNUSED_FF=255, |
va009039 | 1:28afb064a41c | 349 | #else /* HAVE_PYTHON27 */ |
va009039 | 0:65f1469d6bfb | 350 | /* |
va009039 | 0:65f1469d6bfb | 351 | * Python source to create this list: |
va009039 | 0:65f1469d6bfb | 352 | * import dis |
va009039 | 0:65f1469d6bfb | 353 | * o = dis.opname |
va009039 | 0:65f1469d6bfb | 354 | * for i in range(256): |
va009039 | 0:65f1469d6bfb | 355 | * if o[i][0] != '<': |
va009039 | 0:65f1469d6bfb | 356 | * print "\t%s," % o[i] |
va009039 | 0:65f1469d6bfb | 357 | * else: |
va009039 | 0:65f1469d6bfb | 358 | * print "\tUNUSED_%02X," % i |
va009039 | 0:65f1469d6bfb | 359 | */ |
va009039 | 0:65f1469d6bfb | 360 | STOP_CODE = 0, /* 0x00 */ |
va009039 | 0:65f1469d6bfb | 361 | POP_TOP, |
va009039 | 0:65f1469d6bfb | 362 | ROT_TWO, |
va009039 | 0:65f1469d6bfb | 363 | ROT_THREE, |
va009039 | 0:65f1469d6bfb | 364 | DUP_TOP, |
va009039 | 0:65f1469d6bfb | 365 | ROT_FOUR, |
va009039 | 0:65f1469d6bfb | 366 | UNUSED_06, |
va009039 | 0:65f1469d6bfb | 367 | UNUSED_07, |
va009039 | 0:65f1469d6bfb | 368 | UNUSED_08, |
va009039 | 0:65f1469d6bfb | 369 | NOP, |
va009039 | 0:65f1469d6bfb | 370 | UNARY_POSITIVE, /* d010 */ |
va009039 | 0:65f1469d6bfb | 371 | UNARY_NEGATIVE, |
va009039 | 0:65f1469d6bfb | 372 | UNARY_NOT, |
va009039 | 0:65f1469d6bfb | 373 | UNARY_CONVERT, |
va009039 | 0:65f1469d6bfb | 374 | UNUSED_0E, |
va009039 | 0:65f1469d6bfb | 375 | UNARY_INVERT, |
va009039 | 0:65f1469d6bfb | 376 | UNUSED_10, /* 0x10 */ |
va009039 | 0:65f1469d6bfb | 377 | UNUSED_11, |
va009039 | 0:65f1469d6bfb | 378 | LIST_APPEND, |
va009039 | 0:65f1469d6bfb | 379 | BINARY_POWER, |
va009039 | 0:65f1469d6bfb | 380 | BINARY_MULTIPLY, /* d020 */ |
va009039 | 0:65f1469d6bfb | 381 | BINARY_DIVIDE, |
va009039 | 0:65f1469d6bfb | 382 | BINARY_MODULO, |
va009039 | 0:65f1469d6bfb | 383 | BINARY_ADD, |
va009039 | 0:65f1469d6bfb | 384 | BINARY_SUBTRACT, |
va009039 | 0:65f1469d6bfb | 385 | BINARY_SUBSCR, |
va009039 | 0:65f1469d6bfb | 386 | BINARY_FLOOR_DIVIDE, |
va009039 | 0:65f1469d6bfb | 387 | BINARY_TRUE_DIVIDE, |
va009039 | 0:65f1469d6bfb | 388 | INPLACE_FLOOR_DIVIDE, |
va009039 | 0:65f1469d6bfb | 389 | INPLACE_TRUE_DIVIDE, |
va009039 | 0:65f1469d6bfb | 390 | SLICE_0, /* d030 */ |
va009039 | 0:65f1469d6bfb | 391 | SLICE_1, |
va009039 | 0:65f1469d6bfb | 392 | SLICE_2, /* 0x20 */ |
va009039 | 0:65f1469d6bfb | 393 | SLICE_3, |
va009039 | 0:65f1469d6bfb | 394 | UNUSED_22, |
va009039 | 0:65f1469d6bfb | 395 | UNUSED_23, |
va009039 | 0:65f1469d6bfb | 396 | UNUSED_24, |
va009039 | 0:65f1469d6bfb | 397 | UNUSED_25, |
va009039 | 0:65f1469d6bfb | 398 | UNUSED_26, |
va009039 | 0:65f1469d6bfb | 399 | UNUSED_27, |
va009039 | 0:65f1469d6bfb | 400 | STORE_SLICE_0, /* d040 */ |
va009039 | 0:65f1469d6bfb | 401 | STORE_SLICE_1, |
va009039 | 0:65f1469d6bfb | 402 | STORE_SLICE_2, |
va009039 | 0:65f1469d6bfb | 403 | STORE_SLICE_3, |
va009039 | 0:65f1469d6bfb | 404 | UNUSED_2C, |
va009039 | 0:65f1469d6bfb | 405 | UNUSED_2D, |
va009039 | 0:65f1469d6bfb | 406 | UNUSED_2E, |
va009039 | 0:65f1469d6bfb | 407 | UNUSED_2F, |
va009039 | 0:65f1469d6bfb | 408 | UNUSED_30, /* 0x30 */ |
va009039 | 0:65f1469d6bfb | 409 | UNUSED_31, |
va009039 | 0:65f1469d6bfb | 410 | DELETE_SLICE_0, /* d050 */ |
va009039 | 0:65f1469d6bfb | 411 | DELETE_SLICE_1, |
va009039 | 0:65f1469d6bfb | 412 | DELETE_SLICE_2, |
va009039 | 0:65f1469d6bfb | 413 | DELETE_SLICE_3, |
va009039 | 0:65f1469d6bfb | 414 | STORE_MAP, |
va009039 | 0:65f1469d6bfb | 415 | INPLACE_ADD, |
va009039 | 0:65f1469d6bfb | 416 | INPLACE_SUBTRACT, |
va009039 | 0:65f1469d6bfb | 417 | INPLACE_MULTIPLY, |
va009039 | 0:65f1469d6bfb | 418 | INPLACE_DIVIDE, |
va009039 | 0:65f1469d6bfb | 419 | INPLACE_MODULO, |
va009039 | 0:65f1469d6bfb | 420 | STORE_SUBSCR, /* d060 */ |
va009039 | 0:65f1469d6bfb | 421 | DELETE_SUBSCR, |
va009039 | 0:65f1469d6bfb | 422 | BINARY_LSHIFT, |
va009039 | 0:65f1469d6bfb | 423 | BINARY_RSHIFT, |
va009039 | 0:65f1469d6bfb | 424 | BINARY_AND, /* 0x40 */ |
va009039 | 0:65f1469d6bfb | 425 | BINARY_XOR, |
va009039 | 0:65f1469d6bfb | 426 | BINARY_OR, |
va009039 | 0:65f1469d6bfb | 427 | INPLACE_POWER, |
va009039 | 0:65f1469d6bfb | 428 | GET_ITER, |
va009039 | 0:65f1469d6bfb | 429 | UNUSED_45, |
va009039 | 0:65f1469d6bfb | 430 | PRINT_EXPR, /* d070 */ |
va009039 | 0:65f1469d6bfb | 431 | PRINT_ITEM, |
va009039 | 0:65f1469d6bfb | 432 | PRINT_NEWLINE, |
va009039 | 0:65f1469d6bfb | 433 | PRINT_ITEM_TO, |
va009039 | 0:65f1469d6bfb | 434 | PRINT_NEWLINE_TO, |
va009039 | 0:65f1469d6bfb | 435 | INPLACE_LSHIFT, |
va009039 | 0:65f1469d6bfb | 436 | INPLACE_RSHIFT, |
va009039 | 0:65f1469d6bfb | 437 | INPLACE_AND, |
va009039 | 0:65f1469d6bfb | 438 | INPLACE_XOR, |
va009039 | 0:65f1469d6bfb | 439 | INPLACE_OR, |
va009039 | 0:65f1469d6bfb | 440 | BREAK_LOOP, /* 0x50 *//* d080 */ |
va009039 | 0:65f1469d6bfb | 441 | WITH_CLEANUP, |
va009039 | 0:65f1469d6bfb | 442 | LOAD_LOCALS, |
va009039 | 0:65f1469d6bfb | 443 | RETURN_VALUE, |
va009039 | 0:65f1469d6bfb | 444 | IMPORT_STAR, |
va009039 | 0:65f1469d6bfb | 445 | EXEC_STMT, |
va009039 | 0:65f1469d6bfb | 446 | YIELD_VALUE, |
va009039 | 0:65f1469d6bfb | 447 | POP_BLOCK, |
va009039 | 0:65f1469d6bfb | 448 | END_FINALLY, |
va009039 | 0:65f1469d6bfb | 449 | BUILD_CLASS, |
va009039 | 0:65f1469d6bfb | 450 | |
va009039 | 0:65f1469d6bfb | 451 | /* Opcodes from here have an argument */ |
va009039 | 0:65f1469d6bfb | 452 | HAVE_ARGUMENT = 90, /* d090 */ |
va009039 | 0:65f1469d6bfb | 453 | STORE_NAME = 90, |
va009039 | 0:65f1469d6bfb | 454 | DELETE_NAME, |
va009039 | 0:65f1469d6bfb | 455 | UNPACK_SEQUENCE, |
va009039 | 0:65f1469d6bfb | 456 | FOR_ITER, |
va009039 | 0:65f1469d6bfb | 457 | UNUSED_5E, |
va009039 | 0:65f1469d6bfb | 458 | STORE_ATTR, |
va009039 | 0:65f1469d6bfb | 459 | DELETE_ATTR, /* 0x60 */ |
va009039 | 0:65f1469d6bfb | 460 | STORE_GLOBAL, |
va009039 | 0:65f1469d6bfb | 461 | DELETE_GLOBAL, |
va009039 | 0:65f1469d6bfb | 462 | DUP_TOPX, |
va009039 | 0:65f1469d6bfb | 463 | LOAD_CONST, /* d100 */ |
va009039 | 0:65f1469d6bfb | 464 | LOAD_NAME, |
va009039 | 0:65f1469d6bfb | 465 | BUILD_TUPLE, |
va009039 | 0:65f1469d6bfb | 466 | BUILD_LIST, |
va009039 | 0:65f1469d6bfb | 467 | BUILD_MAP, |
va009039 | 0:65f1469d6bfb | 468 | LOAD_ATTR, |
va009039 | 0:65f1469d6bfb | 469 | COMPARE_OP, |
va009039 | 0:65f1469d6bfb | 470 | IMPORT_NAME, |
va009039 | 0:65f1469d6bfb | 471 | IMPORT_FROM, |
va009039 | 0:65f1469d6bfb | 472 | UNUSED_6D, |
va009039 | 0:65f1469d6bfb | 473 | JUMP_FORWARD, /* d110 */ |
va009039 | 0:65f1469d6bfb | 474 | JUMP_IF_FALSE, |
va009039 | 0:65f1469d6bfb | 475 | JUMP_IF_TRUE, /* 0x70 */ |
va009039 | 0:65f1469d6bfb | 476 | JUMP_ABSOLUTE, |
va009039 | 0:65f1469d6bfb | 477 | UNUSED_72, |
va009039 | 0:65f1469d6bfb | 478 | UNUSED_73, |
va009039 | 0:65f1469d6bfb | 479 | LOAD_GLOBAL, |
va009039 | 0:65f1469d6bfb | 480 | UNUSED_75, |
va009039 | 0:65f1469d6bfb | 481 | UNUSED_76, |
va009039 | 0:65f1469d6bfb | 482 | CONTINUE_LOOP, |
va009039 | 0:65f1469d6bfb | 483 | SETUP_LOOP, /* d120 */ |
va009039 | 0:65f1469d6bfb | 484 | SETUP_EXCEPT, |
va009039 | 0:65f1469d6bfb | 485 | SETUP_FINALLY, |
va009039 | 0:65f1469d6bfb | 486 | UNUSED_7B, |
va009039 | 0:65f1469d6bfb | 487 | LOAD_FAST, |
va009039 | 0:65f1469d6bfb | 488 | STORE_FAST, |
va009039 | 0:65f1469d6bfb | 489 | DELETE_FAST, |
va009039 | 0:65f1469d6bfb | 490 | UNUSED_79, |
va009039 | 0:65f1469d6bfb | 491 | UNUSED_80, /* 0x80 */ |
va009039 | 0:65f1469d6bfb | 492 | UNUSED_81, |
va009039 | 0:65f1469d6bfb | 493 | RAISE_VARARGS, /* d130 */ |
va009039 | 0:65f1469d6bfb | 494 | CALL_FUNCTION, |
va009039 | 0:65f1469d6bfb | 495 | MAKE_FUNCTION, |
va009039 | 0:65f1469d6bfb | 496 | BUILD_SLICE, |
va009039 | 0:65f1469d6bfb | 497 | MAKE_CLOSURE, |
va009039 | 0:65f1469d6bfb | 498 | LOAD_CLOSURE, |
va009039 | 0:65f1469d6bfb | 499 | LOAD_DEREF, |
va009039 | 0:65f1469d6bfb | 500 | STORE_DEREF, |
va009039 | 0:65f1469d6bfb | 501 | UNUSED_8A, |
va009039 | 0:65f1469d6bfb | 502 | UNUSED_8B, |
va009039 | 0:65f1469d6bfb | 503 | CALL_FUNCTION_VAR, /* d140 */ |
va009039 | 0:65f1469d6bfb | 504 | CALL_FUNCTION_KW, |
va009039 | 0:65f1469d6bfb | 505 | CALL_FUNCTION_VAR_KW, |
va009039 | 0:65f1469d6bfb | 506 | EXTENDED_ARG, |
va009039 | 0:65f1469d6bfb | 507 | |
va009039 | 0:65f1469d6bfb | 508 | UNUSED_90, UNUSED_91, UNUSED_92, UNUSED_93, |
va009039 | 0:65f1469d6bfb | 509 | UNUSED_94, UNUSED_95, UNUSED_96, UNUSED_97, |
va009039 | 0:65f1469d6bfb | 510 | UNUSED_98, UNUSED_99, UNUSED_9A, UNUSED_9B, |
va009039 | 0:65f1469d6bfb | 511 | UNUSED_9C, UNUSED_9D, UNUSED_9E, UNUSED_9F, |
va009039 | 0:65f1469d6bfb | 512 | UNUSED_A0, UNUSED_A1, UNUSED_A2, UNUSED_A3, |
va009039 | 0:65f1469d6bfb | 513 | UNUSED_A4, UNUSED_A5, UNUSED_A6, UNUSED_A7, |
va009039 | 0:65f1469d6bfb | 514 | UNUSED_A8, UNUSED_A9, UNUSED_AA, UNUSED_AB, |
va009039 | 0:65f1469d6bfb | 515 | UNUSED_AC, UNUSED_AD, UNUSED_AE, UNUSED_AF, |
va009039 | 0:65f1469d6bfb | 516 | UNUSED_B0, UNUSED_B1, UNUSED_B2, UNUSED_B3, |
va009039 | 0:65f1469d6bfb | 517 | UNUSED_B4, UNUSED_B5, UNUSED_B6, UNUSED_B7, |
va009039 | 0:65f1469d6bfb | 518 | UNUSED_B8, UNUSED_B9, UNUSED_BA, UNUSED_BB, |
va009039 | 0:65f1469d6bfb | 519 | UNUSED_BC, UNUSED_BD, UNUSED_BE, UNUSED_BF, |
va009039 | 0:65f1469d6bfb | 520 | UNUSED_C0, UNUSED_C1, UNUSED_C2, UNUSED_C3, |
va009039 | 0:65f1469d6bfb | 521 | UNUSED_C4, UNUSED_C5, UNUSED_C6, UNUSED_C7, |
va009039 | 0:65f1469d6bfb | 522 | UNUSED_C8, UNUSED_C9, UNUSED_CA, UNUSED_CB, |
va009039 | 0:65f1469d6bfb | 523 | UNUSED_CC, UNUSED_CD, UNUSED_CE, UNUSED_CF, |
va009039 | 0:65f1469d6bfb | 524 | UNUSED_D0, UNUSED_D1, UNUSED_D2, UNUSED_D3, |
va009039 | 0:65f1469d6bfb | 525 | UNUSED_D4, UNUSED_D5, UNUSED_D6, UNUSED_D7, |
va009039 | 0:65f1469d6bfb | 526 | UNUSED_D8, UNUSED_D9, UNUSED_DA, UNUSED_DB, |
va009039 | 0:65f1469d6bfb | 527 | UNUSED_DC, UNUSED_DD, UNUSED_DE, UNUSED_DF, |
va009039 | 0:65f1469d6bfb | 528 | UNUSED_E0, UNUSED_E1, UNUSED_E2, UNUSED_E3, |
va009039 | 0:65f1469d6bfb | 529 | UNUSED_E4, UNUSED_E5, UNUSED_E6, UNUSED_E7, |
va009039 | 0:65f1469d6bfb | 530 | UNUSED_E8, UNUSED_E9, UNUSED_EA, UNUSED_EB, |
va009039 | 0:65f1469d6bfb | 531 | UNUSED_EC, UNUSED_ED, UNUSED_EE, UNUSED_EF, |
va009039 | 0:65f1469d6bfb | 532 | UNUSED_F0, UNUSED_F1, UNUSED_F2, UNUSED_F3, |
va009039 | 0:65f1469d6bfb | 533 | UNUSED_F4, UNUSED_F5, UNUSED_F6, UNUSED_F7, |
va009039 | 0:65f1469d6bfb | 534 | UNUSED_F8, UNUSED_F9, UNUSED_FA, UNUSED_FB, |
va009039 | 0:65f1469d6bfb | 535 | UNUSED_FC, UNUSED_FD, UNUSED_FE, UNUSED_FF |
va009039 | 1:28afb064a41c | 536 | #endif /* HAVE_PYTHON27 */ |
va009039 | 0:65f1469d6bfb | 537 | } PmBcode_t, *pPmBcode_t; |
va009039 | 0:65f1469d6bfb | 538 | |
va009039 | 0:65f1469d6bfb | 539 | |
va009039 | 0:65f1469d6bfb | 540 | /** |
va009039 | 0:65f1469d6bfb | 541 | * Interprets the available threads. Does not return. |
va009039 | 0:65f1469d6bfb | 542 | * |
va009039 | 0:65f1469d6bfb | 543 | * @param returnOnNoThreads Loop forever if 0, exit with status if no more |
va009039 | 0:65f1469d6bfb | 544 | * threads left. |
va009039 | 0:65f1469d6bfb | 545 | * @return Return status if called with returnOnNoThreads != 0, |
va009039 | 0:65f1469d6bfb | 546 | * will not return otherwise. |
va009039 | 0:65f1469d6bfb | 547 | */ |
va009039 | 0:65f1469d6bfb | 548 | PmReturn_t interpret(const uint8_t returnOnNoThreads); |
va009039 | 0:65f1469d6bfb | 549 | |
va009039 | 0:65f1469d6bfb | 550 | /** |
va009039 | 0:65f1469d6bfb | 551 | * Selects a thread to run and changes the VM internal variables to |
va009039 | 0:65f1469d6bfb | 552 | * let the switch-loop execute the chosen one in the next iteration. |
va009039 | 0:65f1469d6bfb | 553 | * For the moment the algorithm is primitive and will change the |
va009039 | 0:65f1469d6bfb | 554 | * thread each time it is called in a round-robin fashion. |
va009039 | 0:65f1469d6bfb | 555 | */ |
va009039 | 0:65f1469d6bfb | 556 | PmReturn_t interp_reschedule(void); |
va009039 | 0:65f1469d6bfb | 557 | |
va009039 | 0:65f1469d6bfb | 558 | /** |
va009039 | 0:65f1469d6bfb | 559 | * Creates a thread object and adds it to the queue of threads to be |
va009039 | 0:65f1469d6bfb | 560 | * executed while interpret() is running. |
va009039 | 0:65f1469d6bfb | 561 | * |
va009039 | 0:65f1469d6bfb | 562 | * The given obj may be a function, module, or class. |
va009039 | 0:65f1469d6bfb | 563 | * Creates a frame for the given function. |
va009039 | 0:65f1469d6bfb | 564 | * |
va009039 | 0:65f1469d6bfb | 565 | * @param pfunc Ptr to function to be executed as a thread. |
va009039 | 0:65f1469d6bfb | 566 | * @return Return status |
va009039 | 0:65f1469d6bfb | 567 | */ |
va009039 | 0:65f1469d6bfb | 568 | PmReturn_t interp_addThread(pPmFunc_t pfunc); |
va009039 | 0:65f1469d6bfb | 569 | |
va009039 | 0:65f1469d6bfb | 570 | /** |
va009039 | 0:65f1469d6bfb | 571 | * Sets the reschedule flag. |
va009039 | 0:65f1469d6bfb | 572 | * |
va009039 | 0:65f1469d6bfb | 573 | * @param boolean Reschedule on next occasion if boolean is true; clear |
va009039 | 0:65f1469d6bfb | 574 | * the flag otherwise. |
va009039 | 0:65f1469d6bfb | 575 | */ |
va009039 | 0:65f1469d6bfb | 576 | void interp_setRescheduleFlag(uint8_t boolean); |
va009039 | 0:65f1469d6bfb | 577 | |
va009039 | 0:65f1469d6bfb | 578 | #endif /* __INTERP_H__ */ |