mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 03:30:14 +01:00
py: Allow registration of modules at their definition.
During make, makemoduledefs.py parses the current builds c files for MP_REGISTER_MODULE(module_name, obj_module, enabled_define) These are used to generate a header with the required entries for "mp_rom_map_elem_t mp_builtin_module_table[]" in py/objmodule.c
This commit is contained in:
committed by
Damien George
parent
e4ac104b7f
commit
cf22f4793c
7
py/obj.h
7
py/obj.h
@@ -326,6 +326,13 @@ typedef struct _mp_rom_obj_t { mp_const_obj_t o; } mp_rom_obj_t;
|
||||
#define MP_DEFINE_CONST_STATICMETHOD_OBJ(obj_name, fun_name) const mp_rom_obj_static_class_method_t obj_name = {{&mp_type_staticmethod}, fun_name}
|
||||
#define MP_DEFINE_CONST_CLASSMETHOD_OBJ(obj_name, fun_name) const mp_rom_obj_static_class_method_t obj_name = {{&mp_type_classmethod}, fun_name}
|
||||
|
||||
// Declare a module as a builtin, processed by makemoduledefs.py
|
||||
// param module_name: MP_QSTR_<module name>
|
||||
// param obj_module: mp_obj_module_t instance
|
||||
// prarm enabled_define: used as `#if (enabled_define) around entry`
|
||||
|
||||
#define MP_REGISTER_MODULE(module_name, obj_module, enabled_define)
|
||||
|
||||
// Underlying map/hash table implementation (not dict object or map function)
|
||||
|
||||
typedef struct _mp_map_elem_t {
|
||||
|
||||
Reference in New Issue
Block a user