[pypy-svn] r43650 - in pypy/branch/kill-ctypes/pypy/rpython: lltypesystem lltypesystem/test module

fijal at codespeak.net fijal at codespeak.net
Fri May 25 21:02:13 CEST 2007


Author: fijal
Date: Fri May 25 21:02:13 2007
New Revision: 43650

Modified:
   pypy/branch/kill-ctypes/pypy/rpython/lltypesystem/rffi.py
   pypy/branch/kill-ctypes/pypy/rpython/lltypesystem/test/test_rffi.py
   pypy/branch/kill-ctypes/pypy/rpython/module/ll_os.py
Log:
(fijal, arigo) slight renaming to give saner names


Modified: pypy/branch/kill-ctypes/pypy/rpython/lltypesystem/rffi.py
==============================================================================
--- pypy/branch/kill-ctypes/pypy/rpython/lltypesystem/rffi.py	(original)
+++ pypy/branch/kill-ctypes/pypy/rpython/lltypesystem/rffi.py	Fri May 25 21:02:13 2007
@@ -9,28 +9,28 @@
                               includes=tuple(includes))
 
 # char *
-CCHARP = lltype.Array(lltype.Char, hints={'nolength': True})
+CCHARP = lltype.Ptr(lltype.Array(lltype.Char, hints={'nolength': True}))
 
 # various type mapping
 def str2charp(s):
     """ str -> char*
     """
-    array = lltype.malloc(CCHARP, len(s) + 1, flavor='raw')
+    array = lltype.malloc(CCHARP.TO, len(s) + 1, flavor='raw')
     for i in range(len(s)):
         array[i] = s[i]
     array[len(s)] = '\x00'
     return array
 
 # char**
-CCHARPP = lltype.Array(lltype.Ptr(CCHARP), hints={'nolength': True})
+CCHARPP = lltype.Ptr(lltype.Array(CCHARP, hints={'nolength': True}))
 
 def liststr2charpp(l):
     """ list[str] -> char**, NULL terminated
     """
-    array = lltype.malloc(CCHARPP, len(l) + 1, flavor='raw')
+    array = lltype.malloc(CCHARPP.TO, len(l) + 1, flavor='raw')
     for i in range(len(l)):
         array[i] = str2charp(l[i])
-    array[len(l)] = lltype.nullptr(CCHARP)
+    array[len(l)] = lltype.nullptr(CCHARP.TO)
     return array
 
 def free_charpp(ref):

Modified: pypy/branch/kill-ctypes/pypy/rpython/lltypesystem/test/test_rffi.py
==============================================================================
--- pypy/branch/kill-ctypes/pypy/rpython/lltypesystem/test/test_rffi.py	(original)
+++ pypy/branch/kill-ctypes/pypy/rpython/lltypesystem/test/test_rffi.py	Fri May 25 21:02:13 2007
@@ -40,7 +40,7 @@
     assert xf() == 8+3
 
 def test_string():
-    z = llexternal('strlen', [Ptr(CCHARP)], Signed, includes=['string.h'])
+    z = llexternal('strlen', [CCHARP], Signed, includes=['string.h'])
 
     def f():
         s = str2charp("xxx")
@@ -67,7 +67,7 @@
     """
     c_file = udir.join("stringstar.c")
     c_file.write(c_source)
-    z = llexternal('f', [Ptr(CCHARPP)], Signed, sources=[str(c_file)])
+    z = llexternal('f', [CCHARPP], Signed, sources=[str(c_file)])
 
     def f():
         l = ["xxx", "x", "xxxx"]

Modified: pypy/branch/kill-ctypes/pypy/rpython/module/ll_os.py
==============================================================================
--- pypy/branch/kill-ctypes/pypy/rpython/module/ll_os.py	(original)
+++ pypy/branch/kill-ctypes/pypy/rpython/module/ll_os.py	Fri May 25 21:02:13 2007
@@ -37,8 +37,8 @@
         name = '_execv'
     else:
         name = 'execv'
-    os_execv = rffi.llexternal(name, [lltype.Ptr(rffi.CCHARP),
-                               lltype.Ptr(rffi.CCHARPP)], lltype.Signed)
+    os_execv = rffi.llexternal(name, [rffi.CCHARP, rffi.CCHARPP],
+                               lltype.Signed)
 
     def execv_lltypeimpl(path, args):
         l_path = rffi.str2charp(path)



More information about the Pypy-commit mailing list