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>
This commit is contained in:
David Lechner
2022-07-01 14:06:10 -05:00
committed by Damien George
parent fc3d7ae11b
commit 81dbea1ce3
28 changed files with 31 additions and 46 deletions

View File

@@ -33,6 +33,12 @@
#ifndef MICROPY_USE_READLINE
#define MICROPY_USE_READLINE (1)
#endif
#ifndef MICROPY_USE_READLINE_HISTORY
#define MICROPY_USE_READLINE_HISTORY (1)
#endif
#ifndef MICROPY_READLINE_HISTORY_SIZE
#define MICROPY_READLINE_HISTORY_SIZE (50)
#endif
#define MICROPY_ALLOC_PATH_MAX (260) // see minwindef.h for msvc or limits.h for mingw
#define MICROPY_PERSISTENT_CODE_LOAD (1)
@@ -52,7 +58,6 @@
#define MICROPY_DEBUG_PRINTERS (1)
#define MICROPY_READER_POSIX (1)
#define MICROPY_READER_VFS (1)
#define MICROPY_USE_READLINE_HISTORY (1)
#define MICROPY_HELPER_REPL (1)
#define MICROPY_REPL_EMACS_KEYS (1)
#define MICROPY_REPL_AUTO_INDENT (1)
@@ -210,11 +215,6 @@ typedef long long mp_off_t;
typedef long mp_off_t;
#endif
#if MICROPY_USE_READLINE == 1
#define MICROPY_PORT_ROOT_POINTERS \
char *readline_hist[50];
#endif
#define MP_STATE_PORT MP_STATE_VM
#define MICROPY_MPHALPORT_H "windows_mphal.h"