[pypy-svn] r18983 - in pypy/dist/pypy/translator/c: . src

pedronis at codespeak.net pedronis at codespeak.net
Wed Oct 26 04:21:58 CEST 2005


Author: pedronis
Date: Wed Oct 26 04:21:57 2005
New Revision: 18983

Modified:
   pypy/dist/pypy/translator/c/extfunc.py
   pypy/dist/pypy/translator/c/src/ll__socket.h
Log:
add support for isolating ll_*.h on as needed basis.

Use it for ll__sockect which is broken at the moment at least on linux and Mac OS X
and was causing most translationt test to fail.

Now only the related extfunc tests for _socket functions fail



Modified: pypy/dist/pypy/translator/c/extfunc.py
==============================================================================
--- pypy/dist/pypy/translator/c/extfunc.py	(original)
+++ pypy/dist/pypy/translator/c/extfunc.py	Wed Oct 26 04:21:57 2005
@@ -134,8 +134,21 @@
     yield annotate(ll__socket.ll__socket_addrinfo, *args)
 
 def predeclare_extfuncs(db, rtyper):
+    modules = {}
+    def module_name(c_name):
+        frags = c_name[3:].split('_')
+        if frags[0] == '':
+            return '_' + frags[1]
+        else:
+            return frags[0]
+
     for func, funcobj in db.externalfuncs.items():
         c_name = EXTERNALS[func]
+        # construct a define LL_NEED_<modname> to make it possible to isolate in-develpoment externals and headers
+        modname = module_name(c_name)
+        if modname not in modules:
+            modules[modname] = True
+            yield 'LL_NEED_%s' % modname.upper(), 1
         funcptr = lltype._ptr(lltype.Ptr(lltype.typeOf(funcobj)), funcobj) # hum
         yield c_name, funcptr
 

Modified: pypy/dist/pypy/translator/c/src/ll__socket.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/ll__socket.h	(original)
+++ pypy/dist/pypy/translator/c/src/ll__socket.h	Wed Oct 26 04:21:57 2005
@@ -1,3 +1,4 @@
+#ifdef LL_NEED__SOCKET /* isolate */
 
 #ifdef MS_WINDOWS
   /* winsock2.h has already been included before windows.h in thread_nt.h */
@@ -374,3 +375,5 @@
 #endif /* !HAVE_INET_PTON */
 
 #endif /* PYPY_NOT_MAIN_FILE */
+
+#endif /* isolate */



More information about the Pypy-commit mailing list