diff options
Diffstat (limited to 'py/runtime.c')
-rw-r--r-- | py/runtime.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/py/runtime.c b/py/runtime.c index 7937a65b83..d6b2bf7826 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -34,6 +34,7 @@ static mp_map_t *map_locals; static mp_map_t *map_globals; static mp_map_t map_builtins; +static mp_map_t map_loaded_modules; // TODO: expose as sys.modules typedef enum { MP_CODE_NONE, @@ -83,6 +84,9 @@ void rt_init(void) { // init built-in hash table mp_map_init(&map_builtins, 3); + // init loaded modules table + mp_map_init(&map_loaded_modules, 3); + // built-in exceptions (TODO, make these proper classes) mp_map_add_qstr(&map_builtins, MP_QSTR_AttributeError, mp_obj_new_exception(MP_QSTR_AttributeError)); mp_map_add_qstr(&map_builtins, MP_QSTR_IndexError, mp_obj_new_exception(MP_QSTR_IndexError)); @@ -953,6 +957,10 @@ void rt_globals_set(mp_map_t *m) { map_globals = m; } +mp_map_t *rt_loaded_modules_get(void) { + return &map_loaded_modules; +} + // these must correspond to the respective enum void *const rt_fun_table[RT_F_NUMBER_OF] = { rt_load_const_dec, |