[ctypes-commit] ctypes/source stgdict.c,1.20,1.21 ctypes.h,1.55,1.56 cfield.c,1.60,1.61 callproc.c,1
Brought to you by:
theller
From: Thomas H. <th...@us...> - 2004-10-18 08:07:18
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32432 Modified Files: stgdict.c ctypes.h cfield.c callproc.c _ctypes.c Log Message: We need Py_USING_UNICODE *and* HAVE_WCHAR_H for unicode/wchar_t support. Index: ctypes.h =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/ctypes.h,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** ctypes.h 15 Oct 2004 07:00:21 -0000 1.55 --- ctypes.h 18 Oct 2004 08:07:05 -0000 1.56 *************** *** 291,296 **** /* Python's PyUnicode_*WideChar functions are broken ... */ ! #ifdef Py_USING_UNICODE # undef PyUnicode_FromWideChar # define PyUnicode_FromWideChar My_PyUnicode_FromWideChar --- 291,300 ---- /* Python's PyUnicode_*WideChar functions are broken ... */ ! #if defined(Py_USING_UNICODE) && defined(HAVE_WCHAR_H) ! # define CTYPES_UNICODE ! #endif + + #ifdef CTYPES_UNICODE # undef PyUnicode_FromWideChar # define PyUnicode_FromWideChar My_PyUnicode_FromWideChar *************** *** 299,311 **** # define PyUnicode_AsWideChar My_PyUnicode_AsWideChar - /* see comment in Python's Include/unicodeobject.h */ - # ifdef Py_UNICODE_WIDE - # define My_PyUnicode_FromWideChar My_PyUnicodeUCS4_FromWideChar - # define My_PyUnicode_AsWideChar My_PyUnicodeUCS4_AsWideChar - # else - # define My_PyUnicode_FromWideChar My_PyUnicodeUCS2_FromWideChar - # define My_PyUnicode_AsWideChar My_PyUnicodeUCS2_AsWideChar - # endif - extern PyObject *My_PyUnicode_FromWideChar(const wchar_t *, int); extern int My_PyUnicode_AsWideChar(PyUnicodeObject *, wchar_t *, int); --- 303,306 ---- Index: stgdict.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/stgdict.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** stgdict.c 14 Oct 2004 18:14:35 -0000 1.20 --- stgdict.c 18 Oct 2004 08:07:05 -0000 1.21 *************** *** 216,220 **** case FFI_TYPE_SINT32: if (dict->getfunc != getentry("c")->getfunc ! #ifdef Py_USING_UNICODE && dict->getfunc != getentry("u")->getfunc #endif --- 216,220 ---- case FFI_TYPE_SINT32: if (dict->getfunc != getentry("c")->getfunc ! #ifdef CTYPES_UNICODE && dict->getfunc != getentry("u")->getfunc #endif Index: callproc.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/callproc.c,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -d -r1.111 -r1.112 *** callproc.c 15 Oct 2004 16:55:42 -0000 1.111 --- callproc.c 18 Oct 2004 08:07:05 -0000 1.112 *************** *** 501,505 **** } ! #ifdef Py_USING_UNICODE if (PyUnicode_Check(obj)) { #ifdef HAVE_USABLE_WCHAR_T --- 501,505 ---- } ! #ifdef CTYPES_UNICODE if (PyUnicode_Check(obj)) { #ifdef HAVE_USABLE_WCHAR_T *************** *** 1244,1248 **** } ! #ifdef Py_USING_UNICODE static PyObject * --- 1244,1248 ---- } ! #ifdef CTYPES_UNICODE static PyObject * *************** *** 1387,1391 **** {"memset", c_memset, METH_VARARGS, memset_doc}, {"cast", cast, METH_VARARGS, cast_doc}, ! #ifdef Py_USING_UNICODE {"set_conversion_mode", set_conversion_mode, METH_VARARGS, set_conversion_mode_doc}, #endif --- 1387,1391 ---- {"memset", c_memset, METH_VARARGS, memset_doc}, {"cast", cast, METH_VARARGS, cast_doc}, ! #ifdef CTYPES_UNICODE {"set_conversion_mode", set_conversion_mode, METH_VARARGS, set_conversion_mode_doc}, #endif Index: cfield.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/cfield.c,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** cfield.c 14 Oct 2004 14:43:45 -0000 1.60 --- cfield.c 18 Oct 2004 08:07:05 -0000 1.61 *************** *** 110,114 **** setfunc = fd->setfunc; } ! #ifdef Py_USING_UNICODE if (idict->getfunc == getentry("u")->getfunc) { struct fielddesc *fd = getentry("U"); --- 110,114 ---- setfunc = fd->setfunc; } ! #ifdef CTYPES_UNICODE if (idict->getfunc == getentry("u")->getfunc) { struct fielddesc *fd = getentry("U"); *************** *** 683,687 **** } ! #ifdef Py_USING_UNICODE /* u - a single wchar_t character */ static PyObject * --- 683,687 ---- } ! #ifdef CTYPES_UNICODE /* u - a single wchar_t character */ static PyObject * *************** *** 886,890 **** } ! #ifdef Py_USING_UNICODE static PyObject * Z_set(void *ptr, PyObject *value, unsigned size) --- 886,890 ---- } ! #ifdef CTYPES_UNICODE static PyObject * Z_set(void *ptr, PyObject *value, unsigned size) *************** *** 1088,1092 **** { 'P', P_set, P_get, &ffi_type_pointer}, { 'z', z_set, z_get, &ffi_type_pointer}, ! #ifdef Py_USING_UNICODE { 'u', u_set, u_get, NULL}, /* ffi_type set later */ { 'U', U_set, U_get, &ffi_type_pointer}, --- 1088,1092 ---- { 'P', P_set, P_get, &ffi_type_pointer}, { 'z', z_set, z_get, &ffi_type_pointer}, ! #ifdef CTYPES_UNICODE { 'u', u_set, u_get, NULL}, /* ffi_type set later */ { 'U', U_set, U_get, &ffi_type_pointer}, Index: _ctypes.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/_ctypes.c,v retrieving revision 1.171 retrieving revision 1.172 diff -C2 -d -r1.171 -r1.172 *** _ctypes.c 15 Oct 2004 19:00:09 -0000 1.171 --- _ctypes.c 18 Oct 2004 08:07:05 -0000 1.172 *************** *** 782,786 **** }; ! #ifdef Py_USING_UNICODE static PyObject * WCharArray_get_value(CDataObject *self) --- 782,786 ---- }; ! #ifdef CTYPES_UNICODE static PyObject * WCharArray_get_value(CDataObject *self) *************** *** 972,976 **** if (-1 == add_getset(result, CharArray_getsets)) return NULL; ! #ifdef Py_USING_UNICODE } else if (itemdict->getfunc == getentry("u")->getfunc) { if (-1 == add_getset(result, WCharArray_getsets)) --- 972,976 ---- if (-1 == add_getset(result, CharArray_getsets)) return NULL; ! #ifdef CTYPES_UNICODE } else if (itemdict->getfunc == getentry("u")->getfunc) { if (-1 == add_getset(result, WCharArray_getsets)) *************** *** 3031,3035 **** char *ptr = (char *)self->b_ptr; return PyString_FromStringAndSize(ptr + ilow, len); ! #ifdef Py_USING_UNICODE } else if (itemdict->getfunc == getentry("u")->getfunc) { wchar_t *ptr = (wchar_t *)self->b_ptr; --- 3031,3035 ---- char *ptr = (char *)self->b_ptr; return PyString_FromStringAndSize(ptr + ilow, len); ! #ifdef CTYPES_UNICODE } else if (itemdict->getfunc == getentry("u")->getfunc) { wchar_t *ptr = (wchar_t *)self->b_ptr; *************** *** 3560,3564 **** char *ptr = *(char **)self->b_ptr; return PyString_FromStringAndSize(ptr + ilow, len); ! #ifdef Py_USING_UNICODE } else if (itemdict->getfunc == getentry("u")->getfunc) { wchar_t *ptr = *(wchar_t **)self->b_ptr; --- 3560,3564 ---- char *ptr = *(char **)self->b_ptr; return PyString_FromStringAndSize(ptr + ilow, len); ! #ifdef CTYPES_UNICODE } else if (itemdict->getfunc == getentry("u")->getfunc) { wchar_t *ptr = *(wchar_t **)self->b_ptr; |