summaryrefslogtreecommitdiffstatshomepage
path: root/unix
diff options
context:
space:
mode:
Diffstat (limited to 'unix')
-rw-r--r--unix/Makefile5
-rw-r--r--unix/modffi.c10
-rw-r--r--unix/mpconfigport.h2
3 files changed, 16 insertions, 1 deletions
diff --git a/unix/Makefile b/unix/Makefile
index 07a75f7adb..c9509b9f0d 100644
--- a/unix/Makefile
+++ b/unix/Makefile
@@ -67,3 +67,8 @@ OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
include ../py/mkrules.mk
+.PHONY: test
+
+test: $(PROG) ../tests/run-tests
+ $(eval DIRNAME=$(notdir $(CURDIR)))
+ cd ../tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests
diff --git a/unix/modffi.c b/unix/modffi.c
index cb6a4424f3..f2bd6fcecf 100644
--- a/unix/modffi.c
+++ b/unix/modffi.c
@@ -61,6 +61,8 @@ STATIC ffi_type *char2ffi_type(char c)
case 'I': return &ffi_type_uint;
case 'l': return &ffi_type_slong;
case 'L': return &ffi_type_ulong;
+ case 'f': return &ffi_type_float;
+ case 'd': return &ffi_type_double;
case 'p':
case 's': return &ffi_type_pointer;
case 'v': return &ffi_type_void;
@@ -92,6 +94,14 @@ STATIC mp_obj_t return_ffi_value(ffi_arg val, char type)
}
case 'v':
return mp_const_none;
+ case 'f': {
+ float *p = (float*)&val;
+ return mp_obj_new_float(*p);
+ }
+ case 'd': {
+ double *p = (double*)&val;
+ return mp_obj_new_float(*p);
+ }
default:
return mp_obj_new_int(val);
}
diff --git a/unix/mpconfigport.h b/unix/mpconfigport.h
index 9c91b757a8..cf6e6fae26 100644
--- a/unix/mpconfigport.h
+++ b/unix/mpconfigport.h
@@ -10,12 +10,12 @@
#define MICROPY_ENABLE_REPL_HELPERS (1)
#define MICROPY_ENABLE_LEXER_UNIX (1)
#define MICROPY_ENABLE_SOURCE_LINE (1)
-#define MICROPY_ENABLE_PROPERTY (1)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
#define MICROPY_PATH_MAX (PATH_MAX)
#define MICROPY_USE_COMPUTED_GOTOS (1)
#define MICROPY_MOD_SYS_STDFILES (1)
+#define MICROPY_ENABLE_MOD_CMATH (1)
// type definitions for the specific machine