diff options
author | Andrew Leech <andrew.leech@planetinnovation.com.au> | 2019-02-18 14:58:44 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-03-08 22:46:43 +1100 |
commit | cf22f4793cb04e8e63a0d11f479a69c9be6c93ba (patch) | |
tree | d567e429710b58ad9283d3e9c1a389cde64e0e83 /py/obj.h | |
parent | e4ac104b7f2980114c6d1b0d8ff5917777cf8f24 (diff) |
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
Diffstat (limited to 'py/obj.h')
-rw-r--r-- | py/obj.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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 { |