[Numpy-svn] r3698 - in branches/multicore/numpy/core: . cprops_thread src

numpy-svn@scip... numpy-svn@scip...
Tue Apr 10 17:16:22 CDT 2007


Author: eric
Date: 2007-04-10 17:16:10 -0500 (Tue, 10 Apr 2007)
New Revision: 3698

Modified:
   branches/multicore/numpy/core/cprops_thread/cp_config.h
   branches/multicore/numpy/core/cprops_thread/hashtable.c
   branches/multicore/numpy/core/setup.py
   branches/multicore/numpy/core/src/ufuncobject.c
Log:
fixes for msvc on windows.  It now compiles with mingw, msvc, and linux gcc

Modified: branches/multicore/numpy/core/cprops_thread/cp_config.h
===================================================================
--- branches/multicore/numpy/core/cprops_thread/cp_config.h	2007-04-10 20:21:39 UTC (rev 3697)
+++ branches/multicore/numpy/core/cprops_thread/cp_config.h	2007-04-10 22:16:10 UTC (rev 3698)
@@ -21,6 +21,19 @@
 /* Define to 1 if you have the `getpagesize' function. */
 #define CP_HAS_GETPAGESIZE 1
 
+/* eric: used in thread.c 
+ * Define to 1 if you have the `random' function. 
+ * Note: Even on win32, we can use this with mingw32, but
+ * I don't think it is crictical, so for simplicity, just use
+ * the alternative when building on windows.
+ */ 
+#define CP_HAS_RANDOM 1
+
+/* eric: used in thread.c */
+/* Define to 1 if you have the `srandom' function. */
+/* Note: same comment as above for CP_HAS_RANDOM */
+#define CP_HAS_SRANDOM 1
+
 #else
 /* eric: used internally by cprops_thread to turn on windows features */
 #define _WINDOWS
@@ -31,14 +44,7 @@
 #define CP_HAS_PTHREAD_MUTEX_RECURSIVE 1
 
 
-/* eric: used in thread.c */
-/* Define to 1 if you have the `random' function. */
-#define CP_HAS_RANDOM 1
 
-/* eric: used in thread.c */
-/* Define to 1 if you have the `srandom' function. */
-#define CP_HAS_SRANDOM 1
-
 /* eric: what system doesn't have this??? */
 /* Define to 1 if you have the `read' function. */
 #define CP_HAS_READ 1

Modified: branches/multicore/numpy/core/cprops_thread/hashtable.c
===================================================================
--- branches/multicore/numpy/core/cprops_thread/hashtable.c	2007-04-10 20:21:39 UTC (rev 3697)
+++ branches/multicore/numpy/core/cprops_thread/hashtable.c	2007-04-10 22:16:10 UTC (rev 3698)
@@ -41,6 +41,13 @@
 #define CP_HASHTABLE_MULTIPLE_VALUES 1
 #endif
 
+/* Microsoft's compiler uses stricmp for strcasecmp 
+ * MSVC defines this macro (version number) and mingw32 does not.
+ */
+#ifdef _MSC_VER
+#define strcasecmp stricmp
+#endif
+
 static int table_sizes[] = 
     {
            5,        7,       11,       23,       47,

Modified: branches/multicore/numpy/core/setup.py
===================================================================
--- branches/multicore/numpy/core/setup.py	2007-04-10 20:21:39 UTC (rev 3697)
+++ branches/multicore/numpy/core/setup.py	2007-04-10 22:16:10 UTC (rev 3698)
@@ -212,8 +212,6 @@
         umath_libraries.append('cprops')
         
         if sys.platform == 'win32':
-            # fixme: is this only for gcc, or does msvc need it as well?
-            umath_libraries.append('iberty') # needed for random, srandom
             umath_libraries.append('wsock32') # needed for select
 
         config.add_library('cprops', join('cprops_thread', '*.c'),

Modified: branches/multicore/numpy/core/src/ufuncobject.c
===================================================================
--- branches/multicore/numpy/core/src/ufuncobject.c	2007-04-10 20:21:39 UTC (rev 3697)
+++ branches/multicore/numpy/core/src/ufuncobject.c	2007-04-10 22:16:10 UTC (rev 3698)
@@ -1803,6 +1803,7 @@
 
     static cp_thread_pool* thread_pool=NULL;
     cp_pooled_thread* thread;
+    NPY_BEGIN_THREADS_DEF
     
     if (thread_pool == NULL)
     {
@@ -1813,7 +1814,6 @@
         thread_pool = cp_thread_pool_create(1, 20);
     }
 
-    NPY_BEGIN_THREADS_DEF
 
     if (!(loop = construct_loop(self, args, kwds, mps))) return -1;
     if (loop->notimplemented) {ufuncloop_dealloc(loop); return -2;}



More information about the Numpy-svn mailing list