Numworks Epsilon  1.4.1
Graphing Calculator Operating System
runtime0.h
Go to the documentation of this file.
1 /*
2  * This file is part of the MicroPython project, http://micropython.org/
3  *
4  * The MIT License (MIT)
5  *
6  * Copyright (c) 2013, 2014 Damien P. George
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a copy
9  * of this software and associated documentation files (the "Software"), to deal
10  * in the Software without restriction, including without limitation the rights
11  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12  * copies of the Software, and to permit persons to whom the Software is
13  * furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24  * THE SOFTWARE.
25  */
26 #ifndef MICROPY_INCLUDED_PY_RUNTIME0_H
27 #define MICROPY_INCLUDED_PY_RUNTIME0_H
28 
29 // These must fit in 8 bits; see scope.h
30 #define MP_SCOPE_FLAG_VARARGS (0x01)
31 #define MP_SCOPE_FLAG_VARKEYWORDS (0x02)
32 #define MP_SCOPE_FLAG_GENERATOR (0x04)
33 #define MP_SCOPE_FLAG_DEFKWARGS (0x08)
34 
35 // types for native (viper) function signature
36 #define MP_NATIVE_TYPE_OBJ (0x00)
37 #define MP_NATIVE_TYPE_BOOL (0x01)
38 #define MP_NATIVE_TYPE_INT (0x02)
39 #define MP_NATIVE_TYPE_UINT (0x03)
40 #define MP_NATIVE_TYPE_PTR (0x04)
41 #define MP_NATIVE_TYPE_PTR8 (0x05)
42 #define MP_NATIVE_TYPE_PTR16 (0x06)
43 #define MP_NATIVE_TYPE_PTR32 (0x07)
44 
45 typedef enum {
46  // These ops may appear in the bytecode. Changing this group
47  // in any way requires changing the bytecode version.
52 
53  // Following ops cannot appear in the bytecode
55 
57  MP_UNARY_OP_LEN, // __len__
58  MP_UNARY_OP_HASH, // __hash__; must return a small int
59  MP_UNARY_OP_ABS, // __abs__
60  MP_UNARY_OP_SIZEOF, // for sys.getsizeof()
61 
64 
65 // Note: the first 9+12+12 of these are used in bytecode and changing
66 // them requires changing the bytecode version.
67 typedef enum {
68  // 9 relational operations, should return a bool
78 
79  // 12 inplace arithmetic operations
92 
93  // 12 normal arithmetic operations
106 
107  // Operations below this line don't appear in bytecode, they
108  // just identify special methods.
110 
111  // MP_BINARY_OP_REVERSE_* must follow immediately after MP_BINARY_OP_*
112 #if MICROPY_PY_REVERSE_SPECIAL_METHODS
113  MP_BINARY_OP_REVERSE_OR = MP_BINARY_OP_NUM_BYTECODE,
114  MP_BINARY_OP_REVERSE_XOR,
115  MP_BINARY_OP_REVERSE_AND,
116  MP_BINARY_OP_REVERSE_LSHIFT,
117  MP_BINARY_OP_REVERSE_RSHIFT,
118  MP_BINARY_OP_REVERSE_ADD,
119  MP_BINARY_OP_REVERSE_SUBTRACT,
120  MP_BINARY_OP_REVERSE_MULTIPLY,
121  MP_BINARY_OP_REVERSE_FLOOR_DIVIDE,
122  MP_BINARY_OP_REVERSE_TRUE_DIVIDE,
123  MP_BINARY_OP_REVERSE_MODULO,
124  MP_BINARY_OP_REVERSE_POWER,
125 #endif
126 
127  // This is not emitted by the compiler but is supported by the runtime
129  #if !MICROPY_PY_REVERSE_SPECIAL_METHODS
131  #endif
132  ,
133 
135 
136  // These 2 are not supported by the runtime and must be synthesised by the emitter
140 
141 typedef enum {
162 #if MICROPY_PY_BUILTINS_SET
163  MP_F_BUILD_SET,
164  MP_F_STORE_SET,
165 #endif
178 #if MICROPY_PY_BUILTINS_SLICE
179  MP_F_NEW_SLICE,
180 #endif
191 } mp_fun_kind_t;
192 
193 extern void *const mp_fun_table[MP_F_NUMBER_OF];
194 
195 #endif // MICROPY_INCLUDED_PY_RUNTIME0_H
mp_unary_op_t
Definition: runtime0.h:45
mp_fun_kind_t
Definition: runtime0.h:141
mp_binary_op_t
Definition: runtime0.h:67
void *const mp_fun_table[MP_F_NUMBER_OF]