Skip to content

Commit 90078ae

Browse files
committed
More experiments with compiling as MPY
1 parent 510064f commit 90078ae

File tree

2 files changed

+37
-351
lines changed

2 files changed

+37
-351
lines changed

modules/stage/mod_stage.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
/*
2-
* This file is part of the MicroPython project, http://micropython.org/
3-
*
42
* The MIT License (MIT)
53
*
64
* Copyright (c) 2018 Radomir Dopieralski
@@ -213,6 +211,7 @@ STATIC mp_obj_t text_move(mp_obj_t self_in, mp_obj_t x_in, mp_obj_t y_in) {
213211
STATIC MP_DEFINE_CONST_FUN_OBJ_3(text_move_obj, text_move);
214212

215213

214+
#if !MICROPY_ENABLE_DYNRUNTIME
216215
STATIC const mp_rom_map_elem_t text_locals_dict_table[] = {
217216
{ MP_ROM_QSTR(MP_QSTR_move), MP_ROM_PTR(&text_move_obj) },
218217
};
@@ -224,6 +223,9 @@ const mp_obj_type_t mp_type_text = {
224223
.make_new = text_make_new,
225224
.locals_dict = (mp_obj_dict_t*)&text_locals_dict,
226225
};
226+
#else
227+
extern mp_obj_type_t mp_type_text;
228+
#endif
227229

228230

229231
STATIC mp_obj_t layer_make_new(const mp_obj_type_t *type, size_t n_args,
@@ -285,6 +287,7 @@ STATIC mp_obj_t layer_frame(mp_obj_t self_in, mp_obj_t frame_in,
285287
STATIC MP_DEFINE_CONST_FUN_OBJ_3(layer_frame_obj, layer_frame);
286288

287289

290+
#if !MICROPY_ENABLE_DYNRUNTIME
288291
STATIC const mp_rom_map_elem_t layer_locals_dict_table[] = {
289292
{ MP_ROM_QSTR(MP_QSTR_move), MP_ROM_PTR(&layer_move_obj) },
290293
{ MP_ROM_QSTR(MP_QSTR_frame), MP_ROM_PTR(&layer_frame_obj) },
@@ -297,6 +300,9 @@ const mp_obj_type_t mp_type_layer = {
297300
.make_new = layer_make_new,
298301
.locals_dict = (mp_obj_dict_t*)&layer_locals_dict,
299302
};
303+
#else
304+
extern mp_obj_type_t mp_type_layer;
305+
#endif
300306

301307
inline
302308
void render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,
@@ -380,6 +386,7 @@ STATIC mp_obj_t stage_render(size_t n_args, const mp_obj_t *args) {
380386
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stage_render_obj, 7, 8, stage_render);
381387

382388

389+
#if !MICROPY_ENABLE_DYNRUNTIME
383390
STATIC const mp_rom_map_elem_t stage_module_globals_table[] = {
384391
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__stage) },
385392
{ MP_ROM_QSTR(MP_QSTR_Layer), MP_ROM_PTR(&mp_type_layer) },
@@ -395,3 +402,4 @@ const mp_obj_module_t mp_module__stage = {
395402
};
396403

397404
MP_REGISTER_MODULE(MP_QSTR__stage, mp_module__stage, MODULE_STAGE_ENABLED);
405+
#endif

0 commit comments

Comments
 (0)