diff options
author | David Lechner <david@pybricks.com> | 2022-07-01 12:29:08 -0500 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2022-07-18 13:48:23 +1000 |
commit | fc3d7ae11be11a7f05709ebfd439061fce9ee555 (patch) | |
tree | 8c0ec32de2abad065c7adc8b6d18d1d7d3dffc18 /py/mpstate.h | |
parent | a8d78cc39839aaf4a77bef05377c457c7ba75ead (diff) |
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>
Diffstat (limited to 'py/mpstate.h')
-rw-r--r-- | py/mpstate.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/py/mpstate.h b/py/mpstate.h index 98aa9a849..07a4f3860 100644 --- a/py/mpstate.h +++ b/py/mpstate.h @@ -192,6 +192,13 @@ typedef struct _mp_state_vm_t { // include any root pointers defined by a port MICROPY_PORT_ROOT_POINTERS + // Include any root pointers registered with MP_REGISTER_ROOT_POINTER(). + #ifndef NO_QSTR + // Only include root pointer definitions when not doing qstr extraction, because + // the qstr extraction stage also generates the root pointers header file. + #include "genhdr/root_pointers.h" + #endif + // root pointers for extmod #if MICROPY_REPL_EVENT_DRIVEN |