diff options
author | David Cournapeau <cournape@gmail.com> | 2009-04-30 08:34:41 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2009-04-30 08:34:41 +0000 |
commit | 4c2a9af485cd64335f82dac9756a856da9adee16 (patch) | |
tree | dd53ef7c266d7c71a52af2cc025201fe5a771a11 /numpy/core | |
parent | 065b457b7e52a26bb3fca919b0fb0f12e1c944d3 (diff) | |
download | numpy-4c2a9af485cd64335f82dac9756a856da9adee16.tar.gz |
Compile numpyos.c separately.
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/SConscript | 5 | ||||
-rw-r--r-- | numpy/core/setup.py | 1 | ||||
-rw-r--r-- | numpy/core/src/arraytypes.c.src | 3 | ||||
-rw-r--r-- | numpy/core/src/numpyos.c | 12 | ||||
-rw-r--r-- | numpy/core/src/numpyos.h | 25 | ||||
-rw-r--r-- | numpy/core/src/scalartypes.c.src | 3 |
6 files changed, 41 insertions, 8 deletions
diff --git a/numpy/core/SConscript b/numpy/core/SConscript index 7871bcd28..a8fbafd9a 100644 --- a/numpy/core/SConscript +++ b/numpy/core/SConscript @@ -1,4 +1,4 @@ -# Last Change: Wed Apr 22 07:00 PM 2009 J +# Last Change: Wed Apr 22 08:00 PM 2009 J # vim:syntax=python import os import sys @@ -283,7 +283,8 @@ env.Prepend(LIBPATH=["."]) # Build multiarray #----------------- multiarray_src = [pjoin('src', 'multiarraymodule.c'), - pjoin('src', 'hashdescr.c'), pjoin('src', 'arrayobject.c')] + pjoin('src', 'hashdescr.c'), pjoin('src', 'arrayobject.c'), + pjoin('src', 'numpyos.c')] multiarray_src.extend(arraytypes_src) multiarray_src.extend(scalartypes_src) multiarray = env.DistutilsPythonExtension('multiarray', source = multiarray_src) diff --git a/numpy/core/setup.py b/numpy/core/setup.py index 387b3d17c..030e8d621 100644 --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -493,6 +493,7 @@ def configuration(parent_package='',top_path=None): join('src','scalartypes.c.src'), join('src','arraytypes.c.src'), join('src', 'hashdescr.c'), + join('src', 'numpyos.c'), join('src','arrayobject.c'), join(codegen_dir,'generate_numpy_api.py'), join('*.py') 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}, |