[Python-checkins] CVS: python/dist/src/Mac/Modules/cm _Cmmodule.c,1.7,1.7.4.1 cmsupport.py,1.5,1.5.14.1
Jack Jansen
jackjansen@users.sourceforge.net
Mon, 25 Mar 2002 04:24:52 -0800
Update of /cvsroot/python/python/dist/src/Mac/Modules/cm
In directory usw-pr-cvs1:/tmp/cvs-serv24571
Modified Files:
Tag: release22-maint
_Cmmodule.c cmsupport.py
Log Message:
Backport of _Cmmodule.c 1.8 and cmsupport.py 1.6:
Weaklink most toolbox modules, improving backward compatibility. Modules will no longer fail to load if a single routine is missing on the curent OS version, in stead calling the missing routine will raise an exception.
Should finally fix 531398. 2.2.1 candidate.
Also blacklisted some constants with definitions that were not Python-compatible.
Index: _Cmmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cm/_Cmmodule.c,v
retrieving revision 1.7
retrieving revision 1.7.4.1
diff -C2 -d -r1.7 -r1.7.4.1
*** _Cmmodule.c 18 Dec 2001 15:38:17 -0000 1.7
--- _Cmmodule.c 25 Mar 2002 12:24:50 -0000 1.7.4.1
***************
*** 110,113 ****
--- 110,116 ----
PyObject *_res = NULL;
OSErr _err;
+ #ifndef CloseComponent
+ PyMac_PRECHECK(CloseComponent);
+ #endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
***************
*** 123,126 ****
--- 126,132 ----
PyObject *_res = NULL;
OSErr _err;
+ #ifndef GetComponentInstanceError
+ PyMac_PRECHECK(GetComponentInstanceError);
+ #endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
***************
*** 136,139 ****
--- 142,148 ----
PyObject *_res = NULL;
OSErr theError;
+ #ifndef SetComponentInstanceError
+ PyMac_PRECHECK(SetComponentInstanceError);
+ #endif
if (!PyArg_ParseTuple(_args, "h",
&theError))
***************
*** 150,153 ****
--- 159,165 ----
PyObject *_res = NULL;
Handle _rv;
+ #ifndef GetComponentInstanceStorage
+ PyMac_PRECHECK(GetComponentInstanceStorage);
+ #endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
***************
*** 162,165 ****
--- 174,180 ----
PyObject *_res = NULL;
Handle theStorage;
+ #ifndef SetComponentInstanceStorage
+ PyMac_PRECHECK(SetComponentInstanceStorage);
+ #endif
if (!PyArg_ParseTuple(_args, "O&",
ResObj_Convert, &theStorage))
***************
*** 178,181 ****
--- 193,199 ----
PyObject *_res = NULL;
long _rv;
+ #ifndef GetComponentInstanceA5
+ PyMac_PRECHECK(GetComponentInstanceA5);
+ #endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
***************
*** 193,196 ****
--- 211,217 ----
PyObject *_res = NULL;
long theA5;
+ #ifndef SetComponentInstanceA5
+ PyMac_PRECHECK(SetComponentInstanceA5);
+ #endif
if (!PyArg_ParseTuple(_args, "l",
&theA5))
***************
*** 209,212 ****
--- 230,236 ----
long _rv;
short ftnNumber;
+ #ifndef ComponentFunctionImplemented
+ PyMac_PRECHECK(ComponentFunctionImplemented);
+ #endif
if (!PyArg_ParseTuple(_args, "h",
&ftnNumber))
***************
*** 223,226 ****
--- 247,253 ----
PyObject *_res = NULL;
long _rv;
+ #ifndef GetComponentVersion
+ PyMac_PRECHECK(GetComponentVersion);
+ #endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
***************
*** 236,239 ****
--- 263,269 ----
long _rv;
ComponentInstance target;
+ #ifndef ComponentSetTarget
+ PyMac_PRECHECK(ComponentSetTarget);
+ #endif
if (!PyArg_ParseTuple(_args, "O&",
CmpInstObj_Convert, &target))
***************
*** 362,365 ****
--- 392,398 ----
PyObject *_res = NULL;
OSErr _err;
+ #ifndef UnregisterComponent
+ PyMac_PRECHECK(UnregisterComponent);
+ #endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
***************
*** 379,382 ****
--- 412,418 ----
Handle componentInfo;
Handle componentIcon;
+ #ifndef GetComponentInfo
+ PyMac_PRECHECK(GetComponentInfo);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&O&",
ResObj_Convert, &componentName,
***************
*** 399,402 ****
--- 435,441 ----
PyObject *_res = NULL;
ComponentInstance _rv;
+ #ifndef OpenComponent
+ PyMac_PRECHECK(OpenComponent);
+ #endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
***************
*** 411,414 ****
--- 450,456 ----
PyObject *_res = NULL;
Component _rv;
+ #ifndef ResolveComponentAlias
+ PyMac_PRECHECK(ResolveComponentAlias);
+ #endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
***************
*** 426,429 ****
--- 468,474 ----
short strListID;
short index;
+ #ifndef GetComponentPublicIndString
+ PyMac_PRECHECK(GetComponentPublicIndString);
+ #endif
if (!PyArg_ParseTuple(_args, "O&hh",
PyMac_GetStr255, theString,
***************
*** 445,448 ****
--- 490,496 ----
PyObject *_res = NULL;
long _rv;
+ #ifndef GetComponentRefcon
+ PyMac_PRECHECK(GetComponentRefcon);
+ #endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
***************
*** 457,460 ****
--- 505,511 ----
PyObject *_res = NULL;
long theRefcon;
+ #ifndef SetComponentRefcon
+ PyMac_PRECHECK(SetComponentRefcon);
+ #endif
if (!PyArg_ParseTuple(_args, "l",
&theRefcon))
***************
*** 471,474 ****
--- 522,528 ----
PyObject *_res = NULL;
short _rv;
+ #ifndef OpenComponentResFile
+ PyMac_PRECHECK(OpenComponentResFile);
+ #endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
***************
*** 486,489 ****
--- 540,546 ----
short resID;
Handle theResource;
+ #ifndef GetComponentResource
+ PyMac_PRECHECK(GetComponentResource);
+ #endif
if (!PyArg_ParseTuple(_args, "O&h",
PyMac_GetOSType, &resType,
***************
*** 507,510 ****
--- 564,570 ----
short strListID;
short index;
+ #ifndef GetComponentIndString
+ PyMac_PRECHECK(GetComponentIndString);
+ #endif
if (!PyArg_ParseTuple(_args, "O&hh",
PyMac_GetStr255, theString,
***************
*** 526,529 ****
--- 586,592 ----
PyObject *_res = NULL;
long _rv;
+ #ifndef CountComponentInstances
+ PyMac_PRECHECK(CountComponentInstances);
+ #endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
***************
*** 539,542 ****
--- 602,608 ----
OSErr _err;
short flags;
+ #ifndef SetDefaultComponent
+ PyMac_PRECHECK(SetDefaultComponent);
+ #endif
if (!PyArg_ParseTuple(_args, "h",
&flags))
***************
*** 555,558 ****
--- 621,627 ----
Component _rv;
Component capturingComponent;
+ #ifndef CaptureComponent
+ PyMac_PRECHECK(CaptureComponent);
+ #endif
if (!PyArg_ParseTuple(_args, "O&",
CmpObj_Convert, &capturingComponent))
***************
*** 569,572 ****
--- 638,644 ----
PyObject *_res = NULL;
OSErr _err;
+ #ifndef UncaptureComponent
+ PyMac_PRECHECK(UncaptureComponent);
+ #endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
***************
*** 583,586 ****
--- 655,661 ----
OSErr _err;
Handle iconSuite;
+ #ifndef GetComponentIconSuite
+ PyMac_PRECHECK(GetComponentIconSuite);
+ #endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
***************
*** 670,673 ****
--- 745,751 ----
ComponentResourceHandle cr;
short global;
+ #ifndef RegisterComponentResource
+ PyMac_PRECHECK(RegisterComponentResource);
+ #endif
if (!PyArg_ParseTuple(_args, "O&h",
ResObj_Convert, &cr,
***************
*** 687,690 ****
--- 765,771 ----
Component aComponent;
ComponentDescription looking;
+ #ifndef FindNextComponent
+ PyMac_PRECHECK(FindNextComponent);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&",
CmpObj_Convert, &aComponent,
***************
*** 703,706 ****
--- 784,790 ----
long _rv;
ComponentDescription looking;
+ #ifndef CountComponents
+ PyMac_PRECHECK(CountComponents);
+ #endif
if (!PyArg_ParseTuple(_args, "O&",
CmpDesc_Convert, &looking))
***************
*** 716,719 ****
--- 800,806 ----
PyObject *_res = NULL;
long _rv;
+ #ifndef GetComponentListModSeed
+ PyMac_PRECHECK(GetComponentListModSeed);
+ #endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
***************
*** 729,732 ****
--- 816,822 ----
OSErr _err;
short refnum;
+ #ifndef CloseComponentResFile
+ PyMac_PRECHECK(CloseComponentResFile);
+ #endif
if (!PyArg_ParseTuple(_args, "h",
&refnum))
***************
*** 745,748 ****
--- 835,841 ----
OSType componentType;
OSType componentSubType;
+ #ifndef OpenDefaultComponent
+ PyMac_PRECHECK(OpenDefaultComponent);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&",
PyMac_GetOSType, &componentType,
***************
*** 762,765 ****
--- 855,861 ----
short resRefNum;
short global;
+ #ifndef RegisterComponentResourceFile
+ PyMac_PRECHECK(RegisterComponentResourceFile);
+ #endif
if (!PyArg_ParseTuple(_args, "hh",
&resRefNum,
Index: cmsupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cm/cmsupport.py,v
retrieving revision 1.5
retrieving revision 1.5.14.1
diff -C2 -d -r1.5 -r1.5.14.1
*** cmsupport.py 23 Aug 2001 13:48:02 -0000 1.5
--- cmsupport.py 25 Mar 2002 12:24:50 -0000 1.5.14.1
***************
*** 110,115 ****
# Create the generator classes used to populate the lists
! Function = OSErrFunctionGenerator
! Method = OSErrMethodGenerator
# Create and populate the lists
--- 110,115 ----
# Create the generator classes used to populate the lists
! Function = OSErrWeakLinkFunctionGenerator
! Method = OSErrWeakLinkMethodGenerator
# Create and populate the lists