summaryrefslogtreecommitdiff
path: root/examples/natmod/heapq/heapq.c
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2022-08-18 21:40:53 +1000
committerJim Mussared <jim.mussared@gmail.com>2023-06-08 17:54:24 +1000
commiteb85f4d4c9c332c8e7bef9b20bb06e25f6f6c5d2 (patch)
tree4f5285fc4ed6fdb616401b9ceb3f95f58698dcf0 /examples/natmod/heapq/heapq.c
parent2eba98f1e0d292de0f7e48ce228221ef50c01967 (diff)
examples/natmod: Rename umodule to module.
This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'examples/natmod/heapq/heapq.c')
-rw-r--r--examples/natmod/heapq/heapq.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/natmod/heapq/heapq.c b/examples/natmod/heapq/heapq.c
new file mode 100644
index 000000000..ed19652a6
--- /dev/null
+++ b/examples/natmod/heapq/heapq.c
@@ -0,0 +1,16 @@
+#define MICROPY_PY_HEAPQ (1)
+
+#include "py/dynruntime.h"
+
+#include "extmod/modheapq.c"
+
+mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) {
+ MP_DYNRUNTIME_INIT_ENTRY
+
+ mp_store_global(MP_QSTR___name__, MP_OBJ_NEW_QSTR(MP_QSTR_heapq));
+ mp_store_global(MP_QSTR_heappush, MP_OBJ_FROM_PTR(&mod_heapq_heappush_obj));
+ mp_store_global(MP_QSTR_heappop, MP_OBJ_FROM_PTR(&mod_heapq_heappop_obj));
+ mp_store_global(MP_QSTR_heapify, MP_OBJ_FROM_PTR(&mod_heapq_heapify_obj));
+
+ MP_DYNRUNTIME_INIT_EXIT
+}