all: Make all mp_obj_type_t defs use MP_DEFINE_CONST_OBJ_TYPE.

In preparation for upcoming rework of mp_obj_type_t layout.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
Jim Mussared
2021-07-14 14:38:38 +10:00
committed by Damien George
parent cdb880789f
commit 662b9761b3
227 changed files with 2543 additions and 2184 deletions

View File

@@ -125,11 +125,13 @@ STATIC const mp_rom_map_elem_t mp_irq_locals_dict_table[] = {
};
STATIC MP_DEFINE_CONST_DICT(mp_irq_locals_dict, mp_irq_locals_dict_table);
const mp_obj_type_t mp_irq_type = {
{ &mp_type_type },
.name = MP_QSTR_irq,
.call = mp_irq_call,
.locals_dict = (mp_obj_dict_t *)&mp_irq_locals_dict,
};
MP_DEFINE_CONST_OBJ_TYPE(
mp_irq_type,
MP_QSTR_irq,
MP_TYPE_FLAG_NONE,
MP_TYPE_NULL_MAKE_NEW,
call, mp_irq_call,
locals_dict, (mp_obj_dict_t *)&mp_irq_locals_dict
);
#endif // MICROPY_ENABLE_SCHEDULER

View File

@@ -123,15 +123,17 @@ STATIC const mp_stream_p_t stdio_obj_stream_p = {
.is_text = true,
};
STATIC const mp_obj_type_t stdio_obj_type = {
{ &mp_type_type },
.name = MP_QSTR_FileIO,
.print = stdio_obj_print,
.getiter = mp_identity_getiter,
.iternext = mp_stream_unbuffered_iter,
.protocol = &stdio_obj_stream_p,
.locals_dict = (mp_obj_dict_t *)&stdio_locals_dict,
};
MP_DEFINE_CONST_OBJ_TYPE(
stdio_obj_type,
MP_QSTR_FileIO,
MP_TYPE_FLAG_NONE,
MP_TYPE_NULL_MAKE_NEW,
print, stdio_obj_print,
getiter, mp_identity_getiter,
iternext, mp_stream_unbuffered_iter,
protocol, &stdio_obj_stream_p,
locals_dict, (mp_obj_dict_t *)&stdio_locals_dict
);
const sys_stdio_obj_t mp_sys_stdin_obj = {{&stdio_obj_type}, .fd = STDIO_FD_IN};
const sys_stdio_obj_t mp_sys_stdout_obj = {{&stdio_obj_type}, .fd = STDIO_FD_OUT};
@@ -157,15 +159,17 @@ STATIC const mp_stream_p_t stdio_buffer_obj_stream_p = {
.is_text = false,
};
STATIC const mp_obj_type_t stdio_buffer_obj_type = {
{ &mp_type_type },
.name = MP_QSTR_FileIO,
.print = stdio_obj_print,
.getiter = mp_identity_getiter,
.iternext = mp_stream_unbuffered_iter,
.protocol = &stdio_buffer_obj_stream_p,
.locals_dict = (mp_obj_dict_t *)&stdio_locals_dict,
};
STATIC MP_DEFINE_CONST_OBJ_TYPE(
stdio_buffer_obj_type,
MP_QSTR_FileIO,
MP_TYPE_FLAG_NONE,
MP_TYPE_NULL_MAKE_NEW,
print, stdio_obj_print,
getiter, mp_identity_getiter,
iternext, mp_stream_unbuffered_iter,
protocol, &stdio_buffer_obj_stream_p,
locals_dict, (mp_obj_dict_t *)&stdio_locals_dict
);
STATIC const sys_stdio_obj_t stdio_buffer_obj = {{&stdio_buffer_obj_type}, .fd = 0}; // fd unused
#endif