[pypy-svn] r54798 - pypy/dist/pypy/rlib
afa at codespeak.net
afa at codespeak.net
Fri May 16 20:50:49 CEST 2008
Author: afa
Date: Fri May 16 20:50:45 2008
New Revision: 54798
Modified:
pypy/dist/pypy/rlib/libffi.py
pypy/dist/pypy/rlib/rwin32.py
Log:
Translation fixes for _rawffi on win32.
The translation went almost to the end!
the process failed in gen_makefile(), which is of no use on windows :-(
Modified: pypy/dist/pypy/rlib/libffi.py
==============================================================================
--- pypy/dist/pypy/rlib/libffi.py (original)
+++ pypy/dist/pypy/rlib/libffi.py Fri May 16 20:50:45 2008
@@ -5,7 +5,7 @@
from pypy.rpython.tool import rffi_platform
from pypy.rpython.lltypesystem import lltype, rffi
from pypy.rlib.unroll import unrolling_iterable
-from pypy.rlib.rarithmetic import intmask
+from pypy.rlib.rarithmetic import intmask, r_uint
from pypy.rlib.objectmodel import we_are_translated
from pypy.tool.autopath import pypydir
from pypy.translator.tool.cbuild import ExternalCompilationInfo
@@ -346,7 +346,7 @@
if _MS_WINDOWS:
# This little trick works correctly with MSVC.
# It returns small structures in registers
- if restype.c_type == FFI_TYPE_STRUCT:
+ if r_uint(restype.c_type) == FFI_TYPE_STRUCT:
if restype.c_size <= 4:
restype = ffi_type_sint32
elif restype.c_size <= 8:
Modified: pypy/dist/pypy/rlib/rwin32.py
==============================================================================
--- pypy/dist/pypy/rlib/rwin32.py (original)
+++ pypy/dist/pypy/rlib/rwin32.py Fri May 16 20:50:45 2008
@@ -25,6 +25,7 @@
if WIN32:
DWORD = rffi_platform.SimpleType("DWORD", rffi.UINT)
BOOL = rffi_platform.SimpleType("BOOL", rffi.LONG)
+ HRESULT = rffi_platform.SimpleType("HRESULT", rffi.LONG)
HANDLE = rffi_platform.SimpleType("HANDLE", rffi.VOIDP)
HLOCAL = rffi_platform.SimpleType("HLOCAL", rffi.VOIDP)
@@ -79,3 +80,7 @@
result = ''.join([buf[0][i] for i in range(msglen)])
LocalFree(buf[0])
return result
+
+ def FAILED(hr):
+ return rffi.cast(HRESULT, hr) < 0
+
More information about the Pypy-commit
mailing list