py: Add MP_ROM_* macros and mp_rom_* types and use them.

This commit is contained in:
Damien George
2015-11-27 13:38:15 +00:00
parent 94fe6e523d
commit cbf7674025
46 changed files with 599 additions and 568 deletions

View File

@@ -161,8 +161,8 @@ STATIC mp_obj_t exc___init__(mp_uint_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(exc___init___obj, 1, MP_OBJ_FUN_ARGS_MAX, exc___init__);
STATIC const mp_map_elem_t exc_locals_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR___init__), (mp_obj_t)&exc___init___obj },
STATIC const mp_rom_map_elem_t exc_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___init__), MP_ROM_PTR(&exc___init___obj) },
};
STATIC MP_DEFINE_CONST_DICT(exc_locals_dict, exc_locals_dict_table);
@@ -177,7 +177,7 @@ const mp_obj_type_t mp_type_BaseException = {
};
#define MP_DEFINE_EXCEPTION_BASE(base_name) \
STATIC const mp_obj_tuple_t mp_type_ ## base_name ## _base_tuple = {{&mp_type_tuple}, 1, {(mp_obj_t)&mp_type_ ## base_name}};\
STATIC const mp_rom_obj_tuple_t mp_type_ ## base_name ## _base_tuple = {{&mp_type_tuple}, 1, {MP_ROM_PTR(&mp_type_ ## base_name)}};\
#define MP_DEFINE_EXCEPTION(exc_name, base_name) \
const mp_obj_type_t mp_type_ ## exc_name = { \