Skip to content

Commit 75aebda

Browse files
committed
Merge branch 'stinos-mingw-float-printf'
2 parents d5f5b2f + 3a01840 commit 75aebda

File tree

5 files changed

+14
-0
lines changed

5 files changed

+14
-0
lines changed

py/runtime.c

+5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ const mp_obj_module_t mp_module___main__ = {
4242
};
4343

4444
void mp_init(void) {
45+
// call port specific initialization if any
46+
#ifdef MICROPY_PORT_INIT_FUNC
47+
MICROPY_PORT_INIT_FUNC;
48+
#endif
49+
4550
mp_emit_glue_init();
4651

4752
// init global module stuff

windows/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ SRC_C = \
3131
unix/main.c \
3232
unix/file.c \
3333
realpath.c \
34+
init.c \
3435

3536
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
3637

windows/init.c

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include <stdlib.h>
2+
3+
void init() {
4+
putenv("PRINTF_EXPONENT_DIGITS=2");
5+
}

windows/init.h

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
void init(void);

windows/mpconfigport.h

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#define MICROPY_MOD_SYS_STDFILES (1)
1616
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
1717
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
18+
#define MICROPY_PORT_INIT_FUNC init()
1819

1920
// type definitions for the specific machine
2021

@@ -38,3 +39,4 @@ extern const struct _mp_obj_fun_native_t mp_builtin_open_obj;
3839
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
3940

4041
#include "realpath.h"
42+
#include "init.h"

0 commit comments

Comments
 (0)