From 8bfec2b53822e2b62c4577b32e0beae398a16297 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 10 Mar 2014 13:27:02 +0000 Subject: [PATCH] Rename formatfloat file; remove MICROPY_ENABLE_FLOAT from mpconfigport.h. MICROPY_ENABLE_FLOAT is automatically set in mpconfig.h if MICROPY_FLOAT_IMPL is set to a non-zero value. --- py/{format-float.c => formatfloat.c} | 18 +++++++++--------- py/{format-float.h => formatfloat.h} | 2 -- py/objfloat.c | 5 +++-- py/py.mk | 2 +- stm/mpconfigport.h | 1 - stm/printf.c | 3 ++- 6 files changed, 15 insertions(+), 16 deletions(-) rename py/{format-float.c => formatfloat.c} (98%) rename py/{format-float.h => formatfloat.h} (97%) diff --git a/py/format-float.c b/py/formatfloat.c similarity index 98% rename from py/format-float.c rename to py/formatfloat.c index 5411ae24f6..e42266a714 100644 --- a/py/format-float.c +++ b/py/formatfloat.c @@ -1,25 +1,25 @@ -/*********************************************************************** - - format-float.c - Ruutine for converting a single-precision floating +/*********************************************************************** + + formatfloat.c - Ruutine for converting a single-precision floating point number into a string. - + The code in this funcion was inspired from Fred Bayer's pdouble.c. Since pdouble.c was released as Public Domain, I'm releasing this code as public domain as well. - + The original code can be found in https://github.com/dhylands/format-float - + Dave Hylands - + ***********************************************************************/ -#include +#include #include #include "mpconfig.h" #if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT -#include "format-float.h" +#include "formatfloat.h" // 1 sign bit, 8 exponent bits, and 23 mantissa bits. // exponent values 0 and 255 are reserved, exponent can be 1 to 254. diff --git a/py/format-float.h b/py/formatfloat.h similarity index 97% rename from py/format-float.h rename to py/formatfloat.h index 590fb0e91d..4c2c30e53c 100644 --- a/py/format-float.h +++ b/py/formatfloat.h @@ -1,3 +1 @@ int format_float(float f, char *buf, size_t bufSize, char fmt, int prec, char sign); - - diff --git a/py/objfloat.c b/py/objfloat.c index 5b953f05eb..91d669ad58 100644 --- a/py/objfloat.c +++ b/py/objfloat.c @@ -12,8 +12,9 @@ #include "runtime0.h" #if MICROPY_ENABLE_FLOAT + #if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT -#include "format-float.h" +#include "formatfloat.h" #endif mp_obj_t mp_obj_new_float(mp_float_t value); @@ -120,4 +121,4 @@ mp_obj_t mp_obj_float_binary_op(int op, mp_float_t lhs_val, mp_obj_t rhs_in) { return mp_obj_new_float(lhs_val); } -#endif +#endif // MICROPY_ENABLE_FLOAT diff --git a/py/py.mk b/py/py.mk index 4fd295f8e5..0814176815 100644 --- a/py/py.mk +++ b/py/py.mk @@ -32,7 +32,7 @@ PY_O_BASENAME = \ asmthumb.o \ emitnthumb.o \ emitinlinethumb.o \ - format-float.o \ + formatfloat.o \ parsenumbase.o \ parsenum.o \ runtime.o \ diff --git a/stm/mpconfigport.h b/stm/mpconfigport.h index 57c92181b8..3f48c43f04 100644 --- a/stm/mpconfigport.h +++ b/stm/mpconfigport.h @@ -7,7 +7,6 @@ #define MICROPY_ENABLE_GC (1) #define MICROPY_ENABLE_REPL_HELPERS (1) #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ) -#define MICROPY_ENABLE_FLOAT (1) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT) #define MICROPY_PATH_MAX (128) /* Enable FatFS LFNs diff --git a/stm/printf.c b/stm/printf.c index 56a5d864cf..446b3182fa 100644 --- a/stm/printf.c +++ b/stm/printf.c @@ -11,8 +11,9 @@ #include "lcd.h" #include "usart.h" #include "usb.h" + #if MICROPY_ENABLE_FLOAT -#include "format-float.h" +#include "formatfloat.h" #endif #define PF_FLAG_LEFT_ADJUST (0x01)