#include "misc.h" #include "mpconfig.h" #include "qstr.h" #include "obj.h" #include "builtin.h" #include "runtime.h" #include "objlist.h" #if MICROPY_ENABLE_MOD_SYS // These should be implemented by ports, specific types don't matter, // only addresses. struct _dummy_t; extern struct _dummy_t mp_sys_stdin_obj; extern struct _dummy_t mp_sys_stdout_obj; extern struct _dummy_t mp_sys_stderr_obj; mp_obj_list_t mp_sys_path_obj; mp_obj_list_t mp_sys_argv_obj; STATIC const mp_map_elem_t mp_module_sys_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_sys) }, { MP_OBJ_NEW_QSTR(MP_QSTR_path), (mp_obj_t)&mp_sys_path_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_argv), (mp_obj_t)&mp_sys_argv_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_stdin), (mp_obj_t)&mp_sys_stdin_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_stdout), (mp_obj_t)&mp_sys_stdout_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_stderr), (mp_obj_t)&mp_sys_stderr_obj }, }; STATIC const mp_obj_dict_t mp_module_sys_globals = { .base = {&mp_type_dict}, .map = { .all_keys_are_qstrs = 1, .table_is_fixed_array = 1, .used = sizeof(mp_module_sys_globals_table) / sizeof(mp_map_elem_t), .alloc = sizeof(mp_module_sys_globals_table) / sizeof(mp_map_elem_t), .table = (mp_map_elem_t*)mp_module_sys_globals_table, }, }; const mp_obj_module_t mp_module_sys = { .base = { &mp_type_module }, .name = MP_QSTR_sys, .globals = (mp_obj_dict_t*)&mp_module_sys_globals, }; #endif