summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-08-21 18:52:06 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-08-21 18:52:06 +0000
commita7b84416c876c035d811ef705da3e26309b1709e (patch)
treefd58e71310364b9fd0794a57841a0928c0d6dcb8
parentb9ce9390471f4f0989c6e4605d04ef0e5d1f5494 (diff)
downloadnumpy-a7b84416c876c035d811ef705da3e26309b1709e.tar.gz
Add simple function to replace Ufunc
-rw-r--r--numpy/core/code_generators/ufunc_api_order.txt1
-rw-r--r--numpy/core/include/numpy/arrayobject.h10
-rw-r--r--numpy/core/src/ufuncobject.c24
3 files changed, 27 insertions, 8 deletions
diff --git a/numpy/core/code_generators/ufunc_api_order.txt b/numpy/core/code_generators/ufunc_api_order.txt
index fe37a0049..816d3121d 100644
--- a/numpy/core/code_generators/ufunc_api_order.txt
+++ b/numpy/core/code_generators/ufunc_api_order.txt
@@ -27,3 +27,4 @@ PyUFunc_checkfperr
PyUFunc_clearfperr
PyUFunc_getfperr
PyUFunc_handlefperr
+PyUFunc_ReplaceLoopBySignature \ No newline at end of file
diff --git a/numpy/core/include/numpy/arrayobject.h b/numpy/core/include/numpy/arrayobject.h
index cea108543..871500777 100644
--- a/numpy/core/include/numpy/arrayobject.h
+++ b/numpy/core/include/numpy/arrayobject.h
@@ -16,12 +16,6 @@
#include "noprefix.h"
#endif
-
-/* Add signal handling macros */
-
-#define NPY_SIG_ON
-#define NPY_SIG_OFF
-#define NPY_SIG_CHECK
-
-
+#ifndef NPY_NO_SIGNAL
+#include "npy_interrupt.h"
#endif
diff --git a/numpy/core/src/ufuncobject.c b/numpy/core/src/ufuncobject.c
index 917a4c739..8cc0be1a7 100644
--- a/numpy/core/src/ufuncobject.c
+++ b/numpy/core/src/ufuncobject.c
@@ -3022,6 +3022,30 @@ ufunc_frompyfunc(PyObject *dummy, PyObject *args, PyObject *kwds) {
return (PyObject *)self;
}
+/*UFUNC_API*/
+static int
+PyUFunc_ReplaceLoopBySignature(PyUFuncObject *func,
+ PyUFuncGenericFunction *newfunc,
+ int *signature,
+ PyUFuncGenericFunction *oldfunc)
+{
+ int i,j;
+ /* Find the location of the matching signature */
+ for (i=0; i<func->ntypes; i++) {
+ for (j=0; j<func->nargs; j++) {
+ if (signature[j] == func->types[i*self->nargs+j])
+ break;
+ }
+ if (j >= func->nargs) return -1;
+
+ if (oldfunc != NULL) {
+ *oldfunc = func->functions[i];
+ }
+ func->functions[i] = newfunc;
+ }
+ return -1;
+
+}
/*UFUNC_API*/
static PyObject *