summaryrefslogtreecommitdiff
path: root/numpy/core/src
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2009-04-30 08:34:41 +0000
committerDavid Cournapeau <cournape@gmail.com>2009-04-30 08:34:41 +0000
commit4c2a9af485cd64335f82dac9756a856da9adee16 (patch)
treedd53ef7c266d7c71a52af2cc025201fe5a771a11 /numpy/core/src
parent065b457b7e52a26bb3fca919b0fb0f12e1c944d3 (diff)
downloadnumpy-4c2a9af485cd64335f82dac9756a856da9adee16.tar.gz
Compile numpyos.c separately.
Diffstat (limited to 'numpy/core/src')
-rw-r--r--numpy/core/src/arraytypes.c.src3
-rw-r--r--numpy/core/src/numpyos.c12
-rw-r--r--numpy/core/src/numpyos.h25
-rw-r--r--numpy/core/src/scalartypes.c.src3
4 files changed, 37 insertions, 6 deletions
diff --git a/numpy/core/src/arraytypes.c.src b/numpy/core/src/arraytypes.c.src
index d96f48eee..43bb48dd7 100644
--- a/numpy/core/src/arraytypes.c.src
+++ b/numpy/core/src/arraytypes.c.src
@@ -12,8 +12,7 @@
#include "arrayobject.h"
#include "config.h"
-/* FIXME: this should be built separately */
-#include "numpyos.c"
+#include "numpyos.h"
static double
MyPyFloat_AsDouble(PyObject *obj)
diff --git a/numpy/core/src/numpyos.c b/numpy/core/src/numpyos.c
index 319b4806d..4d7b70a33 100644
--- a/numpy/core/src/numpyos.c
+++ b/numpy/core/src/numpyos.c
@@ -1,6 +1,12 @@
+#define PY_SSIZE_T_CLEAN
+#include <Python.h>
+
#include <locale.h>
#include <stdio.h>
+#define _MULTIARRAYMODULE
+#define NPY_NO_PREFIX
+#include "numpy/arrayobject.h"
#include "numpy/npy_math.h"
/*
@@ -278,7 +284,7 @@ _fix_ascii_format(char* buf, size_t buflen, int decimal)
* Return value: The pointer to the buffer with the converted string.
*/
#define _ASCII_FORMAT(type, suffix, print_type) \
- static char* \
+ NPY_NO_EXPORT char* \
NumPyOS_ascii_format ## suffix(char *buffer, size_t buf_size, \
const char *format, \
type val, int decimal) \
@@ -416,7 +422,7 @@ NumPyOS_ascii_strncasecmp(const char* s1, const char* s2, size_t len)
*
* Work around bugs in PyOS_ascii_strtod
*/
-static double
+NPY_NO_EXPORT double
NumPyOS_ascii_strtod(const char *s, char** endptr)
{
struct lconv *locale_data = localeconv();
@@ -526,7 +532,7 @@ NumPyOS_ascii_strtod(const char *s, char** endptr)
* * 1 if a number read,
* * EOF if end-of-file met before reading anything.
*/
-static int
+NPY_NO_EXPORT int
NumPyOS_ascii_ftolf(FILE *fp, double *value)
{
char buffer[FLOAT_FORMATBUFLEN + 1];
diff --git a/numpy/core/src/numpyos.h b/numpy/core/src/numpyos.h
new file mode 100644
index 000000000..edc6df66b
--- /dev/null
+++ b/numpy/core/src/numpyos.h
@@ -0,0 +1,25 @@
+#ifndef _NPY_NUMPYOS_H_
+#define _NPY_NUMPYOS_H_
+
+NPY_NO_EXPORT char*
+NumPyOS_ascii_formatd(char *buffer, size_t buf_size,
+ const char *format,
+ double val, int decimal);
+
+NPY_NO_EXPORT char*
+NumPyOS_ascii_formatf(char *buffer, size_t buf_size,
+ const char *format,
+ float val, int decimal);
+
+NPY_NO_EXPORT char*
+NumPyOS_ascii_formatl(char *buffer, size_t buf_size,
+ const char *format,
+ long double val, int decimal);
+
+NPY_NO_EXPORT double
+NumPyOS_ascii_strtod(const char *s, char** endptr);
+
+NPY_NO_EXPORT int
+NumPyOS_ascii_ftolf(FILE *fp, double *value);
+
+#endif
diff --git a/numpy/core/src/scalartypes.c.src b/numpy/core/src/scalartypes.c.src
index 17060062f..76bec4a11 100644
--- a/numpy/core/src/scalartypes.c.src
+++ b/numpy/core/src/scalartypes.c.src
@@ -8,11 +8,12 @@
#endif
#define NPY_NO_PREFIX
#include "numpy/arrayobject.h"
+#include "numpy/npy_math.h"
#include "numpy/arrayscalars.h"
#include "config.h"
#include "arrayobject.h"
-#include "numpyos.c"
+#include "numpyos.h"
NPY_NO_EXPORT PyBoolScalarObject _PyArrayScalar_BoolValues[2] = {
{PyObject_HEAD_INIT(&PyBoolArrType_Type) 0},