py/nativeglue: Rename native convert funs to match other native helpers.
This commit is contained in:
parent
3b973a5658
commit
0e4c24ec08
@ -56,8 +56,8 @@ int mp_native_type_from_qstr(qstr qst) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// convert a MicroPython object to a valid native value based on type
|
// convert a MicroPython object to a valid native value based on type
|
||||||
mp_uint_t mp_convert_obj_to_native(mp_obj_t obj, mp_uint_t type) {
|
mp_uint_t mp_native_from_obj(mp_obj_t obj, mp_uint_t type) {
|
||||||
DEBUG_printf("mp_convert_obj_to_native(%p, " UINT_FMT ")\n", obj, type);
|
DEBUG_printf("mp_native_from_obj(%p, " UINT_FMT ")\n", obj, type);
|
||||||
switch (type & 0xf) {
|
switch (type & 0xf) {
|
||||||
case MP_NATIVE_TYPE_OBJ: return (mp_uint_t)obj;
|
case MP_NATIVE_TYPE_OBJ: return (mp_uint_t)obj;
|
||||||
case MP_NATIVE_TYPE_BOOL:
|
case MP_NATIVE_TYPE_BOOL:
|
||||||
@ -80,8 +80,8 @@ mp_uint_t mp_convert_obj_to_native(mp_obj_t obj, mp_uint_t type) {
|
|||||||
#if MICROPY_EMIT_NATIVE || MICROPY_EMIT_INLINE_ASM
|
#if MICROPY_EMIT_NATIVE || MICROPY_EMIT_INLINE_ASM
|
||||||
|
|
||||||
// convert a native value to a MicroPython object based on type
|
// convert a native value to a MicroPython object based on type
|
||||||
mp_obj_t mp_convert_native_to_obj(mp_uint_t val, mp_uint_t type) {
|
mp_obj_t mp_native_to_obj(mp_uint_t val, mp_uint_t type) {
|
||||||
DEBUG_printf("mp_convert_native_to_obj(" UINT_FMT ", " UINT_FMT ")\n", val, type);
|
DEBUG_printf("mp_native_to_obj(" UINT_FMT ", " UINT_FMT ")\n", val, type);
|
||||||
switch (type & 0xf) {
|
switch (type & 0xf) {
|
||||||
case MP_NATIVE_TYPE_OBJ: return (mp_obj_t)val;
|
case MP_NATIVE_TYPE_OBJ: return (mp_obj_t)val;
|
||||||
case MP_NATIVE_TYPE_BOOL: return mp_obj_new_bool(val);
|
case MP_NATIVE_TYPE_BOOL: return mp_obj_new_bool(val);
|
||||||
@ -192,8 +192,8 @@ const void *const mp_fun_table[MP_F_NUMBER_OF] = {
|
|||||||
&mp_const_none_obj,
|
&mp_const_none_obj,
|
||||||
&mp_const_false_obj,
|
&mp_const_false_obj,
|
||||||
&mp_const_true_obj,
|
&mp_const_true_obj,
|
||||||
mp_convert_obj_to_native,
|
mp_native_from_obj,
|
||||||
mp_convert_native_to_obj,
|
mp_native_to_obj,
|
||||||
mp_native_swap_globals,
|
mp_native_swap_globals,
|
||||||
mp_load_name,
|
mp_load_name,
|
||||||
mp_load_global,
|
mp_load_global,
|
||||||
|
@ -510,7 +510,7 @@ STATIC mp_obj_t fun_asm_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mp_convert_native_to_obj(ret, self->type_sig);
|
return mp_native_to_obj(ret, self->type_sig);
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC const mp_obj_type_t mp_type_fun_asm = {
|
STATIC const mp_obj_type_t mp_type_fun_asm = {
|
||||||
|
@ -170,8 +170,8 @@ NORETURN void mp_raise_recursion_depth(void);
|
|||||||
|
|
||||||
// helper functions for native/viper code
|
// helper functions for native/viper code
|
||||||
int mp_native_type_from_qstr(qstr qst);
|
int mp_native_type_from_qstr(qstr qst);
|
||||||
mp_uint_t mp_convert_obj_to_native(mp_obj_t obj, mp_uint_t type);
|
mp_uint_t mp_native_from_obj(mp_obj_t obj, mp_uint_t type);
|
||||||
mp_obj_t mp_convert_native_to_obj(mp_uint_t val, mp_uint_t type);
|
mp_obj_t mp_native_to_obj(mp_uint_t val, mp_uint_t type);
|
||||||
mp_obj_dict_t *mp_native_swap_globals(mp_obj_dict_t *new_globals);
|
mp_obj_dict_t *mp_native_swap_globals(mp_obj_dict_t *new_globals);
|
||||||
mp_obj_t mp_native_call_function_n_kw(mp_obj_t fun_in, size_t n_args_kw, const mp_obj_t *args);
|
mp_obj_t mp_native_call_function_n_kw(mp_obj_t fun_in, size_t n_args_kw, const mp_obj_t *args);
|
||||||
void mp_native_raise(mp_obj_t o);
|
void mp_native_raise(mp_obj_t o);
|
||||||
|
Loading…
Reference in New Issue
Block a user