summaryrefslogtreecommitdiff
path: root/py/obj.h
diff options
context:
space:
mode:
authorAndrew Leech <andrew.leech@planetinnovation.com.au>2019-02-18 14:58:44 +1100
committerDamien George <damien.p.george@gmail.com>2019-03-08 22:46:43 +1100
commitcf22f4793cb04e8e63a0d11f479a69c9be6c93ba (patch)
treed567e429710b58ad9283d3e9c1a389cde64e0e83 /py/obj.h
parente4ac104b7f2980114c6d1b0d8ff5917777cf8f24 (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.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/py/obj.h b/py/obj.h
index 4d42c43de..a22d5f8b8 100644
--- a/py/obj.h
+++ b/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 {