[Python-checkins] CVS: python/dist/src/Mac/Modules/cf CFmodule.c,1.4,1.4.2.1 cfscan.py,1.4,1.4.2.1 cfsupport.py,1.5,1.5.2.1

Tim Peters tim_one@users.sourceforge.net
2001年7月17日 21:13:58 -0700


Update of /cvsroot/python/python/dist/src/Mac/Modules/cf
In directory usw-pr-cvs1:/tmp/cvs-serv20213/descr/dist/src/Mac/Modules/cf
Modified Files:
 Tag: descr-branch
	CFmodule.c cfscan.py cfsupport.py 
Log Message:
2.2a1 release: merge of trunk date2001-07-17a -> trunk date2001-07-17b.
Index: CFmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/CFmodule.c,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -C2 -r1.4 -r1.4.2.1
*** CFmodule.c	2001年07月04日 22:38:38	1.4
--- CFmodule.c	2001年07月18日 04:13:56	1.4.2.1
***************
*** 18,22 ****
 
 #ifdef WITHOUT_FRAMEWORKS
! #include <CoreFoundation.h>
 #else
 #include <CoreFoundation.h>
--- 18,27 ----
 
 #ifdef WITHOUT_FRAMEWORKS
! #include <CFBase.h>
! #include <CFArray.h>
! #include <CFData.h>
! #include <CFDictionary.h>
! #include <CFString.h>
! #include <CFURL.h>
 #else
 #include <CoreFoundation.h>
***************
*** 28,31 ****
--- 33,38 ----
 staticforward PyObject *CFStringRefObj_New(CFStringRef);
 staticforward int CFStringRefObj_Convert(PyObject *, CFStringRef *);
+ staticforward PyObject *CFURLRefObj_New(CFURLRef);
+ staticforward int CFURLRefObj_Convert(PyObject *, CFURLRef *);
 
 staticforward int CFURLRefObj_Convert(PyObject *, CFURLRef *);
***************
*** 343,346 ****
--- 350,366 ----
 }
 
+ static PyObject *CFArrayRefObj_CFArrayCreateCopy(CFArrayRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFArrayRef _rv;
+ 	if (!PyArg_ParseTuple(_args, ""))
+ 		return NULL;
+ 	_rv = CFArrayCreateCopy((CFAllocatorRef)NULL,
+ 	 _self->ob_itself);
+ 	_res = Py_BuildValue("O&",
+ 	 CFArrayRefObj_New, _rv);
+ 	return _res;
+ }
+ 
 static PyObject *CFArrayRefObj_CFArrayGetCount(CFArrayRefObject *_self, PyObject *_args)
 {
***************
*** 356,362 ****
--- 376,402 ----
 }
 
+ static PyObject *CFArrayRefObj_CFStringCreateByCombiningStrings(CFArrayRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFStringRef _rv;
+ 	CFStringRef separatorString;
+ 	if (!PyArg_ParseTuple(_args, "O&",
+ 	 CFStringRefObj_Convert, &separatorString))
+ 		return NULL;
+ 	_rv = CFStringCreateByCombiningStrings((CFAllocatorRef)NULL,
+ 	 _self->ob_itself,
+ 	 separatorString);
+ 	_res = Py_BuildValue("O&",
+ 	 CFStringRefObj_New, _rv);
+ 	return _res;
+ }
+ 
 static PyMethodDef CFArrayRefObj_methods[] = {
+ 	{"CFArrayCreateCopy", (PyCFunction)CFArrayRefObj_CFArrayCreateCopy, 1,
+ 	 "() -> (CFArrayRef _rv)"},
 	{"CFArrayGetCount", (PyCFunction)CFArrayRefObj_CFArrayGetCount, 1,
 	 "() -> (CFIndex _rv)"},
+ 	{"CFStringCreateByCombiningStrings", (PyCFunction)CFArrayRefObj_CFStringCreateByCombiningStrings, 1,
+ 	 "(CFStringRef separatorString) -> (CFStringRef _rv)"},
 	{NULL, NULL, 0}
 };
***************
*** 613,616 ****
--- 653,669 ----
 }
 
+ static PyObject *CFDictionaryRefObj_CFDictionaryCreateCopy(CFDictionaryRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFDictionaryRef _rv;
+ 	if (!PyArg_ParseTuple(_args, ""))
+ 		return NULL;
+ 	_rv = CFDictionaryCreateCopy((CFAllocatorRef)NULL,
+ 	 _self->ob_itself);
+ 	_res = Py_BuildValue("O&",
+ 	 CFDictionaryRefObj_New, _rv);
+ 	return _res;
+ }
+ 
 static PyObject *CFDictionaryRefObj_CFDictionaryGetCount(CFDictionaryRefObject *_self, PyObject *_args)
 {
***************
*** 627,630 ****
--- 680,685 ----
 
 static PyMethodDef CFDictionaryRefObj_methods[] = {
+ 	{"CFDictionaryCreateCopy", (PyCFunction)CFDictionaryRefObj_CFDictionaryCreateCopy, 1,
+ 	 "() -> (CFDictionaryRef _rv)"},
 	{"CFDictionaryGetCount", (PyCFunction)CFDictionaryRefObj_CFDictionaryGetCount, 1,
 	 "() -> (CFIndex _rv)"},
***************
*** 846,849 ****
--- 901,917 ----
 }
 
+ static PyObject *CFDataRefObj_CFDataCreateCopy(CFDataRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFDataRef _rv;
+ 	if (!PyArg_ParseTuple(_args, ""))
+ 		return NULL;
+ 	_rv = CFDataCreateCopy((CFAllocatorRef)NULL,
+ 	 _self->ob_itself);
+ 	_res = Py_BuildValue("O&",
+ 	 CFDataRefObj_New, _rv);
+ 	return _res;
+ }
+ 
 static PyObject *CFDataRefObj_CFDataGetLength(CFDataRefObject *_self, PyObject *_args)
 {
***************
*** 859,865 ****
--- 927,953 ----
 }
 
+ static PyObject *CFDataRefObj_CFStringCreateFromExternalRepresentation(CFDataRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFStringRef _rv;
+ 	CFStringEncoding encoding;
+ 	if (!PyArg_ParseTuple(_args, "l",
+ 	 &encoding))
+ 		return NULL;
+ 	_rv = CFStringCreateFromExternalRepresentation((CFAllocatorRef)NULL,
+ 	 _self->ob_itself,
+ 	 encoding);
+ 	_res = Py_BuildValue("O&",
+ 	 CFStringRefObj_New, _rv);
+ 	return _res;
+ }
+ 
 static PyMethodDef CFDataRefObj_methods[] = {
+ 	{"CFDataCreateCopy", (PyCFunction)CFDataRefObj_CFDataCreateCopy, 1,
+ 	 "() -> (CFDataRef _rv)"},
 	{"CFDataGetLength", (PyCFunction)CFDataRefObj_CFDataGetLength, 1,
 	 "() -> (CFIndex _rv)"},
+ 	{"CFStringCreateFromExternalRepresentation", (PyCFunction)CFDataRefObj_CFStringCreateFromExternalRepresentation, 1,
+ 	 "(CFStringEncoding encoding) -> (CFStringRef _rv)"},
 	{NULL, NULL, 0}
 };
***************
*** 1174,1177 ****
--- 1262,1294 ----
 }
 
+ static PyObject *CFStringRefObj_CFStringCreateWithSubstring(CFStringRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFStringRef _rv;
+ 	CFRange range;
+ 	if (!PyArg_ParseTuple(_args, "O&",
+ 	 CFRange_Convert, &range))
+ 		return NULL;
+ 	_rv = CFStringCreateWithSubstring((CFAllocatorRef)NULL,
+ 	 _self->ob_itself,
+ 	 range);
+ 	_res = Py_BuildValue("O&",
+ 	 CFStringRefObj_New, _rv);
+ 	return _res;
+ }
+ 
+ static PyObject *CFStringRefObj_CFStringCreateCopy(CFStringRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFStringRef _rv;
+ 	if (!PyArg_ParseTuple(_args, ""))
+ 		return NULL;
+ 	_rv = CFStringCreateCopy((CFAllocatorRef)NULL,
+ 	 _self->ob_itself);
+ 	_res = Py_BuildValue("O&",
+ 	 CFStringRefObj_New, _rv);
+ 	return _res;
+ }
+ 
 static PyObject *CFStringRefObj_CFStringGetLength(CFStringRefObject *_self, PyObject *_args)
 {
***************
*** 1221,1224 ****
--- 1338,1360 ----
 }
 
+ static PyObject *CFStringRefObj_CFStringCreateExternalRepresentation(CFStringRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFDataRef _rv;
+ 	CFStringEncoding encoding;
+ 	UInt8 lossByte;
+ 	if (!PyArg_ParseTuple(_args, "lb",
+ 	 &encoding,
+ 	 &lossByte))
+ 		return NULL;
+ 	_rv = CFStringCreateExternalRepresentation((CFAllocatorRef)NULL,
+ 	 _self->ob_itself,
+ 	 encoding,
+ 	 lossByte);
+ 	_res = Py_BuildValue("O&",
+ 	 CFDataRefObj_New, _rv);
+ 	return _res;
+ }
+ 
 static PyObject *CFStringRefObj_CFStringGetSmallestEncoding(CFStringRefObject *_self, PyObject *_args)
 {
***************
*** 1313,1316 ****
--- 1449,1474 ----
 }
 
+ static PyObject *CFStringRefObj_CFStringCreateArrayWithFindResults(CFStringRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFArrayRef _rv;
+ 	CFStringRef stringToFind;
+ 	CFRange rangeToSearch;
+ 	CFOptionFlags compareOptions;
+ 	if (!PyArg_ParseTuple(_args, "O&O&l",
+ 	 CFStringRefObj_Convert, &stringToFind,
+ 	 CFRange_Convert, &rangeToSearch,
+ 	 &compareOptions))
+ 		return NULL;
+ 	_rv = CFStringCreateArrayWithFindResults((CFAllocatorRef)NULL,
+ 	 _self->ob_itself,
+ 	 stringToFind,
+ 	 rangeToSearch,
+ 	 compareOptions);
+ 	_res = Py_BuildValue("O&",
+ 	 CFArrayRefObj_New, _rv);
+ 	return _res;
+ }
+ 
 static PyObject *CFStringRefObj_CFStringFind(CFStringRefObject *_self, PyObject *_args)
 {
***************
*** 1387,1390 ****
--- 1545,1564 ----
 }
 
+ static PyObject *CFStringRefObj_CFStringCreateArrayBySeparatingStrings(CFStringRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFArrayRef _rv;
+ 	CFStringRef separatorString;
+ 	if (!PyArg_ParseTuple(_args, "O&",
+ 	 CFStringRefObj_Convert, &separatorString))
+ 		return NULL;
+ 	_rv = CFStringCreateArrayBySeparatingStrings((CFAllocatorRef)NULL,
+ 	 _self->ob_itself,
+ 	 separatorString);
+ 	_res = Py_BuildValue("O&",
+ 	 CFArrayRefObj_New, _rv);
+ 	return _res;
+ }
+ 
 static PyObject *CFStringRefObj_CFStringGetIntValue(CFStringRefObject *_self, PyObject *_args)
 {
***************
*** 1438,1441 ****
--- 1612,1666 ----
 }
 
+ static PyObject *CFStringRefObj_CFURLCreateWithString(CFStringRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFURLRef _rv;
+ 	CFURLRef baseURL;
+ 	if (!PyArg_ParseTuple(_args, "O&",
+ 	 OptionalCFURLRefObj_Convert, &baseURL))
+ 		return NULL;
+ 	_rv = CFURLCreateWithString((CFAllocatorRef)NULL,
+ 	 _self->ob_itself,
+ 	 baseURL);
+ 	_res = Py_BuildValue("O&",
+ 	 CFURLRefObj_New, _rv);
+ 	return _res;
+ }
+ 
+ static PyObject *CFStringRefObj_CFURLCreateWithFileSystemPath(CFStringRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFURLRef _rv;
+ 	CFURLPathStyle pathStyle;
+ 	Boolean isDirectory;
+ 	if (!PyArg_ParseTuple(_args, "ll",
+ 	 &pathStyle,
+ 	 &isDirectory))
+ 		return NULL;
+ 	_rv = CFURLCreateWithFileSystemPath((CFAllocatorRef)NULL,
+ 	 _self->ob_itself,
+ 	 pathStyle,
+ 	 isDirectory);
+ 	_res = Py_BuildValue("O&",
+ 	 CFURLRefObj_New, _rv);
+ 	return _res;
+ }
+ 
+ static PyObject *CFStringRefObj_CFURLCreateStringByReplacingPercentEscapes(CFStringRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFStringRef _rv;
+ 	CFStringRef charactersToLeaveEscaped;
+ 	if (!PyArg_ParseTuple(_args, "O&",
+ 	 CFStringRefObj_Convert, &charactersToLeaveEscaped))
+ 		return NULL;
+ 	_rv = CFURLCreateStringByReplacingPercentEscapes((CFAllocatorRef)NULL,
+ 	 _self->ob_itself,
+ 	 charactersToLeaveEscaped);
+ 	_res = Py_BuildValue("O&",
+ 	 CFStringRefObj_New, _rv);
+ 	return _res;
+ }
+ 
 static PyObject *CFStringRefObj_CFStringGetString(CFStringRefObject *_self, PyObject *_args)
 {
***************
*** 1476,1483 ****
--- 1701,1714 ----
 
 static PyMethodDef CFStringRefObj_methods[] = {
+ 	{"CFStringCreateWithSubstring", (PyCFunction)CFStringRefObj_CFStringCreateWithSubstring, 1,
+ 	 "(CFRange range) -> (CFStringRef _rv)"},
+ 	{"CFStringCreateCopy", (PyCFunction)CFStringRefObj_CFStringCreateCopy, 1,
+ 	 "() -> (CFStringRef _rv)"},
 	{"CFStringGetLength", (PyCFunction)CFStringRefObj_CFStringGetLength, 1,
 	 "() -> (CFIndex _rv)"},
 	{"CFStringGetBytes", (PyCFunction)CFStringRefObj_CFStringGetBytes, 1,
 	 "(CFRange range, CFStringEncoding encoding, UInt8 lossByte, Boolean isExternalRepresentation, CFIndex maxBufLen) -> (CFIndex _rv, UInt8 buffer, CFIndex usedBufLen)"},
+ 	{"CFStringCreateExternalRepresentation", (PyCFunction)CFStringRefObj_CFStringCreateExternalRepresentation, 1,
+ 	 "(CFStringEncoding encoding, UInt8 lossByte) -> (CFDataRef _rv)"},
 	{"CFStringGetSmallestEncoding", (PyCFunction)CFStringRefObj_CFStringGetSmallestEncoding, 1,
 	 "() -> (CFStringEncoding _rv)"},
***************
*** 1490,1493 ****
--- 1721,1726 ----
 	{"CFStringFindWithOptions", (PyCFunction)CFStringRefObj_CFStringFindWithOptions, 1,
 	 "(CFStringRef stringToFind, CFRange rangeToSearch, CFOptionFlags searchOptions) -> (Boolean _rv, CFRange result)"},
+ 	{"CFStringCreateArrayWithFindResults", (PyCFunction)CFStringRefObj_CFStringCreateArrayWithFindResults, 1,
+ 	 "(CFStringRef stringToFind, CFRange rangeToSearch, CFOptionFlags compareOptions) -> (CFArrayRef _rv)"},
 	{"CFStringFind", (PyCFunction)CFStringRefObj_CFStringFind, 1,
 	 "(CFStringRef stringToFind, CFOptionFlags compareOptions) -> (CFRange _rv)"},
***************
*** 1498,1501 ****
--- 1731,1736 ----
 	{"CFStringGetLineBounds", (PyCFunction)CFStringRefObj_CFStringGetLineBounds, 1,
 	 "(CFRange range) -> (CFIndex lineBeginIndex, CFIndex lineEndIndex, CFIndex contentsEndIndex)"},
+ 	{"CFStringCreateArrayBySeparatingStrings", (PyCFunction)CFStringRefObj_CFStringCreateArrayBySeparatingStrings, 1,
+ 	 "(CFStringRef separatorString) -> (CFArrayRef _rv)"},
 	{"CFStringGetIntValue", (PyCFunction)CFStringRefObj_CFStringGetIntValue, 1,
 	 "() -> (SInt32 _rv)"},
***************
*** 1506,1509 ****
--- 1741,1750 ----
 	{"CFShowStr", (PyCFunction)CFStringRefObj_CFShowStr, 1,
 	 "() -> None"},
+ 	{"CFURLCreateWithString", (PyCFunction)CFStringRefObj_CFURLCreateWithString, 1,
+ 	 "(CFURLRef baseURL) -> (CFURLRef _rv)"},
+ 	{"CFURLCreateWithFileSystemPath", (PyCFunction)CFStringRefObj_CFURLCreateWithFileSystemPath, 1,
+ 	 "(CFURLPathStyle pathStyle, Boolean isDirectory) -> (CFURLRef _rv)"},
+ 	{"CFURLCreateStringByReplacingPercentEscapes", (PyCFunction)CFStringRefObj_CFURLCreateStringByReplacingPercentEscapes, 1,
+ 	 "(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)"},
 	{"CFStringGetString", (PyCFunction)CFStringRefObj_CFStringGetString, 1,
 	 "() -> (string _rv)"},
***************
*** 1898,1901 ****
--- 2139,2161 ----
 }
 
+ static PyObject *CFURLRefObj_CFURLCreateData(CFURLRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFDataRef _rv;
+ 	CFStringEncoding encoding;
+ 	Boolean escapeWhitespace;
+ 	if (!PyArg_ParseTuple(_args, "ll",
+ 	 &encoding,
+ 	 &escapeWhitespace))
+ 		return NULL;
+ 	_rv = CFURLCreateData((CFAllocatorRef)NULL,
+ 	 _self->ob_itself,
+ 	 encoding,
+ 	 escapeWhitespace);
+ 	_res = Py_BuildValue("O&",
+ 	 CFDataRefObj_New, _rv);
+ 	return _res;
+ }
+ 
 static PyObject *CFURLRefObj_CFURLCopyAbsoluteURL(CFURLRefObject *_self, PyObject *_args)
 {
***************
*** 2116,2119 ****
--- 2376,2381 ----
 
 static PyMethodDef CFURLRefObj_methods[] = {
+ 	{"CFURLCreateData", (PyCFunction)CFURLRefObj_CFURLCreateData, 1,
+ 	 "(CFStringEncoding encoding, Boolean escapeWhitespace) -> (CFDataRef _rv)"},
 	{"CFURLCopyAbsoluteURL", (PyCFunction)CFURLRefObj_CFURLCopyAbsoluteURL, 1,
 	 "() -> (CFURLRef _rv)"},
***************
*** 2263,2282 ****
 }
 
- static PyObject *CF_CFArrayCreateCopy(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	CFArrayRef _rv;
- 	CFArrayRef srcArray;
- 	PyMac_PRECHECK(CFArrayCreateCopy);
- 	if (!PyArg_ParseTuple(_args, "O&",
- 	 CFArrayRefObj_Convert, &srcArray))
- 		return NULL;
- 	_rv = CFArrayCreateCopy((CFAllocatorRef)NULL,
- 	 srcArray);
- 	_res = Py_BuildValue("O&",
- 	 CFArrayRefObj_New, _rv);
- 	return _res;
- }
- 
 static PyObject *CF_CFArrayCreateMutable(PyObject *_self, PyObject *_args)
 {
--- 2525,2528 ----
***************
*** 2369,2388 ****
 }
 
- static PyObject *CF_CFDataCreateCopy(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	CFDataRef _rv;
- 	CFDataRef data;
- 	PyMac_PRECHECK(CFDataCreateCopy);
- 	if (!PyArg_ParseTuple(_args, "O&",
- 	 CFDataRefObj_Convert, &data))
- 		return NULL;
- 	_rv = CFDataCreateCopy((CFAllocatorRef)NULL,
- 	 data);
- 	_res = Py_BuildValue("O&",
- 	 CFDataRefObj_New, _rv);
- 	return _res;
- }
- 
 static PyObject *CF_CFDataCreateMutable(PyObject *_self, PyObject *_args)
 {
--- 2615,2618 ----
***************
*** 2433,2452 ****
 }
 
- static PyObject *CF_CFDictionaryCreateCopy(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	CFDictionaryRef _rv;
- 	CFDictionaryRef dict;
- 	PyMac_PRECHECK(CFDictionaryCreateCopy);
- 	if (!PyArg_ParseTuple(_args, "O&",
- 	 CFDictionaryRefObj_Convert, &dict))
- 		return NULL;
- 	_rv = CFDictionaryCreateCopy((CFAllocatorRef)NULL,
- 	 dict);
- 	_res = Py_BuildValue("O&",
- 	 CFDictionaryRefObj_New, _rv);
- 	return _res;
- }
- 
 static PyObject *CF_CFDictionaryCreateMutable(PyObject *_self, PyObject *_args)
 {
--- 2663,2666 ----
***************
*** 2577,2615 ****
 }
 
- static PyObject *CF_CFStringCreateWithSubstring(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	CFStringRef _rv;
- 	CFStringRef str;
- 	CFRange range;
- 	PyMac_PRECHECK(CFStringCreateWithSubstring);
- 	if (!PyArg_ParseTuple(_args, "O&O&",
- 	 CFStringRefObj_Convert, &str,
- 	 CFRange_Convert, &range))
- 		return NULL;
- 	_rv = CFStringCreateWithSubstring((CFAllocatorRef)NULL,
- 	 str,
- 	 range);
- 	_res = Py_BuildValue("O&",
- 	 CFStringRefObj_New, _rv);
- 	return _res;
- }
- 
- static PyObject *CF_CFStringCreateCopy(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	CFStringRef _rv;
- 	CFStringRef theString;
- 	PyMac_PRECHECK(CFStringCreateCopy);
- 	if (!PyArg_ParseTuple(_args, "O&",
- 	 CFStringRefObj_Convert, &theString))
- 		return NULL;
- 	_rv = CFStringCreateCopy((CFAllocatorRef)NULL,
- 	 theString);
- 	_res = Py_BuildValue("O&",
- 	 CFStringRefObj_New, _rv);
- 	return _res;
- }
- 
 static PyObject *CF_CFStringCreateMutable(PyObject *_self, PyObject *_args)
 {
--- 2791,2794 ----
***************
*** 2673,2717 ****
 }
 
- static PyObject *CF_CFStringCreateFromExternalRepresentation(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	CFStringRef _rv;
- 	CFDataRef data;
- 	CFStringEncoding encoding;
- 	PyMac_PRECHECK(CFStringCreateFromExternalRepresentation);
- 	if (!PyArg_ParseTuple(_args, "O&l",
- 	 CFDataRefObj_Convert, &data,
- 	 &encoding))
- 		return NULL;
- 	_rv = CFStringCreateFromExternalRepresentation((CFAllocatorRef)NULL,
- 	 data,
- 	 encoding);
- 	_res = Py_BuildValue("O&",
- 	 CFStringRefObj_New, _rv);
- 	return _res;
- }
- 
- static PyObject *CF_CFStringCreateExternalRepresentation(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	CFDataRef _rv;
- 	CFStringRef theString;
- 	CFStringEncoding encoding;
- 	UInt8 lossByte;
- 	PyMac_PRECHECK(CFStringCreateExternalRepresentation);
- 	if (!PyArg_ParseTuple(_args, "O&lb",
- 	 CFStringRefObj_Convert, &theString,
- 	 &encoding,
- 	 &lossByte))
- 		return NULL;
- 	_rv = CFStringCreateExternalRepresentation((CFAllocatorRef)NULL,
- 	 theString,
- 	 encoding,
- 	 lossByte);
- 	_res = Py_BuildValue("O&",
- 	 CFDataRefObj_New, _rv);
- 	return _res;
- }
- 
 static PyObject *CF_CFStringGetSystemEncoding(PyObject *_self, PyObject *_args)
 {
--- 2852,2855 ----
***************
*** 2745,2811 ****
 }
 
- static PyObject *CF_CFStringCreateArrayWithFindResults(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	CFArrayRef _rv;
- 	CFStringRef theString;
- 	CFStringRef stringToFind;
- 	CFRange rangeToSearch;
- 	CFOptionFlags compareOptions;
- 	PyMac_PRECHECK(CFStringCreateArrayWithFindResults);
- 	if (!PyArg_ParseTuple(_args, "O&O&O&l",
- 	 CFStringRefObj_Convert, &theString,
- 	 CFStringRefObj_Convert, &stringToFind,
- 	 CFRange_Convert, &rangeToSearch,
- 	 &compareOptions))
- 		return NULL;
- 	_rv = CFStringCreateArrayWithFindResults((CFAllocatorRef)NULL,
- 	 theString,
- 	 stringToFind,
- 	 rangeToSearch,
- 	 compareOptions);
- 	_res = Py_BuildValue("O&",
- 	 CFArrayRefObj_New, _rv);
- 	return _res;
- }
- 
- static PyObject *CF_CFStringCreateByCombiningStrings(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	CFStringRef _rv;
- 	CFArrayRef theArray;
- 	CFStringRef separatorString;
- 	PyMac_PRECHECK(CFStringCreateByCombiningStrings);
- 	if (!PyArg_ParseTuple(_args, "O&O&",
- 	 CFArrayRefObj_Convert, &theArray,
- 	 CFStringRefObj_Convert, &separatorString))
- 		return NULL;
- 	_rv = CFStringCreateByCombiningStrings((CFAllocatorRef)NULL,
- 	 theArray,
- 	 separatorString);
- 	_res = Py_BuildValue("O&",
- 	 CFStringRefObj_New, _rv);
- 	return _res;
- }
- 
- static PyObject *CF_CFStringCreateArrayBySeparatingStrings(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	CFArrayRef _rv;
- 	CFStringRef theString;
- 	CFStringRef separatorString;
- 	PyMac_PRECHECK(CFStringCreateArrayBySeparatingStrings);
- 	if (!PyArg_ParseTuple(_args, "O&O&",
- 	 CFStringRefObj_Convert, &theString,
- 	 CFStringRefObj_Convert, &separatorString))
- 		return NULL;
- 	_rv = CFStringCreateArrayBySeparatingStrings((CFAllocatorRef)NULL,
- 	 theString,
- 	 separatorString);
- 	_res = Py_BuildValue("O&",
- 	 CFArrayRefObj_New, _rv);
- 	return _res;
- }
- 
 static PyObject *CF_CFStringIsEncodingAvailable(PyObject *_self, PyObject *_args)
 {
--- 2883,2886 ----
***************
*** 2967,3074 ****
 }
 
- static PyObject *CF_CFURLCreateData(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	CFDataRef _rv;
- 	CFURLRef url;
- 	CFStringEncoding encoding;
- 	Boolean escapeWhitespace;
- 	PyMac_PRECHECK(CFURLCreateData);
- 	if (!PyArg_ParseTuple(_args, "O&ll",
- 	 CFURLRefObj_Convert, &url,
- 	 &encoding,
- 	 &escapeWhitespace))
- 		return NULL;
- 	_rv = CFURLCreateData((CFAllocatorRef)NULL,
- 	 url,
- 	 encoding,
- 	 escapeWhitespace);
- 	_res = Py_BuildValue("O&",
- 	 CFDataRefObj_New, _rv);
- 	return _res;
- }
- 
- static PyObject *CF_CFURLCreateWithString(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	CFURLRef _rv;
- 	CFStringRef URLString;
- 	CFURLRef baseURL;
- 	PyMac_PRECHECK(CFURLCreateWithString);
- 	if (!PyArg_ParseTuple(_args, "O&O&",
- 	 CFStringRefObj_Convert, &URLString,
- 	 OptionalCFURLRefObj_Convert, &baseURL))
- 		return NULL;
- 	_rv = CFURLCreateWithString((CFAllocatorRef)NULL,
- 	 URLString,
- 	 baseURL);
- 	_res = Py_BuildValue("O&",
- 	 CFURLRefObj_New, _rv);
- 	return _res;
- }
- 
- static PyObject *CF_CFURLCreateWithFileSystemPath(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	CFURLRef _rv;
- 	CFStringRef filePath;
- 	CFURLPathStyle pathStyle;
- 	Boolean isDirectory;
- 	PyMac_PRECHECK(CFURLCreateWithFileSystemPath);
- 	if (!PyArg_ParseTuple(_args, "O&ll",
- 	 CFStringRefObj_Convert, &filePath,
- 	 &pathStyle,
- 	 &isDirectory))
- 		return NULL;
- 	_rv = CFURLCreateWithFileSystemPath((CFAllocatorRef)NULL,
- 	 filePath,
- 	 pathStyle,
- 	 isDirectory);
- 	_res = Py_BuildValue("O&",
- 	 CFURLRefObj_New, _rv);
- 	return _res;
- }
- 
- static PyObject *CF_CFURLCreateStringWithFileSystemPath(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	CFStringRef _rv;
- 	CFURLRef anURL;
- 	CFURLPathStyle pathStyle;
- 	Boolean resolveAgainstBase;
- 	PyMac_PRECHECK(CFURLCreateStringWithFileSystemPath);
- 	if (!PyArg_ParseTuple(_args, "O&ll",
- 	 CFURLRefObj_Convert, &anURL,
- 	 &pathStyle,
- 	 &resolveAgainstBase))
- 		return NULL;
- 	_rv = CFURLCreateStringWithFileSystemPath((CFAllocatorRef)NULL,
- 	 anURL,
- 	 pathStyle,
- 	 resolveAgainstBase);
- 	_res = Py_BuildValue("O&",
- 	 CFStringRefObj_New, _rv);
- 	return _res;
- }
- 
- static PyObject *CF_CFURLCreateStringByReplacingPercentEscapes(PyObject *_self, PyObject *_args)
- {
- 	PyObject *_res = NULL;
- 	CFStringRef _rv;
- 	CFStringRef originalString;
- 	CFStringRef charactersToLeaveEscaped;
- 	PyMac_PRECHECK(CFURLCreateStringByReplacingPercentEscapes);
- 	if (!PyArg_ParseTuple(_args, "O&O&",
- 	 CFStringRefObj_Convert, &originalString,
- 	 CFStringRefObj_Convert, &charactersToLeaveEscaped))
- 		return NULL;
- 	_rv = CFURLCreateStringByReplacingPercentEscapes((CFAllocatorRef)NULL,
- 	 originalString,
- 	 charactersToLeaveEscaped);
- 	_res = Py_BuildValue("O&",
- 	 CFStringRefObj_New, _rv);
- 	return _res;
- }
- 
 static PyMethodDef CF_methods[] = {
 	{"CFAllocatorGetTypeID", (PyCFunction)CF_CFAllocatorGetTypeID, 1,
--- 3042,3045 ----
***************
*** 3080,3085 ****
 	{"CFArrayGetTypeID", (PyCFunction)CF_CFArrayGetTypeID, 1,
 	 "() -> (CFTypeID _rv)"},
- 	{"CFArrayCreateCopy", (PyCFunction)CF_CFArrayCreateCopy, 1,
- 	 "(CFArrayRef srcArray) -> (CFArrayRef _rv)"},
 	{"CFArrayCreateMutable", (PyCFunction)CF_CFArrayCreateMutable, 1,
 	 "(CFIndex capacity) -> (CFMutableArrayRef _rv)"},
--- 3051,3054 ----
***************
*** 3092,3097 ****
 	{"CFDataCreateWithBytesNoCopy", (PyCFunction)CF_CFDataCreateWithBytesNoCopy, 1,
 	 "(Buffer bytes) -> (CFDataRef _rv)"},
- 	{"CFDataCreateCopy", (PyCFunction)CF_CFDataCreateCopy, 1,
- 	 "(CFDataRef data) -> (CFDataRef _rv)"},
 	{"CFDataCreateMutable", (PyCFunction)CF_CFDataCreateMutable, 1,
 	 "(CFIndex capacity) -> (CFMutableDataRef _rv)"},
--- 3061,3064 ----
***************
*** 3100,3105 ****
 	{"CFDictionaryGetTypeID", (PyCFunction)CF_CFDictionaryGetTypeID, 1,
 	 "() -> (CFTypeID _rv)"},
- 	{"CFDictionaryCreateCopy", (PyCFunction)CF_CFDictionaryCreateCopy, 1,
- 	 "(CFDictionaryRef dict) -> (CFDictionaryRef _rv)"},
 	{"CFDictionaryCreateMutable", (PyCFunction)CF_CFDictionaryCreateMutable, 1,
 	 "(CFIndex capacity) -> (CFMutableDictionaryRef _rv)"},
--- 3067,3070 ----
***************
*** 3116,3123 ****
 	{"CFStringCreateWithCStringNoCopy", (PyCFunction)CF_CFStringCreateWithCStringNoCopy, 1,
 	 "(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
- 	{"CFStringCreateWithSubstring", (PyCFunction)CF_CFStringCreateWithSubstring, 1,
- 	 "(CFStringRef str, CFRange range) -> (CFStringRef _rv)"},
- 	{"CFStringCreateCopy", (PyCFunction)CF_CFStringCreateCopy, 1,
- 	 "(CFStringRef theString) -> (CFStringRef _rv)"},
 	{"CFStringCreateMutable", (PyCFunction)CF_CFStringCreateMutable, 1,
 	 "(CFIndex maxLength) -> (CFMutableStringRef _rv)"},
--- 3081,3084 ----
***************
*** 3126,3143 ****
 	{"CFStringCreateWithBytes", (PyCFunction)CF_CFStringCreateWithBytes, 1,
 	 "(Buffer bytes, CFStringEncoding encoding, Boolean isExternalRepresentation) -> (CFStringRef _rv)"},
- 	{"CFStringCreateFromExternalRepresentation", (PyCFunction)CF_CFStringCreateFromExternalRepresentation, 1,
- 	 "(CFDataRef data, CFStringEncoding encoding) -> (CFStringRef _rv)"},
- 	{"CFStringCreateExternalRepresentation", (PyCFunction)CF_CFStringCreateExternalRepresentation, 1,
- 	 "(CFStringRef theString, CFStringEncoding encoding, UInt8 lossByte) -> (CFDataRef _rv)"},
 	{"CFStringGetSystemEncoding", (PyCFunction)CF_CFStringGetSystemEncoding, 1,
 	 "() -> (CFStringEncoding _rv)"},
 	{"CFStringGetMaximumSizeForEncoding", (PyCFunction)CF_CFStringGetMaximumSizeForEncoding, 1,
 	 "(CFIndex length, CFStringEncoding encoding) -> (CFIndex _rv)"},
- 	{"CFStringCreateArrayWithFindResults", (PyCFunction)CF_CFStringCreateArrayWithFindResults, 1,
- 	 "(CFStringRef theString, CFStringRef stringToFind, CFRange rangeToSearch, CFOptionFlags compareOptions) -> (CFArrayRef _rv)"},
- 	{"CFStringCreateByCombiningStrings", (PyCFunction)CF_CFStringCreateByCombiningStrings, 1,
- 	 "(CFArrayRef theArray, CFStringRef separatorString) -> (CFStringRef _rv)"},
- 	{"CFStringCreateArrayBySeparatingStrings", (PyCFunction)CF_CFStringCreateArrayBySeparatingStrings, 1,
- 	 "(CFStringRef theString, CFStringRef separatorString) -> (CFArrayRef _rv)"},
 	{"CFStringIsEncodingAvailable", (PyCFunction)CF_CFStringIsEncodingAvailable, 1,
 	 "(CFStringEncoding encoding) -> (Boolean _rv)"},
--- 3087,3094 ----
***************
*** 3160,3173 ****
 	{"CFURLCreateWithBytes", (PyCFunction)CF_CFURLCreateWithBytes, 1,
 	 "(Buffer URLBytes, CFStringEncoding encoding, CFURLRef baseURL) -> (CFURLRef _rv)"},
- 	{"CFURLCreateData", (PyCFunction)CF_CFURLCreateData, 1,
- 	 "(CFURLRef url, CFStringEncoding encoding, Boolean escapeWhitespace) -> (CFDataRef _rv)"},
- 	{"CFURLCreateWithString", (PyCFunction)CF_CFURLCreateWithString, 1,
- 	 "(CFStringRef URLString, CFURLRef baseURL) -> (CFURLRef _rv)"},
- 	{"CFURLCreateWithFileSystemPath", (PyCFunction)CF_CFURLCreateWithFileSystemPath, 1,
- 	 "(CFStringRef filePath, CFURLPathStyle pathStyle, Boolean isDirectory) -> (CFURLRef _rv)"},
- 	{"CFURLCreateStringWithFileSystemPath", (PyCFunction)CF_CFURLCreateStringWithFileSystemPath, 1,
- 	 "(CFURLRef anURL, CFURLPathStyle pathStyle, Boolean resolveAgainstBase) -> (CFStringRef _rv)"},
- 	{"CFURLCreateStringByReplacingPercentEscapes", (PyCFunction)CF_CFURLCreateStringByReplacingPercentEscapes, 1,
- 	 "(CFStringRef originalString, CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)"},
 	{NULL, NULL, 0}
 };
--- 3111,3114 ----
Index: cfscan.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/cfscan.py,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -C2 -r1.4 -r1.4.2.1
*** cfscan.py	2001年07月01日 22:03:55	1.4
--- cfscan.py	2001年07月18日 04:13:56	1.4.2.1
***************
*** 59,62 ****
--- 59,68 ----
 				classname = "Method"
 				listname = t + "_methods"
+ 			# Special case for the silly first AllocatorRef argument
+ 			if t == 'CFAllocatorRef' and m == 'InMode' and len(arglist) > 1:
+ 				t, n, m = arglist[1]
+ 				if t in OBJECTS and m == "InMode":
+ 					classname = "MethodSkipArg1"
+ 					listname = t + "_methods"
 		return classname, listname
 
***************
*** 86,92 ****
 			"CFStringGetCString", 
 			"CFStringGetCharacters",
! 			# OSX only, to be done
! ##			"CFURLCreateWithFileSystemPath",
! ##			"CFURLCreateStringWithFileSystemPath",
 			]
 
--- 92,96 ----
 			"CFStringGetCString", 
 			"CFStringGetCharacters",
! 			"CFURLCreateStringWithFileSystemPath", # Gone in later releases
 			]
 
Index: cfsupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/cfsupport.py,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -C2 -r1.5 -r1.5.2.1
*** cfsupport.py	2001年07月04日 22:38:52	1.5
--- cfsupport.py	2001年07月18日 04:13:56	1.5.2.1
***************
*** 18,26 ****
 from macsupport import *
 
 # Create the type objects
 
 includestuff = includestuff + """
 #ifdef WITHOUT_FRAMEWORKS
! #include <CoreFoundation.h>
 #else
 #include <CoreFoundation.h>
--- 18,53 ----
 from macsupport import *
 
+ # Special case generator for the functions that have an AllocatorRef first argument,
+ # which we skip anyway, and the object as the second arg.
+ class MethodSkipArg1(MethodGenerator):
+ 	"""Similar to MethodGenerator, but has self as last argument"""
+ 
+ 	def parseArgumentList(self, args):
+ 		if len(args) < 2:
+ 			raise ValueError, "MethodSkipArg1 expects at least 2 args"
+ 		a0, a1, args = args[0], args[1], args[2:]
+ 		t0, n0, m0 = a0
+ 		if t0 != "CFAllocatorRef" and m0 != InMode:
+ 			raise ValueError, "MethodSkipArg1 should have dummy AllocatorRef first arg"
+ 		t1, n1, m1 = a1
+ 		if m1 != InMode:
+ 			raise ValueError, "method's 'self' must be 'InMode'"
+ 		dummy = Variable(t0, n0, m0)
+ 		self.argumentList.append(dummy)
+ 		self.itself = Variable(t1, "_self->ob_itself", SelfMode)
+ 		self.argumentList.append(self.itself)
+ 		FunctionGenerator.parseArgumentList(self, args)
+ 
+ 
 # Create the type objects
 
 includestuff = includestuff + """
 #ifdef WITHOUT_FRAMEWORKS
! #include <CFBase.h>
! #include <CFArray.h>
! #include <CFData.h>
! #include <CFDictionary.h>
! #include <CFString.h>
! #include <CFURL.h>
 #else
 #include <CoreFoundation.h>
***************
*** 32,35 ****
--- 59,64 ----
 staticforward PyObject *CFStringRefObj_New(CFStringRef);
 staticforward int CFStringRefObj_Convert(PyObject *, CFStringRef *);
+ staticforward PyObject *CFURLRefObj_New(CFURLRef);
+ staticforward int CFURLRefObj_Convert(PyObject *, CFURLRef *);
 
 staticforward int CFURLRefObj_Convert(PyObject *, CFURLRef *);

AltStyle によって変換されたページ (->オリジナル) /