Skip to content

Commit 81dbea1

Browse files
dlechdpgeorge
authored andcommitted
shared/readline: Use MP_REGISTER_ROOT_POINTER().
This uses MP_REGISTER_ROOT_POINTER() to register the readline_history root pointer array used by shared/readline.c and removes the registration from all mpconfigport.h files. This also required adding a new MICROPY_READLINE_HISTORY_SIZE config option since not all ports used the same sized array. Signed-off-by: David Lechner <david@pybricks.com>
1 parent fc3d7ae commit 81dbea1

File tree

28 files changed

+31
-46
lines changed

28 files changed

+31
-46
lines changed

docs/develop/porting.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,6 @@ The following is an example of an ``mpconfigport.h`` file:
174174
175175
#define MP_STATE_PORT MP_STATE_VM
176176
177-
#define MICROPY_PORT_ROOT_POINTERS \
178-
const char *readline_hist[8];
179-
180177
This configuration file contains machine-specific configurations including aspects like if different
181178
MicroPython features should be enabled e.g. ``#define MICROPY_ENABLE_GC (1)``. Making this Setting
182179
``(0)`` disables the feature.

examples/embedding/mpconfigport_minimal.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@
8787
#define MICROPY_PY_UHASHLIB (0)
8888
#define MICROPY_PY_UBINASCII (0)
8989

90-
#define MICROPY_PORT_ROOT_POINTERS \
91-
9290
//////////////////////////////////////////
9391
// Do not change anything beyond this line
9492
//////////////////////////////////////////

ports/cc3200/mpconfigport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@
142142
// vm state and root pointers for the gc
143143
#define MP_STATE_PORT MP_STATE_VM
144144
#define MICROPY_PORT_ROOT_POINTERS \
145-
const char *readline_hist[8]; \
146145
mp_obj_t mp_const_user_interrupt; \
147146
mp_obj_t machine_config_main; \
148147
mp_obj_list_t pyb_sleep_obj_list; \

ports/esp32/mpconfigport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ struct mp_bluetooth_nimble_root_pointers_t;
146146
#endif
147147

148148
#define MICROPY_PORT_ROOT_POINTERS \
149-
const char *readline_hist[8]; \
150149
mp_obj_t machine_pin_irq_handler[40]; \
151150
struct _machine_timer_obj_t *machine_timer_obj_head; \
152151
struct _machine_i2s_obj_t *machine_i2s_obj[I2S_NUM_MAX]; \

ports/esp8266/mpconfigport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ extern const struct _mp_print_t mp_debug_print;
148148
#define MP_STATE_PORT MP_STATE_VM
149149

150150
#define MICROPY_PORT_ROOT_POINTERS \
151-
const char *readline_hist[8]; \
152151
mp_obj_t pin_irq_handler[16]; \
153152
byte *uart0_rxbuf; \
154153

ports/javascript/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ SRC_C = \
3030
mphalport.c \
3131
modutime.c \
3232

33-
SRC_QSTR += $(SRC_C)
33+
SRC_QSTR += $(SRC_C) $(SRC_SHARED)
3434

3535
OBJ += $(PY_O)
3636
OBJ += $(addprefix $(BUILD)/, $(SRC_SHARED:.c=.o))

ports/javascript/mpconfigport.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,3 @@ typedef long mp_off_t;
182182
#define MICROPY_HW_MCU_NAME "Emscripten"
183183

184184
#define MP_STATE_PORT MP_STATE_VM
185-
186-
#define MICROPY_PORT_ROOT_POINTERS \
187-
const char *readline_hist[8];

ports/mimxrt/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ SRC_QSTR += \
290290
modmimxrt.c \
291291
modutime.c \
292292
pin.c \
293+
shared/readline/readline.c \
293294
shared/runtime/mpirq.c \
294295
shared/runtime/sys_stdio_mphal.c \
295296
$(GEN_PINS_SRC)

ports/mimxrt/mpconfigport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ extern const struct _mp_obj_type_t network_lan_type;
242242
#endif
243243

244244
#define MICROPY_PORT_ROOT_POINTERS \
245-
const char *readline_hist[8]; \
246245
struct _machine_timer_obj_t *timer_table[MICROPY_HW_PIT_NUM_CHANNELS]; \
247246
void *machine_pin_irq_objects[MICROPY_HW_NUM_PIN_IRQS]; \
248247
/* list of registered NICs */ \

ports/minimal/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ SRC_C += $(SRC_MOD)
6868

6969
SRC_CXX += $(SRC_MOD_CXX)
7070

71+
SRC_QSTR += shared/readline/readline.c
7172
SRC_QSTR += $(SRC_MOD) $(SRC_MOD_CXX)
7273

7374
OBJ += $(PY_CORE_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))

0 commit comments

Comments
 (0)