mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 04:00:28 +01:00
py/make_root_pointers: Add MP_REGISTER_ROOT_POINTER parser/generator.
This adds new compile-time infrastructure to parse source code files for `MP_REGISTER_ROOT_POINTER()` and generates a new `root_pointers.h` header file containing the collected declarations. This works the same as the existing `MP_REGISTER_MODULE()` feature. Signed-off-by: David Lechner <david@pybricks.com>
This commit is contained in:
committed by
Damien George
parent
a8d78cc398
commit
fc3d7ae11b
11
py/obj.h
11
py/obj.h
@@ -416,13 +416,18 @@ 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}
|
||||
|
||||
#ifndef NO_QSTR
|
||||
|
||||
// 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
|
||||
|
||||
#ifndef NO_QSTR
|
||||
#define MP_REGISTER_MODULE(module_name, obj_module)
|
||||
#endif
|
||||
|
||||
// Declare a root pointer (to avoid garbage collection of a global static variable).
|
||||
// param variable_declaration: a valid C variable declaration
|
||||
#define MP_REGISTER_ROOT_POINTER(variable_declaration)
|
||||
|
||||
#endif // NO_QSTR
|
||||
|
||||
// Underlying map/hash table implementation (not dict object or map function)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user