ctypes-commit Mailing List for ctypes (Page 6)
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-06-14 06:01:49
|
Update of /cvsroot/ctypes/ctypes/docs/manual In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv6892 Modified Files: reference.txt Log Message: *** empty log message *** Index: reference.txt =================================================================== RCS file: /cvsroot/ctypes/ctypes/docs/manual/reference.txt,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** reference.txt 13 Jun 2006 20:40:01 -0000 1.29 --- reference.txt 14 Jun 2006 06:01:42 -0000 1.30 *************** *** 248,281 **** combination with ``paramflags`` documented below. ! Foreign functions can also be created by instantiating function ! prototypes. Function prototypes are comparable to function prototypes ! in C; they describe a function (return type, argument types, calling ! convention) without defining an implementation. ! Function prototypes are created by calling a factory function: ``CFUNCTYPE(restype, *argtypes)`` : funcdesc ! This is a factory function that returns a function prototype. The ! function prototype describes a function that has a result type of ! ``restype``, and accepts arguments as specified by ! ``argtypes``. The function prototype can be used to construct ! several kinds of functions, depending on how the prototype is ! called. ! ! The prototypes returned by ``CFUNCTYPE`` or ``PYFUNCTYPE`` create ! functions that use the standard C calling convention, prototypes ! returned from ``WINFUNCTYPE`` (on Windows) use the ``__stdcall`` ! calling convention. ! ! Functions created by calling the ``CFUNCTYPE`` and ``WINFUNCTYPE`` ! prototypes release the Python GIL before entering the foreign ! function, and acquire it back after leaving the function code. ``WINFUNCTYPE(restype, *argtypes)`` : funcdesc ! Same as ``CFUNCTYPE``, but the function will use the ``stdcall`` ! calling convention. ``PYFUNCTYPE(restype, *argtypes)`` : funcdesc ! TBD ``ArgumentError()`` : excdesc --- 248,285 ---- combination with ``paramflags`` documented below. ! Instances of foreign functions are also C compatible data types; they ! represent C function pointers. ! Foreign functions can also be created by instantiating function ! prototypes. Function prototypes are similar to function prototypes in ! C; they describe a function (return type, argument types, calling ! convention) without defining an implementation. The factory ! functions must be called with the desired result type and the argument ! types of the function. ``CFUNCTYPE(restype, *argtypes)`` : funcdesc ! The returned function prototype creates functions that use the ! standard C calling convention. The function will release the GIL ! during the call. ``WINFUNCTYPE(restype, *argtypes)`` : funcdesc ! Windows only: The returned function prototype creates functions ! that use the ``stdcall`` calling convention, except on Windows CE ! where ``WINFUNCTYPE`` is the same as ``CFUNCTYPE``. The function ! will release the GIL during the call. ``PYFUNCTYPE(restype, *argtypes)`` : funcdesc ! The returned function prototype creates functions that use the ! Python calling convention. The function will *not* release the ! GIL during the call. ! ! Instantiating function prototypes ! ................................. ! ! Function prototypes created by the factory functions can be instatiated ! in different ways, depending on how they are called. ! ! ! XXX Where does the exception description belong? ``ArgumentError()`` : excdesc *************** *** 640,643 **** --- 644,651 ---- Represents the C ``PyObject *`` datatype. + The ``ctypes.wintypes`` module provides quite some other Windows + specific data types, for example ``HWND``, ``WPARAM``, or ``DWORD``. + Some useful structures like ``MSG`` or ``RECT`` are also defined. + Structured data types --------------------- |
From: Thomas H. <th...@us...> - 2006-06-13 20:40:14
|
Update of /cvsroot/ctypes/ctypes/docs/manual In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv2911 Modified Files: reference.txt Log Message: Functions, function prototypes. Index: reference.txt =================================================================== RCS file: /cvsroot/ctypes/ctypes/docs/manual/reference.txt,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** reference.txt 13 Jun 2006 20:16:58 -0000 1.28 --- reference.txt 13 Jun 2006 20:40:01 -0000 1.29 *************** *** 164,177 **** ``cdll`` : vardesc ! Loads ``CDLL`` instances. ``windll`` : vardesc ! Windows only: Loads ``WinDLL`` instances. ``oledll`` : vardesc ! Windows only: Loads ``OleDLL`` instances. ``pydll`` : vardesc ! Loads ``PyDLL`` instances. --- 164,177 ---- ``cdll`` : vardesc ! Creates ``CDLL`` instances. ``windll`` : vardesc ! Windows only: Creates ``WinDLL`` instances. ``oledll`` : vardesc ! Windows only: Creates ``OleDLL`` instances. ``pydll`` : vardesc ! Creates ``PyDLL`` instances. *************** *** 183,202 **** attributes. Note that all these functions are assumed to return integers, which is of course not always the truth, so you have to ! assign the correct ``restype`` attribute. Foreign functions ----------------- ! The ultimate goal of ``ctypes`` is to call functions in shared ! libraries, aka as foreign functions. Foreign function instances can ! be created by retrieving them as attributes of loaded shared ! libraries, or by instantiating a *function prototype*. ! By default, functions got as attributes of loaded shared libraries ! accept any arguments, and have a return type of ``c_int``. ! Function prototypes are created by factory functions. ! They are created by calling one of the following factory functions: ``CFUNCTYPE(restype, *argtypes)`` : funcdesc --- 183,257 ---- attributes. Note that all these functions are assumed to return integers, which is of course not always the truth, so you have to ! assign the correct ``restype`` attribute to use these functions. Foreign functions ----------------- ! As explained in the previous section, foreign functions can be ! accessed as attributes of loaded shared libraries. The function ! objects created in this way by default accept any number of arguments, ! accept any ctypes data instances as arguments, and return the default ! result type specified by the library loader. ! This behaviour can be customized by assigning to special attributes of ! the foreign function object. ! ``restype`` : memberdesc ! Assign a ctypes type to specify the result type of the foreign ! function. Use ``None`` for ``void`` a function not returning ! anything. ! It is possible to assign a callable Python object that is not a ! ctypes type, in this case the function is assumed to return an ! integer, and the callable will be called with this integer, ! allowing to do further processing or error checking. Using this ! is deprecated, for more flexible postprocessing or error checking ! use a ctypes data type as ``restype`` and assign a callable to the ! ``errcheck`` attribute. ! ! ``argtypes``: memberdesc ! Assign a tuple of ctypes types to specify the argument types that ! the function accepts. Functions using the ``stdcall`` calling ! convention can only be called with the same number of arguments as ! the length of this tuple; functions using the C calling convention ! accept additional, unspecified arguments as well. ! ! When a foreign function is called, each actual argument is passed ! to the ``from_param`` class method of the items in the ! ``argtypes`` tuple, this method allows to adapt the actual ! argument to an object that the foreign function accepts. For ! example, a ``c_char_p`` item in the ``argtypes`` tuple will ! convert a unicode string passed as argument into an byte string ! using ctypes conversion rules. ! ! ``errcheck`` : memberdesc ! Assign a Python function or another callable to this attribute. ! The callable will be called with three or more arguments: ! ! ``callable(result, func, arguments, *others)`` : funcdescni ! ``result`` is what the foreign function returns, as specified by the ! ``restype`` attribute. ! ! ``func`` is the foreign function object itself, this allows to ! reuse the same callable object to check or postprocess the results ! of several functions. ! ! ``arguments`` is a tuple containing the parameters originally ! passed to the function call, this allows to specialize the ! behaviour on the arguments used. ! ! The object that this function returns will be returned from the ! foreign function call, but it can also check the result value and ! raise an exception if the foreign function call failed. ! ! ``others`` will usually be an empty tuple, it is only used in ! combination with ``paramflags`` documented below. ! ! Foreign functions can also be created by instantiating function ! prototypes. Function prototypes are comparable to function prototypes ! in C; they describe a function (return type, argument types, calling ! convention) without defining an implementation. ! ! Function prototypes are created by calling a factory function: ``CFUNCTYPE(restype, *argtypes)`` : funcdesc *************** *** 218,222 **** ``WINFUNCTYPE(restype, *argtypes)`` : funcdesc ! TBD ``PYFUNCTYPE(restype, *argtypes)`` : funcdesc --- 273,278 ---- ``WINFUNCTYPE(restype, *argtypes)`` : funcdesc ! Same as ``CFUNCTYPE``, but the function will use the ``stdcall`` ! calling convention. ``PYFUNCTYPE(restype, *argtypes)`` : funcdesc *************** *** 388,395 **** ``from_address(address)`` : methoddesc This method returns a ctypes type instance using the memory ! specified by address. ``from_param(obj)`` : methoddesc ! This method adapts obj to a ctypes type. ``in_dll(name, library)`` : methoddesc --- 444,458 ---- ``from_address(address)`` : methoddesc This method returns a ctypes type instance using the memory ! specified by address which must be an integer. ``from_param(obj)`` : methoddesc ! This method adapts obj to a ctypes type. It is called with the ! actual object used in a foreign function call, when the type is ! present in the foreign functions ``argtypes`` tuple; it must ! return an object that can be used as function call parameter. ! ! All ctypes data types have a default implementation of this ! classmethod, normally it returns ``obj`` if that is an instance of ! the type. Some types accept other objects as well. ``in_dll(name, library)`` : methoddesc |
From: Thomas H. <th...@us...> - 2006-06-13 20:17:15
|
Update of /cvsroot/ctypes/ctypes/docs/manual In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv25209 Modified Files: reference.txt Log Message: fix markup Index: reference.txt =================================================================== RCS file: /cvsroot/ctypes/ctypes/docs/manual/reference.txt,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** reference.txt 13 Jun 2006 19:45:53 -0000 1.27 --- reference.txt 13 Jun 2006 20:16:58 -0000 1.28 *************** *** 134,141 **** an underscore to not clash with exported function names: ! ``_handle``: memberdescni The system handle used to access the library. ! ``_name``: memberdescni The name of the library passed in the contructor. --- 134,141 ---- an underscore to not clash with exported function names: ! ``_handle``: memberdesc The system handle used to access the library. ! ``_name``: memberdesc The name of the library passed in the contructor. |
From: Thomas H. <th...@us...> - 2006-06-13 19:45:57
|
Update of /cvsroot/ctypes/ctypes/docs/manual In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv11674 Modified Files: reference.txt Log Message: *** empty log message *** Index: reference.txt =================================================================== RCS file: /cvsroot/ctypes/ctypes/docs/manual/reference.txt,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** reference.txt 13 Jun 2006 19:39:24 -0000 1.26 --- reference.txt 13 Jun 2006 19:45:53 -0000 1.27 *************** *** 180,184 **** ``pythonapi`` : vardesc - An instance of ``PyDLL`` that exposes Python C api functions as attributes. Note that all these functions are assumed to return --- 180,183 ---- *************** *** 345,349 **** ``"strict"``, ``"replace"``, or ``"ignore"``. ! set_conversion_mode returns a 2-tuple containing the previous conversion rules. On windows, the initial conversion rules are ``('mbcs', 'ignore')``, on other systems ``('ascii', 'strict')``. --- 344,348 ---- ``"strict"``, ``"replace"``, or ``"ignore"``. ! ``set_conversion_mode`` returns a 2-tuple containing the previous conversion rules. On windows, the initial conversion rules are ``('mbcs', 'ignore')``, on other systems ``('ascii', 'strict')``. |
From: Thomas H. <th...@us...> - 2006-06-13 19:39:27
|
Update of /cvsroot/ctypes/ctypes/docs/manual In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv8660 Modified Files: reference.txt Log Message: fix markup Index: reference.txt =================================================================== RCS file: /cvsroot/ctypes/ctypes/docs/manual/reference.txt,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** reference.txt 13 Jun 2006 19:35:01 -0000 1.25 --- reference.txt 13 Jun 2006 19:39:24 -0000 1.26 *************** *** 137,141 **** The system handle used to access the library. ! ``_name'': memberdescni The name of the library passed in the contructor. --- 137,141 ---- The system handle used to access the library. ! ``_name``: memberdescni The name of the library passed in the contructor. |
From: Thomas H. <th...@us...> - 2006-06-13 19:35:04
|
Update of /cvsroot/ctypes/ctypes/docs/manual In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv6494 Modified Files: reference.txt Log Message: Some corrections. Index: reference.txt =================================================================== RCS file: /cvsroot/ctypes/ctypes/docs/manual/reference.txt,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** reference.txt 13 Jun 2006 19:31:58 -0000 1.24 --- reference.txt 13 Jun 2006 19:35:01 -0000 1.25 *************** *** 75,79 **** convention, and are assumed to return ``int``. ! ``OleDLL(name, mode=RTLD_LOCAL, handle=None)`` : funcdesc Windows only: Instances of this class represent loaded shared libraries, functions in these libraries use the ``stdcall`` --- 75,79 ---- convention, and are assumed to return ``int``. ! ``OleDLL(name, mode=RTLD_LOCAL, handle=None)`` : classdesc Windows only: Instances of this class represent loaded shared libraries, functions in these libraries use the ``stdcall`` *************** *** 84,88 **** failure, an ``WindowsError`` is automatically raised. ! ``WinDLL(name, mode=RTLD_LOCAL, handle=None)`` : funcdesc Windows only: Instances of this class represent loaded shared libraries, functions in these libraries use the ``stdcall`` --- 84,88 ---- failure, an ``WindowsError`` is automatically raised. ! ``WinDLL(name, mode=RTLD_LOCAL, handle=None)`` : classdesc Windows only: Instances of this class represent loaded shared libraries, functions in these libraries use the ``stdcall`` *************** *** 96,100 **** these libraries, and reaquired afterwards. ! ``PyDLL(name, mode=RTLD_LOCAL, handle=None)`` : funcdesc Instances of this class behave like ``CDLL`` instances, except that the Python GIL is *not* released during the function call, --- 96,100 ---- these libraries, and reaquired afterwards. ! ``PyDLL(name, mode=RTLD_LOCAL, handle=None)`` : classdesc Instances of this class behave like ``CDLL`` instances, except that the Python GIL is *not* released during the function call, |
From: Thomas H. <th...@us...> - 2006-06-13 19:32:06
|
Update of /cvsroot/ctypes/ctypes/docs/manual In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv5191 Modified Files: reference.txt Log Message: More docs. Index: reference.txt =================================================================== RCS file: /cvsroot/ctypes/ctypes/docs/manual/reference.txt,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** reference.txt 13 Jun 2006 18:59:31 -0000 1.23 --- reference.txt 13 Jun 2006 19:31:58 -0000 1.24 *************** *** 76,80 **** ``OleDLL(name, mode=RTLD_LOCAL, handle=None)`` : funcdesc - Windows only: Instances of this class represent loaded shared libraries, functions in these libraries use the ``stdcall`` --- 76,79 ---- *************** *** 94,101 **** convention on this platform. ! These classes can be instantiated by calling them with at least one ! argument, the pathname of the shared library. If you have an existing ! handle to an already loaded shard library, it can be passed as the ! ``handle`` named parameter, otherwise the underlying platforms ``dlopen`` or ``LoadLibrary`` function is used to load the library into the process, and to get a handle to it. --- 93,111 ---- convention on this platform. ! The Python GIL is released before calling any function exported by ! these libraries, and reaquired afterwards. ! ! ``PyDLL(name, mode=RTLD_LOCAL, handle=None)`` : funcdesc ! Instances of this class behave like ``CDLL`` instances, except ! that the Python GIL is *not* released during the function call, ! and after the function execution the Python error flag is checked. ! If the error flag is set, a Python exception is raised. ! ! Thus, this is only useful to call Python C api functions directly. ! ! All these classes can be instantiated by calling them with at least ! one argument, the pathname of the shared library. If you have an ! existing handle to an already loaded shard library, it can be passed ! as the ``handle`` named parameter, otherwise the underlying platforms ``dlopen`` or ``LoadLibrary`` function is used to load the library into the process, and to get a handle to it. *************** *** 105,112 **** ``mode`` is ignored. Instances of these classes have no public methods, however ``__getattr__`` and ``__getitem__`` have special behaviour: functions exported by the shared library can be accessed as attributes of by ! index. The following public attributes are availabe, the start with an underscore to not clash with exported function names: --- 115,135 ---- ``mode`` is ignored. + ``RTLD_GLOBAL`` : vardesc + Flag to use as ``mode`` parameter. On platforms where this flag + is not available, it is defined as the integer zero. + + ``RTLD_LOCAL`` : vardesc + Flag to use as ``mode`` parameter. On platforms where this is not + available, it is the same as ``RTLD_GLOBAL``. + + Instances of these classes have no public methods, however ``__getattr__`` and ``__getitem__`` have special behaviour: functions exported by the shared library can be accessed as attributes of by ! index. Please note that both ``__getattr__`` and ``__getitem__`` ! cache their result, so calling them repeatedly returns the same object ! each time. ! ! The following public attributes are available, their name starts with an underscore to not clash with exported function names: *************** *** 118,155 **** ! ``LibraryLoader(dlltype)`` : classdesc Class which loads shared ! libraries. ``LoadLibrary(name, mode=RTLD_LOCAL, handle=None)`` : methoddesc ! Load a shared library. ``cdll`` : vardesc ! XXX ! ! ``oledll`` : vardesc ! XXX ! ``py_object`` : classdesc* ! XXX ! ``PyDLL(name, mode=RTLD_LOCAL, handle=None)`` : funcdesc ! XXX ``pydll`` : vardesc ! XXX - ``RTLD_GLOBAL`` : vardesc - XXX ! ``RTLD_LOCAL`` : vardesc ! XXX ! ``windll`` : vardesc ! XXX ! ``pythonapi()`` : vardesc ! XXX Foreign functions --- 141,188 ---- ! Shared libraries can also be loaded by using one of the prefabricated ! objects, which are instances of the ``LibraryLoader`` class, either by ! calling the ``LoadLibrary`` method, or by retrieving the library as ! attribute of the loader instance. ! ! ``LibraryLoader(dlltype)`` : classdesc ! Class which loads shared libraries. ``dlltype`` should be one ! of the ``CDLL``, ``PyDLL``, ``WinDLL``, or ``OleDLL`` types. ! ! ``__getattr__`` has special behaviour: It allows to load a shared ! library by accessing it as attribute of a library loader ! instance. The result is cached, so repeated attribute accesses ! return the same library each time. ``LoadLibrary(name, mode=RTLD_LOCAL, handle=None)`` : methoddesc ! Load a shared library into the process and return it. This method ! always creates a new instance of the library. All three ! parameters are passed to the constructor of the library object. + These prefabricated library loaders are available: ``cdll`` : vardesc ! Loads ``CDLL`` instances. ! ``windll`` : vardesc ! Windows only: Loads ``WinDLL`` instances. ! ``oledll`` : vardesc ! Windows only: Loads ``OleDLL`` instances. ``pydll`` : vardesc ! Loads ``PyDLL`` instances. ! For accessing the C Python api directly, a ready-to-use Python shared ! library object is available: ! ``pythonapi`` : vardesc ! An instance of ``PyDLL`` that exposes Python C api functions as ! attributes. Note that all these functions are assumed to return ! integers, which is of course not always the truth, so you have to ! assign the correct ``restype`` attribute. Foreign functions *************** *** 542,545 **** --- 575,581 ---- or error information for a function or method call. + ``py_object`` : classdesc* + Represents the C ``PyObject *`` datatype. + Structured data types --------------------- |
From: Thomas H. <th...@us...> - 2006-06-13 18:59:40
|
Update of /cvsroot/ctypes/ctypes/docs/manual In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv22275 Modified Files: reference.txt Log Message: Document CDLL, WinDLL, OleDLL. Index: reference.txt =================================================================== RCS file: /cvsroot/ctypes/ctypes/docs/manual/reference.txt,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** reference.txt 13 Jun 2006 17:58:23 -0000 1.22 --- reference.txt 13 Jun 2006 18:59:31 -0000 1.23 *************** *** 67,83 **** ------------------------ ! ``LibraryLoader(dlltype)`` : classdesc ! Class which loads shared libraries. ``LoadLibrary(name, mode=RTLD_LOCAL, handle=None)`` : methoddesc Load a shared library. - ``CDLL(name, mode=RTLD_LOCAL, handle=None)`` : classdesc - XXX - ``cdll`` : vardesc - XXX ! ``OleDLL(name, mode=RTLD_LOCAL, handle=None)`` : funcdesc XXX --- 67,130 ---- ------------------------ ! There are several ways to loaded shared libraries into the Python ! process. One way is to instantiate one of the following classes: ! ! ``CDLL(name, mode=RTLD_LOCAL, handle=None)`` : classdesc ! Instances of this class represent loaded shared libraries. ! Functions in these libraries use the standard C calling ! convention, and are assumed to return ``int``. ! ! ``OleDLL(name, mode=RTLD_LOCAL, handle=None)`` : funcdesc ! ! Windows only: Instances of this class represent loaded shared ! libraries, functions in these libraries use the ``stdcall`` ! calling convention, and are assumed to return the windows specific ! ``HRESULT`` code. ``HRESULT`` values contain information ! specifying whether the function call failed or succeeded, together ! with additional error code. If the return value signals a ! failure, an ``WindowsError`` is automatically raised. ! ! ``WinDLL(name, mode=RTLD_LOCAL, handle=None)`` : funcdesc ! Windows only: Instances of this class represent loaded shared ! libraries, functions in these libraries use the ``stdcall`` ! calling convention, and are assumed to return ``int`` by default. ! ! On Windows CE only the standard calling convention is used, for ! convenience the ``WinDLL`` and ``OleDLL`` use the standard calling ! convention on this platform. ! ! These classes can be instantiated by calling them with at least one ! argument, the pathname of the shared library. If you have an existing ! handle to an already loaded shard library, it can be passed as the ! ``handle`` named parameter, otherwise the underlying platforms ! ``dlopen`` or ``LoadLibrary`` function is used to load the library ! into the process, and to get a handle to it. ! ! The ``mode`` parameter can be used to specify how the library is ! loaded. For details, consult the ``dlopen(3)`` manpage, on Windows, ! ``mode`` is ignored. ! ! Instances of these classes have no public methods, however ! ``__getattr__`` and ``__getitem__`` have special behaviour: functions ! exported by the shared library can be accessed as attributes of by ! index. The following public attributes are availabe, the start with ! an underscore to not clash with exported function names: ! ! ``_handle``: memberdescni ! The system handle used to access the library. ! ! ``_name'': memberdescni ! The name of the library passed in the contructor. ! ! ! ``LibraryLoader(dlltype)`` : classdesc Class which loads shared ! libraries. ``LoadLibrary(name, mode=RTLD_LOCAL, handle=None)`` : methoddesc Load a shared library. ! ``cdll`` : vardesc XXX *************** *** 100,106 **** XXX - ``WinDLL(name, mode=RTLD_LOCAL, handle=None)`` : funcdesc - XXX - ``windll`` : vardesc XXX --- 147,150 ---- |
From: Thomas H. <th...@us...> - 2006-06-13 17:58:40
|
Update of /cvsroot/ctypes/ctypes/docs/manual In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv28052 Modified Files: reference.txt Log Message: Document find_library. Index: reference.txt =================================================================== RCS file: /cvsroot/ctypes/ctypes/docs/manual/reference.txt,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** reference.txt 2 Jun 2006 22:02:07 -0000 1.21 --- reference.txt 13 Jun 2006 17:58:23 -0000 1.22 *************** *** 2,5 **** --- 2,67 ---- ================ + Finding shared libraries + ------------------------ + + When programming in a compiled language, shared libraries are accessed + when compiling/linking a program, and when the program is run. + + The purpose of the ``find_library`` function is to locate a library in + a way similar to what the compiler does (on platforms with several + versions of a shared library the most recent should be loaded), while + the ctypes library loaders act like when a program is run, and call + the runtime loader directly. + + The ``ctypes.util`` module provides a function which can help to + determine the library to load. + + ``find_library(name)`` + Try to find a library and return a pathname. ``name`` is the + library name without any prefix like ``lib``, suffix like ``.so``, + ``.dylib`` or version number (this is the form used for the posix + linker option ``-l``). If no library can be found, returns + ``None``. + + The exact functionality is system dependend. + + On Linux, ``find_library`` tries to run external programs + (/sbin/ldconfig, gcc, and objdump) to find the library file. It + returns the filename of the library file. Here are sone examples:: + + >>> from ctypes.util import find_library + >>> find_library("m") + 'libm.so.6' + >>> find_library("c") + 'libc.so.6' + >>> find_library("bz2") + 'libbz2.so.1.0' + >>> + + On OS X, ``find_library`` tries several predefined naming schemes and + paths to locate the library, and returns a full pathname if successfull:: + + >>> from ctypes.util import find_library + >>> find_library("c") + '/usr/lib/libc.dylib' + >>> find_library("m") + '/usr/lib/libm.dylib' + >>> find_library("bz2") + '/usr/lib/libbz2.dylib' + >>> find_library("AGL") + '/System/Library/Frameworks/AGL.framework/AGL' + >>> + + On Windows, ``find_library`` searches along the system search path, + and returns the full pathname, but since there is no predefined naming + scheme a call like ``find_library("c")`` will fail and return + ``None``. + + If wrapping a shared library with ``ctypes``, it *may* be better to + determine the shared library name at development type, and hardcode + that into the wrapper module instead of using ``find_library`` to + locate the library at runtime. + + Loading shared libraries ------------------------ |
From: Thomas H. <th...@us...> - 2006-06-13 17:57:56
|
Update of /cvsroot/ctypes/ctypes/docs/manual In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv27601 Modified Files: tutorial.txt Log Message: Index: tutorial.txt =================================================================== RCS file: /cvsroot/ctypes/ctypes/docs/manual/tutorial.txt,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** tutorial.txt 31 May 2006 18:02:31 -0000 1.31 --- tutorial.txt 13 Jun 2006 17:57:34 -0000 1.32 *************** *** 56,66 **** >>> ! XXX Add section for Mac OS X. ! ! Finding shared libraries ! ------------------------ - XXX Add description of ctypes.util.find_library (once I really - understand it enough to describe it). Accessing functions from loaded dlls --- 56,61 ---- >>> ! .. XXX Add section for Mac OS X. Accessing functions from loaded dlls |
From: Thomas H. <th...@us...> - 2006-06-13 08:30:06
|
Update of /cvsroot/ctypes/ctypes/codegen In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv29524 Modified Files: ChangeLog Log Message: *** empty log message *** Index: ChangeLog =================================================================== RCS file: /cvsroot/ctypes/ctypes/codegen/ChangeLog,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ChangeLog 9 Jun 2006 17:37:58 -0000 1.5 --- ChangeLog 13 Jun 2006 08:30:02 -0000 1.6 *************** *** 1,2 **** --- 1,7 ---- + 2006-06-13 Thomas Heller <th...@py...> + + * Fixed a problem in gccxmlparser.py when 'Constructor' + descriptions created by gccxml gave no 'name' attribute. + 2006-06-09 Thomas Heller <th...@py...> *************** *** 11,16 **** 2006-06-08 Thomas Heller <th...@py...> ! * ctypes_codegen\codegenerator.py: When generating the '__all__' list, ! don't break long strings. * h2xml does no longer create a file named 'None' when no output --- 16,21 ---- 2006-06-08 Thomas Heller <th...@py...> ! * ctypes_codegen\codegenerator.py: When generating the '__all__' ! list, don't break long strings. * h2xml does no longer create a file named 'None' when no output |
From: Thomas H. <th...@us...> - 2006-06-13 08:19:09
|
Update of /cvsroot/ctypes/ctypes/codegen/ctypes_codegen In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv24466 Modified Files: gccxmlparser.py Log Message: Constructors do not always have names. Index: gccxmlparser.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/codegen/ctypes_codegen/gccxmlparser.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gccxmlparser.py 8 Jun 2006 18:46:47 -0000 1.1 --- gccxmlparser.py 13 Jun 2006 08:19:02 -0000 1.2 *************** *** 207,211 **** def Constructor(self, attrs): ! name = attrs["name"] return typedesc.Constructor(name) --- 207,213 ---- def Constructor(self, attrs): ! name = attrs.get("name", None) ! if not name: ! name = attrs["mangled"] return typedesc.Constructor(name) |
From: Thomas H. <th...@us...> - 2006-06-12 20:29:26
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21746 Modified Files: stgdict.c Log Message: Don't use C++ comment. Index: stgdict.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/stgdict.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** stgdict.c 9 Jun 2006 19:20:20 -0000 1.40 --- stgdict.c 12 Jun 2006 20:29:23 -0000 1.41 *************** *** 168,172 **** CFieldObject *fdescr; CFieldObject *new_descr; ! // Convert to PyArg_UnpackTuple... if (!PyArg_ParseTuple(pair, "OO", &fname, &ftype)) { Py_DECREF(fieldlist); --- 168,172 ---- CFieldObject *fdescr; CFieldObject *new_descr; ! /* Convert to PyArg_UnpackTuple... */ if (!PyArg_ParseTuple(pair, "OO", &fname, &ftype)) { Py_DECREF(fieldlist); |
From: Thomas H. <th...@us...> - 2006-06-12 20:28:58
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21325 Modified Files: callproc.c Log Message: Release the GIL during COM method calls, to avoid deadlocks in Python coded COM objects. Index: callproc.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/callproc.c,v retrieving revision 1.167 retrieving revision 1.168 diff -C2 -d -r1.167 -r1.168 *** callproc.c 8 Jun 2006 13:27:21 -0000 1.167 --- callproc.c 12 Jun 2006 20:28:52 -0000 1.168 *************** *** 805,816 **** TCHAR *text; hr = pIunk->lpVtbl->QueryInterface(pIunk, &IID_ISupportErrorInfo, (void **)&psei); if (FAILED(hr)) goto failed; hr = psei->lpVtbl->InterfaceSupportsErrorInfo(psei, riid); psei->lpVtbl->Release(psei); - if (FAILED(hr)) goto failed; hr = GetErrorInfo(0, &pei); if (hr != S_OK) --- 805,822 ---- TCHAR *text; + /* We absolutely have to release the GIL during COM method calls, + otherwise we may get a deadlock! + */ + Py_BEGIN_ALLOW_THREADS + hr = pIunk->lpVtbl->QueryInterface(pIunk, &IID_ISupportErrorInfo, (void **)&psei); if (FAILED(hr)) goto failed; + hr = psei->lpVtbl->InterfaceSupportsErrorInfo(psei, riid); psei->lpVtbl->Release(psei); if (FAILED(hr)) goto failed; + hr = GetErrorInfo(0, &pei); if (hr != S_OK) *************** *** 823,829 **** pei->lpVtbl->GetSource(pei, &source); failed: ! if (pei) ! pei->lpVtbl->Release(pei); progid = NULL; --- 829,836 ---- pei->lpVtbl->GetSource(pei, &source); + pei->lpVtbl->Release(pei); + failed: ! Py_END_ALLOW_THREADS progid = NULL; *************** *** 1493,1497 **** obj->b_size = size; } else { ! obj->b_ptr = PyMem_Realloc(obj->b_ptr, size); obj->b_size = size; } --- 1500,1507 ---- obj->b_size = size; } else { ! void * ptr = PyMem_Realloc(obj->b_ptr, size); ! if (ptr == NULL) ! return PyErr_NoMemory(); ! obj->b_ptr = ptr; obj->b_size = size; } |
From: Thomas H. <th...@us...> - 2006-06-12 20:28:23
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21204 Modified Files: _ctypes.c Log Message: Fix a wrong printf format. Index: _ctypes.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/_ctypes.c,v retrieving revision 1.338 retrieving revision 1.339 diff -C2 -d -r1.338 -r1.339 *** _ctypes.c 9 Jun 2006 18:40:01 -0000 1.338 --- _ctypes.c 12 Jun 2006 20:28:16 -0000 1.339 *************** *** 1828,1837 **** cp += sprintf(cp, "%x", index); #else ! #ifdef MS_WIN32 ! /* MSVC does not understand the 'z' size specifier */ ! cp += sprintf(cp, "%Ix", index); ! #else ! cp += sprintf(cp, "%zx", index); ! #endif #endif while (target->b_base) { --- 1828,1832 ---- cp += sprintf(cp, "%x", index); #else ! cp += sprintf(cp, "%x", Py_SAFE_DOWNCAST(index, Py_ssize_t, int)); #endif while (target->b_base) { *************** *** 1846,1854 **** cp += sprintf(cp, ":%x", (int)target->b_index); #else ! #ifdef MS_WIN32 ! cp += sprintf(cp, ":%Ix", (size_t)target->b_index); ! #else ! cp += sprintf(cp, ":%zx", (size_t)target->b_index); ! #endif #endif target = target->b_base; --- 1841,1845 ---- cp += sprintf(cp, ":%x", (int)target->b_index); #else ! cp += sprintf(cp, ":%x", Py_SAFE_DOWNCAST(target->b_index, Py_ssize_t, int)); #endif target = target->b_base; |
From: Thomas H. <th...@us...> - 2006-06-12 06:07:23
|
Update of /cvsroot/ctypes/ctypes/source/libffi/src/x86 In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv30157 Modified Files: darwin.S Log Message: I don't know how that happend, but the entire file contents was duplicated. Thanks to Simon Percivall for the heads up. Index: darwin.S =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/libffi/src/x86/darwin.S,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** darwin.S 31 May 2006 11:27:01 -0000 1.1 --- darwin.S 12 Jun 2006 06:07:16 -0000 1.2 *************** *** 194,390 **** #endif /* defined __i386__ */ - #ifdef __i386__ - /* ----------------------------------------------------------------------- - darwin.S - Copyright (c) 1996, 1998, 2001, 2002, 2003 Red Hat, Inc. - - X86 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. - ----------------------------------------------------------------------- */ - - /* - * This file is based on sysv.S and then hacked up by Ronald who hasn't done - * assembly programming in 8 years. - */ - - #ifndef __x86_64__ - - #define LIBFFI_ASM - #include <fficonfig.h> - #include <ffi.h> - - .text - - .globl _ffi_prep_args - - .align 4 - .globl _ffi_call_SYSV - - _ffi_call_SYSV: - .LFB1: - pushl %ebp - .LCFI0: - movl %esp,%ebp - .LCFI1: - /* Make room for all of the new args. */ - movl 16(%ebp),%ecx - subl %ecx,%esp - - movl %esp,%eax - - /* Place all of the ffi_prep_args in position */ - pushl 12(%ebp) - pushl %eax - call *8(%ebp) - - /* Return stack to previous state and call the function */ - addl $8,%esp - - call *28(%ebp) - - /* Remove the space we pushed for the args */ - movl 16(%ebp),%ecx - addl %ecx,%esp - - /* Load %ecx with the return type code */ - movl 20(%ebp),%ecx - - /* If the return value pointer is NULL, assume no return value. */ - cmpl $0,24(%ebp) - jne retint - - /* Even if there is no space for the return value, we are - obliged to handle floating-point values. */ - cmpl $FFI_TYPE_FLOAT,%ecx - jne noretval - fstp %st(0) - - jmp epilogue - - retint: - cmpl $FFI_TYPE_INT,%ecx - jne retfloat - /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx - movl %eax,0(%ecx) - jmp epilogue - - retfloat: - cmpl $FFI_TYPE_FLOAT,%ecx - jne retdouble - /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx - fstps (%ecx) - jmp epilogue - - retdouble: - cmpl $FFI_TYPE_DOUBLE,%ecx - jne retlongdouble - /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx - fstpl (%ecx) - jmp epilogue - - retlongdouble: - cmpl $FFI_TYPE_LONGDOUBLE,%ecx - jne retint64 - /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx - fstpt (%ecx) - jmp epilogue - - retint64: - cmpl $FFI_TYPE_SINT64,%ecx - jne retstruct - /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx - movl %eax,0(%ecx) - movl %edx,4(%ecx) - - retstruct: - /* Nothing to do! */ - - noretval: - epilogue: - movl %ebp,%esp - popl %ebp - ret - .LFE1: - .ffi_call_SYSV_end: - #if 0 - .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV - #endif - - #if 0 - .section .eh_frame,EH_FRAME_FLAGS,@progbits - .Lframe1: - .long .LECIE1-.LSCIE1 /* Length of Common Information Entry */ - .LSCIE1: - .long 0x0 /* CIE Identifier Tag */ - .byte 0x1 /* CIE Version */ - #ifdef __PIC__ - .ascii "zR\0" /* CIE Augmentation */ - #else - .ascii "\0" /* CIE Augmentation */ - #endif - .byte 0x1 /* .uleb128 0x1; CIE Code Alignment Factor */ - .byte 0x7c /* .sleb128 -4; CIE Data Alignment Factor */ - .byte 0x8 /* CIE RA Column */ - #ifdef __PIC__ - .byte 0x1 /* .uleb128 0x1; Augmentation size */ - .byte 0x1b /* FDE Encoding (pcrel sdata4) */ - #endif - .byte 0xc /* DW_CFA_def_cfa */ - .byte 0x4 /* .uleb128 0x4 */ - .byte 0x4 /* .uleb128 0x4 */ - .byte 0x88 /* DW_CFA_offset, column 0x8 */ - .byte 0x1 /* .uleb128 0x1 */ - .align 4 - .LECIE1: - .LSFDE1: - .long .LEFDE1-.LASFDE1 /* FDE Length */ - .LASFDE1: - .long .LASFDE1-.Lframe1 /* FDE CIE offset */ - #ifdef __PIC__ - .long .LFB1-. /* FDE initial location */ - #else - .long .LFB1 /* FDE initial location */ - #endif - .long .LFE1-.LFB1 /* FDE address range */ - #ifdef __PIC__ - .byte 0x0 /* .uleb128 0x0; Augmentation size */ - #endif - .byte 0x4 /* DW_CFA_advance_loc4 */ - .long .LCFI0-.LFB1 - .byte 0xe /* DW_CFA_def_cfa_offset */ - .byte 0x8 /* .uleb128 0x8 */ - .byte 0x85 /* DW_CFA_offset, column 0x5 */ - .byte 0x2 /* .uleb128 0x2 */ - .byte 0x4 /* DW_CFA_advance_loc4 */ - .long .LCFI1-.LCFI0 - .byte 0xd /* DW_CFA_def_cfa_register */ - .byte 0x5 /* .uleb128 0x5 */ - .align 4 - .LEFDE1: - #endif - - #endif /* ifndef __x86_64__ */ - - #endif /* defined __i386__ */ --- 194,195 ---- |
From: Thomas H. <th...@us...> - 2006-06-10 19:37:38
|
Update of /cvsroot/ctypes/ctypes In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv29253 Modified Files: ChangeLog Log Message: *** empty log message *** Index: ChangeLog =================================================================== RCS file: /cvsroot/ctypes/ctypes/ChangeLog,v retrieving revision 1.138 retrieving revision 1.139 diff -C2 -d -r1.138 -r1.139 *** ChangeLog 10 Jun 2006 10:41:39 -0000 1.138 --- ChangeLog 10 Jun 2006 19:37:31 -0000 1.139 *************** *** 1,4 **** --- 1,6 ---- 2006-06-10 Thomas Heller <th...@py...> + * Tagged release_0_9_9_7. + * Fix build on MIPS for libffi. |
From: Thomas H. <th...@us...> - 2006-06-10 10:53:10
|
Update of /cvsroot/ctypes/ctypes In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv8725 Modified Files: ANNOUNCE Log Message: Corrections. Index: ANNOUNCE =================================================================== RCS file: /cvsroot/ctypes/ctypes/ANNOUNCE,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ANNOUNCE 9 Jun 2006 07:26:40 -0000 1.27 --- ANNOUNCE 10 Jun 2006 10:53:04 -0000 1.28 *************** *** 20,32 **** Changes in 0.9.9.7 ! Fixes for 654-bit big endian machines. ! It is now possible to read and write any indexes of pointer ! instances (up to 0.9.9.6, reading was allowed for any indexes, but writing only for index zero). Support for unnamed (anonymous) structure fields has been added, the field names must be listed in the '_anonymous_' class ! variable. Enabled darwin/x86 support for libffi (Bob Ippolito and Ronald --- 20,33 ---- Changes in 0.9.9.7 ! Fixes for 64-bit big endian machines. ! It is now possible to read and write any index of pointer ! instances (up to 0.9.9.6, reading was allowed for any index, but writing only for index zero). Support for unnamed (anonymous) structure fields has been added, the field names must be listed in the '_anonymous_' class ! variable. Fields of unnamed structure fields can be accessed ! directly from the parent structure. Enabled darwin/x86 support for libffi (Bob Ippolito and Ronald |
From: Thomas H. <th...@us...> - 2006-06-10 10:41:44
|
Update of /cvsroot/ctypes/ctypes In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3727 Modified Files: ChangeLog Log Message: Index: ChangeLog =================================================================== RCS file: /cvsroot/ctypes/ctypes/ChangeLog,v retrieving revision 1.137 retrieving revision 1.138 diff -C2 -d -r1.137 -r1.138 *** ChangeLog 9 Jun 2006 07:27:23 -0000 1.137 --- ChangeLog 10 Jun 2006 10:41:39 -0000 1.138 *************** *** 1,5 **** 2006-06-09 Thomas Heller <th...@py...> ! * Tagged release 0_9_9_7. * A casted object does now reference the source objects '_objects' --- 1,13 ---- + 2006-06-10 Thomas Heller <th...@py...> + + * Fix build on MIPS for libffi. + 2006-06-09 Thomas Heller <th...@py...> ! * Correctly support nested anonymous structures/union fields. ! ! * Remove the restriction that pointer item assignments only work ! with index of zero. Another fix for the cast function to keep ! needed objects alive. * A casted object does now reference the source objects '_objects' |
From: Thomas H. <th...@us...> - 2006-06-10 10:35:30
|
Update of /cvsroot/ctypes/ctypes/source/libffi In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv887 Modified Files: fficonfig.py.in configure.ac configure Log Message: Backport from Python svn: Fix build on MIPS for libffi. Index: fficonfig.py.in =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/libffi/fficonfig.py.in,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** fficonfig.py.in 31 May 2006 11:26:40 -0000 1.4 --- fficonfig.py.in 10 Jun 2006 10:35:20 -0000 1.5 *************** *** 40,44 **** ffi_srcdir = '@srcdir@' ! ffi_sources += ffi_platforms['@TARGET@'] ffi_sources = [os.path.join('@srcdir@', f) for f in ffi_sources] --- 40,44 ---- ffi_srcdir = '@srcdir@' ! ffi_sources += ffi_platforms['@MKTARGET@'] ffi_sources = [os.path.join('@srcdir@', f) for f in ffi_sources] Index: configure.ac =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/libffi/configure.ac,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** configure.ac 31 May 2006 11:26:40 -0000 1.4 --- configure.ac 10 Jun 2006 10:35:20 -0000 1.5 *************** *** 72,75 **** --- 72,81 ---- fi + dnl libffi changes TARGET for MIPS to define a such macro in the header + dnl while MIPS_IRIX or MIPS_LINUX is separatedly used to decide which + dnl files will be compiled. So, we need to keep the original decision + dnl of TARGET to use in fficonfig.py.in. + MKTARGET=$TARGET + case x$TARGET in xMIPS*) TARGET=MIPS ;; *************** *** 203,206 **** --- 209,213 ---- AC_SUBST(TARGET) AC_SUBST(TARGETDIR) + AC_SUBST(MKTARGET) AC_SUBST(SHELL) Index: configure =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/libffi/configure,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** configure 31 May 2006 11:26:40 -0000 1.4 --- configure 10 Jun 2006 10:35:20 -0000 1.5 *************** *** 311,315 **** #endif" ! ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC ac_ct_CC EXEEXT OBJEXT CFLAGS CPP CPPFLAGS EGREP ALLOCA HAVE_LONG_DOUBLE TARGET TARGETDIR LIBOBJS LTLIBOBJS' ac_subst_files='' --- 311,315 ---- #endif" ! ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC ac_ct_CC EXEEXT OBJEXT CFLAGS CPP CPPFLAGS EGREP ALLOCA HAVE_LONG_DOUBLE TARGET TARGETDIR MKTARGET LIBOBJS LTLIBOBJS' ac_subst_files='' *************** *** 3536,3539 **** --- 3536,3541 ---- fi + MKTARGET=$TARGET + case x$TARGET in xMIPS*) TARGET=MIPS ;; *************** *** 5462,5465 **** --- 5464,5468 ---- + cat >>confdefs.h <<\_ACEOF #define FFI_NO_RAW_API 1 *************** *** 6142,6145 **** --- 6145,6149 ---- s,@TARGET@,$TARGET,;t t s,@TARGETDIR@,$TARGETDIR,;t t + s,@MKTARGET@,$MKTARGET,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t |
From: Thomas H. <th...@us...> - 2006-06-09 19:20:24
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv18271 Modified Files: stgdict.c ctypes.h Log Message: Correct the support for nested anonymous Structure/Union fields. Index: ctypes.h =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/ctypes.h,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** ctypes.h 9 Jun 2006 05:50:10 -0000 1.105 --- ctypes.h 9 Jun 2006 19:20:20 -0000 1.106 *************** *** 182,185 **** --- 182,186 ---- GETFUNC getfunc; /* getter function if proto is NULL */ SETFUNC setfunc; /* setter function if proto is NULL */ + int anonymous; } CFieldObject; Index: stgdict.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/stgdict.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** stgdict.c 2 Jun 2006 21:13:09 -0000 1.39 --- stgdict.c 9 Jun 2006 19:20:20 -0000 1.40 *************** *** 148,152 **** */ static int ! MakeFields(PyObject *type, CFieldObject *descr) { Py_ssize_t i; --- 148,153 ---- */ static int ! MakeFields(PyObject *type, CFieldObject *descr, ! Py_ssize_t index, Py_ssize_t offset) { Py_ssize_t i; *************** *** 183,186 **** --- 184,198 ---- return -1; } + if (fdescr->anonymous) { + int rc = MakeFields(type, fdescr, + index + fdescr->index, + offset + fdescr->offset); + Py_DECREF(fdescr); + if (rc == -1) { + Py_DECREF(fieldlist); + return -1; + } + continue; + } new_descr = (CFieldObject *)PyObject_CallObject((PyObject *)&CField_Type, NULL); assert(new_descr->ob_type == &CField_Type); *************** *** 191,196 **** } new_descr->size = fdescr->size; ! new_descr->offset = fdescr->offset + descr->offset; ! new_descr->index = fdescr->index + descr->index; new_descr->proto = fdescr->proto; Py_XINCREF(new_descr->proto); --- 203,208 ---- } new_descr->size = fdescr->size; ! new_descr->offset = fdescr->offset + offset; ! new_descr->index = fdescr->index + index; new_descr->proto = fdescr->proto; Py_XINCREF(new_descr->proto); *************** *** 232,236 **** for (i = 0; i < PySequence_Fast_GET_SIZE(anon_names); ++i) { PyObject *fname = PySequence_Fast_GET_ITEM(anon_names, i); /* borrowed */ ! PyObject *descr = PyObject_GetAttr(type, fname); if (descr == NULL) { Py_DECREF(anon_names); --- 244,248 ---- for (i = 0; i < PySequence_Fast_GET_SIZE(anon_names); ++i) { PyObject *fname = PySequence_Fast_GET_ITEM(anon_names, i); /* borrowed */ ! CFieldObject *descr = (CFieldObject *)PyObject_GetAttr(type, fname); if (descr == NULL) { Py_DECREF(anon_names); *************** *** 238,243 **** } assert(descr->ob_type == &CField_Type); /* descr is in the field descriptor. */ ! if (-1 == MakeFields(type, (CFieldObject *)descr)) { Py_DECREF(descr); Py_DECREF(anon_names); --- 250,259 ---- } assert(descr->ob_type == &CField_Type); + descr->anonymous = 1; + /* descr is in the field descriptor. */ ! if (-1 == MakeFields(type, (CFieldObject *)descr, ! ((CFieldObject *)descr)->index, ! ((CFieldObject *)descr)->offset)) { Py_DECREF(descr); Py_DECREF(anon_names); |
From: Thomas H. <th...@us...> - 2006-06-09 19:20:18
|
Update of /cvsroot/ctypes/ctypes/ctypes/test In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv18216 Modified Files: test_anon.py Log Message: Correct the support for nested anonymous Structure/Union fields. Index: test_anon.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/ctypes/test/test_anon.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_anon.py 1 Jun 2006 07:00:51 -0000 1.1 --- test_anon.py 9 Jun 2006 19:20:09 -0000 1.2 *************** *** 36,39 **** --- 36,60 ---- "_anonymous_": ["x"]})) + def test_nested(self): + class ANON_S(Structure): + _fields_ = [("a", c_int)] + + class ANON_U(Union): + _fields_ = [("_", ANON_S), + ("b", c_int)] + _anonymous_ = ["_"] + + class Y(Structure): + _fields_ = [("x", c_int), + ("_", ANON_U), + ("y", c_int)] + _anonymous_ = ["_"] + + self.failUnlessEqual(Y.x.offset, 0) + self.failUnlessEqual(Y.a.offset, sizeof(c_int)) + self.failUnlessEqual(Y.b.offset, sizeof(c_int)) + self.failUnlessEqual(Y._.offset, sizeof(c_int)) + self.failUnlessEqual(Y.y.offset, sizeof(c_int) * 2) + if __name__ == "__main__": unittest.main() |
From: Thomas H. <th...@us...> - 2006-06-09 18:45:41
|
Update of /cvsroot/ctypes/ctypes/ctypes/test In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3748/ctypes/test Modified Files: test_objects.py Log Message: Index: test_objects.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/ctypes/test/test_objects.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_objects.py 9 Jun 2006 07:18:22 -0000 1.1 --- test_objects.py 9 Jun 2006 18:45:38 -0000 1.2 *************** *** 43,47 **** >>> print x.array._b_base_ # doctest: +ELLIPSIS ! <X object at 0x...> >>> --- 43,47 ---- >>> print x.array._b_base_ # doctest: +ELLIPSIS ! <ctypes.test.test_objects.X object at 0x...> >>> *************** *** 55,66 **** ''' ! import unittest, os class TestCase(unittest.TestCase): def test(self): ! import doctest ! doctest.testfile(os.path.abspath(__file__)) if __name__ == '__main__': ! import doctest ! doctest.testfile(os.path.abspath(__file__)) --- 55,66 ---- ''' ! import unittest, doctest ! ! import ctypes.test.test_objects class TestCase(unittest.TestCase): def test(self): ! doctest.testmod(ctypes.test.test_objects) if __name__ == '__main__': ! doctest.testmod(ctypes.test.test_objects) |
From: Thomas H. <th...@us...> - 2006-06-09 18:40:08
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv1280 Modified Files: _ctypes.c Log Message: Fix address calculation in Pointer_ass_item. Index: _ctypes.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/_ctypes.c,v retrieving revision 1.337 retrieving revision 1.338 diff -C2 -d -r1.337 -r1.338 *** _ctypes.c 9 Jun 2006 18:04:45 -0000 1.337 --- _ctypes.c 9 Jun 2006 18:40:01 -0000 1.338 *************** *** 4086,4092 **** } - stgdict = PyObject_stgdict((PyObject *)self); assert(stgdict); proto = stgdict->proto; --- 4086,4092 ---- } stgdict = PyObject_stgdict((PyObject *)self); assert(stgdict); + assert(stgdict->proto); proto = stgdict->proto; *************** *** 4096,4100 **** offset = index * itemdict->size; ! return CData_get(stgdict->proto, stgdict->getfunc, (PyObject *)self, index, size, (*(char **)self->b_ptr) + offset); } --- 4096,4100 ---- offset = index * itemdict->size; ! return CData_get(proto, stgdict->getfunc, (PyObject *)self, index, size, (*(char **)self->b_ptr) + offset); } *************** *** 4106,4110 **** int size; Py_ssize_t offset; ! StgDictObject *stgdict; if (value == NULL) { --- 4106,4111 ---- int size; Py_ssize_t offset; ! StgDictObject *stgdict, *itemdict; ! PyObject *proto; if (value == NULL) { *************** *** 4121,4129 **** stgdict = PyObject_stgdict((PyObject *)self); ! size = stgdict->size / stgdict->length; ! offset = index * size; ! /* XXXXX Make sure proto is NOT NULL! */ ! return CData_set((PyObject *)self, stgdict->proto, stgdict->setfunc, value, index, size, (*(char **)self->b_ptr) + offset); } --- 4122,4135 ---- stgdict = PyObject_stgdict((PyObject *)self); ! assert(stgdict); ! assert(stgdict->proto); ! proto = stgdict->proto; ! /* XXXXXX MAKE SURE PROTO IS NOT NULL! */ ! itemdict = PyType_stgdict(proto); ! size = itemdict->size; ! offset = index * itemdict->size; ! ! return CData_set((PyObject *)self, proto, stgdict->setfunc, value, index, size, (*(char **)self->b_ptr) + offset); } |
From: Thomas H. <th...@us...> - 2006-06-09 18:08:15
|
Update of /cvsroot/ctypes/ctypes/docs/manual In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv20662 Modified Files: test-tutorial.py Log Message: Correct comment. Index: test-tutorial.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/docs/manual/test-tutorial.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test-tutorial.py 19 May 2006 19:21:59 -0000 1.7 --- test-tutorial.py 9 Jun 2006 18:08:08 -0000 1.8 *************** *** 44,48 **** # Python 2.5a2 formats exceptions differently than before, so we # add IGNORE_EXCEPTION_DETAIL. I do not know if this will be ! # fixed or not. doctest.testfile("tutorial.txt", optionflags=doctest.ELLIPSIS | doctest.IGNORE_EXCEPTION_DETAIL) --- 44,51 ---- # Python 2.5a2 formats exceptions differently than before, so we # add IGNORE_EXCEPTION_DETAIL. I do not know if this will be ! # fixed or not. (Is apparently fixed). ! # ! # ctypes may give localized error messages from the operating ! # syetem, so we need IGNORE_EXCEPTION_DETAIL anyway. doctest.testfile("tutorial.txt", optionflags=doctest.ELLIPSIS | doctest.IGNORE_EXCEPTION_DETAIL) |