Commit fb510b3b authored by Damien George's avatar Damien George
Browse files

Rename bultins config variables to MICROPY_PY_BUILTINS_*.

This renames:
MICROPY_PY_FROZENSET -> MICROPY_PY_BUILTINS_FROZENSET
MICROPY_PY_PROPERTY -> MICROPY_PY_BUILTINS_PROPERTY
MICROPY_PY_SLICE -> MICROPY_PY_BUILTINS_SLICE
MICROPY_ENABLE_FLOAT -> MICROPY_PY_BUILTINS_FLOAT

See issue #35 for discussion.
parent c60a261e
...@@ -12,13 +12,13 @@ ...@@ -12,13 +12,13 @@
#define MICROPY_HELPER_REPL (0) #define MICROPY_HELPER_REPL (0)
#define MICROPY_HELPER_LEXER_UNIX (0) #define MICROPY_HELPER_LEXER_UNIX (0)
#define MICROPY_ENABLE_SOURCE_LINE (0) #define MICROPY_ENABLE_SOURCE_LINE (0)
#define MICROPY_PY_BUILTINS_PROPERTY (0)
#define MICROPY_PY_COLLECTIONS (0) #define MICROPY_PY_COLLECTIONS (0)
#define MICROPY_PY_MATH (0) #define MICROPY_PY_MATH (0)
#define MICROPY_PY_CMATH (0) #define MICROPY_PY_CMATH (0)
#define MICROPY_PY_IO (0) #define MICROPY_PY_IO (0)
#define MICROPY_PY_STRUCT (0) #define MICROPY_PY_STRUCT (0)
#define MICROPY_PY_SYS (0) #define MICROPY_PY_SYS (0)
#define MICROPY_PY_PROPERTY (0)
#define MICROPY_CPYTHON_COMPAT (0) #define MICROPY_CPYTHON_COMPAT (0)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE) #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)
......
...@@ -114,7 +114,7 @@ mp_obj_t mp_binary_get_val_array(char typecode, void *p, int index) { ...@@ -114,7 +114,7 @@ mp_obj_t mp_binary_get_val_array(char typecode, void *p, int index) {
// TODO: Explode API more to cover signedness // TODO: Explode API more to cover signedness
return mp_obj_new_int_from_ll(((long long*)p)[index]); return mp_obj_new_int_from_ll(((long long*)p)[index]);
#endif #endif
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
case 'f': case 'f':
return mp_obj_new_float(((float*)p)[index]); return mp_obj_new_float(((float*)p)[index]);
case 'd': case 'd':
...@@ -217,7 +217,7 @@ void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte ** ...@@ -217,7 +217,7 @@ void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte **
void mp_binary_set_val_array(char typecode, void *p, int index, mp_obj_t val_in) { void mp_binary_set_val_array(char typecode, void *p, int index, mp_obj_t val_in) {
switch (typecode) { switch (typecode) {
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
case 'f': case 'f':
((float*)p)[index] = mp_obj_float_get(val_in); ((float*)p)[index] = mp_obj_float_get(val_in);
break; break;
...@@ -260,7 +260,7 @@ void mp_binary_set_val_array_from_int(char typecode, void *p, int index, machine ...@@ -260,7 +260,7 @@ void mp_binary_set_val_array_from_int(char typecode, void *p, int index, machine
((long long*)p)[index] = val; ((long long*)p)[index] = val;
break; break;
#endif #endif
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
case 'f': case 'f':
((float*)p)[index] = val; ((float*)p)[index] = val;
break; break;
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include "runtime.h" #include "runtime.h"
#include "builtin.h" #include "builtin.h"
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
#include <math.h> #include <math.h>
#endif #endif
...@@ -104,7 +104,7 @@ mp_obj_t mp_builtin_abs(mp_obj_t o_in) { ...@@ -104,7 +104,7 @@ mp_obj_t mp_builtin_abs(mp_obj_t o_in) {
val = -val; val = -val;
} }
return MP_OBJ_NEW_SMALL_INT(val); return MP_OBJ_NEW_SMALL_INT(val);
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
} else if (MP_OBJ_IS_TYPE(o_in, &mp_type_float)) { } else if (MP_OBJ_IS_TYPE(o_in, &mp_type_float)) {
mp_float_t value = mp_obj_float_get(o_in); mp_float_t value = mp_obj_float_get(o_in);
// TODO check for NaN etc // TODO check for NaN etc
......
...@@ -44,23 +44,23 @@ STATIC const mp_map_elem_t mp_builtin_object_table[] = { ...@@ -44,23 +44,23 @@ STATIC const mp_map_elem_t mp_builtin_object_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_bool), (mp_obj_t)&mp_type_bool }, { MP_OBJ_NEW_QSTR(MP_QSTR_bool), (mp_obj_t)&mp_type_bool },
{ MP_OBJ_NEW_QSTR(MP_QSTR_bytes), (mp_obj_t)&mp_type_bytes }, { MP_OBJ_NEW_QSTR(MP_QSTR_bytes), (mp_obj_t)&mp_type_bytes },
{ MP_OBJ_NEW_QSTR(MP_QSTR_bytearray), (mp_obj_t)&mp_type_bytearray }, { MP_OBJ_NEW_QSTR(MP_QSTR_bytearray), (mp_obj_t)&mp_type_bytearray },
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
{ MP_OBJ_NEW_QSTR(MP_QSTR_complex), (mp_obj_t)&mp_type_complex }, { MP_OBJ_NEW_QSTR(MP_QSTR_complex), (mp_obj_t)&mp_type_complex },
#endif #endif
{ MP_OBJ_NEW_QSTR(MP_QSTR_dict), (mp_obj_t)&mp_type_dict }, { MP_OBJ_NEW_QSTR(MP_QSTR_dict), (mp_obj_t)&mp_type_dict },
{ MP_OBJ_NEW_QSTR(MP_QSTR_enumerate), (mp_obj_t)&mp_type_enumerate }, { MP_OBJ_NEW_QSTR(MP_QSTR_enumerate), (mp_obj_t)&mp_type_enumerate },
{ MP_OBJ_NEW_QSTR(MP_QSTR_filter), (mp_obj_t)&mp_type_filter }, { MP_OBJ_NEW_QSTR(MP_QSTR_filter), (mp_obj_t)&mp_type_filter },
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
{ MP_OBJ_NEW_QSTR(MP_QSTR_float), (mp_obj_t)&mp_type_float }, { MP_OBJ_NEW_QSTR(MP_QSTR_float), (mp_obj_t)&mp_type_float },
#endif #endif
#if MICROPY_PY_FROZENSET #if MICROPY_PY_BUILTINS_FROZENSET
{ MP_OBJ_NEW_QSTR(MP_QSTR_frozenset), (mp_obj_t)&mp_type_frozenset }, { MP_OBJ_NEW_QSTR(MP_QSTR_frozenset), (mp_obj_t)&mp_type_frozenset },
#endif #endif
{ MP_OBJ_NEW_QSTR(MP_QSTR_int), (mp_obj_t)&mp_type_int }, { MP_OBJ_NEW_QSTR(MP_QSTR_int), (mp_obj_t)&mp_type_int },
{ MP_OBJ_NEW_QSTR(MP_QSTR_list), (mp_obj_t)&mp_type_list }, { MP_OBJ_NEW_QSTR(MP_QSTR_list), (mp_obj_t)&mp_type_list },
{ MP_OBJ_NEW_QSTR(MP_QSTR_map), (mp_obj_t)&mp_type_map }, { MP_OBJ_NEW_QSTR(MP_QSTR_map), (mp_obj_t)&mp_type_map },
{ MP_OBJ_NEW_QSTR(MP_QSTR_object), (mp_obj_t)&mp_type_object }, { MP_OBJ_NEW_QSTR(MP_QSTR_object), (mp_obj_t)&mp_type_object },
#if MICROPY_PY_PROPERTY #if MICROPY_PY_BUILTINS_PROPERTY
{ MP_OBJ_NEW_QSTR(MP_QSTR_property), (mp_obj_t)&mp_type_property }, { MP_OBJ_NEW_QSTR(MP_QSTR_property), (mp_obj_t)&mp_type_property },
#endif #endif
{ MP_OBJ_NEW_QSTR(MP_QSTR_range), (mp_obj_t)&mp_type_range }, { MP_OBJ_NEW_QSTR(MP_QSTR_range), (mp_obj_t)&mp_type_range },
...@@ -169,7 +169,7 @@ STATIC const mp_map_elem_t mp_builtin_module_table[] = { ...@@ -169,7 +169,7 @@ STATIC const mp_map_elem_t mp_builtin_module_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_struct), (mp_obj_t)&mp_module_struct }, { MP_OBJ_NEW_QSTR(MP_QSTR_struct), (mp_obj_t)&mp_module_struct },
#endif #endif
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
{ MP_OBJ_NEW_QSTR(MP_QSTR_math), (mp_obj_t)&mp_module_math }, { MP_OBJ_NEW_QSTR(MP_QSTR_math), (mp_obj_t)&mp_module_math },
#if MICROPY_PY_CMATH #if MICROPY_PY_CMATH
{ MP_OBJ_NEW_QSTR(MP_QSTR_cmath), (mp_obj_t)&mp_module_cmath }, { MP_OBJ_NEW_QSTR(MP_QSTR_cmath), (mp_obj_t)&mp_module_cmath },
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "obj.h" #include "obj.h"
#include "builtin.h" #include "builtin.h"
#if MICROPY_ENABLE_FLOAT && MICROPY_PY_CMATH #if MICROPY_PY_BUILTINS_FLOAT && MICROPY_PY_CMATH
// These are defined in modmath.c // These are defined in modmath.c
extern const mp_obj_float_t mp_math_e_obj; extern const mp_obj_float_t mp_math_e_obj;
...@@ -154,4 +154,4 @@ const mp_obj_module_t mp_module_cmath = { ...@@ -154,4 +154,4 @@ const mp_obj_module_t mp_module_cmath = {
.globals = (mp_obj_dict_t*)&mp_module_cmath_globals, .globals = (mp_obj_dict_t*)&mp_module_cmath_globals,
}; };
#endif // MICROPY_ENABLE_FLOAT && MICROPY_PY_CMATH #endif // MICROPY_PY_BUILTINS_FLOAT && MICROPY_PY_CMATH
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "obj.h" #include "obj.h"
#include "builtin.h" #include "builtin.h"
#if MICROPY_ENABLE_FLOAT && MICROPY_PY_MATH #if MICROPY_PY_BUILTINS_FLOAT && MICROPY_PY_MATH
//TODO: Change macros to check for overflow and raise OverflowError or RangeError //TODO: Change macros to check for overflow and raise OverflowError or RangeError
#define MATH_FUN_1(py_name, c_name) \ #define MATH_FUN_1(py_name, c_name) \
...@@ -184,4 +184,4 @@ const mp_obj_module_t mp_module_math = { ...@@ -184,4 +184,4 @@ const mp_obj_module_t mp_module_math = {
.globals = (mp_obj_dict_t*)&mp_module_math_globals, .globals = (mp_obj_dict_t*)&mp_module_math_globals,
}; };
#endif // MICROPY_ENABLE_FLOAT && MICROPY_PY_MATH #endif // MICROPY_PY_BUILTINS_FLOAT && MICROPY_PY_MATH
...@@ -212,15 +212,15 @@ typedef long long mp_longint_impl_t; ...@@ -212,15 +212,15 @@ typedef long long mp_longint_impl_t;
#endif #endif
#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT #if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
#define MICROPY_ENABLE_FLOAT (1) #define MICROPY_PY_BUILTINS_FLOAT (1)
#define MICROPY_FLOAT_C_FUN(fun) fun##f #define MICROPY_FLOAT_C_FUN(fun) fun##f
typedef float mp_float_t; typedef float mp_float_t;
#elif MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_DOUBLE #elif MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_DOUBLE
#define MICROPY_ENABLE_FLOAT (1) #define MICROPY_PY_BUILTINS_FLOAT (1)
#define MICROPY_FLOAT_C_FUN(fun) fun #define MICROPY_FLOAT_C_FUN(fun) fun
typedef double mp_float_t; typedef double mp_float_t;
#else #else
#define MICROPY_ENABLE_FLOAT (0) #define MICROPY_PY_BUILTINS_FLOAT (0)
#endif #endif
// Enable features which improve CPython compatibility // Enable features which improve CPython compatibility
...@@ -239,20 +239,19 @@ typedef double mp_float_t; ...@@ -239,20 +239,19 @@ typedef double mp_float_t;
/*****************************************************************************/ /*****************************************************************************/
/* Fine control over Python builtins, classes, modules, etc */ /* Fine control over Python builtins, classes, modules, etc */
// Whether to support slice object and correspondingly // Whether to support slice subscript operators and slice object
// slice subscript operators #ifndef MICROPY_PY_BUILTINS_SLICE
#ifndef MICROPY_PY_SLICE #define MICROPY_PY_BUILTINS_SLICE (1)
#define MICROPY_PY_SLICE (1)
#endif #endif
// Whether to support frozenset object // Whether to support frozenset object
#ifndef MICROPY_PY_FROZENSET #ifndef MICROPY_PY_BUILTINS_FROZENSET
#define MICROPY_PY_FROZENSET (0) #define MICROPY_PY_BUILTINS_FROZENSET (0)
#endif #endif
// Whether to support the property object // Whether to support property object
#ifndef MICROPY_PY_PROPERTY #ifndef MICROPY_PY_BUILTINS_PROPERTY
#define MICROPY_PY_PROPERTY (1) #define MICROPY_PY_BUILTINS_PROPERTY (1)
#endif #endif
// Whether to provide "collections" module // Whether to provide "collections" module
......
...@@ -1262,7 +1262,7 @@ bool mpz_as_int_checked(const mpz_t *i, machine_int_t *value) { ...@@ -1262,7 +1262,7 @@ bool mpz_as_int_checked(const mpz_t *i, machine_int_t *value) {
return true; return true;
} }
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
mp_float_t mpz_as_float(const mpz_t *i) { mp_float_t mpz_as_float(const mpz_t *i) {
mp_float_t val = 0; mp_float_t val = 0;
mpz_dig_t *d = i->dig + i->len; mpz_dig_t *d = i->dig + i->len;
......
...@@ -98,7 +98,7 @@ mpz_t *mpz_mod(const mpz_t *lhs, const mpz_t *rhs); ...@@ -98,7 +98,7 @@ mpz_t *mpz_mod(const mpz_t *lhs, const mpz_t *rhs);
machine_int_t mpz_as_int(const mpz_t *z); machine_int_t mpz_as_int(const mpz_t *z);
bool mpz_as_int_checked(const mpz_t *z, machine_int_t *value); bool mpz_as_int_checked(const mpz_t *z, machine_int_t *value);
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
mp_float_t mpz_as_float(const mpz_t *z); mp_float_t mpz_as_float(const mpz_t *z);
#endif #endif
uint mpz_as_str_size(const mpz_t *z, uint base); uint mpz_as_str_size(const mpz_t *z, uint base);
......
...@@ -257,7 +257,7 @@ bool mp_obj_get_int_maybe(mp_const_obj_t arg, machine_int_t *value) { ...@@ -257,7 +257,7 @@ bool mp_obj_get_int_maybe(mp_const_obj_t arg, machine_int_t *value) {
return true; return true;
} }
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
mp_float_t mp_obj_get_float(mp_obj_t arg) { mp_float_t mp_obj_get_float(mp_obj_t arg) {
if (arg == mp_const_false) { if (arg == mp_const_false) {
return 0; return 0;
......
...@@ -371,7 +371,7 @@ mp_obj_t mp_obj_new_int_from_str_len(const char **str, uint len, bool neg, uint ...@@ -371,7 +371,7 @@ mp_obj_t mp_obj_new_int_from_str_len(const char **str, uint len, bool neg, uint
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_str(const char* data, uint len, bool make_qstr_if_not_already); mp_obj_t mp_obj_new_str(const char* data, uint len, bool make_qstr_if_not_already);
mp_obj_t mp_obj_new_bytes(const byte* data, uint len); mp_obj_t mp_obj_new_bytes(const byte* data, uint len);
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
mp_obj_t mp_obj_new_float(mp_float_t val); mp_obj_t mp_obj_new_float(mp_float_t val);
mp_obj_t mp_obj_new_complex(mp_float_t real, mp_float_t imag); mp_obj_t mp_obj_new_complex(mp_float_t real, mp_float_t imag);
#endif #endif
...@@ -420,7 +420,7 @@ bool mp_obj_equal(mp_obj_t o1, mp_obj_t o2); ...@@ -420,7 +420,7 @@ bool mp_obj_equal(mp_obj_t o1, mp_obj_t o2);
machine_int_t mp_obj_get_int(mp_const_obj_t arg); machine_int_t mp_obj_get_int(mp_const_obj_t arg);
bool mp_obj_get_int_maybe(mp_const_obj_t arg, machine_int_t *value); bool mp_obj_get_int_maybe(mp_const_obj_t arg, machine_int_t *value);
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
mp_float_t mp_obj_get_float(mp_obj_t self_in); mp_float_t mp_obj_get_float(mp_obj_t self_in);
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);
#endif #endif
...@@ -442,7 +442,7 @@ void mp_obj_cell_set(mp_obj_t self_in, mp_obj_t obj); ...@@ -442,7 +442,7 @@ void mp_obj_cell_set(mp_obj_t self_in, mp_obj_t obj);
// int // int
// For long int, returns value truncated to machine_int_t // For long int, returns value truncated to machine_int_t
machine_int_t mp_obj_int_get(mp_const_obj_t self_in); machine_int_t mp_obj_int_get(mp_const_obj_t self_in);
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
mp_float_t mp_obj_int_as_float(mp_obj_t self_in); mp_float_t mp_obj_int_as_float(mp_obj_t self_in);
#endif #endif
// Will raise exception if value doesn't fit into machine_int_t // Will raise exception if value doesn't fit into machine_int_t
...@@ -470,7 +470,7 @@ const char *mp_obj_str_get_str(mp_obj_t self_in); // use this only if you need t ...@@ -470,7 +470,7 @@ const char *mp_obj_str_get_str(mp_obj_t self_in); // use this only if you need t
const char *mp_obj_str_get_data(mp_obj_t self_in, uint *len); const char *mp_obj_str_get_data(mp_obj_t self_in, uint *len);
void mp_str_print_quoted(void (*print)(void *env, const char *fmt, ...), void *env, const byte *str_data, uint str_len); void mp_str_print_quoted(void (*print)(void *env, const char *fmt, ...), void *env, const byte *str_data, uint str_len);
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
// float // float
typedef struct _mp_obj_float_t { typedef struct _mp_obj_float_t {
mp_obj_base_t base; mp_obj_base_t base;
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include "runtime0.h" #include "runtime0.h"
#include "runtime.h" #include "runtime.h"
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
#include <math.h> #include <math.h>
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include "runtime0.h" #include "runtime0.h"
#include "runtime.h" #include "runtime.h"
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT #if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
#include "formatfloat.h" #include "formatfloat.h"
...@@ -170,4 +170,4 @@ mp_obj_t mp_obj_float_binary_op(int op, mp_float_t lhs_val, mp_obj_t rhs_in) { ...@@ -170,4 +170,4 @@ mp_obj_t mp_obj_float_binary_op(int op, mp_float_t lhs_val, mp_obj_t rhs_in) {
return mp_obj_new_float(lhs_val); return mp_obj_new_float(lhs_val);
} }
#endif // MICROPY_ENABLE_FLOAT #endif // MICROPY_PY_BUILTINS_FLOAT
...@@ -469,7 +469,7 @@ STATIC machine_uint_t convert_obj_for_inline_asm(mp_obj_t obj) { ...@@ -469,7 +469,7 @@ STATIC machine_uint_t convert_obj_for_inline_asm(mp_obj_t obj) {
} else { } else {
mp_obj_type_t *type = mp_obj_get_type(obj); mp_obj_type_t *type = mp_obj_get_type(obj);
if (0) { if (0) {
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
} else if (type == &mp_type_float) { } else if (type == &mp_type_float) {
// convert float to int (could also pass in float registers) // convert float to int (could also pass in float registers)
return (machine_int_t)mp_obj_float_get(obj); return (machine_int_t)mp_obj_float_get(obj);
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include "runtime0.h" #include "runtime0.h"
#include "runtime.h" #include "runtime.h"
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
#include <math.h> #include <math.h>
#endif #endif
...@@ -62,7 +62,7 @@ STATIC mp_obj_t mp_obj_int_make_new(mp_obj_t type_in, uint n_args, uint n_kw, co ...@@ -62,7 +62,7 @@ STATIC mp_obj_t mp_obj_int_make_new(mp_obj_t type_in, uint n_args, uint n_kw, co
uint l; uint l;
const char *s = mp_obj_str_get_data(args[0], &l); const char *s = mp_obj_str_get_data(args[0], &l);
return mp_parse_num_integer(s, l, 0); return mp_parse_num_integer(s, l, 0);
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
} else if (MP_OBJ_IS_TYPE(args[0], &mp_type_float)) { } else if (MP_OBJ_IS_TYPE(args[0], &mp_type_float)) {
return MP_OBJ_NEW_SMALL_INT((machine_int_t)(MICROPY_FLOAT_C_FUN(trunc)(mp_obj_float_get(args[0])))); return MP_OBJ_NEW_SMALL_INT((machine_int_t)(MICROPY_FLOAT_C_FUN(trunc)(mp_obj_float_get(args[0]))));
#endif #endif
...@@ -267,7 +267,7 @@ machine_int_t mp_obj_int_get_checked(mp_const_obj_t self_in) { ...@@ -267,7 +267,7 @@ machine_int_t mp_obj_int_get_checked(mp_const_obj_t self_in) {
return MP_OBJ_SMALL_INT_VALUE(self_in); return MP_OBJ_SMALL_INT_VALUE(self_in);
} }
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
mp_float_t mp_obj_int_as_float(mp_obj_t self_in) { mp_float_t mp_obj_int_as_float(mp_obj_t self_in) {
return MP_OBJ_SMALL_INT_VALUE(self_in); return MP_OBJ_SMALL_INT_VALUE(self_in);
} }
......
...@@ -188,7 +188,7 @@ machine_int_t mp_obj_int_get_checked(mp_const_obj_t self_in) { ...@@ -188,7 +188,7 @@ machine_int_t mp_obj_int_get_checked(mp_const_obj_t self_in) {
return mp_obj_int_get(self_in); return mp_obj_int_get(self_in);
} }
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
mp_float_t mp_obj_int_as_float(mp_obj_t self_in) { mp_float_t mp_obj_int_as_float(mp_obj_t self_in) {
if (MP_OBJ_IS_SMALL_INT(self_in)) { if (MP_OBJ_IS_SMALL_INT(self_in)) {
return MP_OBJ_SMALL_INT_VALUE(self_in); return MP_OBJ_SMALL_INT_VALUE(self_in);
......
...@@ -118,7 +118,7 @@ mp_obj_t mp_obj_int_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) { ...@@ -118,7 +118,7 @@ mp_obj_t mp_obj_int_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
zrhs = &z_int; zrhs = &z_int;
} else if (MP_OBJ_IS_TYPE(rhs_in, &mp_type_int)) { } else if (MP_OBJ_IS_TYPE(rhs_in, &mp_type_int)) {
zrhs = &((mp_obj_int_t*)rhs_in)->mpz; zrhs = &((mp_obj_int_t*)rhs_in)->mpz;
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
} else if (MP_OBJ_IS_TYPE(rhs_in, &mp_type_float)) { } else if (MP_OBJ_IS_TYPE(rhs_in, &mp_type_float)) {
return mp_obj_float_binary_op(op, mpz_as_float(zlhs), rhs_in); return mp_obj_float_binary_op(op, mpz_as_float(zlhs), rhs_in);
} else if (MP_OBJ_IS_TYPE(rhs_in, &mp_type_complex)) { } else if (MP_OBJ_IS_TYPE(rhs_in, &mp_type_complex)) {
...@@ -130,7 +130,7 @@ mp_obj_t mp_obj_int_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) { ...@@ -130,7 +130,7 @@ mp_obj_t mp_obj_int_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
} }
if (0) { if (0) {
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
} else if (op == MP_BINARY_OP_TRUE_DIVIDE || op == MP_BINARY_OP_INPLACE_TRUE_DIVIDE) { } else if (op == MP_BINARY_OP_TRUE_DIVIDE || op == MP_BINARY_OP_INPLACE_TRUE_DIVIDE) {
mp_float_t flhs = mpz_as_float(zlhs); mp_float_t flhs = mpz_as_float(zlhs);
mp_float_t frhs = mpz_as_float(zrhs); mp_float_t frhs = mpz_as_float(zrhs);
...@@ -292,7 +292,7 @@ machine_int_t mp_obj_int_get_checked(mp_const_obj_t self_in) { ...@@ -292,7 +292,7 @@ machine_int_t mp_obj_int_get_checked(mp_const_obj_t self_in) {
} }
} }
#if MICROPY_ENABLE_FLOAT #if MICROPY_PY_BUILTINS_FLOAT
mp_float_t mp_obj_int_as_float(mp_obj_t self_in) { mp_float_t mp_obj_int_as_float(mp_obj_t self_in) {
if (MP_OBJ_IS_SMALL_INT(self_in)) { if (MP_OBJ_IS_SMALL_INT(self_in)) {
return MP_OBJ_SMALL_INT_VALUE(self_in); return MP_OBJ_SMALL_INT_VALUE(self_in);
......
...@@ -150,7 +150,7 @@ STATIC mp_obj_t list_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) { ...@@ -150,7 +150,7 @@ STATIC mp_obj_t list_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) {
STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
if (value == MP_OBJ_NULL) { if (value == MP_OBJ_NULL) {
// delete // delete
#if MICROPY_PY_SLICE #if MICROPY_PY_BUILTINS_SLICE
if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) { if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) {
mp_obj_list_t *self = self_in; mp_obj_list_t *self = self_in;
mp_bound_slice_t slice; mp_bound_slice_t slice;
...@@ -174,7 +174,7 @@ STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { ...@@ -174,7 +174,7 @@ STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
} else if (value == MP_OBJ_SENTINEL) { } else if (value == MP_OBJ_SENTINEL) {
// load // load
mp_obj_list_t *self = self_in; mp_obj_list_t *self = self_in;
#if MICROPY_PY_SLICE #if MICROPY_PY_BUILTINS_SLICE
if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) { if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) {
mp_bound_slice_t slice; mp_bound_slice_t slice;
if (!mp_seq_get_fast_slice_indexes(self->len, index, &slice)) { if (!mp_seq_get_fast_slice_indexes(self->len, index, &slice)) {
...@@ -188,7 +188,7 @@ STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { ...@@ -188,7 +188,7 @@ STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
uint index_val = mp_get_index(self->base.type, self->len, index, false); uint index_val = mp_get_index(self->base.type, self->len, index, false);
return self->items[index_val]; return self->items[index_val];
} else { } else {
#if MICROPY_PY_SLICE #if MICROPY_PY_BUILTINS_SLICE
if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) { if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) {
mp_obj_list_t *self = self_in; mp_obj_list_t *self = self_in;
assert(MP_OBJ_IS_TYPE(value, &mp_type_list)); assert(MP_OBJ_IS_TYPE(value, &mp_type_list));
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "obj.h" #include "obj.h"
#include "runtime.h" #include "runtime.h"
#if MICROPY_PY_PROPERTY #if MICROPY_PY_BUILTINS_PROPERTY
typedef struct _mp_obj_property_t { typedef struct _mp_obj_property_t {
mp_obj_base_t base; mp_obj_base_t base;
...@@ -115,4 +115,4 @@ const mp_obj_t *mp_obj_property_get(mp_obj_t self_in) { ...@@ -115,4 +115,4 @@ const mp_obj_t *mp_obj_property_get(mp_obj_t self_in) {
return self->proxy; return self->proxy;
} }
#endif // MICROPY_PY_PROPERTY #endif // MICROPY_PY_BUILTINS_PROPERTY
...@@ -52,13 +52,13 @@ STATIC mp_obj_t set_it_iternext(mp_obj_t self_in); ...@@ -52,13 +52,13 @@ STATIC mp_obj_t set_it_iternext(mp_obj_t self_in);
STATIC bool is_set_or_frozenset(mp_obj_t o) { STATIC bool is_set_or_frozenset(mp_obj_t o) {
return MP_OBJ_IS_TYPE(o, &mp_type_set) return MP_OBJ_IS_TYPE(o, &mp_type_set)
#if MICROPY_PY_FROZENSET #if MICROPY_PY_BUILTINS_FROZENSET
|| MP_OBJ_IS_TYPE(o, &mp_type_frozenset) || MP_OBJ_IS_TYPE(o, &mp_type_frozenset)
#endif #endif
; ;
} }
#if MICROPY_PY_FROZENSET #if MICROPY_PY_BUILTINS_FROZENSET
STATIC void check_set_or_frozenset(mp_obj_t o) { STATIC void check_set_or_frozenset(mp_obj_t o) {
if (!is_set_or_frozenset(o)) { if (!is_set_or_frozenset(o)) {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "'set' object required")); nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "'set' object required"));
...@@ -72,7 +72,7 @@ STATIC void check_set(mp_obj_t o) { ...@@ -72,7 +72,7 @@ STATIC void check_set(mp_obj_t o) {
if (!MP_OBJ_IS_TYPE(o, &mp_type_set)) { if (!MP_OBJ_IS_TYPE(o, &mp_type_set)) {
// Emulate CPython behavior // Emulate CPython behavior
// AttributeError: 'frozenset' object has no attribute 'add' // AttributeError: 'frozenset' object has no attribute 'add'
#if MICROPY_PY_FROZENSET #if MICROPY_PY_BUILTINS_FROZENSET
if (MP_OBJ_IS_TYPE(o, &mp_type_frozenset)) { if (MP_OBJ_IS_TYPE(o, &mp_type_frozenset)) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_AttributeError, "'frozenset' has no such attribute")); nlr_raise(mp_obj_new_exception_msg(&mp_type_AttributeError, "'frozenset' has no such attribute"));
} }
...@@ -83,11 +83,11 @@ STATIC void check_set(mp_obj_t o) { ...@@ -83,11 +83,11 @@ STATIC void check_set(mp_obj_t o) {
STATIC void set_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) { STATIC void set_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
mp_obj_set_t *self = self_in; mp_obj_set_t *self = self_in;
#if MICROPY_PY_FROZENSET #if MICROPY_PY_BUILTINS_FROZENSET
bool is_frozen = MP_OBJ_IS_TYPE(self_in, &mp_type_frozenset); bool is_frozen = MP_OBJ_IS_TYPE(self_in, &mp_type_frozenset);
#endif #endif
if (self->set.used == 0) { if (self->set.used == 0) {
#if MICROPY_PY_FROZENSET #if MICROPY_PY_BUILTINS_FROZENSET
if (is_frozen) { if (is_frozen) {