[Python-checkins] CVS: python/dist/src/Mac/Modules/cf _CFmodule.c,1.7,1.7.2.1 cfsupport.py,1.12,1.12.4.1

Jack Jansen jackjansen@users.sourceforge.net
Wed, 19 Dec 2001 07:10:46 -0800


Update of /cvsroot/python/python/dist/src/Mac/Modules/cf
In directory usw-pr-cvs1:/tmp/cvs-serv12554/Modules/cf

Modified Files:
      Tag: r22rc1-branch
	_CFmodule.c cfsupport.py 
Log Message:
Merged Mac subtree into the 22c1 branch.


Index: _CFmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/_CFmodule.c,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -C2 -d -r1.7 -r1.7.2.1
*** _CFmodule.c	2001/12/08 18:02:52	1.7
--- _CFmodule.c	2001/12/19 15:10:14	1.7.2.1
***************
*** 6,11 ****
--- 6,15 ----
  
  
+ #ifdef _WIN32
+ #include "pywintoolbox.h"
+ #else
  #include "macglue.h"
  #include "pymactoolbox.h"
+ #endif
  
  /* Macro to test whether a weak-loaded CFM function exists */
***************
*** 605,608 ****
--- 609,632 ----
  }
  
+ static PyObject *CFMutableArrayRefObj_CFArrayAppendArray(CFMutableArrayRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFArrayRef otherArray;
+ 	CFRange otherRange;
+ #ifndef CFArrayAppendArray
+ 	PyMac_PRECHECK(CFArrayAppendArray);
+ #endif
+ 	if (!PyArg_ParseTuple(_args, "O&O&",
+ 	                      CFArrayRefObj_Convert, &otherArray,
+ 	                      CFRange_Convert, &otherRange))
+ 		return NULL;
+ 	CFArrayAppendArray(_self->ob_itself,
+ 	                   otherArray,
+ 	                   otherRange);
+ 	Py_INCREF(Py_None);
+ 	_res = Py_None;
+ 	return _res;
+ }
+ 
  static PyMethodDef CFMutableArrayRefObj_methods[] = {
  	{"CFArrayRemoveValueAtIndex", (PyCFunction)CFMutableArrayRefObj_CFArrayRemoveValueAtIndex, 1,
***************
*** 612,615 ****
--- 636,641 ----
  	{"CFArrayExchangeValuesAtIndices", (PyCFunction)CFMutableArrayRefObj_CFArrayExchangeValuesAtIndices, 1,
  	 "(CFIndex idx1, CFIndex idx2) -> None"},
+ 	{"CFArrayAppendArray", (PyCFunction)CFMutableArrayRefObj_CFArrayAppendArray, 1,
+ 	 "(CFArrayRef otherArray, CFRange otherRange) -> None"},
  	{NULL, NULL, 0}
  };
***************
*** 1469,1473 ****
  	PyObject *_res = NULL;
  	CFComparisonResult _rv;
! 	CFStringRef string2;
  	CFRange rangeToCompare;
  	CFOptionFlags compareOptions;
--- 1495,1499 ----
  	PyObject *_res = NULL;
  	CFComparisonResult _rv;
! 	CFStringRef theString2;
  	CFRange rangeToCompare;
  	CFOptionFlags compareOptions;
***************
*** 1476,1485 ****
  #endif
  	if (!PyArg_ParseTuple(_args, "O&O&l",
! 	                      CFStringRefObj_Convert, &string2,
  	                      CFRange_Convert, &rangeToCompare,
  	                      &compareOptions))
  		return NULL;
  	_rv = CFStringCompareWithOptions(_self->ob_itself,
! 	                                 string2,
  	                                 rangeToCompare,
  	                                 compareOptions);
--- 1502,1511 ----
  #endif
  	if (!PyArg_ParseTuple(_args, "O&O&l",
! 	                      CFStringRefObj_Convert, &theString2,
  	                      CFRange_Convert, &rangeToCompare,
  	                      &compareOptions))
  		return NULL;
  	_rv = CFStringCompareWithOptions(_self->ob_itself,
! 	                                 theString2,
  	                                 rangeToCompare,
  	                                 compareOptions);
***************
*** 1493,1497 ****
  	PyObject *_res = NULL;
  	CFComparisonResult _rv;
! 	CFStringRef string2;
  	CFOptionFlags compareOptions;
  #ifndef CFStringCompare
--- 1519,1523 ----
  	PyObject *_res = NULL;
  	CFComparisonResult _rv;
! 	CFStringRef theString2;
  	CFOptionFlags compareOptions;
  #ifndef CFStringCompare
***************
*** 1499,1507 ****
  #endif
  	if (!PyArg_ParseTuple(_args, "O&l",
! 	                      CFStringRefObj_Convert, &string2,
  	                      &compareOptions))
  		return NULL;
  	_rv = CFStringCompare(_self->ob_itself,
! 	                      string2,
  	                      compareOptions);
  	_res = Py_BuildValue("l",
--- 1525,1533 ----
  #endif
  	if (!PyArg_ParseTuple(_args, "O&l",
! 	                      CFStringRefObj_Convert, &theString2,
  	                      &compareOptions))
  		return NULL;
  	_rv = CFStringCompare(_self->ob_itself,
! 	                      theString2,
  	                      compareOptions);
  	_res = Py_BuildValue("l",
***************
*** 1751,1754 ****
--- 1777,1802 ----
  }
  
+ static PyObject *CFStringRefObj_CFURLCreateWithFileSystemPathRelativeToBase(CFStringRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFURLRef _rv;
+ 	CFURLPathStyle pathStyle;
+ 	Boolean isDirectory;
+ 	CFURLRef baseURL;
+ 	if (!PyArg_ParseTuple(_args, "llO&",
+ 	                      &pathStyle,
+ 	                      &isDirectory,
+ 	                      OptionalCFURLRefObj_Convert, &baseURL))
+ 		return NULL;
+ 	_rv = CFURLCreateWithFileSystemPathRelativeToBase((CFAllocatorRef)NULL,
+ 	                                                  _self->ob_itself,
+ 	                                                  pathStyle,
+ 	                                                  isDirectory,
+ 	                                                  baseURL);
+ 	_res = Py_BuildValue("O&",
+ 	                     CFURLRefObj_New, _rv);
+ 	return _res;
+ }
+ 
  static PyObject *CFStringRefObj_CFURLCreateStringByReplacingPercentEscapes(CFStringRefObject *_self, PyObject *_args)
  {
***************
*** 1767,1770 ****
--- 1815,1840 ----
  }
  
+ static PyObject *CFStringRefObj_CFURLCreateStringByAddingPercentEscapes(CFStringRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFStringRef _rv;
+ 	CFStringRef charactersToLeaveUnescaped;
+ 	CFStringRef legalURLCharactersToBeEscaped;
+ 	CFStringEncoding encoding;
+ 	if (!PyArg_ParseTuple(_args, "O&O&l",
+ 	                      CFStringRefObj_Convert, &charactersToLeaveUnescaped,
+ 	                      CFStringRefObj_Convert, &legalURLCharactersToBeEscaped,
+ 	                      &encoding))
+ 		return NULL;
+ 	_rv = CFURLCreateStringByAddingPercentEscapes((CFAllocatorRef)NULL,
+ 	                                              _self->ob_itself,
+ 	                                              charactersToLeaveUnescaped,
+ 	                                              legalURLCharactersToBeEscaped,
+ 	                                              encoding);
+ 	_res = Py_BuildValue("O&",
+ 	                     CFStringRefObj_New, _rv);
+ 	return _res;
+ }
+ 
  static PyObject *CFStringRefObj_CFStringGetString(CFStringRefObject *_self, PyObject *_args)
  {
***************
*** 1820,1826 ****
  	 "() -> (CFStringEncoding _rv)"},
  	{"CFStringCompareWithOptions", (PyCFunction)CFStringRefObj_CFStringCompareWithOptions, 1,
! 	 "(CFStringRef string2, CFRange rangeToCompare, CFOptionFlags compareOptions) -> (CFComparisonResult _rv)"},
  	{"CFStringCompare", (PyCFunction)CFStringRefObj_CFStringCompare, 1,
! 	 "(CFStringRef string2, CFOptionFlags compareOptions) -> (CFComparisonResult _rv)"},
  	{"CFStringFindWithOptions", (PyCFunction)CFStringRefObj_CFStringFindWithOptions, 1,
  	 "(CFStringRef stringToFind, CFRange rangeToSearch, CFOptionFlags searchOptions) -> (Boolean _rv, CFRange result)"},
--- 1890,1896 ----
  	 "() -> (CFStringEncoding _rv)"},
  	{"CFStringCompareWithOptions", (PyCFunction)CFStringRefObj_CFStringCompareWithOptions, 1,
! 	 "(CFStringRef theString2, CFRange rangeToCompare, CFOptionFlags compareOptions) -> (CFComparisonResult _rv)"},
  	{"CFStringCompare", (PyCFunction)CFStringRefObj_CFStringCompare, 1,
! 	 "(CFStringRef theString2, CFOptionFlags compareOptions) -> (CFComparisonResult _rv)"},
  	{"CFStringFindWithOptions", (PyCFunction)CFStringRefObj_CFStringFindWithOptions, 1,
  	 "(CFStringRef stringToFind, CFRange rangeToSearch, CFOptionFlags searchOptions) -> (Boolean _rv, CFRange result)"},
***************
*** 1849,1854 ****
--- 1919,1928 ----
  	{"CFURLCreateWithFileSystemPath", (PyCFunction)CFStringRefObj_CFURLCreateWithFileSystemPath, 1,
  	 "(CFURLPathStyle pathStyle, Boolean isDirectory) -> (CFURLRef _rv)"},
+ 	{"CFURLCreateWithFileSystemPathRelativeToBase", (PyCFunction)CFStringRefObj_CFURLCreateWithFileSystemPathRelativeToBase, 1,
+ 	 "(CFURLPathStyle pathStyle, Boolean isDirectory, CFURLRef baseURL) -> (CFURLRef _rv)"},
  	{"CFURLCreateStringByReplacingPercentEscapes", (PyCFunction)CFStringRefObj_CFURLCreateStringByReplacingPercentEscapes, 1,
  	 "(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)"},
+ 	{"CFURLCreateStringByAddingPercentEscapes", (PyCFunction)CFStringRefObj_CFURLCreateStringByAddingPercentEscapes, 1,
+ 	 "(CFStringRef charactersToLeaveUnescaped, CFStringRef legalURLCharactersToBeEscaped, CFStringEncoding encoding) -> (CFStringRef _rv)"},
  	{"CFStringGetString", (PyCFunction)CFStringRefObj_CFStringGetString, 1,
  	 "() -> (string _rv)"},
***************
*** 1976,1980 ****
  {
  	PyObject *_res = NULL;
! 	StringPtr pStr;
  	CFStringEncoding encoding;
  #ifndef CFStringAppendPascalString
--- 2050,2054 ----
  {
  	PyObject *_res = NULL;
! 	Str255 pStr;
  	CFStringEncoding encoding;
  #ifndef CFStringAppendPascalString
***************
*** 1982,1986 ****
  #endif
  	if (!PyArg_ParseTuple(_args, "O&l",
! 	                      PyMac_GetStr255, &pStr,
  	                      &encoding))
  		return NULL;
--- 2056,2060 ----
  #endif
  	if (!PyArg_ParseTuple(_args, "O&l",
! 	                      PyMac_GetStr255, pStr,
  	                      &encoding))
  		return NULL;
***************
*** 2145,2149 ****
  	 "(CFStringRef appendedString) -> None"},
  	{"CFStringAppendPascalString", (PyCFunction)CFMutableStringRefObj_CFStringAppendPascalString, 1,
! 	 "(StringPtr pStr, CFStringEncoding encoding) -> None"},
  	{"CFStringAppendCString", (PyCFunction)CFMutableStringRefObj_CFStringAppendCString, 1,
  	 "(char* cStr, CFStringEncoding encoding) -> None"},
--- 2219,2223 ----
  	 "(CFStringRef appendedString) -> None"},
  	{"CFStringAppendPascalString", (PyCFunction)CFMutableStringRefObj_CFStringAppendPascalString, 1,
! 	 "(Str255 pStr, CFStringEncoding encoding) -> None"},
  	{"CFStringAppendCString", (PyCFunction)CFMutableStringRefObj_CFStringAppendCString, 1,
  	 "(char* cStr, CFStringEncoding encoding) -> None"},
***************
*** 2282,2285 ****
--- 2356,2383 ----
  }
  
+ static PyObject *CFURLRefObj_CFURLGetFileSystemRepresentation(CFURLRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	Boolean _rv;
+ 	Boolean resolveAgainstBase;
+ 	UInt8 buffer;
+ 	CFIndex maxBufLen;
+ #ifndef CFURLGetFileSystemRepresentation
+ 	PyMac_PRECHECK(CFURLGetFileSystemRepresentation);
+ #endif
+ 	if (!PyArg_ParseTuple(_args, "ll",
+ 	                      &resolveAgainstBase,
+ 	                      &maxBufLen))
+ 		return NULL;
+ 	_rv = CFURLGetFileSystemRepresentation(_self->ob_itself,
+ 	                                       resolveAgainstBase,
+ 	                                       &buffer,
+ 	                                       maxBufLen);
+ 	_res = Py_BuildValue("lb",
+ 	                     _rv,
+ 	                     buffer);
+ 	return _res;
+ }
+ 
  static PyObject *CFURLRefObj_CFURLCopyAbsoluteURL(CFURLRefObject *_self, PyObject *_args)
  {
***************
*** 2387,2390 ****
--- 2485,2524 ----
  }
  
+ static PyObject *CFURLRefObj_CFURLCopyStrictPath(CFURLRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFStringRef _rv;
+ 	Boolean isAbsolute;
+ #ifndef CFURLCopyStrictPath
+ 	PyMac_PRECHECK(CFURLCopyStrictPath);
+ #endif
+ 	if (!PyArg_ParseTuple(_args, ""))
+ 		return NULL;
+ 	_rv = CFURLCopyStrictPath(_self->ob_itself,
+ 	                          &isAbsolute);
+ 	_res = Py_BuildValue("O&l",
+ 	                     CFStringRefObj_New, _rv,
+ 	                     isAbsolute);
+ 	return _res;
+ }
+ 
+ static PyObject *CFURLRefObj_CFURLCopyFileSystemPath(CFURLRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFStringRef _rv;
+ 	CFURLPathStyle pathStyle;
+ #ifndef CFURLCopyFileSystemPath
+ 	PyMac_PRECHECK(CFURLCopyFileSystemPath);
+ #endif
+ 	if (!PyArg_ParseTuple(_args, "l",
+ 	                      &pathStyle))
+ 		return NULL;
+ 	_rv = CFURLCopyFileSystemPath(_self->ob_itself,
+ 	                              pathStyle);
+ 	_res = Py_BuildValue("O&",
+ 	                     CFStringRefObj_New, _rv);
+ 	return _res;
+ }
+ 
  static PyObject *CFURLRefObj_CFURLHasDirectoryPath(CFURLRefObject *_self, PyObject *_args)
  {
***************
*** 2531,2537 ****
--- 2665,2782 ----
  }
  
+ static PyObject *CFURLRefObj_CFURLCopyLastPathComponent(CFURLRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFStringRef _rv;
+ #ifndef CFURLCopyLastPathComponent
+ 	PyMac_PRECHECK(CFURLCopyLastPathComponent);
+ #endif
+ 	if (!PyArg_ParseTuple(_args, ""))
+ 		return NULL;
+ 	_rv = CFURLCopyLastPathComponent(_self->ob_itself);
+ 	_res = Py_BuildValue("O&",
+ 	                     CFStringRefObj_New, _rv);
+ 	return _res;
+ }
+ 
+ static PyObject *CFURLRefObj_CFURLCopyPathExtension(CFURLRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFStringRef _rv;
+ #ifndef CFURLCopyPathExtension
+ 	PyMac_PRECHECK(CFURLCopyPathExtension);
+ #endif
+ 	if (!PyArg_ParseTuple(_args, ""))
+ 		return NULL;
+ 	_rv = CFURLCopyPathExtension(_self->ob_itself);
+ 	_res = Py_BuildValue("O&",
+ 	                     CFStringRefObj_New, _rv);
+ 	return _res;
+ }
+ 
+ static PyObject *CFURLRefObj_CFURLCreateCopyAppendingPathComponent(CFURLRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFURLRef _rv;
+ 	CFStringRef pathComponent;
+ 	Boolean isDirectory;
+ 	if (!PyArg_ParseTuple(_args, "O&l",
+ 	                      CFStringRefObj_Convert, &pathComponent,
+ 	                      &isDirectory))
+ 		return NULL;
+ 	_rv = CFURLCreateCopyAppendingPathComponent((CFAllocatorRef)NULL,
+ 	                                            _self->ob_itself,
+ 	                                            pathComponent,
+ 	                                            isDirectory);
+ 	_res = Py_BuildValue("O&",
+ 	                     CFURLRefObj_New, _rv);
+ 	return _res;
+ }
+ 
+ static PyObject *CFURLRefObj_CFURLCreateCopyDeletingLastPathComponent(CFURLRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFURLRef _rv;
+ 	if (!PyArg_ParseTuple(_args, ""))
+ 		return NULL;
+ 	_rv = CFURLCreateCopyDeletingLastPathComponent((CFAllocatorRef)NULL,
+ 	                                               _self->ob_itself);
+ 	_res = Py_BuildValue("O&",
+ 	                     CFURLRefObj_New, _rv);
+ 	return _res;
+ }
+ 
+ static PyObject *CFURLRefObj_CFURLCreateCopyAppendingPathExtension(CFURLRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFURLRef _rv;
+ 	CFStringRef extension;
+ 	if (!PyArg_ParseTuple(_args, "O&",
+ 	                      CFStringRefObj_Convert, &extension))
+ 		return NULL;
+ 	_rv = CFURLCreateCopyAppendingPathExtension((CFAllocatorRef)NULL,
+ 	                                            _self->ob_itself,
+ 	                                            extension);
+ 	_res = Py_BuildValue("O&",
+ 	                     CFURLRefObj_New, _rv);
+ 	return _res;
+ }
+ 
+ static PyObject *CFURLRefObj_CFURLCreateCopyDeletingPathExtension(CFURLRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFURLRef _rv;
+ 	if (!PyArg_ParseTuple(_args, ""))
+ 		return NULL;
+ 	_rv = CFURLCreateCopyDeletingPathExtension((CFAllocatorRef)NULL,
+ 	                                           _self->ob_itself);
+ 	_res = Py_BuildValue("O&",
+ 	                     CFURLRefObj_New, _rv);
+ 	return _res;
+ }
+ 
+ static PyObject *CFURLRefObj_CFURLGetFSRef(CFURLRefObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	Boolean _rv;
+ 	FSRef fsRef;
+ #ifndef CFURLGetFSRef
+ 	PyMac_PRECHECK(CFURLGetFSRef);
+ #endif
+ 	if (!PyArg_ParseTuple(_args, ""))
+ 		return NULL;
+ 	_rv = CFURLGetFSRef(_self->ob_itself,
+ 	                    &fsRef);
+ 	_res = Py_BuildValue("lO&",
+ 	                     _rv,
+ 	                     PyMac_BuildFSRef, fsRef);
+ 	return _res;
+ }
+ 
  static PyMethodDef CFURLRefObj_methods[] = {
  	{"CFURLCreateData", (PyCFunction)CFURLRefObj_CFURLCreateData, 1,
  	 "(CFStringEncoding encoding, Boolean escapeWhitespace) -> (CFDataRef _rv)"},
+ 	{"CFURLGetFileSystemRepresentation", (PyCFunction)CFURLRefObj_CFURLGetFileSystemRepresentation, 1,
+ 	 "(Boolean resolveAgainstBase, CFIndex maxBufLen) -> (Boolean _rv, UInt8 buffer)"},
  	{"CFURLCopyAbsoluteURL", (PyCFunction)CFURLRefObj_CFURLCopyAbsoluteURL, 1,
  	 "() -> (CFURLRef _rv)"},
***************
*** 2548,2551 ****
--- 2793,2800 ----
  	{"CFURLCopyPath", (PyCFunction)CFURLRefObj_CFURLCopyPath, 1,
  	 "() -> (CFStringRef _rv)"},
+ 	{"CFURLCopyStrictPath", (PyCFunction)CFURLRefObj_CFURLCopyStrictPath, 1,
+ 	 "() -> (CFStringRef _rv, Boolean isAbsolute)"},
+ 	{"CFURLCopyFileSystemPath", (PyCFunction)CFURLRefObj_CFURLCopyFileSystemPath, 1,
+ 	 "(CFURLPathStyle pathStyle) -> (CFStringRef _rv)"},
  	{"CFURLHasDirectoryPath", (PyCFunction)CFURLRefObj_CFURLHasDirectoryPath, 1,
  	 "() -> (Boolean _rv)"},
***************
*** 2566,2569 ****
--- 2815,2832 ----
  	{"CFURLCopyFragment", (PyCFunction)CFURLRefObj_CFURLCopyFragment, 1,
  	 "(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)"},
+ 	{"CFURLCopyLastPathComponent", (PyCFunction)CFURLRefObj_CFURLCopyLastPathComponent, 1,
+ 	 "() -> (CFStringRef _rv)"},
+ 	{"CFURLCopyPathExtension", (PyCFunction)CFURLRefObj_CFURLCopyPathExtension, 1,
+ 	 "() -> (CFStringRef _rv)"},
+ 	{"CFURLCreateCopyAppendingPathComponent", (PyCFunction)CFURLRefObj_CFURLCreateCopyAppendingPathComponent, 1,
+ 	 "(CFStringRef pathComponent, Boolean isDirectory) -> (CFURLRef _rv)"},
+ 	{"CFURLCreateCopyDeletingLastPathComponent", (PyCFunction)CFURLRefObj_CFURLCreateCopyDeletingLastPathComponent, 1,
+ 	 "() -> (CFURLRef _rv)"},
+ 	{"CFURLCreateCopyAppendingPathExtension", (PyCFunction)CFURLRefObj_CFURLCreateCopyAppendingPathExtension, 1,
+ 	 "(CFStringRef extension) -> (CFURLRef _rv)"},
+ 	{"CFURLCreateCopyDeletingPathExtension", (PyCFunction)CFURLRefObj_CFURLCreateCopyDeletingPathExtension, 1,
+ 	 "() -> (CFURLRef _rv)"},
+ 	{"CFURLGetFSRef", (PyCFunction)CFURLRefObj_CFURLGetFSRef, 1,
+ 	 "() -> (Boolean _rv, FSRef fsRef)"},
  	{NULL, NULL, 0}
  };
***************
*** 2621,2624 ****
--- 2884,2907 ----
  
  
+ static PyObject *CF___CFRangeMake(PyObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFRange _rv;
+ 	CFIndex loc;
+ 	CFIndex len;
+ #ifndef __CFRangeMake
+ 	PyMac_PRECHECK(__CFRangeMake);
+ #endif
+ 	if (!PyArg_ParseTuple(_args, "ll",
+ 	                      &loc,
+ 	                      &len))
+ 		return NULL;
+ 	_rv = __CFRangeMake(loc,
+ 	                    len);
+ 	_res = Py_BuildValue("O&",
+ 	                     CFRange_New, _rv);
+ 	return _res;
+ }
+ 
  static PyObject *CF_CFAllocatorGetTypeID(PyObject *_self, PyObject *_args)
  {
***************
*** 2661,2672 ****
  	PyObject *_res = NULL;
  	CFStringRef _rv;
! 	CFTypeID theType;
  #ifndef CFCopyTypeIDDescription
  	PyMac_PRECHECK(CFCopyTypeIDDescription);
  #endif
  	if (!PyArg_ParseTuple(_args, "l",
! 	                      &theType))
  		return NULL;
! 	_rv = CFCopyTypeIDDescription(theType);
  	_res = Py_BuildValue("O&",
  	                     CFStringRefObj_New, _rv);
--- 2944,2955 ----
  	PyObject *_res = NULL;
  	CFStringRef _rv;
! 	CFTypeID type_id;
  #ifndef CFCopyTypeIDDescription
  	PyMac_PRECHECK(CFCopyTypeIDDescription);
  #endif
  	if (!PyArg_ParseTuple(_args, "l",
! 	                      &type_id))
  		return NULL;
! 	_rv = CFCopyTypeIDDescription(type_id);
  	_res = Py_BuildValue("O&",
  	                     CFStringRefObj_New, _rv);
***************
*** 2713,2717 ****
  	CFMutableArrayRef _rv;
  	CFIndex capacity;
! 	CFArrayRef srcArray;
  #ifndef CFArrayCreateMutableCopy
  	PyMac_PRECHECK(CFArrayCreateMutableCopy);
--- 2996,3000 ----
  	CFMutableArrayRef _rv;
  	CFIndex capacity;
! 	CFArrayRef theArray;
  #ifndef CFArrayCreateMutableCopy
  	PyMac_PRECHECK(CFArrayCreateMutableCopy);
***************
*** 2719,2727 ****
  	if (!PyArg_ParseTuple(_args, "lO&",
  	                      &capacity,
! 	                      CFArrayRefObj_Convert, &srcArray))
  		return NULL;
  	_rv = CFArrayCreateMutableCopy((CFAllocatorRef)NULL,
  	                               capacity,
! 	                               srcArray);
  	_res = Py_BuildValue("O&",
  	                     CFMutableArrayRefObj_New, _rv);
--- 3002,3010 ----
  	if (!PyArg_ParseTuple(_args, "lO&",
  	                      &capacity,
! 	                      CFArrayRefObj_Convert, &theArray))
  		return NULL;
  	_rv = CFArrayCreateMutableCopy((CFAllocatorRef)NULL,
  	                               capacity,
! 	                               theArray);
  	_res = Py_BuildValue("O&",
  	                     CFMutableArrayRefObj_New, _rv);
***************
*** 2810,2814 ****
  	CFMutableDataRef _rv;
  	CFIndex capacity;
! 	CFDataRef data;
  #ifndef CFDataCreateMutableCopy
  	PyMac_PRECHECK(CFDataCreateMutableCopy);
--- 3093,3097 ----
  	CFMutableDataRef _rv;
  	CFIndex capacity;
! 	CFDataRef theData;
  #ifndef CFDataCreateMutableCopy
  	PyMac_PRECHECK(CFDataCreateMutableCopy);
***************
*** 2816,2824 ****
  	if (!PyArg_ParseTuple(_args, "lO&",
  	                      &capacity,
! 	                      CFDataRefObj_Convert, &data))
  		return NULL;
  	_rv = CFDataCreateMutableCopy((CFAllocatorRef)NULL,
  	                              capacity,
! 	                              data);
  	_res = Py_BuildValue("O&",
  	                     CFMutableDataRefObj_New, _rv);
--- 3099,3107 ----
  	if (!PyArg_ParseTuple(_args, "lO&",
  	                      &capacity,
! 	                      CFDataRefObj_Convert, &theData))
  		return NULL;
  	_rv = CFDataCreateMutableCopy((CFAllocatorRef)NULL,
  	                              capacity,
! 	                              theData);
  	_res = Py_BuildValue("O&",
  	                     CFMutableDataRefObj_New, _rv);
***************
*** 2866,2870 ****
  	CFMutableDictionaryRef _rv;
  	CFIndex capacity;
! 	CFDictionaryRef dict;
  #ifndef CFDictionaryCreateMutableCopy
  	PyMac_PRECHECK(CFDictionaryCreateMutableCopy);
--- 3149,3153 ----
  	CFMutableDictionaryRef _rv;
  	CFIndex capacity;
! 	CFDictionaryRef theDict;
  #ifndef CFDictionaryCreateMutableCopy
  	PyMac_PRECHECK(CFDictionaryCreateMutableCopy);
***************
*** 2872,2880 ****
  	if (!PyArg_ParseTuple(_args, "lO&",
  	                      &capacity,
! 	                      CFDictionaryRefObj_Convert, &dict))
  		return NULL;
  	_rv = CFDictionaryCreateMutableCopy((CFAllocatorRef)NULL,
  	                                    capacity,
! 	                                    dict);
  	_res = Py_BuildValue("O&",
  	                     CFMutableDictionaryRefObj_New, _rv);
--- 3155,3163 ----
  	if (!PyArg_ParseTuple(_args, "lO&",
  	                      &capacity,
! 	                      CFDictionaryRefObj_Convert, &theDict))
  		return NULL;
  	_rv = CFDictionaryCreateMutableCopy((CFAllocatorRef)NULL,
  	                                    capacity,
! 	                                    theDict);
  	_res = Py_BuildValue("O&",
  	                     CFMutableDictionaryRefObj_New, _rv);
***************
*** 2901,2905 ****
  	PyObject *_res = NULL;
  	CFStringRef _rv;
! 	StringPtr pStr;
  	CFStringEncoding encoding;
  #ifndef CFStringCreateWithPascalString
--- 3184,3188 ----
  	PyObject *_res = NULL;
  	CFStringRef _rv;
! 	Str255 pStr;
  	CFStringEncoding encoding;
  #ifndef CFStringCreateWithPascalString
***************
*** 2907,2911 ****
  #endif
  	if (!PyArg_ParseTuple(_args, "O&l",
! 	                      PyMac_GetStr255, &pStr,
  	                      &encoding))
  		return NULL;
--- 3190,3194 ----
  #endif
  	if (!PyArg_ParseTuple(_args, "O&l",
! 	                      PyMac_GetStr255, pStr,
  	                      &encoding))
  		return NULL;
***************
*** 2943,2947 ****
  	PyObject *_res = NULL;
  	CFStringRef _rv;
! 	StringPtr pStr;
  	CFStringEncoding encoding;
  #ifndef CFStringCreateWithPascalStringNoCopy
--- 3226,3230 ----
  	PyObject *_res = NULL;
  	CFStringRef _rv;
! 	Str255 pStr;
  	CFStringEncoding encoding;
  #ifndef CFStringCreateWithPascalStringNoCopy
***************
*** 2949,2953 ****
  #endif
  	if (!PyArg_ParseTuple(_args, "O&l",
! 	                      PyMac_GetStr255, &pStr,
  	                      &encoding))
  		return NULL;
--- 3232,3236 ----
  #endif
  	if (!PyArg_ParseTuple(_args, "O&l",
! 	                      PyMac_GetStr255, pStr,
  	                      &encoding))
  		return NULL;
***************
*** 3203,3206 ****
--- 3486,3506 ----
  }
  
+ static PyObject *CF_CFStringGetMostCompatibleMacStringEncoding(PyObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFStringEncoding _rv;
+ 	CFStringEncoding encoding;
+ #ifndef CFStringGetMostCompatibleMacStringEncoding
+ 	PyMac_PRECHECK(CFStringGetMostCompatibleMacStringEncoding);
+ #endif
+ 	if (!PyArg_ParseTuple(_args, "l",
+ 	                      &encoding))
+ 		return NULL;
+ 	_rv = CFStringGetMostCompatibleMacStringEncoding(encoding);
+ 	_res = Py_BuildValue("l",
+ 	                     _rv);
+ 	return _res;
+ }
+ 
  static PyObject *CF___CFStringMakeConstantString(PyObject *_self, PyObject *_args)
  {
***************
*** 3262,3266 ****
--- 3562,3637 ----
  }
  
+ static PyObject *CF_CFURLCreateFromFileSystemRepresentation(PyObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFURLRef _rv;
+ 	unsigned char *buffer__in__;
+ 	long buffer__len__;
+ 	int buffer__in_len__;
+ 	Boolean isDirectory;
+ #ifndef CFURLCreateFromFileSystemRepresentation
+ 	PyMac_PRECHECK(CFURLCreateFromFileSystemRepresentation);
+ #endif
+ 	if (!PyArg_ParseTuple(_args, "s#l",
+ 	                      &buffer__in__, &buffer__in_len__,
+ 	                      &isDirectory))
+ 		return NULL;
+ 	buffer__len__ = buffer__in_len__;
+ 	_rv = CFURLCreateFromFileSystemRepresentation((CFAllocatorRef)NULL,
+ 	                                              buffer__in__, buffer__len__,
+ 	                                              isDirectory);
+ 	_res = Py_BuildValue("O&",
+ 	                     CFURLRefObj_New, _rv);
+ 	return _res;
+ }
+ 
+ static PyObject *CF_CFURLCreateFromFileSystemRepresentationRelativeToBase(PyObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFURLRef _rv;
+ 	unsigned char *buffer__in__;
+ 	long buffer__len__;
+ 	int buffer__in_len__;
+ 	Boolean isDirectory;
+ 	CFURLRef baseURL;
+ #ifndef CFURLCreateFromFileSystemRepresentationRelativeToBase
+ 	PyMac_PRECHECK(CFURLCreateFromFileSystemRepresentationRelativeToBase);
+ #endif
+ 	if (!PyArg_ParseTuple(_args, "s#lO&",
+ 	                      &buffer__in__, &buffer__in_len__,
+ 	                      &isDirectory,
+ 	                      OptionalCFURLRefObj_Convert, &baseURL))
+ 		return NULL;
+ 	buffer__len__ = buffer__in_len__;
+ 	_rv = CFURLCreateFromFileSystemRepresentationRelativeToBase((CFAllocatorRef)NULL,
+ 	                                                            buffer__in__, buffer__len__,
+ 	                                                            isDirectory,
+ 	                                                            baseURL);
+ 	_res = Py_BuildValue("O&",
+ 	                     CFURLRefObj_New, _rv);
+ 	return _res;
+ }
+ 
+ static PyObject *CF_CFURLCreateFromFSRef(PyObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	CFURLRef _rv;
+ 	FSRef fsRef;
+ #ifndef CFURLCreateFromFSRef
+ 	PyMac_PRECHECK(CFURLCreateFromFSRef);
+ #endif
+ 	if (!PyArg_ParseTuple(_args, "O&",
+ 	                      PyMac_GetFSRef, &fsRef))
+ 		return NULL;
+ 	_rv = CFURLCreateFromFSRef((CFAllocatorRef)NULL,
+ 	                           &fsRef);
+ 	_res = Py_BuildValue("O&",
+ 	                     CFURLRefObj_New, _rv);
+ 	return _res;
+ }
+ 
  static PyMethodDef CF_methods[] = {
+ 	{"__CFRangeMake", (PyCFunction)CF___CFRangeMake, 1,
+ 	 "(CFIndex loc, CFIndex len) -> (CFRange _rv)"},
  	{"CFAllocatorGetTypeID", (PyCFunction)CF_CFAllocatorGetTypeID, 1,
  	 "() -> (CFTypeID _rv)"},
***************
*** 3268,3272 ****
  	 "(CFIndex size, CFOptionFlags hint) -> (CFIndex _rv)"},
  	{"CFCopyTypeIDDescription", (PyCFunction)CF_CFCopyTypeIDDescription, 1,
! 	 "(CFTypeID theType) -> (CFStringRef _rv)"},
  	{"CFArrayGetTypeID", (PyCFunction)CF_CFArrayGetTypeID, 1,
  	 "() -> (CFTypeID _rv)"},
--- 3639,3643 ----
  	 "(CFIndex size, CFOptionFlags hint) -> (CFIndex _rv)"},
  	{"CFCopyTypeIDDescription", (PyCFunction)CF_CFCopyTypeIDDescription, 1,
! 	 "(CFTypeID type_id) -> (CFStringRef _rv)"},
  	{"CFArrayGetTypeID", (PyCFunction)CF_CFArrayGetTypeID, 1,
  	 "() -> (CFTypeID _rv)"},
***************
*** 3274,3278 ****
  	 "(CFIndex capacity) -> (CFMutableArrayRef _rv)"},
  	{"CFArrayCreateMutableCopy", (PyCFunction)CF_CFArrayCreateMutableCopy, 1,
! 	 "(CFIndex capacity, CFArrayRef srcArray) -> (CFMutableArrayRef _rv)"},
  	{"CFDataGetTypeID", (PyCFunction)CF_CFDataGetTypeID, 1,
  	 "() -> (CFTypeID _rv)"},
--- 3645,3649 ----
  	 "(CFIndex capacity) -> (CFMutableArrayRef _rv)"},
  	{"CFArrayCreateMutableCopy", (PyCFunction)CF_CFArrayCreateMutableCopy, 1,
! 	 "(CFIndex capacity, CFArrayRef theArray) -> (CFMutableArrayRef _rv)"},
  	{"CFDataGetTypeID", (PyCFunction)CF_CFDataGetTypeID, 1,
  	 "() -> (CFTypeID _rv)"},
***************
*** 3284,3288 ****
  	 "(CFIndex capacity) -> (CFMutableDataRef _rv)"},
  	{"CFDataCreateMutableCopy", (PyCFunction)CF_CFDataCreateMutableCopy, 1,
! 	 "(CFIndex capacity, CFDataRef data) -> (CFMutableDataRef _rv)"},
  	{"CFDictionaryGetTypeID", (PyCFunction)CF_CFDictionaryGetTypeID, 1,
  	 "() -> (CFTypeID _rv)"},
--- 3655,3659 ----
  	 "(CFIndex capacity) -> (CFMutableDataRef _rv)"},
  	{"CFDataCreateMutableCopy", (PyCFunction)CF_CFDataCreateMutableCopy, 1,
! 	 "(CFIndex capacity, CFDataRef theData) -> (CFMutableDataRef _rv)"},
  	{"CFDictionaryGetTypeID", (PyCFunction)CF_CFDictionaryGetTypeID, 1,
  	 "() -> (CFTypeID _rv)"},
***************
*** 3290,3302 ****
  	 "(CFIndex capacity) -> (CFMutableDictionaryRef _rv)"},
  	{"CFDictionaryCreateMutableCopy", (PyCFunction)CF_CFDictionaryCreateMutableCopy, 1,
! 	 "(CFIndex capacity, CFDictionaryRef dict) -> (CFMutableDictionaryRef _rv)"},
  	{"CFStringGetTypeID", (PyCFunction)CF_CFStringGetTypeID, 1,
  	 "() -> (CFTypeID _rv)"},
  	{"CFStringCreateWithPascalString", (PyCFunction)CF_CFStringCreateWithPascalString, 1,
! 	 "(StringPtr pStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
  	{"CFStringCreateWithCString", (PyCFunction)CF_CFStringCreateWithCString, 1,
  	 "(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
  	{"CFStringCreateWithPascalStringNoCopy", (PyCFunction)CF_CFStringCreateWithPascalStringNoCopy, 1,
! 	 "(StringPtr pStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
  	{"CFStringCreateWithCStringNoCopy", (PyCFunction)CF_CFStringCreateWithCStringNoCopy, 1,
  	 "(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
--- 3661,3673 ----
  	 "(CFIndex capacity) -> (CFMutableDictionaryRef _rv)"},
  	{"CFDictionaryCreateMutableCopy", (PyCFunction)CF_CFDictionaryCreateMutableCopy, 1,
! 	 "(CFIndex capacity, CFDictionaryRef theDict) -> (CFMutableDictionaryRef _rv)"},
  	{"CFStringGetTypeID", (PyCFunction)CF_CFStringGetTypeID, 1,
  	 "() -> (CFTypeID _rv)"},
  	{"CFStringCreateWithPascalString", (PyCFunction)CF_CFStringCreateWithPascalString, 1,
! 	 "(Str255 pStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
  	{"CFStringCreateWithCString", (PyCFunction)CF_CFStringCreateWithCString, 1,
  	 "(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
  	{"CFStringCreateWithPascalStringNoCopy", (PyCFunction)CF_CFStringCreateWithPascalStringNoCopy, 1,
! 	 "(Str255 pStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
  	{"CFStringCreateWithCStringNoCopy", (PyCFunction)CF_CFStringCreateWithCStringNoCopy, 1,
  	 "(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
***************
*** 3325,3328 ****
--- 3696,3701 ----
  	{"CFStringConvertEncodingToIANACharSetName", (PyCFunction)CF_CFStringConvertEncodingToIANACharSetName, 1,
  	 "(CFStringEncoding encoding) -> (CFStringRef _rv)"},
+ 	{"CFStringGetMostCompatibleMacStringEncoding", (PyCFunction)CF_CFStringGetMostCompatibleMacStringEncoding, 1,
+ 	 "(CFStringEncoding encoding) -> (CFStringEncoding _rv)"},
  	{"__CFStringMakeConstantString", (PyCFunction)CF___CFStringMakeConstantString, 1,
  	 "(char* cStr) -> (CFStringRef _rv)"},
***************
*** 3331,3334 ****
--- 3704,3713 ----
  	{"CFURLCreateWithBytes", (PyCFunction)CF_CFURLCreateWithBytes, 1,
  	 "(Buffer URLBytes, CFStringEncoding encoding, CFURLRef baseURL) -> (CFURLRef _rv)"},
+ 	{"CFURLCreateFromFileSystemRepresentation", (PyCFunction)CF_CFURLCreateFromFileSystemRepresentation, 1,
+ 	 "(Buffer buffer, Boolean isDirectory) -> (CFURLRef _rv)"},
+ 	{"CFURLCreateFromFileSystemRepresentationRelativeToBase", (PyCFunction)CF_CFURLCreateFromFileSystemRepresentationRelativeToBase, 1,
+ 	 "(Buffer buffer, Boolean isDirectory, CFURLRef baseURL) -> (CFURLRef _rv)"},
+ 	{"CFURLCreateFromFSRef", (PyCFunction)CF_CFURLCreateFromFSRef, 1,
+ 	 "(FSRef fsRef) -> (CFURLRef _rv)"},
  	{NULL, NULL, 0}
  };

Index: cfsupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/cfsupport.py,v
retrieving revision 1.12
retrieving revision 1.12.4.1
diff -C2 -d -r1.12 -r1.12.4.1
*** cfsupport.py	2001/11/05 14:39:11	1.12
--- cfsupport.py	2001/12/19 15:10:14	1.12.4.1
***************
*** 172,175 ****
--- 172,177 ----
  CFComparisonResult = Type("CFComparisonResult", "l")  # a bit dangerous, it's an enum
  CFURLPathStyle = Type("CFURLPathStyle", "l") #  a bit dangerous, it's an enum
+ FSRef_ptr = OpaqueType("FSRef", "PyMac_BuildFSRef", "PyMac_GetFSRef")
+ FSRef = OpaqueByValueType("FSRef", "PyMac_BuildFSRef", "PyMac_GetFSRef")
  
  char_ptr = stringptr