[pypy-svn] r47508 - in pypy/dist/pypy/module/_ffi: . test
fijal at codespeak.net
fijal at codespeak.net
Wed Oct 17 01:19:51 CEST 2007
Author: fijal
Date: Wed Oct 17 01:19:49 2007
New Revision: 47508
Modified:
pypy/dist/pypy/module/_ffi/TODO
pypy/dist/pypy/module/_ffi/__init__.py
pypy/dist/pypy/module/_ffi/interp_ffi.py
pypy/dist/pypy/module/_ffi/test/test__ffi.py
Log:
* A skipped test
* Make it rpython once again
Modified: pypy/dist/pypy/module/_ffi/TODO
==============================================================================
--- pypy/dist/pypy/module/_ffi/TODO (original)
+++ pypy/dist/pypy/module/_ffi/TODO Wed Oct 17 01:19:49 2007
@@ -1,8 +1,7 @@
* long support with all messy corners (when to create long integer and
- such)
+ such), also short overflowing
* add arrays
-* keyword arguments for structure creation
Modified: pypy/dist/pypy/module/_ffi/__init__.py
==============================================================================
--- pypy/dist/pypy/module/_ffi/__init__.py (original)
+++ pypy/dist/pypy/module/_ffi/__init__.py Wed Oct 17 01:19:49 2007
@@ -10,11 +10,12 @@
applevelname = '_ffi'
interpleveldefs = {
- 'CDLL' : 'interp_ffi.W_CDLL',
- 'FuncPtr' : 'interp_ffi.W_FuncPtr',
+ 'CDLL' : 'interp_ffi.W_CDLL',
+ 'FuncPtr' : 'interp_ffi.W_FuncPtr',
'StructureInstance' : 'structure.W_StructureInstance',
}
appleveldefs = {
'Structure' : 'app_ffi.Structure',
+ #'StructureInstance' : 'app_ffi.StructureInstance',
}
Modified: pypy/dist/pypy/module/_ffi/interp_ffi.py
==============================================================================
--- pypy/dist/pypy/module/_ffi/interp_ffi.py (original)
+++ pypy/dist/pypy/module/_ffi/interp_ffi.py Wed Oct 17 01:19:49 2007
@@ -178,7 +178,9 @@
elif c == 'f' or c == 'd':
return space.wrap(float(func(arg, ll_type)))
elif c == 'c' or c == 'b' or c == 'B':
- return space.wrap(func(arg, ll_type))
+ return space.wrap(chr(rffi.cast(rffi.INT, func(arg, ll_type))))
+ elif c == 'h' or c == 'H':
+ return space.wrap(rffi.cast(rffi.INT, func(arg, ll_type)))
else:
return space.wrap(intmask(func(arg, ll_type)))
return space.w_None
Modified: pypy/dist/pypy/module/_ffi/test/test__ffi.py
==============================================================================
--- pypy/dist/pypy/module/_ffi/test/test__ffi.py (original)
+++ pypy/dist/pypy/module/_ffi/test/test__ffi.py Wed Oct 17 01:19:49 2007
@@ -188,6 +188,20 @@
x = create_double_struct()
assert X(X(x).next).x2 == 3
+ def test_implicit_structure(self):
+ skip("Does not work yet")
+ import _ffi
+ lib = _ffi.CDLL(self.lib_name)
+ X = _ffi.Structure([('x1', 'i'), ('x2', 'h'), ('x3', 'c'), ('next', 'self')])
+ inner = lib.ptr("inner_struct_elem", [X], 'c')
+ x = X(next=X(next=None, x3='x'), x1=1, x2=2, x3='x')
+ assert x.next.x3 == 'x'
+ assert inner(x) == 'x'
+ create_double_struct = lib.ptr("create_double_struct", [], X)
+ x = create_double_struct()
+ assert x.next.x2 == 3
+
+
def test_longs_ulongs(self):
skip("Not implemented yet")
More information about the Pypy-commit
mailing list