[Python-checkins] CVS: python/dist/src/Mac/Modules/res _Resmodule.c,1.7.4.2,1.7.4.3 ressupport.py,1.18.4.2,1.18.4.3

Jack Jansen jackjansen@users.sourceforge.net
Fri, 22 Mar 2002 07:48:46 -0800


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

Modified Files:
      Tag: release22-maint
	_Resmodule.c ressupport.py 
Log Message:
Backport of _Resmodule.c 1.10 and ressupport.py 1.21:
Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
don't cause import failure.

Fixes 531398, 2.2.1 candidate.



Index: _Resmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/_Resmodule.c,v
retrieving revision 1.7.4.2
retrieving revision 1.7.4.3
diff -C2 -d -r1.7.4.2 -r1.7.4.3
*** _Resmodule.c	18 Mar 2002 15:38:24 -0000	1.7.4.2
--- _Resmodule.c	22 Mar 2002 15:48:44 -0000	1.7.4.3
***************
*** 106,109 ****
--- 106,112 ----
  	PyObject *_res = NULL;
  	short _rv;
+ #ifndef HomeResFile
+ 	PyMac_PRECHECK(HomeResFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 121,124 ****
--- 124,130 ----
  {
  	PyObject *_res = NULL;
+ #ifndef MacLoadResource
+ 	PyMac_PRECHECK(MacLoadResource);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 136,139 ****
--- 142,148 ----
  {
  	PyObject *_res = NULL;
+ #ifndef ReleaseResource
+ 	PyMac_PRECHECK(ReleaseResource);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 151,154 ****
--- 160,166 ----
  {
  	PyObject *_res = NULL;
+ #ifndef DetachResource
+ 	PyMac_PRECHECK(DetachResource);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 167,170 ****
--- 179,185 ----
  	PyObject *_res = NULL;
  	short _rv;
+ #ifndef GetResAttrs
+ 	PyMac_PRECHECK(GetResAttrs);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 185,188 ****
--- 200,206 ----
  	ResType theType;
  	Str255 name;
+ #ifndef GetResInfo
+ 	PyMac_PRECHECK(GetResInfo);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 207,210 ****
--- 225,231 ----
  	short theID;
  	Str255 name;
+ #ifndef SetResInfo
+ 	PyMac_PRECHECK(SetResInfo);
+ #endif
  	if (!PyArg_ParseTuple(_args, "hO&",
  	                      &theID,
***************
*** 229,232 ****
--- 250,256 ----
  	short theID;
  	Str255 name;
+ #ifndef AddResource
+ 	PyMac_PRECHECK(AddResource);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&hO&",
  	                      PyMac_GetOSType, &theType,
***************
*** 251,254 ****
--- 275,281 ----
  	PyObject *_res = NULL;
  	long _rv;
+ #ifndef GetResourceSizeOnDisk
+ 	PyMac_PRECHECK(GetResourceSizeOnDisk);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 267,270 ****
--- 294,300 ----
  	PyObject *_res = NULL;
  	long _rv;
+ #ifndef GetMaxResourceSize
+ 	PyMac_PRECHECK(GetMaxResourceSize);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 285,288 ****
--- 315,321 ----
  	PyObject *_res = NULL;
  	long _rv;
+ #ifndef RsrcMapEntry
+ 	PyMac_PRECHECK(RsrcMapEntry);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 302,305 ****
--- 335,341 ----
  	PyObject *_res = NULL;
  	short attrs;
+ #ifndef SetResAttrs
+ 	PyMac_PRECHECK(SetResAttrs);
+ #endif
  	if (!PyArg_ParseTuple(_args, "h",
  	                      &attrs))
***************
*** 319,322 ****
--- 355,361 ----
  {
  	PyObject *_res = NULL;
+ #ifndef ChangedResource
+ 	PyMac_PRECHECK(ChangedResource);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 334,337 ****
--- 373,379 ----
  {
  	PyObject *_res = NULL;
+ #ifndef RemoveResource
+ 	PyMac_PRECHECK(RemoveResource);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 349,352 ****
--- 391,397 ----
  {
  	PyObject *_res = NULL;
+ #ifndef WriteResource
+ 	PyMac_PRECHECK(WriteResource);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 365,368 ****
--- 410,416 ----
  	PyObject *_res = NULL;
  	long newSize;
+ #ifndef SetResourceSize
+ 	PyMac_PRECHECK(SetResourceSize);
+ #endif
  	if (!PyArg_ParseTuple(_args, "l",
  	                      &newSize))
***************
*** 383,386 ****
--- 431,437 ----
  	PyObject *_res = NULL;
  	Handle _rv;
+ #ifndef GetNextFOND
+ 	PyMac_PRECHECK(GetNextFOND);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 416,419 ****
--- 467,473 ----
  {
  	PyObject *_res = NULL;
+ #ifndef LoadResource
+ 	PyMac_PRECHECK(LoadResource);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 578,581 ****
--- 632,638 ----
  	PyObject *_res = NULL;
  	short _rv;
+ #ifndef InitResources
+ 	PyMac_PRECHECK(InitResources);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 596,599 ****
--- 653,659 ----
  {
  	PyObject *_res = NULL;
+ #ifndef RsrcZoneInit
+ 	PyMac_PRECHECK(RsrcZoneInit);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 613,616 ****
--- 673,679 ----
  	PyObject *_res = NULL;
  	short refNum;
+ #ifndef CloseResFile
+ 	PyMac_PRECHECK(CloseResFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, "h",
  	                      &refNum))
***************
*** 630,633 ****
--- 693,699 ----
  	PyObject *_res = NULL;
  	OSErr _err;
+ #ifndef ResError
+ 	PyMac_PRECHECK(ResError);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 643,646 ****
--- 709,715 ----
  	PyObject *_res = NULL;
  	short _rv;
+ #ifndef CurResFile
+ 	PyMac_PRECHECK(CurResFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 661,664 ****
--- 730,736 ----
  	PyObject *_res = NULL;
  	Str255 fileName;
+ #ifndef CreateResFile
+ 	PyMac_PRECHECK(CreateResFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetStr255, fileName))
***************
*** 682,685 ****
--- 754,760 ----
  	short _rv;
  	Str255 fileName;
+ #ifndef OpenResFile
+ 	PyMac_PRECHECK(OpenResFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetStr255, fileName))
***************
*** 700,703 ****
--- 775,781 ----
  	PyObject *_res = NULL;
  	short refNum;
+ #ifndef UseResFile
+ 	PyMac_PRECHECK(UseResFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, "h",
  	                      &refNum))
***************
*** 717,720 ****
--- 795,801 ----
  	PyObject *_res = NULL;
  	short _rv;
+ #ifndef CountTypes
+ 	PyMac_PRECHECK(CountTypes);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 733,736 ****
--- 814,820 ----
  	PyObject *_res = NULL;
  	short _rv;
+ #ifndef Count1Types
+ 	PyMac_PRECHECK(Count1Types);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 750,753 ****
--- 834,840 ----
  	ResType theType;
  	short index;
+ #ifndef GetIndType
+ 	PyMac_PRECHECK(GetIndType);
+ #endif
  	if (!PyArg_ParseTuple(_args, "h",
  	                      &index))
***************
*** 769,772 ****
--- 856,862 ----
  	ResType theType;
  	short index;
+ #ifndef Get1IndType
+ 	PyMac_PRECHECK(Get1IndType);
+ #endif
  	if (!PyArg_ParseTuple(_args, "h",
  	                      &index))
***************
*** 787,790 ****
--- 877,883 ----
  	PyObject *_res = NULL;
  	Boolean load;
+ #ifndef SetResLoad
+ 	PyMac_PRECHECK(SetResLoad);
+ #endif
  	if (!PyArg_ParseTuple(_args, "b",
  	                      &load))
***************
*** 805,808 ****
--- 898,904 ----
  	short _rv;
  	ResType theType;
+ #ifndef CountResources
+ 	PyMac_PRECHECK(CountResources);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetOSType, &theType))
***************
*** 823,826 ****
--- 919,925 ----
  	short _rv;
  	ResType theType;
+ #ifndef Count1Resources
+ 	PyMac_PRECHECK(Count1Resources);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetOSType, &theType))
***************
*** 842,845 ****
--- 941,947 ----
  	ResType theType;
  	short index;
+ #ifndef GetIndResource
+ 	PyMac_PRECHECK(GetIndResource);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&h",
  	                      PyMac_GetOSType, &theType,
***************
*** 863,866 ****
--- 965,971 ----
  	ResType theType;
  	short index;
+ #ifndef Get1IndResource
+ 	PyMac_PRECHECK(Get1IndResource);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&h",
  	                      PyMac_GetOSType, &theType,
***************
*** 884,887 ****
--- 989,995 ----
  	ResType theType;
  	short theID;
+ #ifndef GetResource
+ 	PyMac_PRECHECK(GetResource);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&h",
  	                      PyMac_GetOSType, &theType,
***************
*** 905,908 ****
--- 1013,1019 ----
  	ResType theType;
  	short theID;
+ #ifndef Get1Resource
+ 	PyMac_PRECHECK(Get1Resource);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&h",
  	                      PyMac_GetOSType, &theType,
***************
*** 926,929 ****
--- 1037,1043 ----
  	ResType theType;
  	Str255 name;
+ #ifndef GetNamedResource
+ 	PyMac_PRECHECK(GetNamedResource);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&",
  	                      PyMac_GetOSType, &theType,
***************
*** 947,950 ****
--- 1061,1067 ----
  	ResType theType;
  	Str255 name;
+ #ifndef Get1NamedResource
+ 	PyMac_PRECHECK(Get1NamedResource);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&",
  	                      PyMac_GetOSType, &theType,
***************
*** 967,970 ****
--- 1084,1090 ----
  	short _rv;
  	ResType theType;
+ #ifndef UniqueID
+ 	PyMac_PRECHECK(UniqueID);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetOSType, &theType))
***************
*** 985,988 ****
--- 1105,1111 ----
  	short _rv;
  	ResType theType;
+ #ifndef Unique1ID
+ 	PyMac_PRECHECK(Unique1ID);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetOSType, &theType))
***************
*** 1002,1005 ****
--- 1125,1131 ----
  	PyObject *_res = NULL;
  	short refNum;
+ #ifndef UpdateResFile
+ 	PyMac_PRECHECK(UpdateResFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, "h",
  	                      &refNum))
***************
*** 1019,1022 ****
--- 1145,1151 ----
  	PyObject *_res = NULL;
  	Boolean install;
+ #ifndef SetResPurge
+ 	PyMac_PRECHECK(SetResPurge);
+ #endif
  	if (!PyArg_ParseTuple(_args, "b",
  	                      &install))
***************
*** 1037,1040 ****
--- 1166,1172 ----
  	short _rv;
  	short refNum;
+ #ifndef GetResFileAttrs
+ 	PyMac_PRECHECK(GetResFileAttrs);
+ #endif
  	if (!PyArg_ParseTuple(_args, "h",
  	                      &refNum))
***************
*** 1055,1058 ****
--- 1187,1193 ----
  	short refNum;
  	short attrs;
+ #ifndef SetResFileAttrs
+ 	PyMac_PRECHECK(SetResFileAttrs);
+ #endif
  	if (!PyArg_ParseTuple(_args, "hh",
  	                      &refNum,
***************
*** 1077,1080 ****
--- 1212,1218 ----
  	short vRefNum;
  	SignedByte permission;
+ #ifndef OpenRFPerm
+ 	PyMac_PRECHECK(OpenRFPerm);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&hb",
  	                      PyMac_GetStr255, fileName,
***************
*** 1102,1105 ****
--- 1240,1246 ----
  	ResType theType;
  	short theID;
+ #ifndef RGetResource
+ 	PyMac_PRECHECK(RGetResource);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&h",
  	                      PyMac_GetOSType, &theType,
***************
*** 1126,1129 ****
--- 1267,1273 ----
  	Str255 fileName;
  	SignedByte permission;
+ #ifndef HOpenResFile
+ 	PyMac_PRECHECK(HOpenResFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, "hlO&b",
  	                      &vRefNum,
***************
*** 1151,1154 ****
--- 1295,1301 ----
  	long dirID;
  	Str255 fileName;
+ #ifndef HCreateResFile
+ 	PyMac_PRECHECK(HCreateResFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, "hlO&",
  	                      &vRefNum,
***************
*** 1174,1177 ****
--- 1321,1327 ----
  	FSSpec spec;
  	SignedByte permission;
+ #ifndef FSpOpenResFile
+ 	PyMac_PRECHECK(FSpOpenResFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&b",
  	                      PyMac_GetFSSpec, &spec,
***************
*** 1196,1199 ****
--- 1346,1352 ----
  	OSType fileType;
  	ScriptCode scriptTag;
+ #ifndef FSpCreateResFile
+ 	PyMac_PRECHECK(FSpCreateResFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&O&h",
  	                      PyMac_GetFSSpec, &spec,
***************
*** 1223,1226 ****
--- 1376,1382 ----
  	SInt16 refNum;
  	RsrcChainLocation where;
+ #ifndef InsertResourceFile
+ 	PyMac_PRECHECK(InsertResourceFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, "hh",
  	                      &refNum,
***************
*** 1243,1246 ****
--- 1399,1405 ----
  	OSErr _err;
  	SInt16 refNum;
+ #ifndef DetachResourceFile
+ 	PyMac_PRECHECK(DetachResourceFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, "h",
  	                      &refNum))
***************
*** 1263,1266 ****
--- 1422,1428 ----
  	Boolean inChain;
  	SInt16 refNum;
+ #ifndef FSpResourceFileAlreadyOpen
+ 	PyMac_PRECHECK(FSpResourceFileAlreadyOpen);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetFSSpec, &resourceFile))
***************
*** 1290,1293 ****
--- 1452,1458 ----
  	SignedByte permission;
  	SInt16 refNum;
+ #ifndef FSpOpenOrphanResFile
+ 	PyMac_PRECHECK(FSpOpenOrphanResFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&b",
  	                      PyMac_GetFSSpec, &spec,
***************
*** 1311,1314 ****
--- 1476,1482 ----
  	OSErr _err;
  	SInt16 refNum;
+ #ifndef GetTopResourceFile
+ 	PyMac_PRECHECK(GetTopResourceFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 1329,1332 ****
--- 1497,1503 ----
  	SInt16 curRefNum;
  	SInt16 nextRefNum;
+ #ifndef GetNextResourceFile
+ 	PyMac_PRECHECK(GetNextResourceFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, "h",
  	                      &curRefNum))
***************
*** 1347,1350 ****
--- 1518,1524 ----
  	FSRef ref;
  	SignedByte permission;
+ #ifndef FSOpenResFile
+ 	PyMac_PRECHECK(FSOpenResFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&b",
  	                      PyMac_GetFSRef, &ref,
***************
*** 1371,1374 ****
--- 1545,1551 ----
  	FSRef newRef;
  	FSSpec newSpec;
+ #ifndef FSCreateResFile
+ 	PyMac_PRECHECK(FSCreateResFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&u#",
  	                      PyMac_GetFSRef, &parentRef,
***************
*** 1399,1402 ****
--- 1576,1582 ----
  	Boolean inChain;
  	SInt16 refNum;
+ #ifndef FSResourceFileAlreadyOpen
+ 	PyMac_PRECHECK(FSResourceFileAlreadyOpen);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetFSRef, &resourceFileRef))
***************
*** 1431,1434 ****
--- 1611,1617 ----
  	FSRef newRef;
  	FSSpec newSpec;
+ #ifndef FSCreateResourceFile
+ 	PyMac_PRECHECK(FSCreateResourceFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&u#u#",
  	                      PyMac_GetFSRef, &parentRef,
***************
*** 1465,1468 ****
--- 1648,1654 ----
  	SignedByte permissions;
  	SInt16 refNum;
+ #ifndef FSOpenResourceFile
+ 	PyMac_PRECHECK(FSOpenResourceFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&u#b",
  	                      PyMac_GetFSRef, &ref,

Index: ressupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/ressupport.py,v
retrieving revision 1.18.4.2
retrieving revision 1.18.4.3
diff -C2 -d -r1.18.4.2 -r1.18.4.3
*** ressupport.py	18 Mar 2002 15:38:24 -0000	1.18.4.2
--- ressupport.py	22 Mar 2002 15:48:44 -0000	1.18.4.3
***************
*** 16,21 ****
  		FunctionGenerator.checkit(self) # XXX
  
! class ResFunction(ResMixIn, OSErrFunctionGenerator): pass
! class ResMethod(ResMixIn, OSErrMethodGenerator): pass
  
  RsrcChainLocation = Type("RsrcChainLocation", "h")
--- 16,21 ----
  		FunctionGenerator.checkit(self) # XXX
  
! class ResFunction(ResMixIn, OSErrWeakLinkFunctionGenerator): pass
! class ResMethod(ResMixIn, OSErrWeakLinkMethodGenerator): pass
  
  RsrcChainLocation = Type("RsrcChainLocation", "h")