py: Make mp_sys_stdout_print object, wrapping sys.stdout for mp_print*.

So now all printing should go via either mp_plat_print or
mp_sys_stdout_print.
This commit is contained in:
Damien George
2015-04-11 12:01:39 +01:00
parent 7f9d1d6ab9
commit 5ae5ec986e
4 changed files with 13 additions and 12 deletions

View File

@@ -47,10 +47,13 @@ typedef struct _mp_print_t {
mp_print_strn_t print_strn;
} mp_print_t;
// Wrapper for platform print function, which wraps MP_PLAT_PRINT_STRN.
// All (non-debug) prints go through this interface (except some which
// go through mp_sys_stdout_obj if MICROPY_PY_IO is defined).
// All (non-debug) prints go through one of the two interfaces below.
// 1) Wrapper for platform print function, which wraps MP_PLAT_PRINT_STRN.
extern const mp_print_t mp_plat_print;
#if MICROPY_PY_IO
// 2) Wrapper for printing to sys.stdout.
extern const mp_print_t mp_sys_stdout_print;
#endif
int mp_print_str(const mp_print_t *print, const char *str);
int mp_print_strn(const mp_print_t *print, const char *str, mp_uint_t len, int flags, char fill, int width);