|
@@ -26,6 +26,8 @@
|
|
|
#ifndef MICROPY_INCLUDED_PY_OBJ_H
|
|
#ifndef MICROPY_INCLUDED_PY_OBJ_H
|
|
|
#define MICROPY_INCLUDED_PY_OBJ_H
|
|
#define MICROPY_INCLUDED_PY_OBJ_H
|
|
|
|
|
|
|
|
|
|
+#include <assert.h>
|
|
|
|
|
+
|
|
|
#include "py/mpconfig.h"
|
|
#include "py/mpconfig.h"
|
|
|
#include "py/misc.h"
|
|
#include "py/misc.h"
|
|
|
#include "py/qstr.h"
|
|
#include "py/qstr.h"
|
|
@@ -66,13 +68,13 @@ typedef struct _mp_obj_base_t mp_obj_base_t;
|
|
|
// as many as we can to MP_OBJ_NULL because it's cheaper to load/compare 0.
|
|
// as many as we can to MP_OBJ_NULL because it's cheaper to load/compare 0.
|
|
|
|
|
|
|
|
#if MICROPY_DEBUG_MP_OBJ_SENTINELS
|
|
#if MICROPY_DEBUG_MP_OBJ_SENTINELS
|
|
|
-#define MP_OBJ_NULL (MP_OBJ_FROM_PTR((void*)0))
|
|
|
|
|
-#define MP_OBJ_STOP_ITERATION (MP_OBJ_FROM_PTR((void*)4))
|
|
|
|
|
-#define MP_OBJ_SENTINEL (MP_OBJ_FROM_PTR((void*)8))
|
|
|
|
|
|
|
+#define MP_OBJ_NULL (MP_OBJ_FROM_PTR((void *)0))
|
|
|
|
|
+#define MP_OBJ_STOP_ITERATION (MP_OBJ_FROM_PTR((void *)4))
|
|
|
|
|
+#define MP_OBJ_SENTINEL (MP_OBJ_FROM_PTR((void *)8))
|
|
|
#else
|
|
#else
|
|
|
-#define MP_OBJ_NULL (MP_OBJ_FROM_PTR((void*)0))
|
|
|
|
|
-#define MP_OBJ_STOP_ITERATION (MP_OBJ_FROM_PTR((void*)0))
|
|
|
|
|
-#define MP_OBJ_SENTINEL (MP_OBJ_FROM_PTR((void*)4))
|
|
|
|
|
|
|
+#define MP_OBJ_NULL (MP_OBJ_FROM_PTR((void *)0))
|
|
|
|
|
+#define MP_OBJ_STOP_ITERATION (MP_OBJ_FROM_PTR((void *)0))
|
|
|
|
|
+#define MP_OBJ_SENTINEL (MP_OBJ_FROM_PTR((void *)4))
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
// These macros/inline functions operate on objects and depend on the
|
|
// These macros/inline functions operate on objects and depend on the
|
|
@@ -81,15 +83,23 @@ typedef struct _mp_obj_base_t mp_obj_base_t;
|
|
|
|
|
|
|
|
#if MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_A
|
|
#if MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_A
|
|
|
|
|
|
|
|
-static inline bool mp_obj_is_small_int(mp_const_obj_t o)
|
|
|
|
|
- { return ((((mp_int_t)(o)) & 1) != 0); }
|
|
|
|
|
|
|
+static inline bool mp_obj_is_small_int(mp_const_obj_t o) {
|
|
|
|
|
+ return (((mp_int_t)(o)) & 1) != 0;
|
|
|
|
|
+}
|
|
|
#define MP_OBJ_SMALL_INT_VALUE(o) (((mp_int_t)(o)) >> 1)
|
|
#define MP_OBJ_SMALL_INT_VALUE(o) (((mp_int_t)(o)) >> 1)
|
|
|
#define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_uint_t)(small_int)) << 1) | 1))
|
|
#define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_uint_t)(small_int)) << 1) | 1))
|
|
|
|
|
|
|
|
-static inline bool mp_obj_is_qstr(mp_const_obj_t o)
|
|
|
|
|
- { return ((((mp_int_t)(o)) & 3) == 2); }
|
|
|
|
|
-#define MP_OBJ_QSTR_VALUE(o) (((mp_uint_t)(o)) >> 2)
|
|
|
|
|
-#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 2) | 2))
|
|
|
|
|
|
|
+static inline bool mp_obj_is_qstr(mp_const_obj_t o) {
|
|
|
|
|
+ return (((mp_int_t)(o)) & 7) == 2;
|
|
|
|
|
+}
|
|
|
|
|
+#define MP_OBJ_QSTR_VALUE(o) (((mp_uint_t)(o)) >> 3)
|
|
|
|
|
+#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
|
|
|
|
|
+
|
|
|
|
|
+static inline bool mp_obj_is_immediate_obj(mp_const_obj_t o) {
|
|
|
|
|
+ return (((mp_int_t)(o)) & 7) == 6;
|
|
|
|
|
+}
|
|
|
|
|
+#define MP_OBJ_IMMEDIATE_OBJ_VALUE(o) (((mp_uint_t)(o)) >> 3)
|
|
|
|
|
+#define MP_OBJ_NEW_IMMEDIATE_OBJ(val) ((mp_obj_t)(((val) << 3) | 6))
|
|
|
|
|
|
|
|
#if MICROPY_PY_BUILTINS_FLOAT
|
|
#if MICROPY_PY_BUILTINS_FLOAT
|
|
|
#define mp_const_float_e MP_ROM_PTR(&mp_const_float_e_obj)
|
|
#define mp_const_float_e MP_ROM_PTR(&mp_const_float_e_obj)
|
|
@@ -102,20 +112,29 @@ mp_float_t mp_obj_float_get(mp_obj_t self_in);
|
|
|
mp_obj_t mp_obj_new_float(mp_float_t value);
|
|
mp_obj_t mp_obj_new_float(mp_float_t value);
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
-static inline bool mp_obj_is_obj(mp_const_obj_t o)
|
|
|
|
|
- { return ((((mp_int_t)(o)) & 3) == 0); }
|
|
|
|
|
|
|
+static inline bool mp_obj_is_obj(mp_const_obj_t o) {
|
|
|
|
|
+ return (((mp_int_t)(o)) & 3) == 0;
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
#elif MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_B
|
|
#elif MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_B
|
|
|
|
|
|
|
|
-static inline bool mp_obj_is_small_int(mp_const_obj_t o)
|
|
|
|
|
- { return ((((mp_int_t)(o)) & 3) == 1); }
|
|
|
|
|
|
|
+static inline bool mp_obj_is_small_int(mp_const_obj_t o) {
|
|
|
|
|
+ return (((mp_int_t)(o)) & 3) == 1;
|
|
|
|
|
+}
|
|
|
#define MP_OBJ_SMALL_INT_VALUE(o) (((mp_int_t)(o)) >> 2)
|
|
#define MP_OBJ_SMALL_INT_VALUE(o) (((mp_int_t)(o)) >> 2)
|
|
|
#define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_uint_t)(small_int)) << 2) | 1))
|
|
#define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_uint_t)(small_int)) << 2) | 1))
|
|
|
|
|
|
|
|
-static inline bool mp_obj_is_qstr(mp_const_obj_t o)
|
|
|
|
|
- { return ((((mp_int_t)(o)) & 3) == 3); }
|
|
|
|
|
-#define MP_OBJ_QSTR_VALUE(o) (((mp_uint_t)(o)) >> 2)
|
|
|
|
|
-#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 2) | 3))
|
|
|
|
|
|
|
+static inline bool mp_obj_is_qstr(mp_const_obj_t o) {
|
|
|
|
|
+ return (((mp_int_t)(o)) & 7) == 3;
|
|
|
|
|
+}
|
|
|
|
|
+#define MP_OBJ_QSTR_VALUE(o) (((mp_uint_t)(o)) >> 3)
|
|
|
|
|
+#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 3))
|
|
|
|
|
+
|
|
|
|
|
+static inline bool mp_obj_is_immediate_obj(mp_const_obj_t o) {
|
|
|
|
|
+ return (((mp_int_t)(o)) & 7) == 7;
|
|
|
|
|
+}
|
|
|
|
|
+#define MP_OBJ_IMMEDIATE_OBJ_VALUE(o) (((mp_uint_t)(o)) >> 3)
|
|
|
|
|
+#define MP_OBJ_NEW_IMMEDIATE_OBJ(val) ((mp_obj_t)(((val) << 3) | 7))
|
|
|
|
|
|
|
|
#if MICROPY_PY_BUILTINS_FLOAT
|
|
#if MICROPY_PY_BUILTINS_FLOAT
|
|
|
#define mp_const_float_e MP_ROM_PTR(&mp_const_float_e_obj)
|
|
#define mp_const_float_e MP_ROM_PTR(&mp_const_float_e_obj)
|
|
@@ -128,13 +147,15 @@ mp_float_t mp_obj_float_get(mp_obj_t self_in);
|
|
|
mp_obj_t mp_obj_new_float(mp_float_t value);
|
|
mp_obj_t mp_obj_new_float(mp_float_t value);
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
-static inline bool mp_obj_is_obj(mp_const_obj_t o)
|
|
|
|
|
- { return ((((mp_int_t)(o)) & 1) == 0); }
|
|
|
|
|
|
|
+static inline bool mp_obj_is_obj(mp_const_obj_t o) {
|
|
|
|
|
+ return (((mp_int_t)(o)) & 1) == 0;
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
#elif MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_C
|
|
#elif MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_C
|
|
|
|
|
|
|
|
-static inline bool mp_obj_is_small_int(mp_const_obj_t o)
|
|
|
|
|
- { return ((((mp_int_t)(o)) & 1) != 0); }
|
|
|
|
|
|
|
+static inline bool mp_obj_is_small_int(mp_const_obj_t o) {
|
|
|
|
|
+ return (((mp_int_t)(o)) & 1) != 0;
|
|
|
|
|
+}
|
|
|
#define MP_OBJ_SMALL_INT_VALUE(o) (((mp_int_t)(o)) >> 1)
|
|
#define MP_OBJ_SMALL_INT_VALUE(o) (((mp_int_t)(o)) >> 1)
|
|
|
#define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_uint_t)(small_int)) << 1) | 1))
|
|
#define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_uint_t)(small_int)) << 1) | 1))
|
|
|
|
|
|
|
@@ -142,8 +163,9 @@ static inline bool mp_obj_is_small_int(mp_const_obj_t o)
|
|
|
#define mp_const_float_e MP_ROM_PTR((mp_obj_t)(((0x402df854 & ~3) | 2) + 0x80800000))
|
|
#define mp_const_float_e MP_ROM_PTR((mp_obj_t)(((0x402df854 & ~3) | 2) + 0x80800000))
|
|
|
#define mp_const_float_pi MP_ROM_PTR((mp_obj_t)(((0x40490fdb & ~3) | 2) + 0x80800000))
|
|
#define mp_const_float_pi MP_ROM_PTR((mp_obj_t)(((0x40490fdb & ~3) | 2) + 0x80800000))
|
|
|
|
|
|
|
|
-static inline bool mp_obj_is_float(mp_const_obj_t o)
|
|
|
|
|
- { return (((mp_uint_t)(o)) & 3) == 2 && (((mp_uint_t)(o)) & 0xff800007) != 0x00000006; }
|
|
|
|
|
|
|
+static inline bool mp_obj_is_float(mp_const_obj_t o) {
|
|
|
|
|
+ return (((mp_uint_t)(o)) & 3) == 2 && (((mp_uint_t)(o)) & 0xff800007) != 0x00000006;
|
|
|
|
|
+}
|
|
|
static inline mp_float_t mp_obj_float_get(mp_const_obj_t o) {
|
|
static inline mp_float_t mp_obj_float_get(mp_const_obj_t o) {
|
|
|
union {
|
|
union {
|
|
|
mp_float_t f;
|
|
mp_float_t f;
|
|
@@ -160,25 +182,41 @@ static inline mp_obj_t mp_obj_new_float(mp_float_t f) {
|
|
|
}
|
|
}
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
-static inline bool mp_obj_is_qstr(mp_const_obj_t o)
|
|
|
|
|
- { return (((mp_uint_t)(o)) & 0xff800007) == 0x00000006; }
|
|
|
|
|
-#define MP_OBJ_QSTR_VALUE(o) (((mp_uint_t)(o)) >> 3)
|
|
|
|
|
-#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 0x00000006))
|
|
|
|
|
|
|
+static inline bool mp_obj_is_qstr(mp_const_obj_t o) {
|
|
|
|
|
+ return (((mp_uint_t)(o)) & 0xff80000f) == 0x00000006;
|
|
|
|
|
+}
|
|
|
|
|
+#define MP_OBJ_QSTR_VALUE(o) (((mp_uint_t)(o)) >> 4)
|
|
|
|
|
+#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 4) | 0x00000006))
|
|
|
|
|
|
|
|
-static inline bool mp_obj_is_obj(mp_const_obj_t o)
|
|
|
|
|
- { return ((((mp_int_t)(o)) & 3) == 0); }
|
|
|
|
|
|
|
+static inline bool mp_obj_is_immediate_obj(mp_const_obj_t o) {
|
|
|
|
|
+ return (((mp_uint_t)(o)) & 0xff80000f) == 0x0000000e;
|
|
|
|
|
+}
|
|
|
|
|
+#define MP_OBJ_IMMEDIATE_OBJ_VALUE(o) (((mp_uint_t)(o)) >> 4)
|
|
|
|
|
+#define MP_OBJ_NEW_IMMEDIATE_OBJ(val) ((mp_obj_t)(((val) << 4) | 0xe))
|
|
|
|
|
+
|
|
|
|
|
+static inline bool mp_obj_is_obj(mp_const_obj_t o) {
|
|
|
|
|
+ return (((mp_int_t)(o)) & 3) == 0;
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
#elif MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_D
|
|
#elif MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_D
|
|
|
|
|
|
|
|
-static inline bool mp_obj_is_small_int(mp_const_obj_t o)
|
|
|
|
|
- { return ((((uint64_t)(o)) & 0xffff000000000000) == 0x0001000000000000); }
|
|
|
|
|
|
|
+static inline bool mp_obj_is_small_int(mp_const_obj_t o) {
|
|
|
|
|
+ return (((uint64_t)(o)) & 0xffff000000000000) == 0x0001000000000000;
|
|
|
|
|
+}
|
|
|
#define MP_OBJ_SMALL_INT_VALUE(o) (((mp_int_t)((o) << 16)) >> 17)
|
|
#define MP_OBJ_SMALL_INT_VALUE(o) (((mp_int_t)((o) << 16)) >> 17)
|
|
|
#define MP_OBJ_NEW_SMALL_INT(small_int) (((((uint64_t)(small_int)) & 0x7fffffffffff) << 1) | 0x0001000000000001)
|
|
#define MP_OBJ_NEW_SMALL_INT(small_int) (((((uint64_t)(small_int)) & 0x7fffffffffff) << 1) | 0x0001000000000001)
|
|
|
|
|
|
|
|
-static inline bool mp_obj_is_qstr(mp_const_obj_t o)
|
|
|
|
|
- { return ((((uint64_t)(o)) & 0xffff000000000000) == 0x0002000000000000); }
|
|
|
|
|
|
|
+static inline bool mp_obj_is_qstr(mp_const_obj_t o) {
|
|
|
|
|
+ return (((uint64_t)(o)) & 0xffff000000000000) == 0x0002000000000000;
|
|
|
|
|
+}
|
|
|
#define MP_OBJ_QSTR_VALUE(o) ((((uint32_t)(o)) >> 1) & 0xffffffff)
|
|
#define MP_OBJ_QSTR_VALUE(o) ((((uint32_t)(o)) >> 1) & 0xffffffff)
|
|
|
-#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 1) | 0x0002000000000001))
|
|
|
|
|
|
|
+#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)(((uint64_t)(((uint32_t)(qst)) << 1)) | 0x0002000000000001))
|
|
|
|
|
+
|
|
|
|
|
+static inline bool mp_obj_is_immediate_obj(mp_const_obj_t o) {
|
|
|
|
|
+ return (((uint64_t)(o)) & 0xffff000000000000) == 0x0003000000000000;
|
|
|
|
|
+}
|
|
|
|
|
+#define MP_OBJ_IMMEDIATE_OBJ_VALUE(o) ((((uint32_t)(o)) >> 46) & 3)
|
|
|
|
|
+#define MP_OBJ_NEW_IMMEDIATE_OBJ(val) (((uint64_t)(val) << 46) | 0x0003000000000000)
|
|
|
|
|
|
|
|
#if MICROPY_PY_BUILTINS_FLOAT
|
|
#if MICROPY_PY_BUILTINS_FLOAT
|
|
|
|
|
|
|
@@ -208,13 +246,17 @@ static inline mp_obj_t mp_obj_new_float(mp_float_t f) {
|
|
|
}
|
|
}
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
-static inline bool mp_obj_is_obj(mp_const_obj_t o)
|
|
|
|
|
- { return ((((uint64_t)(o)) & 0xffff000000000000) == 0x0000000000000000); }
|
|
|
|
|
-#define MP_OBJ_TO_PTR(o) ((void*)(uintptr_t)(o))
|
|
|
|
|
|
|
+static inline bool mp_obj_is_obj(mp_const_obj_t o) {
|
|
|
|
|
+ return (((uint64_t)(o)) & 0xffff000000000000) == 0x0000000000000000;
|
|
|
|
|
+}
|
|
|
|
|
+#define MP_OBJ_TO_PTR(o) ((void *)(uintptr_t)(o))
|
|
|
#define MP_OBJ_FROM_PTR(p) ((mp_obj_t)((uintptr_t)(p)))
|
|
#define MP_OBJ_FROM_PTR(p) ((mp_obj_t)((uintptr_t)(p)))
|
|
|
|
|
|
|
|
// rom object storage needs special handling to widen 32-bit pointer to 64-bits
|
|
// rom object storage needs special handling to widen 32-bit pointer to 64-bits
|
|
|
-typedef union _mp_rom_obj_t { uint64_t u64; struct { const void *lo, *hi; } u32; } mp_rom_obj_t;
|
|
|
|
|
|
|
+typedef union _mp_rom_obj_t { uint64_t u64;
|
|
|
|
|
+ struct { const void *lo, *hi;
|
|
|
|
|
+ } u32;
|
|
|
|
|
+} mp_rom_obj_t;
|
|
|
#define MP_ROM_INT(i) {MP_OBJ_NEW_SMALL_INT(i)}
|
|
#define MP_ROM_INT(i) {MP_OBJ_NEW_SMALL_INT(i)}
|
|
|
#define MP_ROM_QSTR(q) {MP_OBJ_NEW_QSTR(q)}
|
|
#define MP_ROM_QSTR(q) {MP_OBJ_NEW_QSTR(q)}
|
|
|
#if MP_ENDIANNESS_LITTLE
|
|
#if MP_ENDIANNESS_LITTLE
|
|
@@ -232,7 +274,7 @@ typedef union _mp_rom_obj_t { uint64_t u64; struct { const void *lo, *hi; } u32;
|
|
|
|
|
|
|
|
// Cast mp_obj_t to object pointer
|
|
// Cast mp_obj_t to object pointer
|
|
|
#ifndef MP_OBJ_TO_PTR
|
|
#ifndef MP_OBJ_TO_PTR
|
|
|
-#define MP_OBJ_TO_PTR(o) ((void*)o)
|
|
|
|
|
|
|
+#define MP_OBJ_TO_PTR(o) ((void *)o)
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
// Cast object pointer to mp_obj_t
|
|
// Cast object pointer to mp_obj_t
|
|
@@ -242,6 +284,24 @@ typedef union _mp_rom_obj_t { uint64_t u64; struct { const void *lo, *hi; } u32;
|
|
|
|
|
|
|
|
// Macros to create objects that are stored in ROM.
|
|
// Macros to create objects that are stored in ROM.
|
|
|
|
|
|
|
|
|
|
+#ifndef MP_ROM_NONE
|
|
|
|
|
+#if MICROPY_OBJ_IMMEDIATE_OBJS
|
|
|
|
|
+#define MP_ROM_NONE mp_const_none
|
|
|
|
|
+#else
|
|
|
|
|
+#define MP_ROM_NONE MP_ROM_PTR(&mp_const_none_obj)
|
|
|
|
|
+#endif
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+#ifndef MP_ROM_FALSE
|
|
|
|
|
+#if MICROPY_OBJ_IMMEDIATE_OBJS
|
|
|
|
|
+#define MP_ROM_FALSE mp_const_false
|
|
|
|
|
+#define MP_ROM_TRUE mp_const_true
|
|
|
|
|
+#else
|
|
|
|
|
+#define MP_ROM_FALSE MP_ROM_PTR(&mp_const_false_obj)
|
|
|
|
|
+#define MP_ROM_TRUE MP_ROM_PTR(&mp_const_true_obj)
|
|
|
|
|
+#endif
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
#ifndef MP_ROM_INT
|
|
#ifndef MP_ROM_INT
|
|
|
typedef mp_const_obj_t mp_rom_obj_t;
|
|
typedef mp_const_obj_t mp_rom_obj_t;
|
|
|
#define MP_ROM_INT(i) MP_OBJ_NEW_SMALL_INT(i)
|
|
#define MP_ROM_INT(i) MP_OBJ_NEW_SMALL_INT(i)
|
|
@@ -271,25 +331,25 @@ typedef struct _mp_rom_obj_t { mp_const_obj_t o; } mp_rom_obj_t;
|
|
|
|
|
|
|
|
#define MP_DEFINE_CONST_FUN_OBJ_0(obj_name, fun_name) \
|
|
#define MP_DEFINE_CONST_FUN_OBJ_0(obj_name, fun_name) \
|
|
|
const mp_obj_fun_builtin_fixed_t obj_name = \
|
|
const mp_obj_fun_builtin_fixed_t obj_name = \
|
|
|
- {{&mp_type_fun_builtin_0}, .fun._0 = fun_name}
|
|
|
|
|
|
|
+ {{&mp_type_fun_builtin_0}, .fun._0 = fun_name}
|
|
|
#define MP_DEFINE_CONST_FUN_OBJ_1(obj_name, fun_name) \
|
|
#define MP_DEFINE_CONST_FUN_OBJ_1(obj_name, fun_name) \
|
|
|
const mp_obj_fun_builtin_fixed_t obj_name = \
|
|
const mp_obj_fun_builtin_fixed_t obj_name = \
|
|
|
- {{&mp_type_fun_builtin_1}, .fun._1 = fun_name}
|
|
|
|
|
|
|
+ {{&mp_type_fun_builtin_1}, .fun._1 = fun_name}
|
|
|
#define MP_DEFINE_CONST_FUN_OBJ_2(obj_name, fun_name) \
|
|
#define MP_DEFINE_CONST_FUN_OBJ_2(obj_name, fun_name) \
|
|
|
const mp_obj_fun_builtin_fixed_t obj_name = \
|
|
const mp_obj_fun_builtin_fixed_t obj_name = \
|
|
|
- {{&mp_type_fun_builtin_2}, .fun._2 = fun_name}
|
|
|
|
|
|
|
+ {{&mp_type_fun_builtin_2}, .fun._2 = fun_name}
|
|
|
#define MP_DEFINE_CONST_FUN_OBJ_3(obj_name, fun_name) \
|
|
#define MP_DEFINE_CONST_FUN_OBJ_3(obj_name, fun_name) \
|
|
|
const mp_obj_fun_builtin_fixed_t obj_name = \
|
|
const mp_obj_fun_builtin_fixed_t obj_name = \
|
|
|
- {{&mp_type_fun_builtin_3}, .fun._3 = fun_name}
|
|
|
|
|
|
|
+ {{&mp_type_fun_builtin_3}, .fun._3 = fun_name}
|
|
|
#define MP_DEFINE_CONST_FUN_OBJ_VAR(obj_name, n_args_min, fun_name) \
|
|
#define MP_DEFINE_CONST_FUN_OBJ_VAR(obj_name, n_args_min, fun_name) \
|
|
|
const mp_obj_fun_builtin_var_t obj_name = \
|
|
const mp_obj_fun_builtin_var_t obj_name = \
|
|
|
- {{&mp_type_fun_builtin_var}, MP_OBJ_FUN_MAKE_SIG(n_args_min, MP_OBJ_FUN_ARGS_MAX, false), .fun.var = fun_name}
|
|
|
|
|
|
|
+ {{&mp_type_fun_builtin_var}, MP_OBJ_FUN_MAKE_SIG(n_args_min, MP_OBJ_FUN_ARGS_MAX, false), .fun.var = fun_name}
|
|
|
#define MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(obj_name, n_args_min, n_args_max, fun_name) \
|
|
#define MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(obj_name, n_args_min, n_args_max, fun_name) \
|
|
|
const mp_obj_fun_builtin_var_t obj_name = \
|
|
const mp_obj_fun_builtin_var_t obj_name = \
|
|
|
- {{&mp_type_fun_builtin_var}, MP_OBJ_FUN_MAKE_SIG(n_args_min, n_args_max, false), .fun.var = fun_name}
|
|
|
|
|
|
|
+ {{&mp_type_fun_builtin_var}, MP_OBJ_FUN_MAKE_SIG(n_args_min, n_args_max, false), .fun.var = fun_name}
|
|
|
#define MP_DEFINE_CONST_FUN_OBJ_KW(obj_name, n_args_min, fun_name) \
|
|
#define MP_DEFINE_CONST_FUN_OBJ_KW(obj_name, n_args_min, fun_name) \
|
|
|
const mp_obj_fun_builtin_var_t obj_name = \
|
|
const mp_obj_fun_builtin_var_t obj_name = \
|
|
|
- {{&mp_type_fun_builtin_var}, MP_OBJ_FUN_MAKE_SIG(n_args_min, MP_OBJ_FUN_ARGS_MAX, true), .fun.kw = fun_name}
|
|
|
|
|
|
|
+ {{&mp_type_fun_builtin_var}, MP_OBJ_FUN_MAKE_SIG(n_args_min, MP_OBJ_FUN_ARGS_MAX, true), .fun.kw = fun_name}
|
|
|
|
|
|
|
|
// These macros are used to define constant map/dict objects
|
|
// These macros are used to define constant map/dict objects
|
|
|
// You can put "static" in front of the definition to make it local
|
|
// You can put "static" in front of the definition to make it local
|
|
@@ -301,7 +361,7 @@ typedef struct _mp_rom_obj_t { mp_const_obj_t o; } mp_rom_obj_t;
|
|
|
.is_ordered = 1, \
|
|
.is_ordered = 1, \
|
|
|
.used = MP_ARRAY_SIZE(table_name), \
|
|
.used = MP_ARRAY_SIZE(table_name), \
|
|
|
.alloc = MP_ARRAY_SIZE(table_name), \
|
|
.alloc = MP_ARRAY_SIZE(table_name), \
|
|
|
- .table = (mp_map_elem_t*)(mp_rom_map_elem_t*)table_name, \
|
|
|
|
|
|
|
+ .table = (mp_map_elem_t *)(mp_rom_map_elem_t *)table_name, \
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#define MP_DEFINE_CONST_DICT(dict_name, table_name) \
|
|
#define MP_DEFINE_CONST_DICT(dict_name, table_name) \
|
|
@@ -313,7 +373,7 @@ typedef struct _mp_rom_obj_t { mp_const_obj_t o; } mp_rom_obj_t;
|
|
|
.is_ordered = 1, \
|
|
.is_ordered = 1, \
|
|
|
.used = MP_ARRAY_SIZE(table_name), \
|
|
.used = MP_ARRAY_SIZE(table_name), \
|
|
|
.alloc = MP_ARRAY_SIZE(table_name), \
|
|
.alloc = MP_ARRAY_SIZE(table_name), \
|
|
|
- .table = (mp_map_elem_t*)(mp_rom_map_elem_t*)table_name, \
|
|
|
|
|
|
|
+ .table = (mp_map_elem_t *)(mp_rom_map_elem_t *)table_name, \
|
|
|
}, \
|
|
}, \
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -345,15 +405,10 @@ typedef struct _mp_rom_map_elem_t {
|
|
|
mp_rom_obj_t value;
|
|
mp_rom_obj_t value;
|
|
|
} mp_rom_map_elem_t;
|
|
} mp_rom_map_elem_t;
|
|
|
|
|
|
|
|
-// TODO maybe have a truncated mp_map_t for fixed tables, since alloc=used
|
|
|
|
|
-// put alloc last in the structure, so the truncated version does not need it
|
|
|
|
|
-// this would save 1 ROM word for all ROM objects that have a locals_dict
|
|
|
|
|
-// would also need a trucated dict structure
|
|
|
|
|
-
|
|
|
|
|
typedef struct _mp_map_t {
|
|
typedef struct _mp_map_t {
|
|
|
size_t all_keys_are_qstrs : 1;
|
|
size_t all_keys_are_qstrs : 1;
|
|
|
- size_t is_fixed : 1; // a fixed array that can't be modified; must also be ordered
|
|
|
|
|
- size_t is_ordered : 1; // an ordered array
|
|
|
|
|
|
|
+ size_t is_fixed : 1; // if set, table is fixed/read-only and can't be modified
|
|
|
|
|
+ size_t is_ordered : 1; // if set, table is an ordered array, not a hash map
|
|
|
size_t used : (8 * sizeof(size_t) - 3);
|
|
size_t used : (8 * sizeof(size_t) - 3);
|
|
|
size_t alloc;
|
|
size_t alloc;
|
|
|
mp_map_elem_t *table;
|
|
mp_map_elem_t *table;
|
|
@@ -367,9 +422,10 @@ typedef enum _mp_map_lookup_kind_t {
|
|
|
MP_MAP_LOOKUP_ADD_IF_NOT_FOUND_OR_REMOVE_IF_FOUND = 3, // only valid for mp_set_lookup
|
|
MP_MAP_LOOKUP_ADD_IF_NOT_FOUND_OR_REMOVE_IF_FOUND = 3, // only valid for mp_set_lookup
|
|
|
} mp_map_lookup_kind_t;
|
|
} mp_map_lookup_kind_t;
|
|
|
|
|
|
|
|
-extern const mp_map_t mp_const_empty_map;
|
|
|
|
|
-
|
|
|
|
|
-static inline bool mp_map_slot_is_filled(const mp_map_t *map, size_t pos) { return ((map)->table[pos].key != MP_OBJ_NULL && (map)->table[pos].key != MP_OBJ_SENTINEL); }
|
|
|
|
|
|
|
+static inline bool mp_map_slot_is_filled(const mp_map_t *map, size_t pos) {
|
|
|
|
|
+ assert(pos < map->alloc);
|
|
|
|
|
+ return (map)->table[pos].key != MP_OBJ_NULL && (map)->table[pos].key != MP_OBJ_SENTINEL;
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
void mp_map_init(mp_map_t *map, size_t n);
|
|
void mp_map_init(mp_map_t *map, size_t n);
|
|
|
void mp_map_init_fixed_table(mp_map_t *map, size_t n, const mp_obj_t *table);
|
|
void mp_map_init_fixed_table(mp_map_t *map, size_t n, const mp_obj_t *table);
|
|
@@ -388,7 +444,9 @@ typedef struct _mp_set_t {
|
|
|
mp_obj_t *table;
|
|
mp_obj_t *table;
|
|
|
} mp_set_t;
|
|
} mp_set_t;
|
|
|
|
|
|
|
|
-static inline bool mp_set_slot_is_filled(const mp_set_t *set, size_t pos) { return ((set)->table[pos] != MP_OBJ_NULL && (set)->table[pos] != MP_OBJ_SENTINEL); }
|
|
|
|
|
|
|
+static inline bool mp_set_slot_is_filled(const mp_set_t *set, size_t pos) {
|
|
|
|
|
+ return (set)->table[pos] != MP_OBJ_NULL && (set)->table[pos] != MP_OBJ_SENTINEL;
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
void mp_set_init(mp_set_t *set, size_t n);
|
|
void mp_set_init(mp_set_t *set, size_t n);
|
|
|
mp_obj_t mp_set_lookup(mp_set_t *set, mp_obj_t index, mp_map_lookup_kind_t lookup_kind);
|
|
mp_obj_t mp_set_lookup(mp_set_t *set, mp_obj_t index, mp_map_lookup_kind_t lookup_kind);
|
|
@@ -406,6 +464,23 @@ typedef mp_obj_t (*mp_fun_var_t)(size_t n, const mp_obj_t *);
|
|
|
// this arg to mp_map_lookup().
|
|
// this arg to mp_map_lookup().
|
|
|
typedef mp_obj_t (*mp_fun_kw_t)(size_t n, const mp_obj_t *, mp_map_t *);
|
|
typedef mp_obj_t (*mp_fun_kw_t)(size_t n, const mp_obj_t *, mp_map_t *);
|
|
|
|
|
|
|
|
|
|
+// Flags for type behaviour (mp_obj_type_t.flags)
|
|
|
|
|
+// If MP_TYPE_FLAG_EQ_NOT_REFLEXIVE is clear then __eq__ is reflexive (A==A returns True).
|
|
|
|
|
+// If MP_TYPE_FLAG_EQ_CHECKS_OTHER_TYPE is clear then the type can't be equal to an
|
|
|
|
|
+// instance of any different class that also clears this flag. If this flag is set
|
|
|
|
|
+// then the type may check for equality against a different type.
|
|
|
|
|
+// If MP_TYPE_FLAG_EQ_HAS_NEQ_TEST is clear then the type only implements the __eq__
|
|
|
|
|
+// operator and not the __ne__ operator. If it's set then __ne__ may be implemented.
|
|
|
|
|
+// If MP_TYPE_FLAG_BINDS_SELF is set then the type as a method binds self as the first arg.
|
|
|
|
|
+// If MP_TYPE_FLAG_BUILTIN_FUN is set then the type is a built-in function type.
|
|
|
|
|
+#define MP_TYPE_FLAG_IS_SUBCLASSED (0x0001)
|
|
|
|
|
+#define MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS (0x0002)
|
|
|
|
|
+#define MP_TYPE_FLAG_EQ_NOT_REFLEXIVE (0x0004)
|
|
|
|
|
+#define MP_TYPE_FLAG_EQ_CHECKS_OTHER_TYPE (0x0008)
|
|
|
|
|
+#define MP_TYPE_FLAG_EQ_HAS_NEQ_TEST (0x0010)
|
|
|
|
|
+#define MP_TYPE_FLAG_BINDS_SELF (0x0020)
|
|
|
|
|
+#define MP_TYPE_FLAG_BUILTIN_FUN (0x0040)
|
|
|
|
|
+
|
|
|
typedef enum {
|
|
typedef enum {
|
|
|
PRINT_STR = 0,
|
|
PRINT_STR = 0,
|
|
|
PRINT_REPR = 1,
|
|
PRINT_REPR = 1,
|
|
@@ -435,18 +510,9 @@ typedef mp_obj_t (*mp_getiter_fun_t)(mp_obj_t self_in, mp_obj_iter_buf_t *iter_b
|
|
|
|
|
|
|
|
// Buffer protocol
|
|
// Buffer protocol
|
|
|
typedef struct _mp_buffer_info_t {
|
|
typedef struct _mp_buffer_info_t {
|
|
|
- // if we'd bother to support various versions of structure
|
|
|
|
|
- // (with different number of fields), we can distinguish
|
|
|
|
|
- // them with ver = sizeof(struct). Cons: overkill for *micro*?
|
|
|
|
|
- //int ver; // ?
|
|
|
|
|
-
|
|
|
|
|
void *buf; // can be NULL if len == 0
|
|
void *buf; // can be NULL if len == 0
|
|
|
size_t len; // in bytes
|
|
size_t len; // in bytes
|
|
|
int typecode; // as per binary.h
|
|
int typecode; // as per binary.h
|
|
|
-
|
|
|
|
|
- // Rationale: to load arbitrary-sized sprites directly to LCD
|
|
|
|
|
- // Cons: a bit adhoc usecase
|
|
|
|
|
- // int stride;
|
|
|
|
|
} mp_buffer_info_t;
|
|
} mp_buffer_info_t;
|
|
|
#define MP_BUFFER_READ (1)
|
|
#define MP_BUFFER_READ (1)
|
|
|
#define MP_BUFFER_WRITE (2)
|
|
#define MP_BUFFER_WRITE (2)
|
|
@@ -589,7 +655,6 @@ extern const mp_obj_type_t mp_type_MemoryError;
|
|
|
extern const mp_obj_type_t mp_type_NameError;
|
|
extern const mp_obj_type_t mp_type_NameError;
|
|
|
extern const mp_obj_type_t mp_type_NotImplementedError;
|
|
extern const mp_obj_type_t mp_type_NotImplementedError;
|
|
|
extern const mp_obj_type_t mp_type_OSError;
|
|
extern const mp_obj_type_t mp_type_OSError;
|
|
|
-extern const mp_obj_type_t mp_type_TimeoutError;
|
|
|
|
|
extern const mp_obj_type_t mp_type_OverflowError;
|
|
extern const mp_obj_type_t mp_type_OverflowError;
|
|
|
extern const mp_obj_type_t mp_type_RuntimeError;
|
|
extern const mp_obj_type_t mp_type_RuntimeError;
|
|
|
extern const mp_obj_type_t mp_type_StopAsyncIteration;
|
|
extern const mp_obj_type_t mp_type_StopAsyncIteration;
|
|
@@ -602,47 +667,71 @@ extern const mp_obj_type_t mp_type_ValueError;
|
|
|
extern const mp_obj_type_t mp_type_ViperTypeError;
|
|
extern const mp_obj_type_t mp_type_ViperTypeError;
|
|
|
extern const mp_obj_type_t mp_type_ZeroDivisionError;
|
|
extern const mp_obj_type_t mp_type_ZeroDivisionError;
|
|
|
|
|
|
|
|
-// Constant objects, globally accessible
|
|
|
|
|
-// The macros are for convenience only
|
|
|
|
|
|
|
+// Constant objects, globally accessible: None, False, True
|
|
|
|
|
+// These should always be accessed via the below macros.
|
|
|
|
|
+#if MICROPY_OBJ_IMMEDIATE_OBJS
|
|
|
|
|
+// None is even while False/True are odd so their types can be distinguished with 1 bit.
|
|
|
|
|
+#define mp_const_none MP_OBJ_NEW_IMMEDIATE_OBJ(0)
|
|
|
|
|
+#define mp_const_false MP_OBJ_NEW_IMMEDIATE_OBJ(1)
|
|
|
|
|
+#define mp_const_true MP_OBJ_NEW_IMMEDIATE_OBJ(3)
|
|
|
|
|
+#else
|
|
|
#define mp_const_none (MP_OBJ_FROM_PTR(&mp_const_none_obj))
|
|
#define mp_const_none (MP_OBJ_FROM_PTR(&mp_const_none_obj))
|
|
|
#define mp_const_false (MP_OBJ_FROM_PTR(&mp_const_false_obj))
|
|
#define mp_const_false (MP_OBJ_FROM_PTR(&mp_const_false_obj))
|
|
|
#define mp_const_true (MP_OBJ_FROM_PTR(&mp_const_true_obj))
|
|
#define mp_const_true (MP_OBJ_FROM_PTR(&mp_const_true_obj))
|
|
|
-#define mp_const_empty_bytes (MP_OBJ_FROM_PTR(&mp_const_empty_bytes_obj))
|
|
|
|
|
-#define mp_const_empty_tuple (MP_OBJ_FROM_PTR(&mp_const_empty_tuple_obj))
|
|
|
|
|
-#define mp_const_notimplemented (MP_OBJ_FROM_PTR(&mp_const_notimplemented_obj))
|
|
|
|
|
extern const struct _mp_obj_none_t mp_const_none_obj;
|
|
extern const struct _mp_obj_none_t mp_const_none_obj;
|
|
|
extern const struct _mp_obj_bool_t mp_const_false_obj;
|
|
extern const struct _mp_obj_bool_t mp_const_false_obj;
|
|
|
extern const struct _mp_obj_bool_t mp_const_true_obj;
|
|
extern const struct _mp_obj_bool_t mp_const_true_obj;
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+// Constant objects, globally accessible: b'', (), {}, Ellipsis, NotImplemented, GeneratorExit()
|
|
|
|
|
+// The below macros are for convenience only.
|
|
|
|
|
+#define mp_const_empty_bytes (MP_OBJ_FROM_PTR(&mp_const_empty_bytes_obj))
|
|
|
|
|
+#define mp_const_empty_tuple (MP_OBJ_FROM_PTR(&mp_const_empty_tuple_obj))
|
|
|
|
|
+#define mp_const_notimplemented (MP_OBJ_FROM_PTR(&mp_const_notimplemented_obj))
|
|
|
extern const struct _mp_obj_str_t mp_const_empty_bytes_obj;
|
|
extern const struct _mp_obj_str_t mp_const_empty_bytes_obj;
|
|
|
extern const struct _mp_obj_tuple_t mp_const_empty_tuple_obj;
|
|
extern const struct _mp_obj_tuple_t mp_const_empty_tuple_obj;
|
|
|
|
|
+extern const struct _mp_obj_dict_t mp_const_empty_dict_obj;
|
|
|
extern const struct _mp_obj_singleton_t mp_const_ellipsis_obj;
|
|
extern const struct _mp_obj_singleton_t mp_const_ellipsis_obj;
|
|
|
extern const struct _mp_obj_singleton_t mp_const_notimplemented_obj;
|
|
extern const struct _mp_obj_singleton_t mp_const_notimplemented_obj;
|
|
|
extern const struct _mp_obj_exception_t mp_const_GeneratorExit_obj;
|
|
extern const struct _mp_obj_exception_t mp_const_GeneratorExit_obj;
|
|
|
|
|
|
|
|
|
|
+// Fixed empty map. Useful when calling keyword-receiving functions
|
|
|
|
|
+// without any keywords from C, etc.
|
|
|
|
|
+#define mp_const_empty_map (mp_const_empty_dict_obj.map)
|
|
|
|
|
+
|
|
|
// General API for objects
|
|
// General API for objects
|
|
|
|
|
|
|
|
// These macros are derived from more primitive ones and are used to
|
|
// These macros are derived from more primitive ones and are used to
|
|
|
// check for more specific object types.
|
|
// check for more specific object types.
|
|
|
// Note: these are kept as macros because inline functions sometimes use much
|
|
// Note: these are kept as macros because inline functions sometimes use much
|
|
|
// more code space than the equivalent macros, depending on the compiler.
|
|
// more code space than the equivalent macros, depending on the compiler.
|
|
|
-#define mp_obj_is_type(o, t) (mp_obj_is_obj(o) && (((mp_obj_base_t*)MP_OBJ_TO_PTR(o))->type == (t))) // this does not work for checking int, str or fun; use below macros for that
|
|
|
|
|
|
|
+#define mp_obj_is_type(o, t) (mp_obj_is_obj(o) && (((mp_obj_base_t *)MP_OBJ_TO_PTR(o))->type == (t))) // this does not work for checking int, str or fun; use below macros for that
|
|
|
|
|
+#if MICROPY_OBJ_IMMEDIATE_OBJS
|
|
|
|
|
+// bool's are immediates, not real objects, so test for the 2 possible values.
|
|
|
|
|
+#define mp_obj_is_bool(o) ((o) == mp_const_false || (o) == mp_const_true)
|
|
|
|
|
+#else
|
|
|
|
|
+#define mp_obj_is_bool(o) mp_obj_is_type(o, &mp_type_bool)
|
|
|
|
|
+#endif
|
|
|
#define mp_obj_is_int(o) (mp_obj_is_small_int(o) || mp_obj_is_type(o, &mp_type_int))
|
|
#define mp_obj_is_int(o) (mp_obj_is_small_int(o) || mp_obj_is_type(o, &mp_type_int))
|
|
|
#define mp_obj_is_str(o) (mp_obj_is_qstr(o) || mp_obj_is_type(o, &mp_type_str))
|
|
#define mp_obj_is_str(o) (mp_obj_is_qstr(o) || mp_obj_is_type(o, &mp_type_str))
|
|
|
-#define mp_obj_is_str_or_bytes(o) (mp_obj_is_qstr(o) || (mp_obj_is_obj(o) && ((mp_obj_base_t*)MP_OBJ_TO_PTR(o))->type->binary_op == mp_obj_str_binary_op))
|
|
|
|
|
-#define mp_obj_is_fun(o) (mp_obj_is_obj(o) && (((mp_obj_base_t*)MP_OBJ_TO_PTR(o))->type->name == MP_QSTR_function))
|
|
|
|
|
|
|
+#define mp_obj_is_str_or_bytes(o) (mp_obj_is_qstr(o) || (mp_obj_is_obj(o) && ((mp_obj_base_t *)MP_OBJ_TO_PTR(o))->type->binary_op == mp_obj_str_binary_op))
|
|
|
|
|
+#define mp_obj_is_dict_or_ordereddict(o) (mp_obj_is_obj(o) && ((mp_obj_base_t *)MP_OBJ_TO_PTR(o))->type->make_new == mp_obj_dict_make_new)
|
|
|
|
|
+#define mp_obj_is_fun(o) (mp_obj_is_obj(o) && (((mp_obj_base_t *)MP_OBJ_TO_PTR(o))->type->name == MP_QSTR_function))
|
|
|
|
|
|
|
|
mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict);
|
|
mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict);
|
|
|
-static inline mp_obj_t mp_obj_new_bool(mp_int_t x) { return x ? mp_const_true : mp_const_false; }
|
|
|
|
|
|
|
+static inline mp_obj_t mp_obj_new_bool(mp_int_t x) {
|
|
|
|
|
+ return x ? mp_const_true : mp_const_false;
|
|
|
|
|
+}
|
|
|
mp_obj_t mp_obj_new_cell(mp_obj_t obj);
|
|
mp_obj_t mp_obj_new_cell(mp_obj_t obj);
|
|
|
mp_obj_t mp_obj_new_int(mp_int_t value);
|
|
mp_obj_t mp_obj_new_int(mp_int_t value);
|
|
|
mp_obj_t mp_obj_new_int_from_uint(mp_uint_t value);
|
|
mp_obj_t mp_obj_new_int_from_uint(mp_uint_t value);
|
|
|
mp_obj_t mp_obj_new_int_from_str_len(const char **str, size_t len, bool neg, unsigned int base);
|
|
mp_obj_t mp_obj_new_int_from_str_len(const char **str, size_t len, bool neg, unsigned int base);
|
|
|
mp_obj_t mp_obj_new_int_from_ll(long long val); // this must return a multi-precision integer object (or raise an overflow exception)
|
|
mp_obj_t mp_obj_new_int_from_ll(long long val); // this must return a multi-precision integer object (or raise an overflow exception)
|
|
|
mp_obj_t mp_obj_new_int_from_ull(unsigned long long val); // this must return a multi-precision integer object (or raise an overflow exception)
|
|
mp_obj_t mp_obj_new_int_from_ull(unsigned long long val); // this must return a multi-precision integer object (or raise an overflow exception)
|
|
|
-mp_obj_t mp_obj_new_str(const char* data, size_t len);
|
|
|
|
|
-mp_obj_t mp_obj_new_str_via_qstr(const char* data, size_t len);
|
|
|
|
|
|
|
+mp_obj_t mp_obj_new_str(const char *data, size_t len);
|
|
|
|
|
+mp_obj_t mp_obj_new_str_via_qstr(const char *data, size_t len);
|
|
|
mp_obj_t mp_obj_new_str_from_vstr(const mp_obj_type_t *type, vstr_t *vstr);
|
|
mp_obj_t mp_obj_new_str_from_vstr(const mp_obj_type_t *type, vstr_t *vstr);
|
|
|
-mp_obj_t mp_obj_new_bytes(const byte* data, size_t len);
|
|
|
|
|
|
|
+mp_obj_t mp_obj_new_bytes(const byte *data, size_t len);
|
|
|
mp_obj_t mp_obj_new_bytearray(size_t n, void *items);
|
|
mp_obj_t mp_obj_new_bytearray(size_t n, void *items);
|
|
|
mp_obj_t mp_obj_new_bytearray_by_ref(size_t n, void *items);
|
|
mp_obj_t mp_obj_new_bytearray_by_ref(size_t n, void *items);
|
|
|
#if MICROPY_PY_BUILTINS_FLOAT
|
|
#if MICROPY_PY_BUILTINS_FLOAT
|
|
@@ -652,8 +741,11 @@ mp_obj_t mp_obj_new_complex(mp_float_t real, mp_float_t imag);
|
|
|
mp_obj_t mp_obj_new_exception(const mp_obj_type_t *exc_type);
|
|
mp_obj_t mp_obj_new_exception(const mp_obj_type_t *exc_type);
|
|
|
mp_obj_t mp_obj_new_exception_arg1(const mp_obj_type_t *exc_type, mp_obj_t arg);
|
|
mp_obj_t mp_obj_new_exception_arg1(const mp_obj_type_t *exc_type, mp_obj_t arg);
|
|
|
mp_obj_t mp_obj_new_exception_args(const mp_obj_type_t *exc_type, size_t n_args, const mp_obj_t *args);
|
|
mp_obj_t mp_obj_new_exception_args(const mp_obj_type_t *exc_type, size_t n_args, const mp_obj_t *args);
|
|
|
-mp_obj_t mp_obj_new_exception_msg(const mp_obj_type_t *exc_type, const char *msg);
|
|
|
|
|
-mp_obj_t mp_obj_new_exception_msg_varg(const mp_obj_type_t *exc_type, const char *fmt, ...); // counts args by number of % symbols in fmt, excluding %%; can only handle void* sizes (ie no float/double!)
|
|
|
|
|
|
|
+mp_obj_t mp_obj_new_exception_msg(const mp_obj_type_t *exc_type, mp_rom_error_text_t msg);
|
|
|
|
|
+mp_obj_t mp_obj_new_exception_msg_varg(const mp_obj_type_t *exc_type, mp_rom_error_text_t fmt, ...); // counts args by number of % symbols in fmt, excluding %%; can only handle void* sizes (ie no float/double!)
|
|
|
|
|
+#ifdef va_start
|
|
|
|
|
+mp_obj_t mp_obj_new_exception_msg_vlist(const mp_obj_type_t *exc_type, mp_rom_error_text_t fmt, va_list arg); // same fmt restrictions as above
|
|
|
|
|
+#endif
|
|
|
mp_obj_t mp_obj_new_fun_bc(mp_obj_t def_args, mp_obj_t def_kw_args, const byte *code, const mp_uint_t *const_table);
|
|
mp_obj_t mp_obj_new_fun_bc(mp_obj_t def_args, mp_obj_t def_kw_args, const byte *code, const mp_uint_t *const_table);
|
|
|
mp_obj_t mp_obj_new_fun_native(mp_obj_t def_args_in, mp_obj_t def_kw_args, const void *fun_data, const mp_uint_t *const_table);
|
|
mp_obj_t mp_obj_new_fun_native(mp_obj_t def_args_in, mp_obj_t def_kw_args, const void *fun_data, const mp_uint_t *const_table);
|
|
|
mp_obj_t mp_obj_new_fun_asm(size_t n_args, const void *fun_data, mp_uint_t type_sig);
|
|
mp_obj_t mp_obj_new_fun_asm(size_t n_args, const void *fun_data, mp_uint_t type_sig);
|
|
@@ -669,10 +761,10 @@ mp_obj_t mp_obj_new_getitem_iter(mp_obj_t *args, mp_obj_iter_buf_t *iter_buf);
|
|
|
mp_obj_t mp_obj_new_module(qstr module_name);
|
|
mp_obj_t mp_obj_new_module(qstr module_name);
|
|
|
mp_obj_t mp_obj_new_memoryview(byte typecode, size_t nitems, void *items);
|
|
mp_obj_t mp_obj_new_memoryview(byte typecode, size_t nitems, void *items);
|
|
|
|
|
|
|
|
-mp_obj_type_t *mp_obj_get_type(mp_const_obj_t o_in);
|
|
|
|
|
|
|
+const mp_obj_type_t *mp_obj_get_type(mp_const_obj_t o_in);
|
|
|
const char *mp_obj_get_type_str(mp_const_obj_t o_in);
|
|
const char *mp_obj_get_type_str(mp_const_obj_t o_in);
|
|
|
bool mp_obj_is_subclass_fast(mp_const_obj_t object, mp_const_obj_t classinfo); // arguments should be type objects
|
|
bool mp_obj_is_subclass_fast(mp_const_obj_t object, mp_const_obj_t classinfo); // arguments should be type objects
|
|
|
-mp_obj_t mp_instance_cast_to_native_base(mp_const_obj_t self_in, mp_const_obj_t native_type);
|
|
|
|
|
|
|
+mp_obj_t mp_obj_cast_to_native_base(mp_obj_t self_in, mp_const_obj_t native_type);
|
|
|
|
|
|
|
|
void mp_obj_print_helper(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind);
|
|
void mp_obj_print_helper(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind);
|
|
|
void mp_obj_print(mp_obj_t o, mp_print_kind_t kind);
|
|
void mp_obj_print(mp_obj_t o, mp_print_kind_t kind);
|
|
@@ -680,9 +772,12 @@ void mp_obj_print_exception(const mp_print_t *print, mp_obj_t exc);
|
|
|
|
|
|
|
|
bool mp_obj_is_true(mp_obj_t arg);
|
|
bool mp_obj_is_true(mp_obj_t arg);
|
|
|
bool mp_obj_is_callable(mp_obj_t o_in);
|
|
bool mp_obj_is_callable(mp_obj_t o_in);
|
|
|
|
|
+mp_obj_t mp_obj_equal_not_equal(mp_binary_op_t op, mp_obj_t o1, mp_obj_t o2);
|
|
|
bool mp_obj_equal(mp_obj_t o1, mp_obj_t o2);
|
|
bool mp_obj_equal(mp_obj_t o1, mp_obj_t o2);
|
|
|
|
|
|
|
|
-static inline bool mp_obj_is_integer(mp_const_obj_t o) { return mp_obj_is_int(o) || mp_obj_is_type(o, &mp_type_bool); } // returns true if o is bool, small int or long int
|
|
|
|
|
|
|
+static inline bool mp_obj_is_integer(mp_const_obj_t o) {
|
|
|
|
|
+ return mp_obj_is_int(o) || mp_obj_is_bool(o);
|
|
|
|
|
+} // returns true if o is bool, small int or long int
|
|
|
mp_int_t mp_obj_get_int(mp_const_obj_t arg);
|
|
mp_int_t mp_obj_get_int(mp_const_obj_t arg);
|
|
|
mp_int_t mp_obj_get_int_truncated(mp_const_obj_t arg);
|
|
mp_int_t mp_obj_get_int_truncated(mp_const_obj_t arg);
|
|
|
bool mp_obj_get_int_maybe(mp_const_obj_t arg, mp_int_t *value);
|
|
bool mp_obj_get_int_maybe(mp_const_obj_t arg, mp_int_t *value);
|
|
@@ -690,6 +785,7 @@ bool mp_obj_get_int_maybe(mp_const_obj_t arg, mp_int_t *value);
|
|
|
mp_float_t mp_obj_get_float(mp_obj_t self_in);
|
|
mp_float_t mp_obj_get_float(mp_obj_t self_in);
|
|
|
bool mp_obj_get_float_maybe(mp_obj_t arg, mp_float_t *value);
|
|
bool mp_obj_get_float_maybe(mp_obj_t arg, mp_float_t *value);
|
|
|
void mp_obj_get_complex(mp_obj_t self_in, mp_float_t *real, mp_float_t *imag);
|
|
void mp_obj_get_complex(mp_obj_t self_in, mp_float_t *real, mp_float_t *imag);
|
|
|
|
|
+bool mp_obj_get_complex_maybe(mp_obj_t self_in, mp_float_t *real, mp_float_t *imag);
|
|
|
#endif
|
|
#endif
|
|
|
void mp_obj_get_array(mp_obj_t o, size_t *len, mp_obj_t **items); // *items may point inside a GC block
|
|
void mp_obj_get_array(mp_obj_t o, size_t *len, mp_obj_t **items); // *items may point inside a GC block
|
|
|
void mp_obj_get_array_fixed_n(mp_obj_t o, size_t len, mp_obj_t **items); // *items may point inside a GC block
|
|
void mp_obj_get_array_fixed_n(mp_obj_t o, size_t len, mp_obj_t **items); // *items may point inside a GC block
|
|
@@ -709,6 +805,8 @@ void mp_obj_cell_set(mp_obj_t self_in, mp_obj_t obj);
|
|
|
mp_int_t mp_obj_int_get_truncated(mp_const_obj_t self_in);
|
|
mp_int_t mp_obj_int_get_truncated(mp_const_obj_t self_in);
|
|
|
// Will raise exception if value doesn't fit into mp_int_t
|
|
// Will raise exception if value doesn't fit into mp_int_t
|
|
|
mp_int_t mp_obj_int_get_checked(mp_const_obj_t self_in);
|
|
mp_int_t mp_obj_int_get_checked(mp_const_obj_t self_in);
|
|
|
|
|
+// Will raise exception if value is negative or doesn't fit into mp_uint_t
|
|
|
|
|
+mp_uint_t mp_obj_int_get_uint_checked(mp_const_obj_t self_in);
|
|
|
|
|
|
|
|
// exception
|
|
// exception
|
|
|
#define mp_obj_is_native_exception_instance(o) (mp_obj_get_type(o)->make_new == mp_obj_exception_make_new)
|
|
#define mp_obj_is_native_exception_instance(o) (mp_obj_get_type(o)->make_new == mp_obj_exception_make_new)
|
|
@@ -734,10 +832,45 @@ void mp_str_print_quoted(const mp_print_t *print, const byte *str_data, size_t s
|
|
|
|
|
|
|
|
#if MICROPY_PY_BUILTINS_FLOAT
|
|
#if MICROPY_PY_BUILTINS_FLOAT
|
|
|
// float
|
|
// float
|
|
|
|
|
+#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
|
|
|
|
|
+static inline float mp_obj_get_float_to_f(mp_obj_t o) {
|
|
|
|
|
+ return mp_obj_get_float(o);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static inline double mp_obj_get_float_to_d(mp_obj_t o) {
|
|
|
|
|
+ return (double)mp_obj_get_float(o);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static inline mp_obj_t mp_obj_new_float_from_f(float o) {
|
|
|
|
|
+ return mp_obj_new_float(o);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static inline mp_obj_t mp_obj_new_float_from_d(double o) {
|
|
|
|
|
+ return mp_obj_new_float((mp_float_t)o);
|
|
|
|
|
+}
|
|
|
|
|
+#elif MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_DOUBLE
|
|
|
|
|
+static inline float mp_obj_get_float_to_f(mp_obj_t o) {
|
|
|
|
|
+ return (float)mp_obj_get_float(o);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static inline double mp_obj_get_float_to_d(mp_obj_t o) {
|
|
|
|
|
+ return mp_obj_get_float(o);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static inline mp_obj_t mp_obj_new_float_from_f(float o) {
|
|
|
|
|
+ return mp_obj_new_float((mp_float_t)o);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static inline mp_obj_t mp_obj_new_float_from_d(double o) {
|
|
|
|
|
+ return mp_obj_new_float(o);
|
|
|
|
|
+}
|
|
|
|
|
+#endif
|
|
|
#if MICROPY_FLOAT_HIGH_QUALITY_HASH
|
|
#if MICROPY_FLOAT_HIGH_QUALITY_HASH
|
|
|
mp_int_t mp_float_hash(mp_float_t val);
|
|
mp_int_t mp_float_hash(mp_float_t val);
|
|
|
#else
|
|
#else
|
|
|
-static inline mp_int_t mp_float_hash(mp_float_t val) { return (mp_int_t)val; }
|
|
|
|
|
|
|
+static inline mp_int_t mp_float_hash(mp_float_t val) {
|
|
|
|
|
+ return (mp_int_t)val;
|
|
|
|
|
+}
|
|
|
#endif
|
|
#endif
|
|
|
mp_obj_t mp_obj_float_binary_op(mp_binary_op_t op, mp_float_t lhs_val, mp_obj_t rhs); // can return MP_OBJ_NULL if op not supported
|
|
mp_obj_t mp_obj_float_binary_op(mp_binary_op_t op, mp_float_t lhs_val, mp_obj_t rhs); // can return MP_OBJ_NULL if op not supported
|
|
|
|
|
|
|
@@ -766,20 +899,35 @@ typedef struct _mp_obj_dict_t {
|
|
|
mp_obj_base_t base;
|
|
mp_obj_base_t base;
|
|
|
mp_map_t map;
|
|
mp_map_t map;
|
|
|
} mp_obj_dict_t;
|
|
} mp_obj_dict_t;
|
|
|
|
|
+mp_obj_t mp_obj_dict_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args);
|
|
|
void mp_obj_dict_init(mp_obj_dict_t *dict, size_t n_args);
|
|
void mp_obj_dict_init(mp_obj_dict_t *dict, size_t n_args);
|
|
|
size_t mp_obj_dict_len(mp_obj_t self_in);
|
|
size_t mp_obj_dict_len(mp_obj_t self_in);
|
|
|
mp_obj_t mp_obj_dict_get(mp_obj_t self_in, mp_obj_t index);
|
|
mp_obj_t mp_obj_dict_get(mp_obj_t self_in, mp_obj_t index);
|
|
|
mp_obj_t mp_obj_dict_store(mp_obj_t self_in, mp_obj_t key, mp_obj_t value);
|
|
mp_obj_t mp_obj_dict_store(mp_obj_t self_in, mp_obj_t key, mp_obj_t value);
|
|
|
mp_obj_t mp_obj_dict_delete(mp_obj_t self_in, mp_obj_t key);
|
|
mp_obj_t mp_obj_dict_delete(mp_obj_t self_in, mp_obj_t key);
|
|
|
|
|
+mp_obj_t mp_obj_dict_copy(mp_obj_t self_in);
|
|
|
static inline mp_map_t *mp_obj_dict_get_map(mp_obj_t dict) {
|
|
static inline mp_map_t *mp_obj_dict_get_map(mp_obj_t dict) {
|
|
|
- return &((mp_obj_dict_t*)MP_OBJ_TO_PTR(dict))->map;
|
|
|
|
|
|
|
+ return &((mp_obj_dict_t *)MP_OBJ_TO_PTR(dict))->map;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// set
|
|
// set
|
|
|
void mp_obj_set_store(mp_obj_t self_in, mp_obj_t item);
|
|
void mp_obj_set_store(mp_obj_t self_in, mp_obj_t item);
|
|
|
|
|
|
|
|
|
|
+// slice indexes resolved to particular sequence
|
|
|
|
|
+typedef struct {
|
|
|
|
|
+ mp_int_t start;
|
|
|
|
|
+ mp_int_t stop;
|
|
|
|
|
+ mp_int_t step;
|
|
|
|
|
+} mp_bound_slice_t;
|
|
|
|
|
+
|
|
|
// slice
|
|
// slice
|
|
|
-void mp_obj_slice_get(mp_obj_t self_in, mp_obj_t *start, mp_obj_t *stop, mp_obj_t *step);
|
|
|
|
|
|
|
+typedef struct _mp_obj_slice_t {
|
|
|
|
|
+ mp_obj_base_t base;
|
|
|
|
|
+ mp_obj_t start;
|
|
|
|
|
+ mp_obj_t stop;
|
|
|
|
|
+ mp_obj_t step;
|
|
|
|
|
+} mp_obj_slice_t;
|
|
|
|
|
+void mp_obj_slice_indices(mp_obj_t self_in, mp_int_t length, mp_bound_slice_t *result);
|
|
|
|
|
|
|
|
// functions
|
|
// functions
|
|
|
|
|
|
|
@@ -815,7 +963,7 @@ typedef struct _mp_obj_module_t {
|
|
|
mp_obj_dict_t *globals;
|
|
mp_obj_dict_t *globals;
|
|
|
} mp_obj_module_t;
|
|
} mp_obj_module_t;
|
|
|
static inline mp_obj_dict_t *mp_obj_module_get_globals(mp_obj_t module) {
|
|
static inline mp_obj_dict_t *mp_obj_module_get_globals(mp_obj_t module) {
|
|
|
- return ((mp_obj_module_t*)MP_OBJ_TO_PTR(module))->globals;
|
|
|
|
|
|
|
+ return ((mp_obj_module_t *)MP_OBJ_TO_PTR(module))->globals;
|
|
|
}
|
|
}
|
|
|
// check if given module object is a package
|
|
// check if given module object is a package
|
|
|
bool mp_obj_is_package(mp_obj_t module);
|
|
bool mp_obj_is_package(mp_obj_t module);
|
|
@@ -836,13 +984,6 @@ const mp_obj_t *mp_obj_property_get(mp_obj_t self_in);
|
|
|
|
|
|
|
|
// sequence helpers
|
|
// sequence helpers
|
|
|
|
|
|
|
|
-// slice indexes resolved to particular sequence
|
|
|
|
|
-typedef struct {
|
|
|
|
|
- mp_uint_t start;
|
|
|
|
|
- mp_uint_t stop;
|
|
|
|
|
- mp_int_t step;
|
|
|
|
|
-} mp_bound_slice_t;
|
|
|
|
|
-
|
|
|
|
|
void mp_seq_multiply(const void *items, size_t item_sz, size_t len, size_t times, void *dest);
|
|
void mp_seq_multiply(const void *items, size_t item_sz, size_t len, size_t times, void *dest);
|
|
|
#if MICROPY_PY_BUILTINS_SLICE
|
|
#if MICROPY_PY_BUILTINS_SLICE
|
|
|
bool mp_seq_get_fast_slice_indexes(mp_uint_t len, mp_obj_t slice, mp_bound_slice_t *indexes);
|
|
bool mp_seq_get_fast_slice_indexes(mp_uint_t len, mp_obj_t slice, mp_bound_slice_t *indexes);
|
|
@@ -854,19 +995,19 @@ bool mp_seq_cmp_objs(mp_uint_t op, const mp_obj_t *items1, size_t len1, const mp
|
|
|
mp_obj_t mp_seq_index_obj(const mp_obj_t *items, size_t len, size_t n_args, const mp_obj_t *args);
|
|
mp_obj_t mp_seq_index_obj(const mp_obj_t *items, size_t len, size_t n_args, const mp_obj_t *args);
|
|
|
mp_obj_t mp_seq_count_obj(const mp_obj_t *items, size_t len, mp_obj_t value);
|
|
mp_obj_t mp_seq_count_obj(const mp_obj_t *items, size_t len, mp_obj_t value);
|
|
|
mp_obj_t mp_seq_extract_slice(size_t len, const mp_obj_t *seq, mp_bound_slice_t *indexes);
|
|
mp_obj_t mp_seq_extract_slice(size_t len, const mp_obj_t *seq, mp_bound_slice_t *indexes);
|
|
|
|
|
+
|
|
|
// Helper to clear stale pointers from allocated, but unused memory, to preclude GC problems
|
|
// Helper to clear stale pointers from allocated, but unused memory, to preclude GC problems
|
|
|
-#define mp_seq_clear(start, len, alloc_len, item_sz) memset((byte*)(start) + (len) * (item_sz), 0, ((alloc_len) - (len)) * (item_sz))
|
|
|
|
|
|
|
+#define mp_seq_clear(start, len, alloc_len, item_sz) memset((byte *)(start) + (len) * (item_sz), 0, ((alloc_len) - (len)) * (item_sz))
|
|
|
|
|
+
|
|
|
|
|
+// Note: dest and slice regions may overlap
|
|
|
#define mp_seq_replace_slice_no_grow(dest, dest_len, beg, end, slice, slice_len, item_sz) \
|
|
#define mp_seq_replace_slice_no_grow(dest, dest_len, beg, end, slice, slice_len, item_sz) \
|
|
|
- /*printf("memcpy(%p, %p, %d)\n", dest + beg, slice, slice_len * (item_sz));*/ \
|
|
|
|
|
- memcpy(((char*)dest) + (beg) * (item_sz), slice, slice_len * (item_sz)); \
|
|
|
|
|
- /*printf("memmove(%p, %p, %d)\n", dest + (beg + slice_len), dest + end, (dest_len - end) * (item_sz));*/ \
|
|
|
|
|
- memmove(((char*)dest) + (beg + slice_len) * (item_sz), ((char*)dest) + (end) * (item_sz), (dest_len - end) * (item_sz));
|
|
|
|
|
|
|
+ memmove(((char *)dest) + (beg) * (item_sz), slice, slice_len * (item_sz)); \
|
|
|
|
|
+ memmove(((char *)dest) + (beg + slice_len) * (item_sz), ((char *)dest) + (end) * (item_sz), (dest_len - end) * (item_sz));
|
|
|
|
|
|
|
|
// Note: dest and slice regions may overlap
|
|
// Note: dest and slice regions may overlap
|
|
|
#define mp_seq_replace_slice_grow_inplace(dest, dest_len, beg, end, slice, slice_len, len_adj, item_sz) \
|
|
#define mp_seq_replace_slice_grow_inplace(dest, dest_len, beg, end, slice, slice_len, len_adj, item_sz) \
|
|
|
- /*printf("memmove(%p, %p, %d)\n", dest + beg + len_adj, dest + beg, (dest_len - beg) * (item_sz));*/ \
|
|
|
|
|
- memmove(((char*)dest) + (beg + slice_len) * (item_sz), ((char*)dest) + (end) * (item_sz), ((dest_len) + (len_adj) - ((beg) + (slice_len))) * (item_sz)); \
|
|
|
|
|
- memmove(((char*)dest) + (beg) * (item_sz), slice, slice_len * (item_sz));
|
|
|
|
|
|
|
+ memmove(((char *)dest) + (beg + slice_len) * (item_sz), ((char *)dest) + (end) * (item_sz), ((dest_len) + (len_adj) - ((beg) + (slice_len))) * (item_sz)); \
|
|
|
|
|
+ memmove(((char *)dest) + (beg) * (item_sz), slice, slice_len * (item_sz));
|
|
|
|
|
|
|
|
// Provide translation for legacy API
|
|
// Provide translation for legacy API
|
|
|
#define MP_OBJ_IS_SMALL_INT mp_obj_is_small_int
|
|
#define MP_OBJ_IS_SMALL_INT mp_obj_is_small_int
|