summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-03-10 13:27:02 +0000
committerDamien George <damien.p.george@gmail.com>2014-03-10 13:27:02 +0000
commit8bfec2b53822e2b62c4577b32e0beae398a16297 (patch)
tree3116ca2b8fdad7c1d3b1221d658f9eea7a6575a3
parent0a8458c353b60420f17050d819912df9b168d0cb (diff)
downloadmicropython-8bfec2b53822e2b62c4577b32e0beae398a16297.tar.gz
micropython-8bfec2b53822e2b62c4577b32e0beae398a16297.zip
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.
-rw-r--r--py/formatfloat.c (renamed from py/format-float.c)18
-rw-r--r--py/formatfloat.h (renamed from py/format-float.h)2
-rw-r--r--py/objfloat.c5
-rw-r--r--py/py.mk2
-rw-r--r--stm/mpconfigport.h1
-rw-r--r--stm/printf.c3
6 files changed, 15 insertions, 16 deletions
diff --git a/py/format-float.c b/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 <stdint.h>
+#include <stdint.h>
#include <stdlib.h>
#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
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)