ctypes-commit Mailing List for ctypes (Page 33)
Brought to you by:
theller
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(8) |
May
(90) |
Jun
(143) |
Jul
(106) |
Aug
(94) |
Sep
(84) |
Oct
(163) |
Nov
(60) |
Dec
(58) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(128) |
Feb
(79) |
Mar
(227) |
Apr
(192) |
May
(179) |
Jun
(41) |
Jul
(53) |
Aug
(103) |
Sep
(28) |
Oct
(38) |
Nov
(81) |
Dec
(17) |
2006 |
Jan
(184) |
Feb
(111) |
Mar
(188) |
Apr
(67) |
May
(58) |
Jun
(123) |
Jul
(73) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: Thomas H. <th...@us...> - 2006-01-02 17:22:04
|
Update of /cvsroot/ctypes/ctypes/wince In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10001 Modified Files: Tag: branch_1_0 _ctypes.vcp Log Message: Link to ole32.lib. Index: _ctypes.vcp =================================================================== RCS file: /cvsroot/ctypes/ctypes/wince/Attic/_ctypes.vcp,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** _ctypes.vcp 30 Dec 2005 17:26:13 -0000 1.1.2.1 --- _ctypes.vcp 2 Jan 2006 17:21:50 -0000 1.1.2.2 *************** *** 69,73 **** LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /MACHINE:THUMB ! # ADD LINK32 commctrl.lib coredll.lib oleaut32.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /MACHINE:THUMB !ELSEIF "$(CFG)" == "_ctypes - Win32 (WCE ARMV4I) Debug" --- 69,73 ---- LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /MACHINE:THUMB ! # ADD LINK32 commctrl.lib coredll.lib uuid.lib ole32.lib oleaut32.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /MACHINE:THUMB !ELSEIF "$(CFG)" == "_ctypes - Win32 (WCE ARMV4I) Debug" *************** *** 103,107 **** LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /debug /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /MACHINE:THUMB ! # ADD LINK32 commctrl.lib coredll.lib oleaut32.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /debug /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /MACHINE:THUMB !ELSEIF "$(CFG)" == "_ctypes - Win32 (WCE ARMV4) Release" --- 103,107 ---- LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /debug /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /MACHINE:THUMB ! # ADD LINK32 commctrl.lib coredll.lib uuid.lib ole32.lib oleaut32.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /debug /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /MACHINE:THUMB !ELSEIF "$(CFG)" == "_ctypes - Win32 (WCE ARMV4) Release" *************** *** 137,141 **** LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /align:"4096" /MACHINE:ARM ! # ADD LINK32 commctrl.lib coredll.lib oleaut32.lib uuid.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /nodefaultlib:"$(CENoDefaultLib)" /out:"ARMV4Rel/_ctypes.pyd" /subsystem:$(CESubsystem) /align:"4096" /MACHINE:ARM !ELSEIF "$(CFG)" == "_ctypes - Win32 (WCE ARMV4) Debug" --- 137,141 ---- LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /align:"4096" /MACHINE:ARM ! # ADD LINK32 uuid.lib ole32.lib commctrl.lib coredll.lib oleaut32.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /nodefaultlib:"$(CENoDefaultLib)" /out:"ARMV4Rel/_ctypes.pyd" /subsystem:$(CESubsystem) /align:"4096" /MACHINE:ARM !ELSEIF "$(CFG)" == "_ctypes - Win32 (WCE ARMV4) Debug" *************** *** 171,175 **** LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /debug /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /align:"4096" /MACHINE:ARM ! # ADD LINK32 commctrl.lib coredll.lib oleaut32.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /debug /nodefaultlib:"$(CENoDefaultLib)" /out:"ARMV4Dbg/_ctypes.pyd" /subsystem:$(CESubsystem) /align:"4096" /MACHINE:ARM !ELSEIF "$(CFG)" == "_ctypes - Win32 (WCE ARMV4T) Release" --- 171,175 ---- LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /debug /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /align:"4096" /MACHINE:ARM ! # ADD LINK32 commctrl.lib coredll.lib uuid.lib ole32.lib oleaut32.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /debug /nodefaultlib:"$(CENoDefaultLib)" /out:"ARMV4Dbg/_ctypes.pyd" /subsystem:$(CESubsystem) /align:"4096" /MACHINE:ARM !ELSEIF "$(CFG)" == "_ctypes - Win32 (WCE ARMV4T) Release" *************** *** 205,209 **** LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /MACHINE:THUMB ! # ADD LINK32 commctrl.lib coredll.lib oleaut32.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /MACHINE:THUMB !ELSEIF "$(CFG)" == "_ctypes - Win32 (WCE ARMV4T) Debug" --- 205,209 ---- LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /MACHINE:THUMB ! # ADD LINK32 commctrl.lib coredll.lib uuid.lib ole32.lib oleaut32.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /MACHINE:THUMB !ELSEIF "$(CFG)" == "_ctypes - Win32 (WCE ARMV4T) Debug" *************** *** 239,243 **** LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /debug /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /MACHINE:THUMB ! # ADD LINK32 commctrl.lib coredll.lib oleaut32.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /debug /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /MACHINE:THUMB !ELSEIF "$(CFG)" == "_ctypes - Win32 (WCE x86) Release" --- 239,243 ---- LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /debug /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /MACHINE:THUMB ! # ADD LINK32 commctrl.lib coredll.lib uuid.lib ole32.lib oleaut32.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /debug /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /MACHINE:THUMB !ELSEIF "$(CFG)" == "_ctypes - Win32 (WCE x86) Release" *************** *** 273,277 **** LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib $(CEx86Corelibc) /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /nodefaultlib:"OLDNAMES.lib" /nodefaultlib:$(CENoDefaultLib) /subsystem:$(CESubsystem) /MACHINE:IX86 ! # ADD LINK32 $(CEx86Corelibc) commctrl.lib coredll.lib oleaut32.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /nodefaultlib:"OLDNAMES.lib" /nodefaultlib:$(CENoDefaultLib) /subsystem:$(CESubsystem) /MACHINE:IX86 !ELSEIF "$(CFG)" == "_ctypes - Win32 (WCE x86) Debug" --- 273,277 ---- LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib $(CEx86Corelibc) /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /nodefaultlib:"OLDNAMES.lib" /nodefaultlib:$(CENoDefaultLib) /subsystem:$(CESubsystem) /MACHINE:IX86 ! # ADD LINK32 $(CEx86Corelibc) commctrl.lib coredll.lib uuid.lib ole32.lib oleaut32.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /nodefaultlib:"OLDNAMES.lib" /nodefaultlib:$(CENoDefaultLib) /subsystem:$(CESubsystem) /MACHINE:IX86 !ELSEIF "$(CFG)" == "_ctypes - Win32 (WCE x86) Debug" *************** *** 307,311 **** LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib $(CEx86Corelibc) /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /debug /nodefaultlib:"OLDNAMES.lib" /nodefaultlib:$(CENoDefaultLib) /subsystem:$(CESubsystem) /MACHINE:IX86 ! # ADD LINK32 $(CEx86Corelibc) commctrl.lib coredll.lib oleaut32.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /debug /nodefaultlib:"OLDNAMES.lib" /nodefaultlib:$(CENoDefaultLib) /subsystem:$(CESubsystem) /MACHINE:IX86 !ENDIF --- 307,311 ---- LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib $(CEx86Corelibc) /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /debug /nodefaultlib:"OLDNAMES.lib" /nodefaultlib:$(CENoDefaultLib) /subsystem:$(CESubsystem) /MACHINE:IX86 ! # ADD LINK32 $(CEx86Corelibc) commctrl.lib coredll.lib uuid.lib ole32.lib oleaut32.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /debug /nodefaultlib:"OLDNAMES.lib" /nodefaultlib:$(CENoDefaultLib) /subsystem:$(CESubsystem) /MACHINE:IX86 !ENDIF *************** *** 413,418 **** DEP_CPP__CTYP=\ "..\source\ctypes.h"\ - {$(INCLUDE)}"eval.h"\ - {$(INCLUDE)}"object.h"\ NODEP_CPP__CTYP=\ --- 413,416 ---- *************** *** 454,457 **** --- 452,456 ---- ".\uncobject.h"\ ".\upleobject.h"\ + ".\val.h"\ ".\yconfig.h"\ ".\ydebug.h"\ *************** *** 609,614 **** DEP_CPP_CALLB=\ "..\source\ctypes.h"\ - {$(INCLUDE)}"eval.h"\ - {$(INCLUDE)}"object.h"\ NODEP_CPP_CALLB=\ --- 608,611 ---- *************** *** 651,654 **** --- 648,652 ---- ".\uncobject.h"\ ".\upleobject.h"\ + ".\val.h"\ ".\yconfig.h"\ ".\ydebug.h"\ *************** *** 807,812 **** DEP_CPP_CALLP=\ "..\source\ctypes.h"\ - {$(INCLUDE)}"eval.h"\ - {$(INCLUDE)}"object.h"\ NODEP_CPP_CALLP=\ --- 805,808 ---- *************** *** 848,851 **** --- 844,848 ---- ".\uncobject.h"\ ".\upleobject.h"\ + ".\val.h"\ ".\yconfig.h"\ ".\ydebug.h"\ *************** *** 1000,1005 **** DEP_CPP_CFIEL=\ "..\source\ctypes.h"\ - {$(INCLUDE)}"eval.h"\ - {$(INCLUDE)}"object.h"\ NODEP_CPP_CFIEL=\ --- 997,1000 ---- *************** *** 1041,1044 **** --- 1036,1040 ---- ".\uncobject.h"\ ".\upleobject.h"\ + ".\val.h"\ ".\yconfig.h"\ ".\ydebug.h"\ *************** *** 1184,1189 **** DEP_CPP_MALLO=\ "..\source\ctypes.h"\ - {$(INCLUDE)}"eval.h"\ - {$(INCLUDE)}"object.h"\ NODEP_CPP_MALLO=\ --- 1180,1183 ---- *************** *** 1224,1227 **** --- 1218,1222 ---- ".\uncobject.h"\ ".\upleobject.h"\ + ".\val.h"\ ".\yconfig.h"\ ".\ydebug.h"\ *************** *** 1357,1362 **** DEP_CPP_STGDI=\ "..\source\ctypes.h"\ - {$(INCLUDE)}"eval.h"\ - {$(INCLUDE)}"object.h"\ NODEP_CPP_STGDI=\ --- 1352,1355 ---- *************** *** 1397,1400 **** --- 1390,1394 ---- ".\uncobject.h"\ ".\upleobject.h"\ + ".\val.h"\ ".\yconfig.h"\ ".\ydebug.h"\ |
From: Thomas H. <th...@us...> - 2006-01-02 15:09:09
|
Update of /cvsroot/ctypes/ctypes/ctypes/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15853 Modified Files: Tag: branch_1_0 test_loading.py test_functions.py Log Message: Add missing 'import sys'. Index: test_loading.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/ctypes/test/Attic/test_loading.py,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** test_loading.py 22 Dec 2005 20:34:57 -0000 1.1.2.1 --- test_loading.py 2 Jan 2006 15:09:01 -0000 1.1.2.2 *************** *** 1,4 **** from ctypes import * ! import unittest import os, StringIO --- 1,4 ---- from ctypes import * ! import sys, unittest import os, StringIO Index: test_functions.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/ctypes/test/Attic/test_functions.py,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** test_functions.py 3 Nov 2005 19:49:19 -0000 1.1.2.1 --- test_functions.py 2 Jan 2006 15:09:01 -0000 1.1.2.2 *************** *** 5,11 **** Later... """ ! from ctypes import * - import unittest try: --- 5,10 ---- Later... """ ! import sys, unittest from ctypes import * try: |
From: Thomas H. <th...@us...> - 2006-01-02 15:09:03
|
Update of /cvsroot/ctypes/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15826 Modified Files: Tag: branch_1_0 _endian.py Log Message: Add missing 'import sys'. Index: _endian.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/ctypes/Attic/_endian.py,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** _endian.py 30 Nov 2005 09:34:40 -0000 1.1.2.1 --- _endian.py 2 Jan 2006 15:08:53 -0000 1.1.2.2 *************** *** 1,2 **** --- 1,3 ---- + import sys from ctypes import * |
From: Thomas H. <th...@us...> - 2006-01-02 15:06:50
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15402 Modified Files: Tag: branch_1_0 _ctypes.c Log Message: Simplify the code. Index: _ctypes.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/_ctypes.c,v retrieving revision 1.226.2.39 retrieving revision 1.226.2.40 diff -C2 -d -r1.226.2.39 -r1.226.2.40 *** _ctypes.c 30 Dec 2005 17:22:49 -0000 1.226.2.39 --- _ctypes.c 2 Jan 2006 15:06:40 -0000 1.226.2.40 *************** *** 106,109 **** --- 106,115 ---- #ifdef MS_WIN32 #include <windows.h> + # ifdef _WIN32_WCE + /* Unlike desktop Windows, WinCE has both W and A variants of + GetProcAddress, but the default W version is not what we want */ + # undef GetProcAddress + # define GetProcAddress GetProcAddressA + # endif #else #include <dlfcn.h> *************** *** 244,248 **** #ifdef MS_WIN32 ! address = (void *)GetProcAddressA(handle, name); if (!address) { PyErr_Format(PyExc_ValueError, --- 250,254 ---- #ifdef MS_WIN32 ! address = (void *)GetProcAddress(handle, name); if (!address) { PyErr_Format(PyExc_ValueError, *************** *** 2341,2345 **** StgDictObject *dict = PyType_stgdict((PyObject *)type); ! address = (PPROC)GetProcAddressA(handle, name); if (address) return address; --- 2347,2351 ---- StgDictObject *dict = PyType_stgdict((PyObject *)type); ! address = (PPROC)GetProcAddress(handle, name); if (address) return address; *************** *** 2355,2359 **** for (i = 0; i < 32; ++i) { sprintf(mangled_name, "_%s@%d", name, i*4); ! address = (PPROC)GetProcAddressA(handle, mangled_name); if (address) return address; --- 2361,2365 ---- for (i = 0; i < 32; ++i) { sprintf(mangled_name, "_%s@%d", name, i*4); ! address = (PPROC)GetProcAddress(handle, mangled_name); if (address) return address; |
From: Thomas H. <th...@us...> - 2006-01-02 14:58:48
|
Update of /cvsroot/ctypes/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13870 Modified Files: Tag: branch_1_0 __init__.py Log Message: Make clean for 'from ctypes import *'. Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/ctypes/__init__.py,v retrieving revision 1.61.2.19 retrieving revision 1.61.2.20 diff -C2 -d -r1.61.2.19 -r1.61.2.20 *** __init__.py 30 Dec 2005 18:56:14 -0000 1.61.2.19 --- __init__.py 2 Jan 2006 14:58:39 -0000 1.61.2.20 *************** *** 3,7 **** # special developer support to use ctypes from the CVS sandbox, # without installing it ! import os as _os, sys from itertools import chain as _chain --- 3,7 ---- # special developer support to use ctypes from the CVS sandbox, # without installing it ! import os as _os, sys as _sys from itertools import chain as _chain *************** *** 290,294 **** return "<%s '%s', handle %x at %x>" % \ (self.__class__.__name__, self._name, ! (self._handle & (sys.maxint*2 + 1)), id(self)) --- 290,294 ---- return "<%s '%s', handle %x at %x>" % \ (self.__class__.__name__, self._name, ! (self._handle & (_sys.maxint*2 + 1)), id(self)) *************** *** 368,372 **** if osname is not None and osname != _os.name: return ! if platform is not None and platform != sys.platform: return _library_map[alias] = libname --- 368,372 ---- if osname is not None and osname != _os.name: return ! if platform is not None and platform != _sys.platform: return _library_map[alias] = libname *************** *** 428,432 **** raise e ! if _os.name == "posix" and sys.platform == "darwin": def _findLibrary(self, name): return ['lib%s.dylib' % name, --- 428,432 ---- raise e ! if _os.name == "posix" and _sys.platform == "darwin": def _findLibrary(self, name): return ['lib%s.dylib' % name, *************** *** 464,470 **** if _os.name in ("nt", "ce"): ! pythonapi = PyDLL("python dll", sys.dllhandle) ! elif sys.platform == "cygwin": ! pythonapi = PyDLL("libpython%d.%d.dll" % sys.version_info[:2]) else: pythonapi = PyDLL(None) --- 464,470 ---- if _os.name in ("nt", "ce"): ! pythonapi = PyDLL("python dll", _sys.dllhandle) ! elif _sys.platform == "cygwin": ! pythonapi = PyDLL("libpython%d.%d.dll" % _sys.version_info[:2]) else: pythonapi = PyDLL(None) |
From: Thomas H. <th...@us...> - 2005-12-30 18:56:22
|
Update of /cvsroot/ctypes/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15992 Modified Files: Tag: branch_1_0 __init__.py Log Message: Fix indentation. Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/ctypes/__init__.py,v retrieving revision 1.61.2.18 retrieving revision 1.61.2.19 diff -C2 -d -r1.61.2.18 -r1.61.2.19 *** __init__.py 30 Dec 2005 18:27:17 -0000 1.61.2.18 --- __init__.py 30 Dec 2005 18:56:14 -0000 1.61.2.19 *************** *** 412,416 **** if showname: print "ctypes.find: %s" % libname ! return dll def LoadLibraryVersion(self, name, version=''): --- 412,416 ---- if showname: print "ctypes.find: %s" % libname ! return dll def LoadLibraryVersion(self, name, version=''): |
From: Thomas H. <th...@us...> - 2005-12-30 18:27:28
|
Update of /cvsroot/ctypes/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10436 Modified Files: Tag: branch_1_0 __init__.py Log Message: Changes for windows CE, contributed by Luke Dunstan. Thanks a lot! Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/ctypes/__init__.py,v retrieving revision 1.61.2.17 retrieving revision 1.61.2.18 diff -C2 -d -r1.61.2.17 -r1.61.2.18 *** __init__.py 22 Dec 2005 20:45:15 -0000 1.61.2.17 --- __init__.py 30 Dec 2005 18:27:17 -0000 1.61.2.18 *************** *** 29,33 **** raise Exception, ("Version number mismatch", __version__, _ctypes_version) ! if _os.name == "nt": from _ctypes import FormatError --- 29,33 ---- raise Exception, ("Version number mismatch", __version__, _ctypes_version) ! if _os.name in ("nt", "ce"): from _ctypes import FormatError *************** *** 96,100 **** return CFunctionType ! if _os.name == "nt": from _ctypes import LoadLibrary as _LoadLibrary, \ FreeLibrary as _FreeLibrary --- 96,100 ---- return CFunctionType ! if _os.name in ("nt", "ce"): from _ctypes import LoadLibrary as _LoadLibrary, \ FreeLibrary as _FreeLibrary *************** *** 218,222 **** pass else: ! if _os.name == "nt": set_conversion_mode("mbcs", "ignore") else: --- 218,222 ---- pass else: ! if _os.name in ("nt", "ce"): set_conversion_mode("mbcs", "ignore") else: *************** *** 320,324 **** _restype_ = c_int # default, can be overridden in instances ! if _os.name == "nt": class WinDLL(CDLL): --- 320,324 ---- _restype_ = c_int # default, can be overridden in instances ! if _os.name == "nt": class WinDLL(CDLL): *************** *** 463,467 **** pydll = _DLLS(PyDLL) ! if _os.name == "nt": pythonapi = PyDLL("python dll", sys.dllhandle) elif sys.platform == "cygwin": --- 463,467 ---- pydll = _DLLS(PyDLL) ! if _os.name in ("nt", "ce"): pythonapi = PyDLL("python dll", sys.dllhandle) elif sys.platform == "cygwin": |
From: Thomas H. <th...@us...> - 2005-12-30 17:26:22
|
Update of /cvsroot/ctypes/ctypes/wince In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29169 Added Files: Tag: branch_1_0 _ctypes.vcw _ctypes.vcp .cvsignore Log Message: Changes for windows CE, contributed by Luke Dunstan. Thanks a lot! --- NEW FILE: .cvsignore --- ARMV4Rel _ctypes.vcb _ctypes.vcl _ctypes.vco --- NEW FILE: _ctypes.vcp --- # Microsoft eMbedded Visual Tools Project File - Name="_ctypes" - Package Owner=<4> # Microsoft eMbedded Visual Tools Generated Build File, Format Version 6.02 # ** DO NOT EDIT ** # TARGTYPE "Win32 (WCE ARMV4T) Dynamic-Link Library" 0xa402 # TARGTYPE "Win32 (WCE x86) Dynamic-Link Library" 0x8302 # TARGTYPE "Win32 (WCE ARMV4) Dynamic-Link Library" 0xa302 # TARGTYPE "Win32 (WCE ARMV4I) Dynamic-Link Library" 0xa502 CFG=_ctypes - Win32 (WCE ARMV4) Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "_ctypes.vcn". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "_ctypes.vcn" CFG="_ctypes - Win32 (WCE ARMV4) Debug" [...1733 lines suppressed...] "$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" armasm -g -arch 4 $(InputPath) $(IntDir)\$(InputName).obj # End Custom Build !ELSEIF "$(CFG)" == "_ctypes - Win32 (WCE ARMV4T) Release" !ELSEIF "$(CFG)" == "_ctypes - Win32 (WCE ARMV4T) Debug" !ELSEIF "$(CFG)" == "_ctypes - Win32 (WCE x86) Release" !ELSEIF "$(CFG)" == "_ctypes - Win32 (WCE x86) Debug" !ENDIF # End Source File # End Group # End Target # End Project --- NEW FILE: _ctypes.vcw --- Microsoft eMbedded Visual Tools Workspace File, Format Version 4.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### Project: "_ctypes"=".\_ctypes.vcp" - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Project: "_ctypes_test"=".\_ctypes_test\_ctypes_test.vcp" - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### |
From: Thomas H. <th...@us...> - 2005-12-30 17:23:38
|
Update of /cvsroot/ctypes/ctypes/wince In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28763/wince Log Message: Directory /cvsroot/ctypes/ctypes/wince added to the repository --> Using per-directory sticky tag `branch_1_0' |
Update of /cvsroot/ctypes/ctypes/source/libffi_arm_wince In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28673 Added Files: Tag: branch_1_0 sysv.asm prep_cif.c ffitarget.h fficonfig.h ffi_common.h ffi.h ffi.c debug.c Log Message: Changes for windows CE, contributed by Luke Dunstan. Thanks a lot! --- NEW FILE: ffi_common.h --- /* ----------------------------------------------------------------------- ffi_common.h - Copyright (c) 1996 Red Hat, Inc. Common internal definitions and macros. Only necessary for building libffi. ----------------------------------------------------------------------- */ #ifndef FFI_COMMON_H #define FFI_COMMON_H #ifdef __cplusplus extern "C" { #endif #include <fficonfig.h> /* Do not move this. Some versions of AIX are very picky about where this is positioned. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # if HAVE_ALLOCA_H # include <alloca.h> # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); # endif # endif # endif #endif /* Check for the existence of memcpy. */ #if STDC_HEADERS # include <string.h> #else # ifndef HAVE_MEMCPY # define memcpy(d, s, n) bcopy ((s), (d), (n)) # endif #endif #if defined(FFI_DEBUG) #include <stdio.h> #endif #ifdef FFI_DEBUG /*@exits@*/ void ffi_assert(/*@temp@*/ char *expr, /*@temp@*/ char *file, int line); void ffi_stop_here(void); void ffi_type_test(/*@temp@*/ /*@out@*/ ffi_type *a, /*@temp@*/ char *file, int line); #define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__)) #define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l))) #define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__) #else #define FFI_ASSERT(x) #define FFI_ASSERT_AT(x, f, l) #define FFI_ASSERT_VALID_TYPE(x) #endif #define ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1) /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif); /* Extended cif, used in callback from assembly routine */ typedef struct { /*@dependent@*/ ffi_cif *cif; /*@dependent@*/ void *rvalue; /*@dependent@*/ void **avalue; } extended_cif; /* Terse sized type definitions. */ #if defined(__GNUC__) typedef unsigned int UINT8 __attribute__((__mode__(__QI__))); typedef signed int SINT8 __attribute__((__mode__(__QI__))); typedef unsigned int UINT16 __attribute__((__mode__(__HI__))); typedef signed int SINT16 __attribute__((__mode__(__HI__))); typedef unsigned int UINT32 __attribute__((__mode__(__SI__))); typedef signed int SINT32 __attribute__((__mode__(__SI__))); typedef unsigned int UINT64 __attribute__((__mode__(__DI__))); typedef signed int SINT64 __attribute__((__mode__(__DI__))); #elif defined(_MSC_VER) typedef unsigned __int8 UINT8; typedef signed __int8 SINT8; typedef unsigned __int16 UINT16; typedef signed __int16 SINT16; typedef unsigned __int32 UINT32; typedef signed __int32 SINT32; typedef unsigned __int64 UINT64; typedef signed __int64 SINT64; #else #error "Need typedefs here" #endif typedef float FLOAT32; #ifdef __cplusplus } #endif #endif --- NEW FILE: sysv.asm --- ; ----------------------------------------------------------------------- ; sysv.S - Copyright (c) 1998 Red Hat, Inc. ; ; ARM Foreign Function Interface ; ; Permission is hereby granted, free of charge, to any person obtaining ; a copy of this software and associated documentation files (the ; ``Software''), to deal in the Software without restriction, including ; without limitation the rights to use, copy, modify, merge, publish, ; distribute, sublicense, and/or sell copies of the Software, and to ; permit persons to whom the Software is furnished to do so, subject to ; the following conditions: ; ; The above copyright notice and this permission notice shall be included ; in all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS ; OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ; IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR ; OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ; ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ; OTHER DEALINGS IN THE SOFTWARE. ; ----------------------------------------------------------------------- */ ;#define LIBFFI_ASM ;#include <fficonfig.h> ;#include <ffi.h> ;#ifdef HAVE_MACHINE_ASM_H ;#include <machine/asm.h> ;#else ;#ifdef __USER_LABEL_PREFIX__ ;#define CONCAT1(a, b) CONCAT2(a, b) ;#define CONCAT2(a, b) a ## b ;/* Use the right prefix for global labels. */ ;#define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x) ;#else ;#define CNAME(x) x ;#endif ;#define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): ;#endif FFI_TYPE_VOID EQU 0 FFI_TYPE_INT EQU 1 FFI_TYPE_FLOAT EQU 2 FFI_TYPE_DOUBLE EQU 3 ;FFI_TYPE_LONGDOUBLE EQU 4 FFI_TYPE_UINT8 EQU 5 FFI_TYPE_SINT8 EQU 6 FFI_TYPE_UINT16 EQU 7 FFI_TYPE_SINT16 EQU 8 FFI_TYPE_UINT32 EQU 9 FFI_TYPE_SINT32 EQU 10 FFI_TYPE_UINT64 EQU 11 FFI_TYPE_SINT64 EQU 12 FFI_TYPE_STRUCT EQU 13 FFI_TYPE_POINTER EQU 14 ; WinCE always uses software floating point (I think) __SOFTFP__ EQU {TRUE} AREA |.text|, CODE, ARM ; .text ; a1: ffi_prep_args ; a2: &ecif ; a3: cif->bytes ; a4: fig->flags ; sp+0: ecif.rvalue ; sp+4: fn ; This assumes we are using gas. ;ENTRY(ffi_call_SYSV) EXPORT |ffi_call_SYSV| |ffi_call_SYSV| PROC ; Save registers stmfd sp!, {a1-a4, fp, lr} mov fp, sp ; Make room for all of the new args. sub sp, fp, a3 ; Place all of the ffi_prep_args in position mov ip, a1 mov a1, sp ; a2 already set ; And call mov lr, pc mov pc, ip ; move first 4 parameters in registers ldr a1, [sp, #0] ldr a2, [sp, #4] ldr a3, [sp, #8] ldr a4, [sp, #12] ; and adjust stack ldr ip, [fp, #8] cmp ip, #16 movge ip, #16 add sp, sp, ip ; call function mov lr, pc ldr pc, [fp, #28] ; Remove the space we pushed for the args mov sp, fp ; Load a3 with the pointer to storage for the return value ldr a3, [sp, #24] ; Load a4 with the return type code ldr a4, [sp, #12] ; If the return value pointer is NULL, assume no return value. cmp a3, #0 beq call_epilogue ; return INT cmp a4, #FFI_TYPE_INT streq a1, [a3] beq call_epilogue ; return FLOAT cmp a4, #FFI_TYPE_FLOAT [ __SOFTFP__ ;ifdef __SOFTFP__ streq a1, [a3] | ;else stfeqs f0, [a3] ] ;endif beq call_epilogue ; return DOUBLE or LONGDOUBLE cmp a4, #FFI_TYPE_DOUBLE [ __SOFTFP__ ;ifdef __SOFTFP__ stmeqia a3, {a1, a2} | ;else stfeqd f0, [a3] ] ;endif beq call_epilogue ; return SINT64 or UINT64 cmp a4, #FFI_TYPE_SINT64 stmeqia a3, {a1, a2} call_epilogue ldmfd sp!, {a1-a4, fp, pc} ;.ffi_call_SYSV_end: ;.size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) ENDP RESERVE_RETURN EQU 16 ; This function is called by the trampoline ; It is NOT callable from C ; ip = pointer to struct ffi_closure IMPORT |ffi_closure_SYSV_inner| EXPORT |ffi_closure_SYSV| |ffi_closure_SYSV| PROC ; Store the argument registers on the stack stmfd sp!, {a1-a4} ; Push the return address onto the stack stmfd sp!, {lr} mov a1, ip ; first arg = address of ffi_closure add a2, sp, #4 ; second arg = sp+4 (points to saved a1) ; Allocate space for a non-struct return value sub sp, sp, #RESERVE_RETURN mov a3, sp ; third arg = return value address ; static unsigned int ; ffi_closure_SYSV_inner (ffi_closure *closure, char *in_args, void *rvalue) bl ffi_closure_SYSV_inner ; a1 now contains the return type code ; At this point the return value is on the stack ; Transfer it to the correct registers if necessary ; return INT cmp a1, #FFI_TYPE_INT ldreq a1, [sp] beq closure_epilogue ; return FLOAT cmp a1, #FFI_TYPE_FLOAT [ __SOFTFP__ ;ifdef __SOFTFP__ ldreq a1, [sp] | ;else stfeqs f0, [sp] ] ;endif beq closure_epilogue ; return DOUBLE or LONGDOUBLE cmp a1, #FFI_TYPE_DOUBLE [ __SOFTFP__ ;ifdef __SOFTFP__ ldmeqia sp, {a1, a2} | ;else stfeqd f0, [sp] ] ;endif beq closure_epilogue ; return SINT64 or UINT64 cmp a1, #FFI_TYPE_SINT64 ldmeqia sp, {a1, a2} closure_epilogue add sp, sp, #RESERVE_RETURN ; remove return value buffer ldmfd sp!, {ip} ; ip = pop return address add sp, sp, #16 ; remove saved argument registers {a1-a4} from the stack mov pc, ip ; return ENDP ; ffi_closure_SYSV END --- NEW FILE: ffitarget.h --- /* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for ARM. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, FFI_DEFAULT_ABI = FFI_SYSV, FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_TRAMPOLINE_SIZE 12 #define FFI_NATIVE_RAW_API 0 #endif --- NEW FILE: prep_cif.c --- /* ----------------------------------------------------------------------- prep_cif.c - Copyright (c) 1996, 1998 Red Hat, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include <ffi.h> #include <ffi_common.h> #include <stdlib.h> /* Round up to FFI_SIZEOF_ARG. */ #define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG) /* Perform machine independent initialization of aggregate type specifications. */ static ffi_status initialize_aggregate(/*@out@*/ ffi_type *arg) { ffi_type **ptr; FFI_ASSERT(arg != NULL); /*@-usedef@*/ FFI_ASSERT(arg->elements != NULL); FFI_ASSERT(arg->size == 0); FFI_ASSERT(arg->alignment == 0); ptr = &(arg->elements[0]); while ((*ptr) != NULL) { if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) return FFI_BAD_TYPEDEF; /* Perform a sanity check on the argument type */ FFI_ASSERT_VALID_TYPE(*ptr); arg->size = ALIGN(arg->size, (*ptr)->alignment); arg->size += (*ptr)->size; arg->alignment = (arg->alignment > (*ptr)->alignment) ? arg->alignment : (*ptr)->alignment; ptr++; } /* Structure size includes tail padding. This is important for structures that fit in one register on ABIs like the PowerPC64 Linux ABI that right justify small structs in a register. It's also needed for nested structure layout, for example struct A { long a; char b; }; struct B { struct A x; char y; }; should find y at an offset of 2*sizeof(long) and result in a total size of 3*sizeof(long). */ arg->size = ALIGN (arg->size, arg->alignment); if (arg->size == 0) return FFI_BAD_TYPEDEF; else return FFI_OK; /*@=usedef@*/ } /* Perform machine independent ffi_cif preparation, then call machine dependent routine. */ ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif, ffi_abi abi, unsigned int nargs, /*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type *rtype, /*@dependent@*/ ffi_type **atypes) { unsigned bytes = 0; unsigned int i; ffi_type **ptr; FFI_ASSERT(cif != NULL); FFI_ASSERT((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI)); cif->abi = abi; cif->arg_types = atypes; cif->nargs = nargs; cif->rtype = rtype; cif->flags = 0; /* Initialize the return type if necessary */ /*@-usedef@*/ if ((cif->rtype->size == 0) && (initialize_aggregate(cif->rtype) != FFI_OK)) return FFI_BAD_TYPEDEF; /*@=usedef@*/ /* Perform a sanity check on the return type */ FFI_ASSERT_VALID_TYPE(cif->rtype); /* x86-64 and s390 stack space allocation is handled in prep_machdep. */ #if !defined M68K && !defined __x86_64__ && !defined S390 /* Make space for the return structure pointer */ if (cif->rtype->type == FFI_TYPE_STRUCT /* MSVC returns small structures in registers. But we have a different workaround: pretend int32 or int64 return type, and converting to structure afterwards. */ #ifdef SPARC && (cif->abi != FFI_V9 || cif->rtype->size > 32) #endif ) bytes = STACK_ARG_SIZE(sizeof(void*)); #endif for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { /* Initialize any uninitialized aggregate type definitions */ if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) return FFI_BAD_TYPEDEF; /* Perform a sanity check on the argument type, do this check after the initialization. */ FFI_ASSERT_VALID_TYPE(*ptr); #if !defined __x86_64__ && !defined S390 #ifdef SPARC if (((*ptr)->type == FFI_TYPE_STRUCT && ((*ptr)->size > 16 || cif->abi != FFI_V9)) || ((*ptr)->type == FFI_TYPE_LONGDOUBLE && cif->abi != FFI_V9)) bytes += sizeof(void*); else #endif { #ifndef _MSC_VER /* Don't know if this is a libffi bug or not. At least on Windows with MSVC, function call parameters are *not* aligned in the same way as structure fields are, they are only aligned in integer boundaries. This doesn't do any harm for cdecl functions and closures, since the caller cleans up the stack, but it is wrong for stdcall functions where the callee cleans. */ /* Add any padding if necessary */ if (((*ptr)->alignment - 1) & bytes) bytes = ALIGN(bytes, (*ptr)->alignment); #endif bytes += STACK_ARG_SIZE((*ptr)->size); } #endif } cif->bytes = bytes; /* Perform machine dependent cif processing */ return ffi_prep_cif_machdep(cif); } --- NEW FILE: fficonfig.h --- /* fficonfig.h created manually for Windows CE on ARM */ /* fficonfig.h.in. Generated from configure.ac by autoheader. */ /* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ #define BYTEORDER 1234 /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ /* #undef CRAY_STACKSEG_END */ /* Define to 1 if using `alloca.c'. */ /* #undef C_ALLOCA */ /* Define to the flags needed for the .section .eh_frame directive. */ /* #undef EH_FRAME_FLAGS */ /* Define this if you want extra debugging. */ #ifdef DEBUG /* Defined by the project settings for Debug builds */ #define FFI_DEBUG #else #undef FFI_DEBUG #endif /* Define this is you do not want support for the raw API. */ /* #undef FFI_NO_RAW_API */ /* Define this is you do not want support for aggregate types. */ /* #undef FFI_NO_STRUCTS */ /* Define to 1 if you have `alloca', as a function or macro. */ #define HAVE_ALLOCA 1 /* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). */ /* #undef HAVE_ALLOCA_H */ /* Define if your assembler supports .register. */ /* #undef HAVE_AS_REGISTER_PSEUDO_OP */ /* Define if your assembler and linker support unaligned PC relative relocs. */ /* #undef HAVE_AS_SPARC_UA_PCREL */ /* Define to 1 if you have the <inttypes.h> header file. */ /* #undef HAVE_INTTYPES_H */ /* Define if you have the long double type and it is bigger than a double */ /* This differs from the MSVC build, but even there it should not be defined */ /* #undef HAVE_LONG_DOUBLE */ /* Define to 1 if you have the `memcpy' function. */ #define HAVE_MEMCPY 1 /* Define to 1 if you have the <memory.h> header file. */ /* WinCE has this but I don't think we need to use it */ /* #undef HAVE_MEMORY_H */ /* Define to 1 if you have the `mmap' function. */ /* #undef HAVE_MMAP */ /* Define if mmap with MAP_ANON(YMOUS) works. */ /* #undef HAVE_MMAP_ANON */ /* Define if mmap of /dev/zero works. */ /* #undef HAVE_MMAP_DEV_ZERO */ /* Define if read-only mmap of a plain file works. */ /* #undef HAVE_MMAP_FILE */ /* Define if .eh_frame sections should be read-only. */ /* #undef HAVE_RO_EH_FRAME */ /* Define to 1 if you have the <stdint.h> header file. */ /* #undef HAVE_STDINT_H */ /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the <strings.h> header file. */ /* #undef HAVE_STRINGS_H */ /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the <sys/mman.h> header file. */ /* #undef HAVE_SYS_MMAN_H */ /* Define to 1 if you have the <sys/stat.h> header file. */ /* #undef HAVE_SYS_STAT_H */ /* Define to 1 if you have the <sys/types.h> header file. */ /* #undef HAVE_SYS_TYPES_H */ /* Define to 1 if you have the <unistd.h> header file. */ /* #undef HAVE_UNISTD_H */ /* Define if the host machine stores words of multi-word integers in big-endian order. */ /* #undef HOST_WORDS_BIG_ENDIAN */ /* Define to 1 if your C compiler doesn't accept -c and -o together. */ /* #undef NO_MINUS_C_MINUS_O */ /* Name of package */ /* #undef PACKAGE */ /* Define to the address where bug reports for this package should be sent. */ /* #undef PACKAGE_BUGREPORT */ /* Define to the full name of this package. */ /* #undef PACKAGE_NAME */ /* Define to the full name and version of this package. */ /* #undef PACKAGE_STRING */ /* Define to the one symbol short name of this package. */ /* #undef PACKAGE_TARNAME */ /* Define to the version of this package. */ /* #undef PACKAGE_VERSION */ /* The number of bytes in type double */ #define SIZEOF_DOUBLE 8 /* The number of bytes in type long double */ #define SIZEOF_LONG_DOUBLE 8 /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ /* #undef STACK_DIRECTION */ /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define this if you are using Purify and want to suppress spurious messages. */ /* #undef USING_PURIFY */ /* Version number of package */ /* #undef VERSION */ /* whether byteorder is bigendian */ /* #undef WORDS_BIGENDIAN */ #define alloca _alloca #define abort() exit(999) --- NEW FILE: debug.c --- /* ----------------------------------------------------------------------- debug.c - Copyright (c) 1996 Red Hat, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include <ffi.h> #include <ffi_common.h> #include <stdlib.h> #include <stdio.h> /* General debugging routines */ void ffi_stop_here(void) { /* This function is only useful for debugging purposes. Place a breakpoint on ffi_stop_here to be notified of significant events. */ } /* This function should only be called via the FFI_ASSERT() macro */ void ffi_assert(char *expr, char *file, int line) { fprintf(stderr, "ASSERTION FAILURE: %s at %s:%d\n", expr, file, line); ffi_stop_here(); abort(); } /* Perform a sanity check on an ffi_type structure */ void ffi_type_test(ffi_type *a, char *file, int line) { FFI_ASSERT_AT(a != NULL, file, line); /*@-usedef@*/ FFI_ASSERT_AT(a->type <= FFI_TYPE_LAST, file, line); FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->size > 0, file, line); FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->alignment > 0, file, line); FFI_ASSERT_AT(a->type != FFI_TYPE_STRUCT || a->elements != NULL, file, line); /*@=usedef@*/ } --- NEW FILE: ffi.c --- /* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1998 Red Hat, Inc. ARM Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include <ffi.h> #include <ffi_common.h> #include <stdlib.h> #ifdef _WIN32_WCE #pragma warning (disable : 4142) /* benign redefinition of type */ #include <windows.h> #endif /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments */ /*@-exportheader@*/ void ffi_prep_args(char *stack, extended_cif *ecif) /*@=exportheader@*/ { register unsigned int i; register void **p_argv; register char *argp; register ffi_type **p_arg; argp = stack; if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT ) { *(void **) argp = ecif->rvalue; argp += 4; } p_argv = ecif->avalue; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++) { size_t z; size_t argalign = (*p_arg)->alignment; #ifdef _WIN32_WCE if (argalign > 4) argalign = 4; #endif /* Align if necessary */ if ((argalign - 1) & (unsigned) argp) { argp = (char *) ALIGN(argp, argalign); } z = (*p_arg)->size; if (z < sizeof(int)) { z = sizeof(int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; case FFI_TYPE_STRUCT: /* *p_argv may not be aligned for a UINT32 */ memcpy(argp, *p_argv, z); break; default: FFI_ASSERT(0); } } else if (z == sizeof(int)) { *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); } else { memcpy(argp, *p_argv, z); } p_argv++; argp += z; } return; } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { /* Set the return type flag */ switch (cif->rtype->type) { case FFI_TYPE_VOID: case FFI_TYPE_STRUCT: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: case FFI_TYPE_SINT64: cif->flags = (unsigned) cif->rtype->type; break; case FFI_TYPE_UINT64: cif->flags = FFI_TYPE_SINT64; break; default: cif->flags = FFI_TYPE_INT; break; } return FFI_OK; } /*@-declundef@*/ /*@-exportheader@*/ extern void ffi_call_SYSV(void (*)(char *, extended_cif *), /*@out@*/ extended_cif *, unsigned, unsigned, /*@out@*/ unsigned *, void (*fn)()); /*@=declundef@*/ /*@=exportheader@*/ /* Return type changed from void for ctypes */ int ffi_call(/*@dependent@*/ ffi_cif *cif, void (*fn)(), /*@out@*/ void *rvalue, /*@dependent@*/ void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { /*@-sysunrecog@*/ ecif.rvalue = alloca(cif->rtype->size); /*@=sysunrecog@*/ } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_SYSV: /*@-usedef@*/ ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); /*@=usedef@*/ break; default: FFI_ASSERT(0); break; } /* I think calculating the real stack pointer delta is not useful because stdcall is not supported */ return 0; } /** private members **/ static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, void** args, ffi_cif* cif); /* This function is called by ffi_closure_SYSV in sysv.asm */ unsigned int ffi_closure_SYSV_inner (ffi_closure *closure, char *in_args, void *rvalue) { ffi_cif *cif = closure->cif; void **out_args; out_args = (void **) alloca(cif->nargs * sizeof (void *)); /* this call will initialize out_args, such that each * element in that array points to the corresponding * value on the stack; and if the function returns * a structure, it will re-set rvalue to point to the * structure return address. */ ffi_prep_incoming_args_SYSV(in_args, &rvalue, out_args, cif); (closure->fun)(cif, rvalue, out_args, closure->user_data); /* Tell ffi_closure_SYSV what the returntype is */ return cif->flags; } /*@-exportheader@*/ static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue, ffi_cif *cif) /*@=exportheader@*/ { unsigned int i; void **p_argv; char *argp; ffi_type **p_arg; argp = stack; if ( cif->rtype->type == FFI_TYPE_STRUCT ) { *rvalue = *(void **) argp; argp += 4; } p_argv = avalue; for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) { size_t z; size_t argalign = (*p_arg)->alignment; #ifdef _WIN32_WCE if (argalign > 4) argalign = 4; #endif /* Align if necessary */ if ((argalign - 1) & (unsigned) argp) { argp = (char *) ALIGN(argp, argalign); } z = (*p_arg)->size; if (z < sizeof(int)) z = sizeof(int); *p_argv = (void*) argp; p_argv++; argp += z; } } /* add ip, pc, #-8 ; ip = address of this trampoline == address of ffi_closure ldr pc, [pc, #-4] ; jump to __fun DCD __fun */ #define FFI_INIT_TRAMPOLINE(TRAMP,FUN) \ { \ unsigned int *__tramp = (unsigned int *)(TRAMP); \ __tramp[0] = 0xe24fc008; /* add ip, pc, #-8 */ \ __tramp[1] = 0xe51ff004; /* ldr pc, [pc, #-4] */ \ __tramp[2] = (unsigned int)(FUN); \ } /* the cif must already be prep'ed */ /* defined in sysv.asm */ void ffi_closure_SYSV(void); ffi_status ffi_prep_closure (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data) { FFI_ASSERT (cif->abi == FFI_SYSV); FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_SYSV); closure->cif = cif; closure->user_data = user_data; closure->fun = fun; #ifdef _WIN32_WCE /* This is important to allow calling the trampoline safely */ FlushInstructionCache(GetCurrentProcess(), 0, 0); #endif return FFI_OK; } --- NEW FILE: ffi.h --- /* -----------------------------------------------------------------*-C-*- libffi 2.00-beta-wince - Copyright (c) 1996-2003 Red Hat, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ /* ------------------------------------------------------------------- The basic API is described in the README file. The raw API is designed to bypass some of the argument packing and unpacking on architectures for which it can be avoided. The closure API allows interpreted functions to be packaged up inside a C function pointer, so that they can be called as C functions, with no understanding on the client side that they are interpreted. It can also be used in other cases in which it is necessary to package up a user specified parameter and a function pointer as a single function pointer. The closure API must be implemented in order to get its functionality, e.g. for use by gij. Routines are provided to emulate the raw API if the underlying platform doesn't allow faster implementation. More details on the raw and cloure API can be found in: http://gcc.gnu.org/ml/java/1999-q3/msg00138.html and http://gcc.gnu.org/ml/java/1999-q3/msg00174.html -------------------------------------------------------------------- */ #ifndef LIBFFI_H #define LIBFFI_H #ifdef __cplusplus extern "C" { #endif /* Specify which architecture libffi is configured for. */ /*#define @TARGET@*/ /* ---- System configuration information --------------------------------- */ #include <ffitarget.h> #ifndef LIBFFI_ASM #include <stddef.h> #include <limits.h> /* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). But we can find it either under the correct ANSI name, or under GNU C's internal name. */ #ifdef LONG_LONG_MAX # define FFI_LONG_LONG_MAX LONG_LONG_MAX #else # ifdef LLONG_MAX # define FFI_LONG_LONG_MAX LLONG_MAX # else # ifdef __GNUC__ # define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ # endif # ifdef _MSC_VER # define FFI_LONG_LONG_MAX _I64_MAX # endif # endif #endif #if SCHAR_MAX == 127 # define ffi_type_uchar ffi_type_uint8 # define ffi_type_schar ffi_type_sint8 #else #error "char size not supported" #endif #if SHRT_MAX == 32767 # define ffi_type_ushort ffi_type_uint16 # define ffi_type_sshort ffi_type_sint16 #elif SHRT_MAX == 2147483647 # define ffi_type_ushort ffi_type_uint32 # define ffi_type_sshort ffi_type_sint32 #else #error "short size not supported" #endif #if INT_MAX == 32767 # define ffi_type_uint ffi_type_uint16 # define ffi_type_sint ffi_type_sint16 #elif INT_MAX == 2147483647 # define ffi_type_uint ffi_type_uint32 # define ffi_type_sint ffi_type_sint32 #elif INT_MAX == 9223372036854775807 # define ffi_type_uint ffi_type_uint64 # define ffi_type_sint ffi_type_sint64 #else #error "int size not supported" #endif #define ffi_type_ulong ffi_type_uint64 #define ffi_type_slong ffi_type_sint64 #if LONG_MAX == 2147483647 # if FFI_LONG_LONG_MAX != 9223372036854775807 #error "no 64-bit data type supported" # endif #elif LONG_MAX != 9223372036854775807 #error "long size not supported" #endif /* The closure code assumes that this works on pointers, i.e. a size_t */ /* can hold a pointer. */ typedef struct _ffi_type { size_t size; unsigned short alignment; unsigned short type; /*@null@*/ struct _ffi_type **elements; } ffi_type; /* These are defined in types.c */ extern ffi_type ffi_type_void; extern ffi_type ffi_type_uint8; extern ffi_type ffi_type_sint8; extern ffi_type ffi_type_uint16; extern ffi_type ffi_type_sint16; extern ffi_type ffi_type_uint32; extern ffi_type ffi_type_sint32; extern ffi_type ffi_type_uint64; extern ffi_type ffi_type_sint64; extern ffi_type ffi_type_float; extern ffi_type ffi_type_double; extern ffi_type ffi_type_longdouble; extern ffi_type ffi_type_pointer; typedef enum { FFI_OK = 0, FFI_BAD_TYPEDEF, FFI_BAD_ABI } ffi_status; typedef unsigned FFI_TYPE; typedef struct { ffi_abi abi; unsigned nargs; /*@dependent@*/ ffi_type **arg_types; /*@dependent@*/ ffi_type *rtype; unsigned bytes; unsigned flags; #ifdef FFI_EXTRA_CIF_FIELDS FFI_EXTRA_CIF_FIELDS; #endif } ffi_cif; /* ---- Definitions for the raw API -------------------------------------- */ #ifndef FFI_SIZEOF_ARG # if LONG_MAX == 2147483647 # define FFI_SIZEOF_ARG 4 # elif LONG_MAX == 9223372036854775807 # define FFI_SIZEOF_ARG 8 # endif #endif typedef union { ffi_sarg sint; ffi_arg uint; float flt; char data[FFI_SIZEOF_ARG]; void* ptr; } ffi_raw; void ffi_raw_call (/*@dependent@*/ ffi_cif *cif, void (*fn)(), /*@out@*/ void *rvalue, /*@dependent@*/ ffi_raw *avalue); void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); size_t ffi_raw_size (ffi_cif *cif); /* This is analogous to the raw API, except it uses Java parameter */ /* packing, even on 64-bit machines. I.e. on 64-bit machines */ /* longs and doubles are followed by an empty 64-bit word. */ void ffi_java_raw_call (/*@dependent@*/ ffi_cif *cif, void (*fn)(), /*@out@*/ void *rvalue, /*@dependent@*/ ffi_raw *avalue); void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); size_t ffi_java_raw_size (ffi_cif *cif); /* ---- Definitions for closures ----------------------------------------- */ #if FFI_CLOSURES typedef struct { char tramp[FFI_TRAMPOLINE_SIZE]; ffi_cif *cif; void (*fun)(ffi_cif*,void*,void**,void*); void *user_data; } ffi_closure; ffi_status ffi_prep_closure (ffi_closure*, ffi_cif *, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data); typedef struct { char tramp[FFI_TRAMPOLINE_SIZE]; ffi_cif *cif; #if !FFI_NATIVE_RAW_API /* if this is enabled, then a raw closure has the same layout as a regular closure. We use this to install an intermediate handler to do the transaltion, void** -> ffi_raw*. */ void (*translate_args)(ffi_cif*,void*,void**,void*); void *this_closure; #endif void (*fun)(ffi_cif*,void*,ffi_raw*,void*); void *user_data; } ffi_raw_closure; ffi_status ffi_prep_raw_closure (ffi_raw_closure*, ffi_cif *cif, void (*fun)(ffi_cif*,void*,ffi_raw*,void*), void *user_data); ffi_status ffi_prep_java_raw_closure (ffi_raw_closure*, ffi_cif *cif, void (*fun)(ffi_cif*,void*,ffi_raw*,void*), void *user_data); #endif /* FFI_CLOSURES */ /* ---- Public interface definition -------------------------------------- */ ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif, ffi_abi abi, unsigned int nargs, /*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type *rtype, /*@dependent@*/ ffi_type **atypes); /* Return type changed from void for ctypes */ int ffi_call(/*@dependent@*/ ffi_cif *cif, void (*fn)(), /*@out@*/ void *rvalue, /*@dependent@*/ void **avalue); /* Useful for eliminating compiler warnings */ #define FFI_FN(f) ((void (*)())f) /* ---- Definitions shared with assembly code ---------------------------- */ #endif /* If these change, update src/mips/ffitarget.h. */ #define FFI_TYPE_VOID 0 #define FFI_TYPE_INT 1 #define FFI_TYPE_FLOAT 2 #define FFI_TYPE_DOUBLE 3 #if 0 /*@HAVE_LONG_DOUBLE@*/ #define FFI_TYPE_LONGDOUBLE 4 #else #define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE #endif #define FFI_TYPE_UINT8 5 #define FFI_TYPE_SINT8 6 #define FFI_TYPE_UINT16 7 #define FFI_TYPE_SINT16 8 #define FFI_TYPE_UINT32 9 #define FFI_TYPE_SINT32 10 #define FFI_TYPE_UINT64 11 #define FFI_TYPE_SINT64 12 #define FFI_TYPE_STRUCT 13 #define FFI_TYPE_POINTER 14 /* This should always refer to the last type code (for sanity checks) */ #define FFI_TYPE_LAST FFI_TYPE_POINTER #ifdef __cplusplus } #endif #endif |
From: Thomas H. <th...@us...> - 2005-12-30 17:22:57
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28646 Modified Files: Tag: branch_1_0 cfield.c callproc.c callbacks.c _ctypes.c Log Message: Changes for windows CE, contributed by Luke Dunstan. Thanks a lot! Index: callbacks.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/callbacks.c,v retrieving revision 1.71.2.6 retrieving revision 1.71.2.7 diff -C2 -d -r1.71.2.6 -r1.71.2.7 *** callbacks.c 3 Nov 2005 07:33:51 -0000 1.71.2.6 --- callbacks.c 30 Dec 2005 17:22:49 -0000 1.71.2.7 *************** *** 326,330 **** cc = FFI_DEFAULT_ABI; ! #ifdef MS_WIN32 if (is_cdecl == 0) cc = FFI_STDCALL; --- 326,330 ---- cc = FFI_DEFAULT_ABI; ! #if defined(MS_WIN32) && !defined(_WIN32_WCE) if (is_cdecl == 0) cc = FFI_STDCALL; Index: callproc.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/callproc.c,v retrieving revision 1.127.2.15 retrieving revision 1.127.2.16 diff -C2 -d -r1.127.2.15 -r1.127.2.16 *** callproc.c 28 Oct 2005 17:56:37 -0000 1.127.2.15 --- callproc.c 30 Dec 2005 17:22:49 -0000 1.127.2.16 *************** *** 78,82 **** PyObject *ComError; ! static char *FormatError(DWORD code) { char *lpMsgBuf; --- 78,82 ---- PyObject *ComError; ! static TCHAR *FormatError(DWORD code) { char *lpMsgBuf; *************** *** 86,90 **** code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language ! (LPSTR) &lpMsgBuf, 0, NULL); --- 86,90 ---- code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language ! (LPTSTR) &lpMsgBuf, 0, NULL); *************** *** 94,106 **** lpMsgBuf[n] = '\0'; /* rstrip() */ } ! return (char *)lpMsgBuf; } void SetException(DWORD code, EXCEPTION_RECORD *pr) { ! char *lpMsgBuf; lpMsgBuf = FormatError(code); if(lpMsgBuf) { ! PyErr_SetString(PyExc_WindowsError, lpMsgBuf); LocalFree(lpMsgBuf); } else { --- 94,106 ---- lpMsgBuf[n] = '\0'; /* rstrip() */ } ! return (TCHAR *)lpMsgBuf; } void SetException(DWORD code, EXCEPTION_RECORD *pr) { ! TCHAR *lpMsgBuf; lpMsgBuf = FormatError(code); if(lpMsgBuf) { ! PyErr_SetFromWindowsErr(code); LocalFree(lpMsgBuf); } else { *************** *** 573,577 **** if (dict == NULL) return &ffi_type_sint; ! #ifdef MS_WIN32 /* This little trick works correctly with MSVC. It returns small structures in registers --- 573,577 ---- if (dict == NULL) return &ffi_type_sint; ! #if defined(MS_WIN32) && !defined(_WIN32_WCE) /* This little trick works correctly with MSVC. It returns small structures in registers *************** *** 613,617 **** #ifdef MS_WIN32 int delta; ! DWORD dwExceptionCode; EXCEPTION_RECORD record; #endif --- 613,617 ---- #ifdef MS_WIN32 int delta; ! DWORD dwExceptionCode = 0; EXCEPTION_RECORD record; #endif *************** *** 624,631 **** cc = FFI_DEFAULT_ABI; ! #ifdef MS_WIN32 if ((flags & FUNCFLAG_CDECL) == 0) cc = FFI_STDCALL; - dwExceptionCode = 0; #endif if (FFI_OK != ffi_prep_cif(&cif, --- 624,630 ---- cc = FFI_DEFAULT_ABI; ! #if defined(MS_WIN32) && !defined(_WIN32_WCE) if ((flags & FUNCFLAG_CDECL) == 0) cc = FFI_STDCALL; #endif if (FFI_OK != ffi_prep_cif(&cif, *************** *** 781,785 **** GUID guid; DWORD helpcontext=0; ! char *text; LPOLESTR progid; PyObject *obj; --- 780,784 ---- GUID guid; DWORD helpcontext=0; ! TCHAR *text; LPOLESTR progid; PyObject *obj; *************** *** 808,813 **** progid = NULL; ProgIDFromCLSID(&guid, &progid); ! /* XXX Free progid with CoTaskMemFree */ /* XXX Is COMError derived from WindowsError or not? */ --- 807,813 ---- progid = NULL; + #ifndef _WIN32_WCE ProgIDFromCLSID(&guid, &progid); ! #endif /* XXX Is COMError derived from WindowsError or not? */ *************** *** 967,970 **** --- 967,980 ---- #ifdef MS_WIN32 + + #ifdef _UNICODE + # define PYBUILD_TSTR "u" + #else + # define PYBUILD_TSTR "s" + # ifndef _T + # define _T(text) text + # endif + #endif + static char format_error_doc[] = "FormatError([integer]) -> string\n\ *************** *** 975,979 **** { PyObject *result; ! char *lpMsgBuf; DWORD code = 0; if (!PyArg_ParseTuple(args, "|i:FormatError", &code)) --- 985,989 ---- { PyObject *result; ! TCHAR *lpMsgBuf; DWORD code = 0; if (!PyArg_ParseTuple(args, "|i:FormatError", &code)) *************** *** 983,987 **** lpMsgBuf = FormatError(code); if (lpMsgBuf) { ! result = Py_BuildValue("s", lpMsgBuf); LocalFree(lpMsgBuf); } else { --- 993,997 ---- lpMsgBuf = FormatError(code); if (lpMsgBuf) { ! result = Py_BuildValue(PYBUILD_TSTR, lpMsgBuf); LocalFree(lpMsgBuf); } else { *************** *** 999,1007 **** static PyObject *load_library(PyObject *self, PyObject *args) { ! char *name; PyObject *ignored; HMODULE hMod; ! if (!PyArg_ParseTuple(args, "s|O:LoadLibrary", &name, &ignored)) return NULL; hMod = LoadLibrary(name); if (!hMod) --- 1009,1034 ---- static PyObject *load_library(PyObject *self, PyObject *args) { ! TCHAR *name; ! PyObject *nameobj; PyObject *ignored; HMODULE hMod; ! if (!PyArg_ParseTuple(args, "O|O:LoadLibrary", &nameobj, &ignored)) return NULL; + #ifdef _UNICODE + name = alloca((PyString_Size(nameobj) + 1) * sizeof(WCHAR)); + { + int r; + char *aname = PyString_AsString(nameobj); + if(!aname) + return NULL; + r = MultiByteToWideChar(CP_ACP, 0, aname, -1, name, PyString_Size(nameobj) + 1); + name[r] = 0; + } + #else + name = PyString_AsString(nameobj); + if(!name) + return NULL; + #endif + hMod = LoadLibrary(name); if (!hMod) *************** *** 1360,1364 **** static char set_conversion_mode_doc[] = ! "FormatError(encoding, errors) -> (previous-encoding, previous-errors)\n\ \n\ Set the encoding and error handling ctypes uses when converting\n\ --- 1387,1391 ---- static char set_conversion_mode_doc[] = ! "set_conversion_mode(encoding, errors) -> (previous-encoding, previous-errors)\n\ \n\ Set the encoding and error handling ctypes uses when converting\n\ *************** *** 1445,1449 **** // a.ffi_type->size memcpy(result->b_ptr, &a.value, ! min(result->b_size, a.ffi_type->size)); Py_XDECREF(a.keep); return (PyObject *)result; --- 1472,1476 ---- // a.ffi_type->size memcpy(result->b_ptr, &a.value, ! min(result->b_size, (int)a.ffi_type->size)); Py_XDECREF(a.keep); return (PyObject *)result; Index: cfield.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/cfield.c,v retrieving revision 1.74.2.15 retrieving revision 1.74.2.16 diff -C2 -d -r1.74.2.15 -r1.74.2.16 *** cfield.c 14 Dec 2005 22:05:41 -0000 1.74.2.15 --- cfield.c 30 Dec 2005 17:22:47 -0000 1.74.2.16 *************** *** 431,434 **** --- 431,445 ---- ( ((v >> 24) & 0xFF)) ) + #ifdef _MSC_VER + #define SWAP_8(v) \ + ( ( (v & 0x00000000000000FFL) << 56 ) | \ + ( (v & 0x000000000000FF00L) << 40 ) | \ + ( (v & 0x0000000000FF0000L) << 24 ) | \ + ( (v & 0x00000000FF000000L) << 8 ) | \ + ( (v & 0x000000FF00000000L) >> 8 ) | \ + ( (v & 0x0000FF0000000000L) >> 24 ) | \ + ( (v & 0x00FF000000000000L) >> 40 ) | \ + ( ((v >> 56) & 0xFF)) ) + #else #define SWAP_8(v) \ ( ( (v & 0x00000000000000FFLL) << 56 ) | \ *************** *** 440,443 **** --- 451,455 ---- ( (v & 0x00FF000000000000LL) >> 40 ) | \ ( ((v >> 56) & 0xFF)) ) + #endif #define SWAP_INT SWAP_4 *************** *** 1213,1217 **** /* XXX What about invalid pointers ??? */ if (*(void **)ptr) { ! #ifdef MS_WIN32 if (IsBadStringPtrA(*(char **)ptr, -1)) { PyErr_Format(PyExc_ValueError, --- 1225,1229 ---- /* XXX What about invalid pointers ??? */ if (*(void **)ptr) { ! #if defined(MS_WIN32) && !defined(_WIN32_WCE) if (IsBadStringPtrA(*(char **)ptr, -1)) { PyErr_Format(PyExc_ValueError, Index: _ctypes.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/_ctypes.c,v retrieving revision 1.226.2.38 retrieving revision 1.226.2.39 diff -C2 -d -r1.226.2.38 -r1.226.2.39 *** _ctypes.c 30 Nov 2005 09:36:07 -0000 1.226.2.38 --- _ctypes.c 30 Dec 2005 17:22:49 -0000 1.226.2.39 *************** *** 244,248 **** #ifdef MS_WIN32 ! address = (void *)GetProcAddress(handle, name); if (!address) { PyErr_Format(PyExc_ValueError, --- 244,248 ---- #ifdef MS_WIN32 ! address = (void *)GetProcAddressA(handle, name); if (!address) { PyErr_Format(PyExc_ValueError, *************** *** 2341,2345 **** StgDictObject *dict = PyType_stgdict((PyObject *)type); ! address = (PPROC)GetProcAddress(handle, name); if (address) return address; --- 2341,2345 ---- StgDictObject *dict = PyType_stgdict((PyObject *)type); ! address = (PPROC)GetProcAddressA(handle, name); if (address) return address; *************** *** 2355,2359 **** for (i = 0; i < 32; ++i) { sprintf(mangled_name, "_%s@%d", name, i*4); ! address = (PPROC)GetProcAddress(handle, mangled_name); if (address) return address; --- 2355,2359 ---- for (i = 0; i < 32; ++i) { sprintf(mangled_name, "_%s@%d", name, i*4); ! address = (PPROC)GetProcAddressA(handle, mangled_name); if (address) return address; |
From: Thomas H. <th...@us...> - 2005-12-30 17:21:04
|
Update of /cvsroot/ctypes/ctypes/source/libffi_arm_wince In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28379/libffi_arm_wince Log Message: Directory /cvsroot/ctypes/ctypes/source/libffi_arm_wince added to the repository --> Using per-directory sticky tag `branch_1_0' |
From: Thomas H. <th...@us...> - 2005-12-22 20:45:28
|
Update of /cvsroot/ctypes/ctypes/ctypes/macholib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17127 Modified Files: Tag: branch_1_0 dyld.py Log Message: Some smaller fixes. Index: dyld.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/ctypes/macholib/dyld.py,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** dyld.py 15 Apr 2005 17:23:12 -0000 1.1.2.1 --- dyld.py 22 Dec 2005 20:45:20 -0000 1.1.2.2 *************** *** 6,10 **** from framework import framework_info from dylib import dylib_info ! from itertools import * __all__ = [ --- 6,10 ---- from framework import framework_info from dylib import dylib_info ! from itertools import chain __all__ = [ *************** *** 159,163 **** def test_dyld_find(): - env = {} print dyld_find('libSystem') print dyld_find('System.framework/System') --- 159,162 ---- |
From: Thomas H. <th...@us...> - 2005-12-22 20:45:24
|
Update of /cvsroot/ctypes/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17103 Modified Files: Tag: branch_1_0 __init__.py Log Message: Some smaller fixes. Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/ctypes/__init__.py,v retrieving revision 1.61.2.16 retrieving revision 1.61.2.17 diff -C2 -d -r1.61.2.16 -r1.61.2.17 *** __init__.py 22 Dec 2005 20:34:57 -0000 1.61.2.16 --- __init__.py 22 Dec 2005 20:45:15 -0000 1.61.2.17 *************** *** 4,7 **** --- 4,9 ---- # without installing it import os as _os, sys + from itertools import chain as _chain + _magicfile = _os.path.join(_os.path.dirname(__file__), ".CTYPES_DEVEL") if _os.path.isfile(_magicfile): *************** *** 373,376 **** --- 375,379 ---- register_library_alias("c", "msvcrt", "nt") + register_library_alias("m", "msvcrt", "nt") class _DLLS(object): *************** *** 394,398 **** global _library_map if name in _library_map: ! names = itertools.chain( self._findLibrary(name), self._findLibrary(_library_map[name])) --- 397,401 ---- global _library_map if name in _library_map: ! names = _chain( self._findLibrary(name), self._findLibrary(_library_map[name])) |
From: Thomas H. <th...@us...> - 2005-12-22 20:35:06
|
Update of /cvsroot/ctypes/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14956 Modified Files: Tag: branch_1_0 __init__.py util.py Log Message: Added Andreas Degerts library loading code, except for the docs. Index: util.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/ctypes/util.py,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** util.py 15 Apr 2005 18:20:25 -0000 1.1.2.1 --- util.py 22 Dec 2005 20:34:57 -0000 1.1.2.2 *************** *** 1,25 **** ! import os, sys ! ! if os.name == "nt": ! # LoadLibrary already does what we need. ! def find_library(name): ! return name ! elif sys.platform == "darwin": ! from ctypes.macholib.dyld import dyld_find ! # use macholib to find the library path ! def find_library(name): ! possible = ['lib.%s.dylib' % name, ! '%s.dylib' % name, ! '%s.framework/%s' % (name, name)] ! for dylib in possible: try: ! return os.path.realpath(dyld_find(dylib)) ! except ValueError: ! pass ! raise ValueError, "%s not found" % (name,) ! else: ! def find_library(name): ! return 'lib%s.so' % name --- 1,45 ---- ! import os, re, tempfile ! if os.name == "posix": ! def findLib_gcc(name): ! expr = '[^\(\)\s]*lib%s\.[^\(\)\s]*' % name ! cmd = 'if type gcc &>/dev/null; then CC=gcc; else CC=cc; fi;' \ ! '$CC -Wl,-t -o /dev/null 2>&1 -l' + name ! try: ! fdout, outfile = tempfile.mkstemp() ! fd = os.popen(cmd) ! trace = fd.read() ! err = fd.close() ! finally: try: ! os.unlink(outfile) ! except OSError, e: ! if e.errno != errno.ENOENT: ! raise ! res = re.search(expr, trace) ! if not res: ! return None ! return res.group(0) ! def findLib_ld(name): ! expr = '/[^\(\)\s]*lib%s\.[^\(\)\s]*' % name ! res = re.search(expr, os.popen('/sbin/ldconfig -p 2>/dev/null').read()) ! if not res: ! return None ! return res.group(0) ! ! def get_soname(f): ! cmd = "objdump -p -j .dynamic 2>/dev/null " + f ! res = re.search(r'\sSONAME\s+([^\s]+)', os.popen(cmd).read()) ! if not res: ! return f ! return res.group(1) ! ! def findLib(name): ! lib = findLib_ld(name) ! if not lib: ! lib = findLib_gcc(name) ! if not lib: ! return [name] ! return [get_soname(lib)] Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/ctypes/__init__.py,v retrieving revision 1.61.2.15 retrieving revision 1.61.2.16 diff -C2 -d -r1.61.2.15 -r1.61.2.16 *** __init__.py 30 Nov 2005 09:34:16 -0000 1.61.2.15 --- __init__.py 22 Dec 2005 20:34:57 -0000 1.61.2.16 *************** *** 362,365 **** --- 362,377 ---- return func + def register_library_alias(alias, libname, osname, platform=None): + global _library_map + if osname is not None and osname != _os.name: + return + if platform is not None and platform != sys.platform: + return + _library_map[alias] = libname + + _library_map = {} + + register_library_alias("c", "msvcrt", "nt") + class _DLLS(object): def __init__(self, dlltype): *************** *** 367,375 **** def __getattr__(self, name): ! from ctypes.util import find_library ! if name.startswith("__"): raise AttributeError, name ! libpath = find_library(name) ! dll = self._dlltype(libpath) setattr(self, name, dll) return dll --- 379,385 ---- def __getattr__(self, name): ! if name[0] == '_': raise AttributeError, name ! dll = self.LoadLibrary(name) setattr(self, name, dll) return dll *************** *** 381,384 **** --- 391,460 ---- return self._dlltype(name) + def find(self, name, showname=True): + global _library_map + if name in _library_map: + names = itertools.chain( + self._findLibrary(name), + self._findLibrary(_library_map[name])) + else: + names = self._findLibrary(name) + for libname in names: + try: + dll = self._dlltype(libname) + except OSError: + continue + break + else: + raise OSError, "not found: %s" % name + if showname: + print "ctypes.find: %s" % libname + return dll + + def LoadLibraryVersion(self, name, version=''): + global _library_map + try: + return self._LoadLibraryVersion(name, version) + except OSError, e: + pass + if name not in _library_map: + raise + name = _library_map[name] + try: + return self._LoadLibraryVersion(name, version) + except OSError: + raise e + + if _os.name == "posix" and sys.platform == "darwin": + def _findLibrary(self, name): + return ['lib%s.dylib' % name, + '%s.dylib' % name, + '%s.framework/%s' % (name, name)] + + def _LoadLibraryVersion(self, name, version=''): + for libname in self._findLibrary(name): + try: + return self._dlltype(libname) + except OSError: + continue + raise OSError, "not found: %s" % name + + elif _os.name == "posix": + def _findLibrary(self, name): + from util import findLib + return findLib(name) + + def _LoadLibraryVersion(self, name, version=''): + if version: + version = '.' + version + dll = self._dlltype("lib%s.so%s" % (name, version)) + return dll + + else: + def _findLibrary(self, name): + return [name] + + def _LoadLibraryVersion(self, name, version=''): + return self._dlltype(name) + cdll = _DLLS(CDLL) pydll = _DLLS(PyDLL) |
From: Thomas H. <th...@us...> - 2005-12-22 20:35:05
|
Update of /cvsroot/ctypes/ctypes/ctypes/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14956/test Modified Files: Tag: branch_1_0 test_libc.py Added Files: Tag: branch_1_0 test_loading.py Log Message: Added Andreas Degerts library loading code, except for the docs. Index: test_libc.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/ctypes/test/Attic/test_libc.py,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** test_libc.py 3 Nov 2005 19:49:19 -0000 1.1.2.1 --- test_libc.py 22 Dec 2005 20:34:57 -0000 1.1.2.2 *************** *** 1,35 **** - import os import sys import unittest from ctypes import * - from ctypes.util import find_library - from ctypes.decorators import cdecl, name_library - - # specify which libraries the decorator has to load. Normally, one - # would use ful so-names to specify exact the library we want. - - if os.name == "nt": - name_library("libc", "msvcrt") - name_library("libm", "msvcrt") - elif os.name == "darwin": - name_library("libc", find_library("c")) - name_library("libm", find_library("m")) - else: - name_library("libc", "libc.so.6") - name_library("libm", find_library("m")) - - # load libraries with cdll magic. I still don't know how to find - # 'libc.so.6' from 'c' on linux, otherwise this could be a lot nicer. - - if os.name == "nt": - libm = libc = cdll.msvcrt - elif sys.platform == "darwin": - libc = cdll.c - libm = cdll.m - else: - libc = CDLL("libc.so.6") - libm = cdll.m class LibTest(unittest.TestCase): --- 1,9 ---- import sys import unittest from ctypes import * + libc = cdll.find('c', False) + libm = cdll.find('m', False) class LibTest(unittest.TestCase): *************** *** 41,45 **** self.failUnlessEqual(libm.sqrt(2.0), math.sqrt(2.0)) ! def test_cdecl_decorator(self): # @ cdecl(c_double, "libm", [c_double]) --- 15,19 ---- self.failUnlessEqual(libm.sqrt(2.0), math.sqrt(2.0)) ! def SKIP_test_cdecl_decorator(self): # @ cdecl(c_double, "libm", [c_double]) *************** *** 63,67 **** self.failUnlessEqual(chars.raw, " ,,aaaadmmmnpppsss\x00") ! def test_qsort_decorator(self): from ctypes.decorators import cdecl, name_library --- 37,41 ---- self.failUnlessEqual(chars.raw, " ,,aaaadmmmnpppsss\x00") ! def SKIP_test_qsort_decorator(self): from ctypes.decorators import cdecl, name_library --- NEW FILE: test_loading.py --- from ctypes import * import unittest import os, StringIO class LoaderTest(unittest.TestCase): unknowndll = "xxrandomnamexx" def test_LoadLibrary(self): if os.name == "nt": name = "msvcrt" elif sys.platform == "darwin": name = "libc.dylib" else: name = "libc.so.6" cdll.LoadLibrary(name) self.assertRaises(OSError, cdll.LoadLibrary, self.unknowndll) def test_LoadLibraryVersion(self): version = "6" name = "c" cdll.LoadLibraryVersion(name, version) if sys.platform == "linux2": # linux uses version, libc 9 should not exist self.assertRaises(OSError, cdll.LoadLibraryVersion, name, "9") self.assertRaises(OSError, cdll.LoadLibraryVersion, self.unknowndll, "") def test_find(self): name = "c" cdll.find(name, False) self.assertRaises(OSError, cdll.find, self.unknowndll) if __name__ == "__main__": unittest.main() |
From: Thomas H. <th...@us...> - 2005-12-14 22:14:56
|
Update of /cvsroot/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4631 Modified Files: Tag: branch_1_0 ChangeLog Log Message: Index: ChangeLog =================================================================== RCS file: /cvsroot/ctypes/ctypes/ChangeLog,v retrieving revision 1.86.2.31 retrieving revision 1.86.2.32 diff -C2 -d -r1.86.2.31 -r1.86.2.32 *** ChangeLog 30 Nov 2005 09:40:43 -0000 1.86.2.31 --- ChangeLog 14 Dec 2005 22:14:46 -0000 1.86.2.32 *************** *** 1,2 **** --- 1,7 ---- + 2005-12-14 Thomas Heller <th...@py...> + + * Implemented different endians for c_float and c_double. + Added testcases for them. + 2005-11-30 Thomas Heller <th...@py...> |
From: Thomas H. <th...@us...> - 2005-12-14 22:05:50
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2250 Modified Files: Tag: branch_1_0 cfield.c Log Message: Implemented c_double with different endian. Index: cfield.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/cfield.c,v retrieving revision 1.74.2.14 retrieving revision 1.74.2.15 diff -C2 -d -r1.74.2.14 -r1.74.2.15 *** cfield.c 14 Dec 2005 22:00:57 -0000 1.74.2.14 --- cfield.c 14 Dec 2005 22:05:41 -0000 1.74.2.15 *************** *** 893,896 **** --- 893,928 ---- static PyObject * + d_set_sw(void *ptr, PyObject *value, unsigned size) + { + double x; + + x = PyFloat_AsDouble(value); + if (x == -1 && PyErr_Occurred()) { + PyErr_Format(PyExc_TypeError, + " float expected instead of %s instance", + value->ob_type->tp_name); + return NULL; + } + #ifdef IS_BIG_ENDIAN + if (_PyFloat_Pack8(x, (unsigned char *)ptr, 1)) + return NULL; + #else + if (_PyFloat_Pack8(x, (unsigned char *)ptr, 0)) + return NULL; + #endif + _RET(value); + } + + static PyObject * + d_get_sw(void *ptr, unsigned size) + { + #ifdef IS_BIG_ENDIAN + return PyFloat_FromDouble(_PyFloat_Unpack8(ptr, 1)); + #else + return PyFloat_FromDouble(_PyFloat_Unpack8(ptr, 0)); + #endif + } + + static PyObject * f_set(void *ptr, PyObject *value, unsigned size) { *************** *** 1372,1376 **** { 'B', B_set, B_get, &ffi_type_uchar}, { 'c', c_set, c_get, &ffi_type_schar}, ! { 'd', d_set, d_get, &ffi_type_double/*, d_set_sw, d_get_sw*/}, { 'f', f_set, f_get, &ffi_type_float, f_set_sw, f_get_sw}, { 'h', h_set, h_get, &ffi_type_sshort, h_set_sw, h_get_sw}, --- 1404,1408 ---- { 'B', B_set, B_get, &ffi_type_uchar}, { 'c', c_set, c_get, &ffi_type_schar}, ! { 'd', d_set, d_get, &ffi_type_double, d_set_sw, d_get_sw}, { 'f', f_set, f_get, &ffi_type_float, f_set_sw, f_get_sw}, { 'h', h_set, h_get, &ffi_type_sshort, h_set_sw, h_get_sw}, |
From: Thomas H. <th...@us...> - 2005-12-14 22:01:13
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv877 Modified Files: Tag: branch_1_0 cfield.c Log Message: Implemented c_float with different endian. Index: cfield.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/cfield.c,v retrieving revision 1.74.2.13 retrieving revision 1.74.2.14 diff -C2 -d -r1.74.2.13 -r1.74.2.14 *** cfield.c 30 Nov 2005 07:47:02 -0000 1.74.2.13 --- cfield.c 14 Dec 2005 22:00:57 -0000 1.74.2.14 *************** *** 915,918 **** --- 915,950 ---- static PyObject * + f_set_sw(void *ptr, PyObject *value, unsigned size) + { + float x; + + x = (float)PyFloat_AsDouble(value); + if (x == -1 && PyErr_Occurred()) { + PyErr_Format(PyExc_TypeError, + " float expected instead of %s instance", + value->ob_type->tp_name); + return NULL; + } + #ifdef IS_BIG_ENDIAN + if (_PyFloat_Pack4(x, (unsigned char *)ptr, 1)) + return NULL; + #else + if (_PyFloat_Pack4(x, (unsigned char *)ptr, 0)) + return NULL; + #endif + _RET(value); + } + + static PyObject * + f_get_sw(void *ptr, unsigned size) + { + #ifdef IS_BIG_ENDIAN + return PyFloat_FromDouble(_PyFloat_Unpack4(ptr, 1)); + #else + return PyFloat_FromDouble(_PyFloat_Unpack4(ptr, 0)); + #endif + } + + static PyObject * O_get(void *ptr, unsigned size) { *************** *** 1341,1345 **** { 'c', c_set, c_get, &ffi_type_schar}, { 'd', d_set, d_get, &ffi_type_double/*, d_set_sw, d_get_sw*/}, ! { 'f', f_set, f_get, &ffi_type_float/*, f_set_sw, f_get_sw*/}, { 'h', h_set, h_get, &ffi_type_sshort, h_set_sw, h_get_sw}, { 'H', H_set, H_get, &ffi_type_ushort, H_set_sw, H_get_sw}, --- 1373,1377 ---- { 'c', c_set, c_get, &ffi_type_schar}, { 'd', d_set, d_get, &ffi_type_double/*, d_set_sw, d_get_sw*/}, ! { 'f', f_set, f_get, &ffi_type_float, f_set_sw, f_get_sw}, { 'h', h_set, h_get, &ffi_type_sshort, h_set_sw, h_get_sw}, { 'H', H_set, H_get, &ffi_type_ushort, H_set_sw, H_get_sw}, |
From: Thomas H. <th...@us...> - 2005-12-14 20:55:12
|
Update of /cvsroot/ctypes/ctypes/ctypes/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20234 Modified Files: Tag: branch_1_0 test_byteswap.py Log Message: Test different endians of c_float and c_double. Index: test_byteswap.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/ctypes/test/Attic/test_byteswap.py,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -C2 -d -r1.1.2.6 -r1.1.2.7 *** test_byteswap.py 30 Nov 2005 09:35:03 -0000 1.1.2.6 --- test_byteswap.py 14 Dec 2005 20:55:01 -0000 1.1.2.7 *************** *** 1,11 **** ! from ctypes import * ! import unittest ! import sys from binascii import hexlify - from ctypes.test import requires ! import struct ! ! requires("swap") ##class BITS(Structure): --- 1,6 ---- ! import sys, unittest, struct, math from binascii import hexlify ! from ctypes import * ##class BITS(Structure): *************** *** 119,122 **** --- 114,152 ---- self.failUnlessEqual(s.value, 0x1234567890ABCDEF) + def test_endian_float(self): + if sys.byteorder == "little": + self.failUnless(c_float.__ctype_le__ is c_float) + self.failUnless(c_float.__ctype_be__.__ctype_le__ is c_float) + else: + self.failUnless(c_float.__ctype_be__ is c_float) + self.failUnless(c_float.__ctype_le__.__ctype_be__ is c_float) + s = c_float(math.pi) + self.failUnlessEqual(bin(struct.pack("f", math.pi)), bin(s)) + # Hm, what's the precision of a float compared to a double? + self.failUnlessAlmostEqual(s.value, math.pi, 6) + s = c_float.__ctype_le__(math.pi) + self.failUnlessAlmostEqual(s.value, math.pi, 6) + self.failUnlessEqual(bin(struct.pack("<f", math.pi)), bin(s)) + s = c_float.__ctype_be__(math.pi) + self.failUnlessAlmostEqual(s.value, math.pi, 6) + self.failUnlessEqual(bin(struct.pack(">f", math.pi)), bin(s)) + + def test_endian_double(self): + if sys.byteorder == "little": + self.failUnless(c_double.__ctype_le__ is c_double) + self.failUnless(c_double.__ctype_be__.__ctype_le__ is c_double) + else: + self.failUnless(c_double.__ctype_be__ is c_double) + self.failUnless(c_double.__ctype_le__.__ctype_be__ is c_double) + s = c_double(math.pi) + self.failUnlessEqual(s.value, math.pi) + self.failUnlessEqual(bin(struct.pack("d", math.pi)), bin(s)) + s = c_double.__ctype_le__(math.pi) + self.failUnlessEqual(s.value, math.pi) + self.failUnlessEqual(bin(struct.pack("<d", math.pi)), bin(s)) + s = c_double.__ctype_be__(math.pi) + self.failUnlessEqual(s.value, math.pi) + self.failUnlessEqual(bin(struct.pack(">d", math.pi)), bin(s)) + def test_endian_other(self): self.failUnless(c_byte.__ctype_le__ is c_byte) |
From: Thomas H. <th...@us...> - 2005-12-14 20:23:17
|
Update of /cvsroot/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13216 Added Files: WARNING! Log Message: WARNING: DON'T use the CVS HEAD! --- NEW FILE: WARNING! --- IMPORTANT NOTE: =============== The CVS HEAD of the ctypes projects is not currently used. Stable code is in the branch_1_0 CVS branch. |
From: Thomas H. <th...@us...> - 2005-12-07 19:42:10
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21671 Modified Files: Tag: branch_1_0 _comobject.py Log Message: Fix some pychecker warnings. Index: _comobject.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/Attic/_comobject.py,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** _comobject.py 20 Oct 2005 17:23:11 -0000 1.1.2.1 --- _comobject.py 7 Dec 2005 19:41:57 -0000 1.1.2.2 *************** *** 87,91 **** def IUnknown_Release(self, this, ! _InterlockedDecrement=_InterlockedDecrement, _byref=byref, _debug=logging.getLogger("comtypes.refcount").debug): --- 87,91 ---- def IUnknown_Release(self, this, ! InterlockedDecrement=_InterlockedDecrement, _byref=byref, _debug=logging.getLogger("comtypes.refcount").debug): *************** *** 94,98 **** # module level variables may have been deleted already - so we # supply them as default arguments. ! result = _InterlockedDecrement(_byref(self._refcnt)) _debug("%r.Release() -> %s", self, result) if result == 0: --- 94,98 ---- # module level variables may have been deleted already - so we # supply them as default arguments. ! result = InterlockedDecrement(_byref(self._refcnt)) _debug("%r.Release() -> %s", self, result) if result == 0: |
From: Thomas H. <th...@us...> - 2005-11-30 09:40:51
|
Update of /cvsroot/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2500 Modified Files: Tag: branch_1_0 ChangeLog Log Message: *** empty log message *** Index: ChangeLog =================================================================== RCS file: /cvsroot/ctypes/ctypes/ChangeLog,v retrieving revision 1.86.2.30 retrieving revision 1.86.2.31 diff -C2 -d -r1.86.2.30 -r1.86.2.31 *** ChangeLog 30 Nov 2005 09:38:07 -0000 1.86.2.30 --- ChangeLog 30 Nov 2005 09:40:43 -0000 1.86.2.31 *************** *** 2,7 **** * Implemented BigEndianStructure and LittleEndianStructure base ! classes which support different endians. <<More explanation needed>> ! Changed version number to 0.9.9.1. 2005-11-04 Thomas Heller <th...@py...> --- 2,12 ---- * Implemented BigEndianStructure and LittleEndianStructure base ! classes which support different endians. The fields of structures ! with non-native byte ordering are limited to c_char and all the ! integer variantions of different sizes, plus arrays of these. ! Integer bit fields do work. c_double, c_float, and structures are ! not yet supported as field types. ! ! * Changed version number to 0.9.9.1. 2005-11-04 Thomas Heller <th...@py...> |
From: Thomas H. <th...@us...> - 2005-11-30 09:38:16
|
Update of /cvsroot/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1640 Modified Files: Tag: branch_1_0 ChangeLog Log Message: *** empty log message *** Index: ChangeLog =================================================================== RCS file: /cvsroot/ctypes/ctypes/ChangeLog,v retrieving revision 1.86.2.29 retrieving revision 1.86.2.30 diff -C2 -d -r1.86.2.29 -r1.86.2.30 *** ChangeLog 30 Nov 2005 09:37:36 -0000 1.86.2.29 --- ChangeLog 30 Nov 2005 09:38:07 -0000 1.86.2.30 *************** *** 3,6 **** --- 3,7 ---- * Implemented BigEndianStructure and LittleEndianStructure base classes which support different endians. <<More explanation needed>> + Changed version number to 0.9.9.1. 2005-11-04 Thomas Heller <th...@py...> |
From: Thomas H. <th...@us...> - 2005-11-30 09:37:43
|
Update of /cvsroot/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1516 Modified Files: Tag: branch_1_0 ChangeLog Log Message: *** empty log message *** Index: ChangeLog =================================================================== RCS file: /cvsroot/ctypes/ctypes/ChangeLog,v retrieving revision 1.86.2.28 retrieving revision 1.86.2.29 diff -C2 -d -r1.86.2.28 -r1.86.2.29 *** ChangeLog 11 Nov 2005 08:20:07 -0000 1.86.2.28 --- ChangeLog 30 Nov 2005 09:37:36 -0000 1.86.2.29 *************** *** 1,2 **** --- 1,7 ---- + 2005-11-30 Thomas Heller <th...@py...> + + * Implemented BigEndianStructure and LittleEndianStructure base + classes which support different endians. <<More explanation needed>> + 2005-11-04 Thomas Heller <th...@py...> |