[Python-checkins] CVS: python/dist/src/Mac/Modules/cf _CFmodule.c,1.9,1.10
Jack Jansen
jackjansen@users.sourceforge.net
Tue, 01 Jan 2002 14:42:49 -0800
Update of /cvsroot/python/python/dist/src/Mac/Modules/cf
In directory usw-pr-cvs1:/tmp/cvs-serv10230/Python/Mac/Modules/cf
Modified Files:
_CFmodule.c
Log Message:
Added some support for unicode arguments.
Index: _CFmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/_CFmodule.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** _CFmodule.c 2001/12/18 15:38:34 1.9
--- _CFmodule.c 2002/01/01 22:42:47 1.10
***************
*** 2047,2050 ****
--- 2047,2070 ----
}
+ static PyObject *CFMutableStringRefObj_CFStringAppendCharacters(CFMutableStringRefObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+ UniChar *chars__in__;
+ UniCharCount chars__len__;
+ int chars__in_len__;
+ #ifndef CFStringAppendCharacters
+ PyMac_PRECHECK(CFStringAppendCharacters);
+ #endif
+ if (!PyArg_ParseTuple(_args, "u#",
+ &chars__in__, &chars__in_len__))
+ return NULL;
+ chars__len__ = chars__in_len__;
+ CFStringAppendCharacters(_self->ob_itself,
+ chars__in__, chars__len__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+ }
+
static PyObject *CFMutableStringRefObj_CFStringAppendPascalString(CFMutableStringRefObject *_self, PyObject *_args)
{
***************
*** 2218,2221 ****
--- 2238,2243 ----
{"CFStringAppend", (PyCFunction)CFMutableStringRefObj_CFStringAppend, 1,
"(CFStringRef appendedString) -> None"},
+ {"CFStringAppendCharacters", (PyCFunction)CFMutableStringRefObj_CFStringAppendCharacters, 1,
+ "(Buffer chars) -> None"},
{"CFStringAppendPascalString", (PyCFunction)CFMutableStringRefObj_CFStringAppendPascalString, 1,
"(Str255 pStr, CFStringEncoding encoding) -> None"},
***************
*** 3222,3225 ****
--- 3244,3268 ----
}
+ static PyObject *CF_CFStringCreateWithCharacters(PyObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ UniChar *chars__in__;
+ UniCharCount chars__len__;
+ int chars__in_len__;
+ #ifndef CFStringCreateWithCharacters
+ PyMac_PRECHECK(CFStringCreateWithCharacters);
+ #endif
+ if (!PyArg_ParseTuple(_args, "u#",
+ &chars__in__, &chars__in_len__))
+ return NULL;
+ chars__len__ = chars__in_len__;
+ _rv = CFStringCreateWithCharacters((CFAllocatorRef)NULL,
+ chars__in__, chars__len__);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+ }
+
static PyObject *CF_CFStringCreateWithPascalStringNoCopy(PyObject *_self, PyObject *_args)
{
***************
*** 3266,3269 ****
--- 3309,3334 ----
}
+ static PyObject *CF_CFStringCreateWithCharactersNoCopy(PyObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+ CFStringRef _rv;
+ UniChar *chars__in__;
+ UniCharCount chars__len__;
+ int chars__in_len__;
+ #ifndef CFStringCreateWithCharactersNoCopy
+ PyMac_PRECHECK(CFStringCreateWithCharactersNoCopy);
+ #endif
+ if (!PyArg_ParseTuple(_args, "u#",
+ &chars__in__, &chars__in_len__))
+ return NULL;
+ chars__len__ = chars__in_len__;
+ _rv = CFStringCreateWithCharactersNoCopy((CFAllocatorRef)NULL,
+ chars__in__, chars__len__,
+ (CFAllocatorRef)NULL);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, _rv);
+ return _res;
+ }
+
static PyObject *CF_CFStringCreateMutable(PyObject *_self, PyObject *_args)
{
***************
*** 3668,3675 ****
--- 3733,3744 ----
{"CFStringCreateWithCString", (PyCFunction)CF_CFStringCreateWithCString, 1,
"(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
+ {"CFStringCreateWithCharacters", (PyCFunction)CF_CFStringCreateWithCharacters, 1,
+ "(Buffer chars) -> (CFStringRef _rv)"},
{"CFStringCreateWithPascalStringNoCopy", (PyCFunction)CF_CFStringCreateWithPascalStringNoCopy, 1,
"(Str255 pStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
{"CFStringCreateWithCStringNoCopy", (PyCFunction)CF_CFStringCreateWithCStringNoCopy, 1,
"(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
+ {"CFStringCreateWithCharactersNoCopy", (PyCFunction)CF_CFStringCreateWithCharactersNoCopy, 1,
+ "(Buffer chars) -> (CFStringRef _rv)"},
{"CFStringCreateMutable", (PyCFunction)CF_CFStringCreateMutable, 1,
"(CFIndex maxLength) -> (CFMutableStringRef _rv)"},