2003-03-04 Thomas Heller * ctypes.py (cdll): Changed the __getattr__ implementations for all *DLL classes to raise an attribute error if the requested name both starts and ends with a double underscore. Thanks to Wolfgang Strobl for pointing at this. 2003-02-26 Thomas Heller * source\_ctypes.c: Removed the unused from_bytes stuff. * source\_ctypes.c (CString_new): The buffer is only initialized to the bytes from the string is passed in, if any. The terminating NUL byte is always set. This allows large c_string instances to be created with minimum overhead. * source: Moved code from _ctypes.c into the new files cfield.c (field accessors) and stgdict.c (storage info dict). 2003-02-25 Thomas Heller * source\callproc.c: Added call_cdeclfunction. * source\_ctypes.c: addressof() now accepts CFunction instances. 2003-02-24 Thomas Heller * source\_ctypes.c: c_string() and c_wstring() signatures changed. If the first parameter is a string, an optional positive integer can be used as second parameter to specify the size of the internal buffer. This size does NOT include the terminating NUL byte. Since sizeof() does now support c_string and c_wstring, len() is no longer supported (c_string and c_wstring have never really been sequences). * source\_ctypes.c: Made sizeof() and addressof() work with c_string and c_wstring objects. * source\callproc.c: PyCArgObjects now have a readonly _obj attribute, this is the object passed to the byref() call. Useful for implmenting custom argument type checking in Python. 2003-02-20 Thomas Heller * unittests\test_strings.py (StringTestCase.test_sized_strings): Added tests for the new c_string constructor. * source\_ctypes.c (CString_new): The c_string constructor can now be called with a positive integer, this will create an empty string buffer of the specified length (+ 1 for a terminating NUL character). * source\_ctypes.c (CString_new): It's no longer possible to call c_string with None as argument. It created a string of zero size, but this doesn't seem to make sense. 2003-02-19 Thomas Heller * source/_ctypes.c, ctypes.py: Add a c_voidp data type, which represents (void) pointers to memory locations. The value attribute is a Python integer (or a long). 2003-02-18 Thomas Heller * (Repository): Added a packages directory, and created a ctcom package. See separate changelog. 2003-02-11 Thomas Heller * source/_ctypes.c: The .from_parameter method of POINTER classes now accept Array instances containing elements of exactly the same type. * source/callproc.c: Make sure call_comproc checks for valid number of arguments before calling _CallProc. 2003-02-07 Thomas Heller * Version 0.4.0 released and uploaded. * source/_ctypes.c: PointerType_new, ArrayType_new, SimpleType_new, and CFunctionType_new did not check for NULL result from PyType_Type.tp_new() call. This call will fail in Python 2.3 when 'object' is listed as the first base class with a TypeError: MRO conflict among bases. Spotted by Greg Chapman. 2003-02-05 Thomas Heller * The 'raw' and 'value' properties of c_wstring are back, also fixed some severe bugs (it seems c_wstring never worked correctly). Added unittests. * Fixed a problem in c_string: The NUL byte at the buffer end could be overwritten. Added unittests for c_strings. Per suggestion from Niki Spahiev, CFieldObjects now have a readonly size and offset property. Added short docs for them. 2003-01-31 Thomas Heller * Item deletion on Array or Pointer instances did crash with a NULL pointer access. Added unittest for this, and also for Arrays. 2003-01-28 Thomas Heller * source\_ctypes.c: Dangerous code checked in. Pointer instances can point to a single data item, or they can point to an array of values. Back in the distant past ;-), I had a SetSize() method, which would enable indexes != 0. Don't know when and why I removed it, but I need it again. Should it have to be enabled explicitely? Would be better, it seems. Note that there's no corresponding ass_item implementation with indexes != 0. This means, we can get and change the items the pointer points to, if they are mutable, but not replace the items by different ones. 2003-01-24 Thomas Heller * (several): Fixed the alignment and size of the compound datatypes Structure, Union, and hopefully also Array. 2003-01-23 Thomas Heller * source/_ctypes.c: Raise a TypeError if a SimpleCData type or a CDataType is specified as a CFunction's restype. * source/_ctypes.c: CFunction now has a from_param class method. This means that CFunction subclasses can now be used in the argtypes attribute, and so typechecking is done. * unittests: Rewrote the tests from doctest to pyunit. 2003-01-21 Thomas Heller * source/: Merged in these changes from the C_FAST_CARGS branch: ConvParam returns PyCArgObject instances now. Fixed the _as_parameter_ properties of Array, CString, and CFunction so that they 'return' PyCArgObject instances instead of magic tuples. Added a public 'P' fielddescriptor, which is mostly for internal use. The 's' rettype value for functions is probably useless, because functions return *pointers* to strings (char *), not strings. Adapted all the unittests to work, and also changed the samples. 2003-01-20 Thomas Heller * source/*.[ch]: Introduced PyCArgObject objects, which contain a Python object itself and also the data converted to C. This replaces the magic 3-tuples, and should be somewhat faster because no two conversions take place. This is now used by SimpleType_from_param(), byref(), and Pointer_as_parameter(), and is understood by ConvParam(). In the long run this should be the only thing (besides primitive Python data types with trivial conversions) used by ConvParam(). Also ConvParam should probably *return* these things. 2003-01-17 Thomas Heller * source/_ctypes.c: Rewrite of SimpleType_from_param complete. unittests/test_parameters.py shows that it does the right things in most cases. * (Repository): Moved everything from local CVS to the SF repository, and restructured the directories.