[Numpy-svn] r3041 - in trunk/numpy/core: code_generators include/numpy src

numpy-svn at scipy.org numpy-svn at scipy.org
Mon Aug 21 14:52:10 EDT 2006


Author: oliphant
Date: 2006-08-21 13:52:06 -0500 (Mon, 21 Aug 2006)
New Revision: 3041

Modified:
   trunk/numpy/core/code_generators/ufunc_api_order.txt
   trunk/numpy/core/include/numpy/arrayobject.h
   trunk/numpy/core/src/ufuncobject.c
Log:
Add simple function to replace Ufunc

Modified: trunk/numpy/core/code_generators/ufunc_api_order.txt
===================================================================
--- trunk/numpy/core/code_generators/ufunc_api_order.txt	2006-08-19 06:01:10 UTC (rev 3040)
+++ trunk/numpy/core/code_generators/ufunc_api_order.txt	2006-08-21 18:52:06 UTC (rev 3041)
@@ -27,3 +27,4 @@
 PyUFunc_clearfperr
 PyUFunc_getfperr
 PyUFunc_handlefperr
+PyUFunc_ReplaceLoopBySignature
\ No newline at end of file

Modified: trunk/numpy/core/include/numpy/arrayobject.h
===================================================================
--- trunk/numpy/core/include/numpy/arrayobject.h	2006-08-19 06:01:10 UTC (rev 3040)
+++ trunk/numpy/core/include/numpy/arrayobject.h	2006-08-21 18:52:06 UTC (rev 3041)
@@ -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

Modified: trunk/numpy/core/src/ufuncobject.c
===================================================================
--- trunk/numpy/core/src/ufuncobject.c	2006-08-19 06:01:10 UTC (rev 3040)
+++ trunk/numpy/core/src/ufuncobject.c	2006-08-21 18:52:06 UTC (rev 3041)
@@ -3022,7 +3022,31 @@
 	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 *
 PyUFunc_FromFuncAndData(PyUFuncGenericFunction *func, void **data,




More information about the Numpy-svn mailing list