py: Move to guarded includes, everywhere in py/ core.
Addresses issue #1022.
This commit is contained in:
parent
db1ac360c3
commit
51dfcb4bb7
@ -27,12 +27,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
void mp_arg_check_num(mp_uint_t n_args, mp_uint_t n_kw, mp_uint_t n_args_min, mp_uint_t n_args_max, bool takes_kw) {
|
||||
// TODO maybe take the function name as an argument so we can print nicer error messages
|
||||
|
@ -29,13 +29,13 @@
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "asmarm.h"
|
||||
#include "py/mpconfig.h"
|
||||
|
||||
// wrapper around everything in this file
|
||||
#if MICROPY_EMIT_ARM
|
||||
|
||||
#include "py/asmarm.h"
|
||||
|
||||
#define SIGNED_FIT24(x) (((x) & 0xff800000) == 0) || (((x) & 0xff000000) == 0xff000000)
|
||||
|
||||
struct _asm_arm_t {
|
||||
|
@ -28,13 +28,13 @@
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "asmthumb.h"
|
||||
#include "py/mpconfig.h"
|
||||
|
||||
// wrapper around everything in this file
|
||||
#if MICROPY_EMIT_THUMB || MICROPY_EMIT_INLINE_THUMB
|
||||
|
||||
#include "py/asmthumb.h"
|
||||
|
||||
#define UNSIGNED_FIT8(x) (((x) & 0xffffff00) == 0)
|
||||
#define UNSIGNED_FIT16(x) (((x) & 0xffff0000) == 0)
|
||||
#define SIGNED_FIT8(x) (((x) & 0xffffff80) == 0) || (((x) & 0xffffff80) == 0xffffff80)
|
||||
|
@ -29,13 +29,12 @@
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "py/mpconfig.h"
|
||||
|
||||
// wrapper around everything in this file
|
||||
#if MICROPY_EMIT_X64
|
||||
|
||||
#include "asmx64.h"
|
||||
#include "py/asmx64.h"
|
||||
|
||||
/* all offsets are measured in multiples of 8 bytes */
|
||||
#define WORD_SIZE (8)
|
||||
|
@ -29,13 +29,12 @@
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "py/mpconfig.h"
|
||||
|
||||
// wrapper around everything in this file
|
||||
#if MICROPY_EMIT_X86
|
||||
|
||||
#include "asmx86.h"
|
||||
#include "py/asmx86.h"
|
||||
|
||||
/* all offsets are measured in multiples of 4 bytes */
|
||||
#define WORD_SIZE (4)
|
||||
|
14
py/bc.c
14
py/bc.c
@ -29,17 +29,9 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "objtuple.h"
|
||||
#include "objfun.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "bc.h"
|
||||
#include "stackctrl.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/objfun.h"
|
||||
#include "py/bc.h"
|
||||
|
||||
#if 0 // print debugging info
|
||||
#define DEBUG_PRINT (1)
|
||||
|
7
py/bc.h
7
py/bc.h
@ -23,6 +23,11 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __MICROPY_INCLUDED_PY_BC_H__
|
||||
#define __MICROPY_INCLUDED_PY_BC_H__
|
||||
|
||||
#include "py/runtime.h"
|
||||
#include "py/obj.h"
|
||||
|
||||
// Exception stack entry
|
||||
typedef struct _mp_exc_stack {
|
||||
@ -61,3 +66,5 @@ const byte *mp_bytecode_print_str(const byte *ip);
|
||||
#define MP_TAGPTR_TAG0(x) ((mp_uint_t)(x) & 1)
|
||||
#define MP_TAGPTR_TAG1(x) ((mp_uint_t)(x) & 2)
|
||||
#define MP_TAGPTR_MAKE(ptr, tag) ((void*)((mp_uint_t)(ptr) | (tag)))
|
||||
|
||||
#endif // __MICROPY_INCLUDED_PY_BC_H__
|
||||
|
4
py/bc0.h
4
py/bc0.h
@ -23,6 +23,8 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __MICROPY_INCLUDED_PY_BC0_H__
|
||||
#define __MICROPY_INCLUDED_PY_BC0_H__
|
||||
|
||||
// Micro Python byte-codes.
|
||||
// The comment at the end of the line (if it exists) tells the arguments to the byte-code.
|
||||
@ -118,3 +120,5 @@
|
||||
#define MP_BC_STORE_FAST_MULTI (0xc0) // + N(16)
|
||||
#define MP_BC_UNARY_OP_MULTI (0xd0) // + op(5)
|
||||
#define MP_BC_BINARY_OP_MULTI (0xd5) // + op(35)
|
||||
|
||||
#endif // __MICROPY_INCLUDED_PY_BC0_H__
|
||||
|
@ -30,12 +30,8 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "smallint.h"
|
||||
#include "binary.h"
|
||||
#include "py/binary.h"
|
||||
#include "py/smallint.h"
|
||||
|
||||
// Helpers to work with binary-encoded data
|
||||
|
||||
|
@ -23,6 +23,10 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __MICROPY_INCLUDED_PY_BINARY_H__
|
||||
#define __MICROPY_INCLUDED_PY_BINARY_H__
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
// Use special typecode to differentiate repr() of bytearray vs array.array('B')
|
||||
// (underlyingly they're same).
|
||||
@ -36,3 +40,5 @@ mp_obj_t mp_binary_get_val(char struct_type, char val_type, byte **ptr);
|
||||
void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte **ptr);
|
||||
long long mp_binary_get_int(mp_uint_t size, bool is_signed, bool big_endian, const byte *src);
|
||||
void mp_binary_set_int(mp_uint_t val_sz, bool big_endian, byte *dest, mp_uint_t val);
|
||||
|
||||
#endif // __MICROPY_INCLUDED_PY_BINARY_H__
|
||||
|
@ -23,6 +23,10 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __MICROPY_INCLUDED_PY_BUILTIN_H__
|
||||
#define __MICROPY_INCLUDED_PY_BUILTIN_H__
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
mp_obj_t mp_builtin___import__(mp_uint_t n_args, const mp_obj_t *args);
|
||||
mp_obj_t mp_builtin_open(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs);
|
||||
@ -101,3 +105,5 @@ extern const mp_obj_module_t mp_module_ure;
|
||||
extern const mp_obj_module_t mp_module_uheapq;
|
||||
extern const mp_obj_module_t mp_module_uhashlib;
|
||||
extern const mp_obj_module_t mp_module_ubinascii;
|
||||
|
||||
#endif // __MICROPY_INCLUDED_PY_BUILTIN_H__
|
||||
|
@ -26,20 +26,11 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "lexer.h"
|
||||
#include "lexerunix.h"
|
||||
#include "parse.h"
|
||||
#include "obj.h"
|
||||
#include "objfun.h"
|
||||
#include "parsehelper.h"
|
||||
#include "compile.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "builtin.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/objfun.h"
|
||||
#include "py/compile.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/builtin.h"
|
||||
|
||||
#if MICROPY_PY_BUILTINS_COMPILE
|
||||
|
||||
|
@ -25,25 +25,15 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "lexer.h"
|
||||
#include "lexerunix.h"
|
||||
#include "parse.h"
|
||||
#include "obj.h"
|
||||
#include "objmodule.h"
|
||||
#include "parsehelper.h"
|
||||
#include "compile.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "builtin.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/compile.h"
|
||||
#include "py/objmodule.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/builtin.h"
|
||||
|
||||
#if 0 // print debugging info
|
||||
#define DEBUG_PRINT (1)
|
||||
|
24
py/compile.c
24
py/compile.c
@ -31,26 +31,18 @@
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "lexer.h"
|
||||
#include "parse.h"
|
||||
#include "runtime0.h"
|
||||
#include "obj.h"
|
||||
#include "emitglue.h"
|
||||
#include "scope.h"
|
||||
#include "emit.h"
|
||||
#include "compile.h"
|
||||
#include "runtime.h"
|
||||
#include "builtin.h"
|
||||
#include "smallint.h"
|
||||
#include "py/scope.h"
|
||||
#include "py/emit.h"
|
||||
#include "py/compile.h"
|
||||
#include "py/smallint.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/builtin.h"
|
||||
|
||||
// TODO need to mangle __attr names
|
||||
|
||||
typedef enum {
|
||||
#define DEF_RULE(rule, comp, kind, ...) PN_##rule,
|
||||
#include "grammar.h"
|
||||
#include "py/grammar.h"
|
||||
#undef DEF_RULE
|
||||
PN_maximum_number_of,
|
||||
PN_string, // special node for non-interned string
|
||||
@ -2937,7 +2929,7 @@ STATIC compile_function_t compile_function[] = {
|
||||
#define nc NULL
|
||||
#define c(f) compile_##f
|
||||
#define DEF_RULE(rule, comp, kind, ...) comp,
|
||||
#include "grammar.h"
|
||||
#include "py/grammar.h"
|
||||
#undef nc
|
||||
#undef c
|
||||
#undef DEF_RULE
|
||||
|
11
py/emit.h
11
py/emit.h
@ -24,6 +24,13 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __MICROPY_INCLUDED_PY_EMIT_H__
|
||||
#define __MICROPY_INCLUDED_PY_EMIT_H__
|
||||
|
||||
#include "py/lexer.h"
|
||||
#include "py/scope.h"
|
||||
#include "py/runtime0.h"
|
||||
|
||||
/* Notes on passes:
|
||||
* We don't know exactly the opcodes in pass 1 because they depend on the
|
||||
* closing over of variables (LOAD_CLOSURE, BUILD_TUPLE, MAKE_CLOSURE), which
|
||||
@ -33,10 +40,6 @@
|
||||
* This is problematic for some emitters (x64) since they need to know the maximum
|
||||
* stack size to compile the entry to the function, and this affects code size.
|
||||
*/
|
||||
#ifndef __MICROPY_INCLUDED_PY_EMIT_H__
|
||||
#define __MICROPY_INCLUDED_PY_EMIT_H__
|
||||
|
||||
#include "py/runtime0.h"
|
||||
|
||||
typedef enum {
|
||||
MP_PASS_SCOPE = 1, // work out id's and their kind, and number of labels
|
||||
|
13
py/emitbc.c
13
py/emitbc.c
@ -30,17 +30,8 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "lexer.h"
|
||||
#include "parse.h"
|
||||
#include "obj.h"
|
||||
#include "emitglue.h"
|
||||
#include "scope.h"
|
||||
#include "runtime0.h"
|
||||
#include "emit.h"
|
||||
#include "bc0.h"
|
||||
#include "py/emit.h"
|
||||
#include "py/bc0.h"
|
||||
|
||||
#if !MICROPY_EMIT_CPYTHON
|
||||
|
||||
|
@ -28,16 +28,7 @@
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "lexer.h"
|
||||
#include "parse.h"
|
||||
#include "runtime0.h"
|
||||
#include "obj.h"
|
||||
#include "emitglue.h"
|
||||
#include "scope.h"
|
||||
#include "emit.h"
|
||||
#include "py/emit.h"
|
||||
|
||||
#define EMIT(fun, ...) (emit_method_table->fun(emit, __VA_ARGS__))
|
||||
|
||||
|
11
py/emitcpy.c
11
py/emitcpy.c
@ -30,16 +30,7 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "lexer.h"
|
||||
#include "parse.h"
|
||||
#include "obj.h"
|
||||
#include "emitglue.h"
|
||||
#include "scope.h"
|
||||
#include "runtime0.h"
|
||||
#include "emit.h"
|
||||
#include "py/emit.h"
|
||||
|
||||
// wrapper around everything in this file
|
||||
#if MICROPY_EMIT_CPYTHON
|
||||
|
@ -30,14 +30,9 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "emitglue.h"
|
||||
#include "bc.h"
|
||||
#include "py/emitglue.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/bc.h"
|
||||
|
||||
#if 0 // print debugging info
|
||||
#define DEBUG_PRINT (1)
|
||||
|
@ -26,6 +26,8 @@
|
||||
#ifndef __MICROPY_INCLUDED_PY_EMITGLUE_H__
|
||||
#define __MICROPY_INCLUDED_PY_EMITGLUE_H__
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
// These variables and functions glue the code emitters to the runtime.
|
||||
|
||||
typedef enum {
|
||||
|
@ -30,23 +30,14 @@
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "lexer.h"
|
||||
#include "parse.h"
|
||||
#include "obj.h"
|
||||
#include "emitglue.h"
|
||||
#include "scope.h"
|
||||
#include "runtime0.h"
|
||||
#include "emit.h"
|
||||
#include "asmthumb.h"
|
||||
#include "py/emit.h"
|
||||
#include "py/asmthumb.h"
|
||||
|
||||
#if MICROPY_EMIT_INLINE_THUMB
|
||||
|
||||
typedef enum {
|
||||
#define DEF_RULE(rule, comp, kind, ...) PN_##rule,
|
||||
#include "grammar.h"
|
||||
#include "py/grammar.h"
|
||||
#undef DEF_RULE
|
||||
PN_maximum_number_of,
|
||||
} pn_kind_t;
|
||||
|
@ -42,24 +42,12 @@
|
||||
|
||||
// for x in l[0:8]: can be compiled into a native loop if l has pointer type
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "lexer.h"
|
||||
#include "parse.h"
|
||||
#include "obj.h"
|
||||
#include "emitglue.h"
|
||||
#include "scope.h"
|
||||
#include "runtime0.h"
|
||||
#include "emit.h"
|
||||
#include "runtime.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/emit.h"
|
||||
|
||||
#if 0 // print debugging info
|
||||
#define DEBUG_PRINT (1)
|
||||
@ -78,7 +66,7 @@
|
||||
|
||||
// x64 specific stuff
|
||||
|
||||
#include "asmx64.h"
|
||||
#include "py/asmx64.h"
|
||||
|
||||
#define EXPORT_FUN(name) emit_native_x64_##name
|
||||
|
||||
@ -163,7 +151,7 @@
|
||||
|
||||
// x86 specific stuff
|
||||
|
||||
#include "asmx86.h"
|
||||
#include "py/asmx86.h"
|
||||
|
||||
STATIC byte mp_f_n_args[MP_F_NUMBER_OF] = {
|
||||
[MP_F_CONVERT_OBJ_TO_NATIVE] = 2,
|
||||
@ -295,7 +283,7 @@ STATIC byte mp_f_n_args[MP_F_NUMBER_OF] = {
|
||||
|
||||
// thumb specific stuff
|
||||
|
||||
#include "asmthumb.h"
|
||||
#include "py/asmthumb.h"
|
||||
|
||||
#define EXPORT_FUN(name) emit_native_thumb_##name
|
||||
|
||||
@ -378,7 +366,7 @@ STATIC byte mp_f_n_args[MP_F_NUMBER_OF] = {
|
||||
|
||||
// ARM specific stuff
|
||||
|
||||
#include "asmarm.h"
|
||||
#include "py/asmarm.h"
|
||||
|
||||
#define EXPORT_FUN(name) emit_native_arm_##name
|
||||
|
||||
|
@ -24,20 +24,9 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "lexer.h"
|
||||
#include "parse.h"
|
||||
#include "obj.h"
|
||||
#include "emitglue.h"
|
||||
#include "scope.h"
|
||||
#include "runtime0.h"
|
||||
#include "emit.h"
|
||||
#include "py/emit.h"
|
||||
|
||||
struct _emit_t {
|
||||
scope_t *scope;
|
||||
|
@ -42,10 +42,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "py/mpconfig.h"
|
||||
|
||||
#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
|
||||
#include "formatfloat.h"
|
||||
|
||||
#include "py/formatfloat.h"
|
||||
|
||||
// 1 sign bit, 8 exponent bits, and 23 mantissa bits.
|
||||
// exponent values 0 and 255 are reserved, exponent can be 1 to 254.
|
||||
@ -63,7 +64,7 @@ static const float g_neg_pow[] = {
|
||||
1e-32, 1e-16, 1e-8, 1e-4, 1e-2, 1e-1
|
||||
};
|
||||
|
||||
int format_float(float f, char *buf, size_t buf_size, char fmt, int prec, char sign) {
|
||||
int mp_format_float(float f, char *buf, size_t buf_size, char fmt, int prec, char sign) {
|
||||
|
||||
char *s = buf;
|
||||
int buf_remaining = buf_size - 1;
|
||||
|
@ -23,5 +23,9 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __MICROPY_INCLUDED_PY_FORMATFLOAT_H__
|
||||
#define __MICROPY_INCLUDED_PY_FORMATFLOAT_H__
|
||||
|
||||
int format_float(float f, char *buf, size_t bufSize, char fmt, int prec, char sign);
|
||||
int mp_format_float(float f, char *buf, size_t bufSize, char fmt, int prec, char sign);
|
||||
|
||||
#endif // __MICROPY_INCLUDED_PY_FORMATFLOAT_H__
|
||||
|
12
py/gc.c
12
py/gc.c
@ -27,16 +27,10 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "gc.h"
|
||||
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime.h"
|
||||
#include "py/gc.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#if MICROPY_ENABLE_GC
|
||||
|
||||
|
9
py/gc.h
9
py/gc.h
@ -23,6 +23,13 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __MICROPY_INCLUDED_PY_GC_H__
|
||||
#define __MICROPY_INCLUDED_PY_GC_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include "py/misc.h"
|
||||
|
||||
void gc_init(void *start, void *end);
|
||||
|
||||
@ -60,3 +67,5 @@ typedef struct _gc_info_t {
|
||||
void gc_info(gc_info_t *info);
|
||||
void gc_dump_info(void);
|
||||
void gc_dump_alloc_table(void);
|
||||
|
||||
#endif // __MICROPY_INCLUDED_PY_GC_H__
|
||||
|
10
py/lexer.c
10
py/lexer.c
@ -24,18 +24,10 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* lexer.c -- simple tokeniser for Python implementation
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "lexer.h"
|
||||
#include "py/lexer.h"
|
||||
|
||||
#define TAB_SIZE (8)
|
||||
|
||||
|
@ -26,6 +26,11 @@
|
||||
#ifndef __MICROPY_INCLUDED_PY_LEXER_H__
|
||||
#define __MICROPY_INCLUDED_PY_LEXER_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include "py/qstr.h"
|
||||
|
||||
/* lexer.h -- simple tokeniser for Micro Python
|
||||
*
|
||||
* Uses (byte) length instead of null termination.
|
||||
|
@ -24,12 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "lexer.h"
|
||||
#include "py/lexer.h"
|
||||
|
||||
typedef struct _mp_lexer_str_buf_t {
|
||||
mp_uint_t free_len; // if > 0, src_beg will be freed when done by: m_free(src_beg, free_len)
|
||||
|
@ -24,8 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "py/mpconfig.h"
|
||||
|
||||
#if MICROPY_HELPER_LEXER_UNIX
|
||||
|
||||
@ -36,9 +35,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "qstr.h"
|
||||
#include "lexer.h"
|
||||
#include "lexerunix.h"
|
||||
#include "py/lexer.h"
|
||||
|
||||
typedef struct _mp_lexer_file_buf_t {
|
||||
int fd;
|
||||
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013, 2014 Damien P. George
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
mp_lexer_t *mp_lexer_new_from_file(const char *filename);
|
||||
|
||||
void mp_import_set_directory(const char *dir);
|
@ -27,10 +27,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "py/mpconfig.h"
|
||||
#include "py/misc.h"
|
||||
|
||||
#if 0 // print debugging info
|
||||
#define DEBUG_printf DEBUG_printf
|
||||
@ -47,7 +46,7 @@ STATIC size_t peak_bytes_allocated = 0;
|
||||
#endif
|
||||
|
||||
#if MICROPY_ENABLE_GC
|
||||
#include "gc.h"
|
||||
#include "py/gc.h"
|
||||
|
||||
// We redirect standard alloc functions to GC heap - just for the rest of
|
||||
// this module. In the rest of micropython source, system malloc can be
|
||||
|
8
py/map.c
8
py/map.c
@ -28,11 +28,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime0.h"
|
||||
#include "py/mpconfig.h"
|
||||
#include "py/misc.h"
|
||||
#include "py/obj.h"
|
||||
|
||||
// Fixed empty map. Useful when need to call kw-receiving functions
|
||||
// without any keywords from C, etc.
|
||||
|
@ -24,11 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "builtin.h"
|
||||
#include "py/builtin.h"
|
||||
|
||||
#if MICROPY_PY_ARRAY
|
||||
|
||||
|
@ -27,18 +27,14 @@
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "objstr.h"
|
||||
#include "smallint.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "builtin.h"
|
||||
#include "stream.h"
|
||||
#include "pfenv.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/smallint.h"
|
||||
#include "py/objstr.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/builtin.h"
|
||||
#include "py/stream.h"
|
||||
#include "py/pfenv.h"
|
||||
|
||||
#if MICROPY_PY_BUILTINS_FLOAT
|
||||
#include <math.h>
|
||||
|
@ -24,16 +24,12 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "builtin.h"
|
||||
#include "py/builtin.h"
|
||||
|
||||
#if MICROPY_PY_BUILTINS_FLOAT && MICROPY_PY_CMATH
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/// \module cmath - mathematical functions for complex numbers
|
||||
///
|
||||
/// The `cmath` module provides some basic mathematical funtions for
|
||||
|
@ -24,11 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "builtin.h"
|
||||
#include "py/builtin.h"
|
||||
|
||||
#if MICROPY_PY_COLLECTIONS
|
||||
|
||||
|
10
py/modgc.c
10
py/modgc.c
@ -24,14 +24,8 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime.h"
|
||||
#include "gc.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/gc.h"
|
||||
|
||||
#if MICROPY_PY_GC && MICROPY_ENABLE_GC
|
||||
|
||||
|
@ -24,11 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "builtin.h"
|
||||
#include "py/builtin.h"
|
||||
|
||||
#if MICROPY_PY_IO
|
||||
|
||||
|
10
py/modmath.c
10
py/modmath.c
@ -24,16 +24,12 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "builtin.h"
|
||||
#include "py/builtin.h"
|
||||
|
||||
#if MICROPY_PY_BUILTINS_FLOAT && MICROPY_PY_MATH
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/// \module math - mathematical functions
|
||||
///
|
||||
/// The `math` module provides some basic mathematical funtions for
|
||||
|
@ -24,15 +24,11 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "builtin.h"
|
||||
#include "stackctrl.h"
|
||||
#include "gc.h"
|
||||
|
||||
#include "py/builtin.h"
|
||||
#include "py/stackctrl.h"
|
||||
#include "py/gc.h"
|
||||
|
||||
// Various builtins specific to MicroPython runtime,
|
||||
// living in micropython module
|
||||
|
@ -27,15 +27,11 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "builtin.h"
|
||||
#include "objtuple.h"
|
||||
#include "objstr.h"
|
||||
#include "binary.h"
|
||||
#include "parsenum.h"
|
||||
|
||||
#include "py/builtin.h"
|
||||
#include "py/objtuple.h"
|
||||
#include "py/binary.h"
|
||||
#include "py/parsenum.h"
|
||||
|
||||
#if MICROPY_PY_STRUCT
|
||||
|
||||
|
24
py/modsys.c
24
py/modsys.c
@ -24,22 +24,14 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "builtin.h"
|
||||
#include "runtime.h"
|
||||
#include "objlist.h"
|
||||
#include "objtuple.h"
|
||||
#include "objstr.h"
|
||||
#include "mpz.h"
|
||||
#include "objint.h"
|
||||
#include "pfenv.h"
|
||||
#include "stream.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/builtin.h"
|
||||
#include "py/objlist.h"
|
||||
#include "py/objtuple.h"
|
||||
#include "py/objstr.h"
|
||||
#include "py/objint.h"
|
||||
#include "py/pfenv.h"
|
||||
#include "py/stream.h"
|
||||
|
||||
#if MICROPY_PY_SYS
|
||||
|
||||
|
7
py/mpz.c
7
py/mpz.c
@ -24,15 +24,10 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "mpz.h"
|
||||
#include "py/mpz.h"
|
||||
|
||||
#if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_MPZ
|
||||
|
||||
|
9
py/mpz.h
9
py/mpz.h
@ -23,6 +23,13 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __MICROPY_INCLUDED_PY_MPZ_H__
|
||||
#define __MICROPY_INCLUDED_PY_MPZ_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include "py/misc.h"
|
||||
|
||||
// This mpz module implements arbitrary precision integers.
|
||||
//
|
||||
@ -131,3 +138,5 @@ mp_float_t mpz_as_float(const mpz_t *z);
|
||||
#endif
|
||||
mp_uint_t mpz_as_str_size(const mpz_t *i, mp_uint_t base, const char *prefix, char comma);
|
||||
mp_uint_t mpz_as_str_inpl(const mpz_t *z, mp_uint_t base, const char *prefix, char base_char, char comma, char *str);
|
||||
|
||||
#endif // __MICROPY_INCLUDED_PY_MPZ_H__
|
||||
|
@ -28,14 +28,10 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "emitglue.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/emitglue.h"
|
||||
|
||||
#if MICROPY_EMIT_NATIVE
|
||||
|
||||
|
6
py/nlr.h
6
py/nlr.h
@ -23,6 +23,8 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __MICROPY_INCLUDED_PY_NLR_H__
|
||||
#define __MICROPY_INCLUDED_PY_NLR_H__
|
||||
|
||||
// non-local return
|
||||
// exception handling, basically a stack of setjmp/longjmp buffers
|
||||
@ -31,6 +33,8 @@
|
||||
#include <setjmp.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
|
||||
typedef struct _nlr_buf_t nlr_buf_t;
|
||||
struct _nlr_buf_t {
|
||||
// the entries here must all be machine word size
|
||||
@ -91,3 +95,5 @@ void nlr_jump_fail(void *val);
|
||||
nlr_jump(_val); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#endif // __MICROPY_INCLUDED_PY_NLR_H__
|
||||
|
@ -24,10 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <setjmp.h>
|
||||
#include <stdio.h>
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "py/nlr.h"
|
||||
|
||||
#if MICROPY_NLR_SETJMP
|
||||
|
||||
|
18
py/obj.c
18
py/obj.c
@ -29,17 +29,13 @@
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "objtype.h"
|
||||
#include "mpz.h"
|
||||
#include "objint.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "stackctrl.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/objtype.h"
|
||||
#include "py/objint.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/stackctrl.h"
|
||||
|
||||
mp_obj_type_t *mp_obj_get_type(mp_const_obj_t o_in) {
|
||||
if (MP_OBJ_IS_SMALL_INT(o_in)) {
|
||||
|
@ -29,14 +29,10 @@
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "binary.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/binary.h"
|
||||
|
||||
#if MICROPY_PY_ARRAY || MICROPY_PY_BUILTINS_BYTEARRAY || MICROPY_PY_BUILTINS_MEMORYVIEW
|
||||
|
||||
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013, 2014 Damien P. George
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
mp_obj_t mp_obj_new_bytearray(mp_uint_t n, void *items);
|
10
py/objbool.c
10
py/objbool.c
@ -26,13 +26,9 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
typedef struct _mp_obj_bool_t {
|
||||
mp_obj_base_t base;
|
||||
|
@ -26,12 +26,8 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
typedef struct _mp_obj_bound_meth_t {
|
||||
mp_obj_base_t base;
|
||||
|
@ -24,12 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime.h"
|
||||
#include "py/obj.h"
|
||||
|
||||
typedef struct _mp_obj_cell_t {
|
||||
mp_obj_base_t base;
|
||||
|
@ -26,13 +26,8 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "objtuple.h"
|
||||
#include "runtime.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
typedef struct _mp_obj_closure_t {
|
||||
mp_obj_base_t base;
|
||||
|
@ -28,21 +28,18 @@
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "parsenum.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/parsenum.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#if MICROPY_PY_BUILTINS_COMPLEX
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
|
||||
#include "formatfloat.h"
|
||||
#include "py/formatfloat.h"
|
||||
#endif
|
||||
|
||||
typedef struct _mp_obj_complex_t {
|
||||
@ -58,12 +55,12 @@ STATIC void complex_print(void (*print)(void *env, const char *fmt, ...), void *
|
||||
#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
|
||||
char buf[16];
|
||||
if (o->real == 0) {
|
||||
format_float(o->imag, buf, sizeof(buf), 'g', 7, '\0');
|
||||
mp_format_float(o->imag, buf, sizeof(buf), 'g', 7, '\0');
|
||||
print(env, "%sj", buf);
|
||||
} else {
|
||||
format_float(o->real, buf, sizeof(buf), 'g', 7, '\0');
|
||||
mp_format_float(o->real, buf, sizeof(buf), 'g', 7, '\0');
|
||||
print(env, "(%s+", buf);
|
||||
format_float(o->imag, buf, sizeof(buf), 'g', 7, '\0');
|
||||
mp_format_float(o->imag, buf, sizeof(buf), 'g', 7, '\0');
|
||||
print(env, "%sj)", buf);
|
||||
}
|
||||
#else
|
||||
|
15
py/objdict.c
15
py/objdict.c
@ -24,19 +24,14 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "objtuple.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "builtin.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/builtin.h"
|
||||
|
||||
STATIC mp_obj_t dict_update(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs);
|
||||
|
||||
|
@ -27,11 +27,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
typedef struct _mp_obj_enumerate_t {
|
||||
mp_obj_base_t base;
|
||||
|
@ -28,20 +28,13 @@
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "objlist.h"
|
||||
#include "objstr.h"
|
||||
#include "objtuple.h"
|
||||
#include "objtype.h"
|
||||
#include "runtime.h"
|
||||
#include "runtime0.h"
|
||||
#include "gc.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/objlist.h"
|
||||
#include "py/objstr.h"
|
||||
#include "py/objtuple.h"
|
||||
#include "py/objtype.h"
|
||||
#include "py/gc.h"
|
||||
|
||||
typedef struct _mp_obj_exception_t {
|
||||
mp_obj_base_t base;
|
||||
|
@ -24,15 +24,8 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
typedef struct _mp_obj_filter_t {
|
||||
mp_obj_base_t base;
|
||||
|
@ -30,26 +30,22 @@
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "parsenum.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/parsenum.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#if MICROPY_PY_BUILTINS_FLOAT
|
||||
|
||||
#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
|
||||
#include "formatfloat.h"
|
||||
#include "py/formatfloat.h"
|
||||
#endif
|
||||
|
||||
STATIC void float_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
|
||||
mp_obj_float_t *o = o_in;
|
||||
#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
|
||||
char buf[16];
|
||||
format_float(o->value, buf, sizeof(buf), 'g', 7, '\0');
|
||||
mp_format_float(o->value, buf, sizeof(buf), 'g', 7, '\0');
|
||||
print(env, "%s", buf);
|
||||
if (strchr(buf, '.') == NULL && strchr(buf, 'e') == NULL) {
|
||||
// Python floats always have decimal point
|
||||
|
19
py/objfun.c
19
py/objfun.c
@ -25,21 +25,16 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "objtuple.h"
|
||||
#include "objfun.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "bc.h"
|
||||
#include "stackctrl.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/objtuple.h"
|
||||
#include "py/objfun.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/bc.h"
|
||||
#include "py/stackctrl.h"
|
||||
|
||||
#if 0 // print debugging info
|
||||
#define DEBUG_PRINT (1)
|
||||
|
@ -23,6 +23,10 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __MICROPY_INCLUDED_PY_OBJFUN_H__
|
||||
#define __MICROPY_INCLUDED_PY_OBJFUN_H__
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
typedef struct _mp_obj_fun_bc_t {
|
||||
mp_obj_base_t base;
|
||||
@ -41,3 +45,5 @@ typedef struct _mp_obj_fun_bc_t {
|
||||
// - a single slot for kw args dict (if it takes them)
|
||||
mp_obj_t extra_args[];
|
||||
} mp_obj_fun_bc_t;
|
||||
|
||||
#endif // __MICROPY_INCLUDED_PY_OBJFUN_H__
|
||||
|
@ -28,15 +28,12 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime.h"
|
||||
#include "bc.h"
|
||||
#include "objgenerator.h"
|
||||
#include "objfun.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/bc.h"
|
||||
#include "py/objgenerator.h"
|
||||
#include "py/objfun.h"
|
||||
|
||||
/******************************************************************************/
|
||||
/* generator wrapper */
|
||||
|
@ -23,5 +23,12 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __MICROPY_INCLUDED_PY_OBJGENERATOR_H__
|
||||
#define __MICROPY_INCLUDED_PY_OBJGENERATOR_H__
|
||||
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
mp_vm_return_kind_t mp_obj_gen_resume(mp_obj_t self_in, mp_obj_t send_val, mp_obj_t throw_val, mp_obj_t *ret_val);
|
||||
|
||||
#endif // __MICROPY_INCLUDED_PY_OBJGENERATOR_H__
|
||||
|
@ -26,12 +26,8 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
// this is a wrapper object that is turns something that has a __getitem__ method into an iterator
|
||||
|
||||
|
20
py/objint.c
20
py/objint.c
@ -25,22 +25,16 @@
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "parsenum.h"
|
||||
#include "smallint.h"
|
||||
#include "mpz.h"
|
||||
#include "objint.h"
|
||||
#include "objstr.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/parsenum.h"
|
||||
#include "py/smallint.h"
|
||||
#include "py/objint.h"
|
||||
#include "py/objstr.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#if MICROPY_PY_BUILTINS_FLOAT
|
||||
#include <math.h>
|
||||
|
@ -23,6 +23,11 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __MICROPY_INCLUDED_PY_OBJINT_H__
|
||||
#define __MICROPY_INCLUDED_PY_OBJINT_H__
|
||||
|
||||
#include "py/mpz.h"
|
||||
#include "py/obj.h"
|
||||
|
||||
typedef struct _mp_obj_int_t {
|
||||
mp_obj_base_t base;
|
||||
@ -45,3 +50,5 @@ bool mp_obj_int_is_positive(mp_obj_t self_in);
|
||||
mp_obj_t mp_obj_int_unary_op(mp_uint_t op, mp_obj_t o_in);
|
||||
mp_obj_t mp_obj_int_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in);
|
||||
mp_obj_t mp_obj_int_binary_op_extra_cases(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in);
|
||||
|
||||
#endif // __MICROPY_INCLUDED_PY_OBJINT_H__
|
||||
|
@ -26,19 +26,13 @@
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "smallint.h"
|
||||
#include "mpz.h"
|
||||
#include "objint.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/smallint.h"
|
||||
#include "py/objint.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#if MICROPY_PY_BUILTINS_FLOAT
|
||||
#include <math.h>
|
||||
|
@ -24,22 +24,16 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "parsenumbase.h"
|
||||
#include "obj.h"
|
||||
#include "smallint.h"
|
||||
#include "mpz.h"
|
||||
#include "objint.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/parsenumbase.h"
|
||||
#include "py/smallint.h"
|
||||
#include "py/objint.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#if MICROPY_PY_BUILTINS_FLOAT
|
||||
#include <math.h>
|
||||
|
12
py/objlist.c
12
py/objlist.c
@ -27,14 +27,10 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "objlist.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/objlist.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
STATIC mp_obj_t mp_obj_new_list_iterator(mp_obj_list_t *list, mp_uint_t cur);
|
||||
STATIC mp_obj_list_t *list_new(mp_uint_t n);
|
||||
|
@ -23,6 +23,10 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __MICROPY_INCLUDED_PY_OBJLIST_H__
|
||||
#define __MICROPY_INCLUDED_PY_OBJLIST_H__
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
typedef struct _mp_obj_list_t {
|
||||
mp_obj_base_t base;
|
||||
@ -30,3 +34,5 @@ typedef struct _mp_obj_list_t {
|
||||
mp_uint_t len;
|
||||
mp_obj_t *items;
|
||||
} mp_obj_list_t;
|
||||
|
||||
#endif // __MICROPY_INCLUDED_PY_OBJLIST_H__
|
||||
|
@ -27,12 +27,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
typedef struct _mp_obj_map_t {
|
||||
mp_obj_base_t base;
|
||||
|
@ -27,14 +27,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "objmodule.h"
|
||||
#include "runtime.h"
|
||||
#include "builtin.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/objmodule.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/builtin.h"
|
||||
|
||||
STATIC mp_map_t mp_loaded_modules_map; // TODO: expose as sys.modules
|
||||
|
||||
|
@ -23,8 +23,14 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __MICROPY_INCLUDED_PY_OBJMODULE_H__
|
||||
#define __MICROPY_INCLUDED_PY_OBJMODULE_H__
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
void mp_module_init(void);
|
||||
void mp_module_deinit(void);
|
||||
mp_obj_t mp_module_get(qstr module_name);
|
||||
void mp_module_register(qstr qstr, mp_obj_t module);
|
||||
|
||||
#endif // __MICROPY_INCLUDED_PY_OBJMODULE_H__
|
||||
|
@ -27,13 +27,9 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "nlr.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "objtuple.h"
|
||||
#include "runtime.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/objtuple.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#if MICROPY_PY_COLLECTIONS
|
||||
|
||||
|
@ -26,12 +26,9 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime0.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime0.h"
|
||||
|
||||
typedef struct _mp_obj_none_t {
|
||||
mp_obj_base_t base;
|
||||
|
@ -26,12 +26,9 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime0.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime0.h"
|
||||
|
||||
mp_obj_t instance_make_new(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args);
|
||||
|
||||
|
@ -27,12 +27,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#if MICROPY_PY_BUILTINS_PROPERTY
|
||||
|
||||
|
@ -26,13 +26,9 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
/******************************************************************************/
|
||||
/* range iterator */
|
||||
|
@ -27,12 +27,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
typedef struct _mp_obj_reversed_t {
|
||||
mp_obj_base_t base;
|
||||
|
12
py/objset.c
12
py/objset.c
@ -28,14 +28,10 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime.h"
|
||||
#include "runtime0.h"
|
||||
#include "builtin.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/builtin.h"
|
||||
|
||||
#if MICROPY_PY_BUILTINS_SET
|
||||
|
||||
|
@ -27,12 +27,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime0.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime0.h"
|
||||
|
||||
/******************************************************************************/
|
||||
/* ellipsis object, a singleton */
|
||||
|
19
py/objstr.c
19
py/objstr.c
@ -25,21 +25,16 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "unicode.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "pfenv.h"
|
||||
#include "objstr.h"
|
||||
#include "objlist.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/unicode.h"
|
||||
#include "py/objstr.h"
|
||||
#include "py/objlist.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/pfenv.h"
|
||||
|
||||
STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, mp_uint_t n_args, const mp_obj_t *args, mp_obj_t dict);
|
||||
|
||||
|
@ -23,6 +23,10 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __MICROPY_INCLUDED_PY_OBJSTR_H__
|
||||
#define __MICROPY_INCLUDED_PY_OBJSTR_H__
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
typedef struct _mp_obj_str_t {
|
||||
mp_obj_base_t base;
|
||||
@ -85,3 +89,5 @@ MP_DECLARE_CONST_FUN_OBJ(str_isalpha_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_isdigit_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_isupper_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_islower_obj);
|
||||
|
||||
#endif // __MICROPY_INCLUDED_PY_OBJSTR_H__
|
||||
|
@ -28,14 +28,10 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime.h"
|
||||
#include "stream.h"
|
||||
#include "objstr.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/objstr.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/stream.h"
|
||||
|
||||
#if MICROPY_PY_IO
|
||||
|
||||
|
@ -25,20 +25,15 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "pfenv.h"
|
||||
#include "objstr.h"
|
||||
#include "objlist.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/objstr.h"
|
||||
#include "py/objlist.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/pfenv.h"
|
||||
|
||||
#if MICROPY_PY_BUILTINS_STR_UNICODE
|
||||
|
||||
|
@ -27,14 +27,10 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "objtuple.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/objtuple.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
STATIC mp_obj_t mp_obj_new_tuple_iterator(mp_obj_tuple_t *tuple, mp_uint_t cur);
|
||||
|
||||
|
@ -23,6 +23,10 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __MICROPY_INCLUDED_PY_OBJTUPLE_H__
|
||||
#define __MICROPY_INCLUDED_PY_OBJTUPLE_H__
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
typedef struct _mp_obj_tuple_t {
|
||||
mp_obj_base_t base;
|
||||
@ -35,3 +39,5 @@ mp_obj_t mp_obj_tuple_unary_op(mp_uint_t op, mp_obj_t self_in);
|
||||
mp_obj_t mp_obj_tuple_binary_op(mp_uint_t op, mp_obj_t lhs, mp_obj_t rhs);
|
||||
mp_obj_t mp_obj_tuple_subscr(mp_obj_t base, mp_obj_t index, mp_obj_t value);
|
||||
mp_obj_t mp_obj_tuple_getiter(mp_obj_t o_in);
|
||||
|
||||
#endif // __MICROPY_INCLUDED_PY_OBJTUPLE_H__
|
||||
|
12
py/objtype.c
12
py/objtype.c
@ -30,14 +30,10 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime0.h"
|
||||
#include "runtime.h"
|
||||
#include "objtype.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/objtype.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#if 0 // print debugging info
|
||||
#define DEBUG_PRINT (1)
|
||||
|
@ -23,6 +23,10 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __MICROPY_INCLUDED_PY_OBJTYPE_H__
|
||||
#define __MICROPY_INCLUDED_PY_OBJTYPE_H__
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
// instance object
|
||||
// creating an instance of a class makes one of these objects
|
||||
@ -36,3 +40,5 @@ typedef struct _mp_obj_instance_t {
|
||||
// these need to be exposed so mp_obj_is_callable can work correctly
|
||||
bool mp_obj_instance_is_callable(mp_obj_t self_in);
|
||||
mp_obj_t mp_obj_instance_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args);
|
||||
|
||||
#endif // __MICROPY_INCLUDED_PY_OBJTYPE_H__
|
||||
|
@ -27,12 +27,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "objtuple.h"
|
||||
#include "runtime.h"
|
||||
#include "py/objtuple.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
typedef struct _mp_obj_zip_t {
|
||||
mp_obj_base_t base;
|
||||
|
@ -24,14 +24,8 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "nlr.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "obj.h"
|
||||
#include "runtime.h"
|
||||
#include "runtime0.h"
|
||||
#include "builtin.h"
|
||||
#include "py/runtime0.h"
|
||||
#include "py/builtin.h"
|
||||
|
||||
STATIC mp_obj_t op_getitem(mp_obj_t self_in, mp_obj_t key_in) {
|
||||
mp_obj_type_t *type = mp_obj_get_type(self_in);
|
||||
|
17
py/parse.c
17
py/parse.c
@ -30,13 +30,10 @@
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "lexer.h"
|
||||
#include "parsenumbase.h"
|
||||
#include "parse.h"
|
||||
#include "smallint.h"
|
||||
#include "py/lexer.h"
|
||||
#include "py/parse.h"
|
||||
#include "py/parsenum.h"
|
||||
#include "py/smallint.h"
|
||||
|
||||
#define RULE_ACT_ARG_MASK (0x0f)
|
||||
#define RULE_ACT_KIND_MASK (0x30)
|
||||
@ -69,7 +66,7 @@ typedef struct _rule_t {
|
||||
|
||||
enum {
|
||||
#define DEF_RULE(rule, comp, kind, ...) RULE_##rule,
|
||||
#include "grammar.h"
|
||||
#include "py/grammar.h"
|
||||
#undef DEF_RULE
|
||||
RULE_maximum_number_of,
|
||||
RULE_string, // special node for non-interned string
|
||||
@ -91,7 +88,7 @@ enum {
|
||||
#else
|
||||
#define DEF_RULE(rule, comp, kind, ...) static const rule_t rule_##rule = { RULE_##rule, kind, { __VA_ARGS__ } };
|
||||
#endif
|
||||
#include "grammar.h"
|
||||
#include "py/grammar.h"
|
||||
#undef or
|
||||
#undef and
|
||||
#undef list
|
||||
@ -105,7 +102,7 @@ enum {
|
||||
|
||||
STATIC const rule_t *rules[] = {
|
||||
#define DEF_RULE(rule, comp, kind, ...) &rule_##rule,
|
||||
#include "grammar.h"
|
||||
#include "py/grammar.h"
|
||||
#undef DEF_RULE
|
||||
};
|
||||
|
||||
|
@ -26,6 +26,10 @@
|
||||
#ifndef __MICROPY_INCLUDED_PY_PARSE_H__
|
||||
#define __MICROPY_INCLUDED_PY_PARSE_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
|
||||
struct _mp_lexer_t;
|
||||
|
||||
// a mp_parse_node_t is:
|
||||
|
@ -26,16 +26,9 @@
|
||||
|
||||
// these functions are separate from parse.c to keep parser independent of mp_obj_t
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "lexer.h"
|
||||
#include "parse.h"
|
||||
#include "obj.h"
|
||||
#include "parsehelper.h"
|
||||
#include "py/parsehelper.h"
|
||||
|
||||
#define STR_MEMORY "parser could not allocate enough memory"
|
||||
#define STR_UNEXPECTED_INDENT "unexpected indent"
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include "py/lexer.h"
|
||||
#include "py/parse.h"
|
||||
#include "py/obj.h"
|
||||
|
||||
void mp_parse_show_exception(mp_lexer_t *lex, mp_parse_error_kind_t parse_error_kind);
|
||||
mp_obj_t mp_parse_make_exception(mp_lexer_t *lex, mp_parse_error_kind_t parse_error_kind);
|
||||
|
@ -27,15 +27,9 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "mpconfig.h"
|
||||
#include "misc.h"
|
||||
#include "qstr.h"
|
||||
#include "nlr.h"
|
||||
#include "obj.h"
|
||||
#include "parsenumbase.h"
|
||||
#include "parsenum.h"
|
||||
#include "smallint.h"
|
||||
#include "runtime.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/parsenum.h"
|
||||
#include "py/smallint.h"
|
||||
|
||||
#if MICROPY_PY_BUILTINS_FLOAT
|
||||
#include <math.h>
|
||||
|
@ -23,6 +23,14 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __MICROPY_INCLUDED_PY_PARSENUM_H__
|
||||
#define __MICROPY_INCLUDED_PY_PARSENUM_H__
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include "py/obj.h"
|
||||
|
||||
mp_uint_t mp_parse_num_base(const char *str, mp_uint_t len, mp_uint_t *base);
|
||||
mp_obj_t mp_parse_num_integer(const char *restrict str, mp_uint_t len, mp_uint_t base);
|
||||
mp_obj_t mp_parse_num_decimal(const char *str, mp_uint_t len, bool allow_imag, bool force_complex);
|
||||
|
||||
#endif // __MICROPY_INCLUDED_PY_PARSENUM_H__
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user