[Python-checkins] CVS: python/dist/src/Mac/Modules/icn _Icnmodule.c,1.4,1.5
Jack Jansen
jackjansen@users.sourceforge.net
Sun, 24 Mar 2002 15:03:25 -0800
Update of /cvsroot/python/python/dist/src/Mac/Modules/icn
In directory usw-pr-cvs1:/tmp/cvs-serv31710/Python/Mac/Modules/icn
Modified Files:
_Icnmodule.c
Log Message:
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: _Icnmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/icn/_Icnmodule.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** _Icnmodule.c 18 Dec 2001 15:37:33 -0000 1.4
--- _Icnmodule.c 24 Mar 2002 23:03:23 -0000 1.5
***************
*** 35,38 ****
--- 35,41 ----
CIconHandle _rv;
SInt16 iconID;
+ #ifndef GetCIcon
+ PyMac_PRECHECK(GetCIcon);
+ #endif
if (!PyArg_ParseTuple(_args, "h",
&iconID))
***************
*** 49,52 ****
--- 52,58 ----
Rect theRect;
CIconHandle theIcon;
+ #ifndef PlotCIcon
+ PyMac_PRECHECK(PlotCIcon);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&",
PyMac_GetRect, &theRect,
***************
*** 64,67 ****
--- 70,76 ----
PyObject *_res = NULL;
CIconHandle theIcon;
+ #ifndef DisposeCIcon
+ PyMac_PRECHECK(DisposeCIcon);
+ #endif
if (!PyArg_ParseTuple(_args, "O&",
ResObj_Convert, &theIcon))
***************
*** 78,81 ****
--- 87,93 ----
Handle _rv;
SInt16 iconID;
+ #ifndef GetIcon
+ PyMac_PRECHECK(GetIcon);
+ #endif
if (!PyArg_ParseTuple(_args, "h",
&iconID))
***************
*** 92,95 ****
--- 104,110 ----
Rect theRect;
Handle theIcon;
+ #ifndef PlotIcon
+ PyMac_PRECHECK(PlotIcon);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&",
PyMac_GetRect, &theRect,
***************
*** 111,114 ****
--- 126,132 ----
IconTransformType transform;
SInt16 theResID;
+ #ifndef PlotIconID
+ PyMac_PRECHECK(PlotIconID);
+ #endif
if (!PyArg_ParseTuple(_args, "O&hhh",
PyMac_GetRect, &theRect,
***************
*** 132,135 ****
--- 150,156 ----
OSErr _err;
IconSuiteRef theIconSuite;
+ #ifndef NewIconSuite
+ PyMac_PRECHECK(NewIconSuite);
+ #endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
***************
*** 148,151 ****
--- 169,175 ----
IconSuiteRef theSuite;
ResType theType;
+ #ifndef AddIconToSuite
+ PyMac_PRECHECK(AddIconToSuite);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&O&",
ResObj_Convert, &theIconData,
***************
*** 169,172 ****
--- 193,199 ----
IconSuiteRef theSuite;
ResType theType;
+ #ifndef GetIconFromSuite
+ PyMac_PRECHECK(GetIconFromSuite);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&",
ResObj_Convert, &theSuite,
***************
*** 189,192 ****
--- 216,222 ----
SInt16 theResID;
IconSelectorValue selector;
+ #ifndef GetIconSuite
+ PyMac_PRECHECK(GetIconSuite);
+ #endif
if (!PyArg_ParseTuple(_args, "hl",
&theResID,
***************
*** 208,211 ****
--- 238,244 ----
IconSuiteRef theIconSuite;
Boolean disposeData;
+ #ifndef DisposeIconSuite
+ PyMac_PRECHECK(DisposeIconSuite);
+ #endif
if (!PyArg_ParseTuple(_args, "O&b",
ResObj_Convert, &theIconSuite,
***************
*** 228,231 ****
--- 261,267 ----
IconTransformType transform;
IconSuiteRef theIconSuite;
+ #ifndef PlotIconSuite
+ PyMac_PRECHECK(PlotIconSuite);
+ #endif
if (!PyArg_ParseTuple(_args, "O&hhO&",
PyMac_GetRect, &theRect,
***************
*** 252,255 ****
--- 288,294 ----
IconTransformType transform;
IconCacheRef theIconCache;
+ #ifndef LoadIconCache
+ PyMac_PRECHECK(LoadIconCache);
+ #endif
if (!PyArg_ParseTuple(_args, "O&hhO&",
PyMac_GetRect, &theRect,
***************
*** 275,278 ****
--- 314,320 ----
RGBColor labelColor;
Str255 labelString;
+ #ifndef GetLabel
+ PyMac_PRECHECK(GetLabel);
+ #endif
if (!PyArg_ParseTuple(_args, "hO&",
&labelNumber,
***************
*** 296,299 ****
--- 338,344 ----
IconAlignmentType align;
SInt16 iconID;
+ #ifndef PtInIconID
+ PyMac_PRECHECK(PtInIconID);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&hh",
PyMac_GetPoint, &testPt,
***************
*** 319,322 ****
--- 364,370 ----
IconAlignmentType align;
IconSuiteRef theIconSuite;
+ #ifndef PtInIconSuite
+ PyMac_PRECHECK(PtInIconSuite);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&hO&",
PyMac_GetPoint, &testPt,
***************
*** 342,345 ****
--- 390,396 ----
IconAlignmentType align;
SInt16 iconID;
+ #ifndef RectInIconID
+ PyMac_PRECHECK(RectInIconID);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&hh",
PyMac_GetRect, &testRect,
***************
*** 365,368 ****
--- 416,422 ----
IconAlignmentType align;
IconSuiteRef theIconSuite;
+ #ifndef RectInIconSuite
+ PyMac_PRECHECK(RectInIconSuite);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&hO&",
PyMac_GetRect, &testRect,
***************
*** 388,391 ****
--- 442,448 ----
IconAlignmentType align;
SInt16 iconID;
+ #ifndef IconIDToRgn
+ PyMac_PRECHECK(IconIDToRgn);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&hh",
ResObj_Convert, &theRgn,
***************
*** 412,415 ****
--- 469,475 ----
IconAlignmentType align;
IconSuiteRef theIconSuite;
+ #ifndef IconSuiteToRgn
+ PyMac_PRECHECK(IconSuiteToRgn);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&hO&",
ResObj_Convert, &theRgn,
***************
*** 434,437 ****
--- 494,500 ----
IconSuiteRef theSuite;
SInt16 theLabel;
+ #ifndef SetSuiteLabel
+ PyMac_PRECHECK(SetSuiteLabel);
+ #endif
if (!PyArg_ParseTuple(_args, "O&h",
ResObj_Convert, &theSuite,
***************
*** 451,454 ****
--- 514,520 ----
SInt16 _rv;
IconSuiteRef theSuite;
+ #ifndef GetSuiteLabel
+ PyMac_PRECHECK(GetSuiteLabel);
+ #endif
if (!PyArg_ParseTuple(_args, "O&",
ResObj_Convert, &theSuite))
***************
*** 468,471 ****
--- 534,540 ----
IconTransformType transform;
Handle theIcon;
+ #ifndef PlotIconHandle
+ PyMac_PRECHECK(PlotIconHandle);
+ #endif
if (!PyArg_ParseTuple(_args, "O&hhO&",
PyMac_GetRect, &theRect,
***************
*** 492,495 ****
--- 561,567 ----
IconTransformType transform;
Handle theSICN;
+ #ifndef PlotSICNHandle
+ PyMac_PRECHECK(PlotSICNHandle);
+ #endif
if (!PyArg_ParseTuple(_args, "O&hhO&",
PyMac_GetRect, &theRect,
***************
*** 516,519 ****
--- 588,594 ----
IconTransformType transform;
CIconHandle theCIcon;
+ #ifndef PlotCIconHandle
+ PyMac_PRECHECK(PlotCIconHandle);
+ #endif
if (!PyArg_ParseTuple(_args, "O&hhO&",
PyMac_GetRect, &theRect,
***************
*** 537,540 ****
--- 612,618 ----
{
PyObject *_res = NULL;
+ #ifndef IconServicesTerminate
+ PyMac_PRECHECK(IconServicesTerminate);
+ #endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
***************
*** 553,556 ****
--- 631,637 ----
IconSelectorValue whichIcons;
IconFamilyHandle iconFamily;
+ #ifndef IconRefToIconFamily
+ PyMac_PRECHECK(IconRefToIconFamily);
+ #endif
if (!PyArg_ParseTuple(_args, "O&l",
ResObj_Convert, &theIconRef,
***************
*** 573,576 ****
--- 654,660 ----
IconSelectorValue whichIcons;
IconSuiteRef iconSuite;
+ #ifndef IconFamilyToIconSuite
+ PyMac_PRECHECK(IconFamilyToIconSuite);
+ #endif
if (!PyArg_ParseTuple(_args, "O&l",
ResObj_Convert, &iconFamily,
***************
*** 593,596 ****
--- 677,683 ----
IconSelectorValue whichIcons;
IconFamilyHandle iconFamily;
+ #ifndef IconSuiteToIconFamily
+ PyMac_PRECHECK(IconSuiteToIconFamily);
+ #endif
if (!PyArg_ParseTuple(_args, "O&l",
ResObj_Convert, &iconSuite,
***************
*** 613,616 ****
--- 700,706 ----
OSType iconType;
Handle h;
+ #ifndef SetIconFamilyData
+ PyMac_PRECHECK(SetIconFamilyData);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&O&",
ResObj_Convert, &iconFamily,
***************
*** 634,637 ****
--- 724,730 ----
OSType iconType;
Handle h;
+ #ifndef GetIconFamilyData
+ PyMac_PRECHECK(GetIconFamilyData);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&O&",
ResObj_Convert, &iconFamily,
***************
*** 654,657 ****
--- 747,753 ----
IconRef theIconRef;
UInt16 owners;
+ #ifndef GetIconRefOwners
+ PyMac_PRECHECK(GetIconRefOwners);
+ #endif
if (!PyArg_ParseTuple(_args, "O&",
ResObj_Convert, &theIconRef))
***************
*** 670,673 ****
--- 766,772 ----
OSErr _err;
IconRef theIconRef;
+ #ifndef AcquireIconRef
+ PyMac_PRECHECK(AcquireIconRef);
+ #endif
if (!PyArg_ParseTuple(_args, "O&",
ResObj_Convert, &theIconRef))
***************
*** 685,688 ****
--- 784,790 ----
OSErr _err;
IconRef theIconRef;
+ #ifndef ReleaseIconRef
+ PyMac_PRECHECK(ReleaseIconRef);
+ #endif
if (!PyArg_ParseTuple(_args, "O&",
ResObj_Convert, &theIconRef))
***************
*** 702,705 ****
--- 804,810 ----
IconRef theIconRef;
SInt16 theLabel;
+ #ifndef GetIconRefFromFile
+ PyMac_PRECHECK(GetIconRefFromFile);
+ #endif
if (!PyArg_ParseTuple(_args, "O&",
PyMac_GetFSSpec, &theFile))
***************
*** 723,726 ****
--- 828,834 ----
OSType iconType;
IconRef theIconRef;
+ #ifndef GetIconRef
+ PyMac_PRECHECK(GetIconRef);
+ #endif
if (!PyArg_ParseTuple(_args, "hO&O&",
&vRefNum,
***************
*** 748,751 ****
--- 856,862 ----
SInt8 accessPrivileges;
IconRef theIconRef;
+ #ifndef GetIconRefFromFolder
+ PyMac_PRECHECK(GetIconRefFromFolder);
+ #endif
if (!PyArg_ParseTuple(_args, "hllbb",
&vRefNum,
***************
*** 775,778 ****
--- 886,892 ----
IconFamilyHandle iconFamily;
IconRef theIconRef;
+ #ifndef RegisterIconRefFromIconFamily
+ PyMac_PRECHECK(RegisterIconRefFromIconFamily);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&O&",
PyMac_GetOSType, &creator,
***************
*** 799,802 ****
--- 913,919 ----
SInt16 resourceID;
IconRef theIconRef;
+ #ifndef RegisterIconRefFromResource
+ PyMac_PRECHECK(RegisterIconRefFromResource);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&O&h",
PyMac_GetOSType, &creator,
***************
*** 822,825 ****
--- 939,945 ----
OSType creator;
OSType iconType;
+ #ifndef UnregisterIconRef
+ PyMac_PRECHECK(UnregisterIconRef);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&",
PyMac_GetOSType, &creator,
***************
*** 839,842 ****
--- 959,965 ----
OSErr _err;
IconRef theIconRef;
+ #ifndef UpdateIconRef
+ PyMac_PRECHECK(UpdateIconRef);
+ #endif
if (!PyArg_ParseTuple(_args, "O&",
ResObj_Convert, &theIconRef))
***************
*** 856,859 ****
--- 979,985 ----
FSSpec resourceFile;
SInt16 resourceID;
+ #ifndef OverrideIconRefFromResource
+ PyMac_PRECHECK(OverrideIconRefFromResource);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&h",
ResObj_Convert, &theIconRef,
***************
*** 876,879 ****
--- 1002,1008 ----
IconRef oldIconRef;
IconRef newIconRef;
+ #ifndef OverrideIconRef
+ PyMac_PRECHECK(OverrideIconRef);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&",
ResObj_Convert, &oldIconRef,
***************
*** 893,896 ****
--- 1022,1028 ----
OSErr _err;
IconRef theIconRef;
+ #ifndef RemoveIconRefOverride
+ PyMac_PRECHECK(RemoveIconRefOverride);
+ #endif
if (!PyArg_ParseTuple(_args, "O&",
ResObj_Convert, &theIconRef))
***************
*** 910,913 ****
--- 1042,1048 ----
IconRef foregroundIconRef;
IconRef compositeIconRef;
+ #ifndef CompositeIconRef
+ PyMac_PRECHECK(CompositeIconRef);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&",
ResObj_Convert, &backgroundIconRef,
***************
*** 930,933 ****
--- 1065,1071 ----
IconRef backgroundIconRef;
IconRef foregroundIconRef;
+ #ifndef IsIconRefComposite
+ PyMac_PRECHECK(IsIconRefComposite);
+ #endif
if (!PyArg_ParseTuple(_args, "O&",
ResObj_Convert, &compositeIconRef))
***************
*** 948,951 ****
--- 1086,1092 ----
Boolean _rv;
IconRef theIconRef;
+ #ifndef IsValidIconRef
+ PyMac_PRECHECK(IsValidIconRef);
+ #endif
if (!PyArg_ParseTuple(_args, "O&",
ResObj_Convert, &theIconRef))
***************
*** 966,969 ****
--- 1107,1113 ----
IconServicesUsageFlags theIconServicesUsageFlags;
IconRef theIconRef;
+ #ifndef PlotIconRef
+ PyMac_PRECHECK(PlotIconRef);
+ #endif
if (!PyArg_ParseTuple(_args, "O&hhlO&",
PyMac_GetRect, &theRect,
***************
*** 993,996 ****
--- 1137,1143 ----
IconServicesUsageFlags theIconServicesUsageFlags;
IconRef theIconRef;
+ #ifndef PtInIconRef
+ PyMac_PRECHECK(PtInIconRef);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&hlO&",
PyMac_GetPoint, &testPt,
***************
*** 1019,1022 ****
--- 1166,1172 ----
IconServicesUsageFlags iconServicesUsageFlags;
IconRef theIconRef;
+ #ifndef RectInIconRef
+ PyMac_PRECHECK(RectInIconRef);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&hlO&",
PyMac_GetRect, &testRect,
***************
*** 1045,1048 ****
--- 1195,1201 ----
IconServicesUsageFlags iconServicesUsageFlags;
IconRef theIconRef;
+ #ifndef IconRefToRgn
+ PyMac_PRECHECK(IconRefToRgn);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&hlO&",
ResObj_Convert, &theRgn,
***************
*** 1071,1074 ****
--- 1224,1230 ----
IconServicesUsageFlags iconServicesUsageFlags;
IconRef theIconRef;
+ #ifndef GetIconSizesFromIconRef
+ PyMac_PRECHECK(GetIconSizesFromIconRef);
+ #endif
if (!PyArg_ParseTuple(_args, "llO&",
&iconSelectorInput,
***************
*** 1092,1095 ****
--- 1248,1254 ----
OSType creator;
OSType iconType;
+ #ifndef FlushIconRefs
+ PyMac_PRECHECK(FlushIconRefs);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&",
PyMac_GetOSType, &creator,
***************
*** 1109,1112 ****
--- 1268,1274 ----
OSErr _err;
SInt16 vRefNum;
+ #ifndef FlushIconRefsByVolume
+ PyMac_PRECHECK(FlushIconRefsByVolume);
+ #endif
if (!PyArg_ParseTuple(_args, "h",
&vRefNum))
***************
*** 1125,1128 ****
--- 1287,1293 ----
SInt16 vRefNum;
Boolean enableCustomIcons;
+ #ifndef SetCustomIconsEnabled
+ PyMac_PRECHECK(SetCustomIconsEnabled);
+ #endif
if (!PyArg_ParseTuple(_args, "hb",
&vRefNum,
***************
*** 1143,1146 ****
--- 1308,1314 ----
SInt16 vRefNum;
Boolean customIconsEnabled;
+ #ifndef GetCustomIconsEnabled
+ PyMac_PRECHECK(GetCustomIconsEnabled);
+ #endif
if (!PyArg_ParseTuple(_args, "h",
&vRefNum))
***************
*** 1159,1162 ****
--- 1327,1333 ----
Boolean _rv;
IconRef iconRef;
+ #ifndef IsIconRefMaskEmpty
+ PyMac_PRECHECK(IsIconRefMaskEmpty);
+ #endif
if (!PyArg_ParseTuple(_args, "O&",
ResObj_Convert, &iconRef))
***************
*** 1177,1180 ****
--- 1348,1354 ----
OSType inVariant;
IconTransformType outTransform;
+ #ifndef GetIconRefVariant
+ PyMac_PRECHECK(GetIconRefVariant);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&",
ResObj_Convert, &inIconRef,
***************
*** 1201,1204 ****
--- 1375,1381 ----
FSSpec iconFile;
IconRef theIconRef;
+ #ifndef RegisterIconRefFromIconFile
+ PyMac_PRECHECK(RegisterIconRefFromIconFile);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&O&",
PyMac_GetOSType, &creator,
***************
*** 1225,1228 ****
--- 1402,1408 ----
FSSpec iconFile;
IconFamilyHandle iconFamily;
+ #ifndef ReadIconFile
+ PyMac_PRECHECK(ReadIconFile);
+ #endif
if (!PyArg_ParseTuple(_args, "O&",
PyMac_GetFSSpec, &iconFile))
***************
*** 1245,1248 ****
--- 1425,1431 ----
IconFamilyHandle iconFamily;
FSSpec iconFile;
+ #ifndef WriteIconFile
+ PyMac_PRECHECK(WriteIconFile);
+ #endif
if (!PyArg_ParseTuple(_args, "O&O&",
ResObj_Convert, &iconFamily,