py/mpconfig: Make configuration of dupterm object reusable.

This commit is contained in:
Paul Sokolovsky 2016-01-01 13:15:18 +02:00
parent ddea7cb702
commit 9bbfd5efd4
2 changed files with 7 additions and 3 deletions

View File

@ -819,6 +819,12 @@ typedef double mp_float_t;
#define MICROPY_PORT_ROOT_POINTERS
#endif
#if MICROPY_PY_OS_DUPTERM
#define MP_ROOT_PTR_DUPTERM_OBJ mp_obj_t term_obj
#else
#define MP_ROOT_PTR_DUPTERM_OBJ
#endif
/*****************************************************************************/
/* Miscellaneous settings */

View File

@ -244,18 +244,16 @@ extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
#define MP_STATE_PORT MP_STATE_VM
#if MICROPY_PY_OS_DUPTERM
#define ROOT_POINTERS_1 mp_obj_t term_obj
#include <stddef.h>
void mp_hal_dupterm_tx_strn(const char *str, size_t len);
#else
#define ROOT_POINTERS_1
#define mp_hal_dupterm_tx_strn(s, l)
#endif
#define MICROPY_PORT_ROOT_POINTERS \
const char *readline_hist[50]; \
mp_obj_t keyboard_interrupt_obj; \
ROOT_POINTERS_1; \
MP_ROOT_PTR_DUPTERM_OBJ; \
void *mmap_region_head; \
// We need to provide a declaration/definition of alloca()