[Python-checkins] CVS: python/dist/src/Mac/Modules/ae _AEmodule.c,1.8.4.1,1.8.4.2 aesupport.py,1.24.14.1,1.24.14.2

Jack Jansen jackjansen@users.sourceforge.net
Mon, 25 Mar 2002 02:21:44 -0800


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

Modified Files:
      Tag: release22-maint
	_AEmodule.c aesupport.py 
Log Message:
Backport of _AEmodule.c 1.10 and aesupport.py 1.26:
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, inAlso blacklisted some constants with definitions that were not Python-compatible.



Index: _AEmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ae/_AEmodule.c,v
retrieving revision 1.8.4.1
retrieving revision 1.8.4.2
diff -C2 -d -r1.8.4.1 -r1.8.4.2
*** _AEmodule.c	24 Feb 2002 22:57:48 -0000	1.8.4.1
--- _AEmodule.c	25 Mar 2002 10:21:42 -0000	1.8.4.2
***************
*** 99,102 ****
--- 99,105 ----
  	DescType toType;
  	AEDesc result;
+ #ifndef AECoerceDesc
+ 	PyMac_PRECHECK(AECoerceDesc);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetOSType, &toType))
***************
*** 116,119 ****
--- 119,125 ----
  	OSErr _err;
  	AEDesc result;
+ #ifndef AEDuplicateDesc
+ 	PyMac_PRECHECK(AEDuplicateDesc);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 131,134 ****
--- 137,143 ----
  	OSErr _err;
  	long theCount;
+ #ifndef AECountItems
+ 	PyMac_PRECHECK(AECountItems);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 150,153 ****
--- 159,165 ----
  	long dataPtr__len__;
  	int dataPtr__in_len__;
+ #ifndef AEPutPtr
+ 	PyMac_PRECHECK(AEPutPtr);
+ #endif
  	if (!PyArg_ParseTuple(_args, "lO&s#",
  	                      &index,
***************
*** 172,175 ****
--- 184,190 ----
  	long index;
  	AEDesc theAEDesc;
+ #ifndef AEPutDesc
+ 	PyMac_PRECHECK(AEPutDesc);
+ #endif
  	if (!PyArg_ParseTuple(_args, "lO&",
  	                      &index,
***************
*** 196,199 ****
--- 211,217 ----
  	long dataPtr__len__;
  	int dataPtr__in_len__;
+ #ifndef AEGetNthPtr
+ 	PyMac_PRECHECK(AEGetNthPtr);
+ #endif
  	if (!PyArg_ParseTuple(_args, "lO&i",
  	                      &index,
***************
*** 231,234 ****
--- 249,255 ----
  	AEKeyword theAEKeyword;
  	AEDesc result;
+ #ifndef AEGetNthDesc
+ 	PyMac_PRECHECK(AEGetNthDesc);
+ #endif
  	if (!PyArg_ParseTuple(_args, "lO&",
  	                      &index,
***************
*** 254,257 ****
--- 275,281 ----
  	DescType typeCode;
  	Size dataSize;
+ #ifndef AESizeOfNthItem
+ 	PyMac_PRECHECK(AESizeOfNthItem);
+ #endif
  	if (!PyArg_ParseTuple(_args, "l",
  	                      &index))
***************
*** 273,276 ****
--- 297,303 ----
  	OSErr _err;
  	long index;
+ #ifndef AEDeleteItem
+ 	PyMac_PRECHECK(AEDeleteItem);
+ #endif
  	if (!PyArg_ParseTuple(_args, "l",
  	                      &index))
***************
*** 293,296 ****
--- 320,326 ----
  	long dataPtr__len__;
  	int dataPtr__in_len__;
+ #ifndef AEPutParamPtr
+ 	PyMac_PRECHECK(AEPutParamPtr);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&s#",
  	                      PyMac_GetOSType, &theAEKeyword,
***************
*** 315,318 ****
--- 345,351 ----
  	AEKeyword theAEKeyword;
  	AEDesc theAEDesc;
+ #ifndef AEPutParamDesc
+ 	PyMac_PRECHECK(AEPutParamDesc);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&",
  	                      PyMac_GetOSType, &theAEKeyword,
***************
*** 338,341 ****
--- 371,377 ----
  	long dataPtr__len__;
  	int dataPtr__in_len__;
+ #ifndef AEGetParamPtr
+ 	PyMac_PRECHECK(AEGetParamPtr);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&i",
  	                      PyMac_GetOSType, &theAEKeyword,
***************
*** 370,373 ****
--- 406,412 ----
  	DescType desiredType;
  	AEDesc result;
+ #ifndef AEGetParamDesc
+ 	PyMac_PRECHECK(AEGetParamDesc);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&",
  	                      PyMac_GetOSType, &theAEKeyword,
***************
*** 391,394 ****
--- 430,436 ----
  	DescType typeCode;
  	Size dataSize;
+ #ifndef AESizeOfParam
+ 	PyMac_PRECHECK(AESizeOfParam);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetOSType, &theAEKeyword))
***************
*** 410,413 ****
--- 452,458 ----
  	OSErr _err;
  	AEKeyword theAEKeyword;
+ #ifndef AEDeleteParam
+ 	PyMac_PRECHECK(AEDeleteParam);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetOSType, &theAEKeyword))
***************
*** 431,434 ****
--- 476,482 ----
  	long dataPtr__len__;
  	int dataPtr__in_len__;
+ #ifndef AEGetAttributePtr
+ 	PyMac_PRECHECK(AEGetAttributePtr);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&i",
  	                      PyMac_GetOSType, &theAEKeyword,
***************
*** 463,466 ****
--- 511,517 ----
  	DescType desiredType;
  	AEDesc result;
+ #ifndef AEGetAttributeDesc
+ 	PyMac_PRECHECK(AEGetAttributeDesc);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&",
  	                      PyMac_GetOSType, &theAEKeyword,
***************
*** 484,487 ****
--- 535,541 ----
  	DescType typeCode;
  	Size dataSize;
+ #ifndef AESizeOfAttribute
+ 	PyMac_PRECHECK(AESizeOfAttribute);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetOSType, &theAEKeyword))
***************
*** 507,510 ****
--- 561,567 ----
  	long dataPtr__len__;
  	int dataPtr__in_len__;
+ #ifndef AEPutAttributePtr
+ 	PyMac_PRECHECK(AEPutAttributePtr);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&s#",
  	                      PyMac_GetOSType, &theAEKeyword,
***************
*** 529,532 ****
--- 586,592 ----
  	AEKeyword theAEKeyword;
  	AEDesc theAEDesc;
+ #ifndef AEPutAttributeDesc
+ 	PyMac_PRECHECK(AEPutAttributeDesc);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&",
  	                      PyMac_GetOSType, &theAEKeyword,
***************
*** 548,551 ****
--- 608,614 ----
  	PyObject *_res = NULL;
  	Size _rv;
+ #ifndef AEGetDescDataSize
+ 	PyMac_PRECHECK(AEGetDescDataSize);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 565,568 ****
--- 628,634 ----
  	AESendPriority sendPriority;
  	long timeOutInTicks;
+ #ifndef AESend
+ 	PyMac_PRECHECK(AESend);
+ #endif
  	if (!PyArg_ParseTuple(_args, "lhl",
  	                      &sendMode,
***************
*** 587,590 ****
--- 653,659 ----
  	PyObject *_res = NULL;
  	OSErr _err;
+ #ifndef AEResetTimer
+ 	PyMac_PRECHECK(AEResetTimer);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 600,603 ****
--- 669,675 ----
  	PyObject *_res = NULL;
  	OSErr _err;
+ #ifndef AESuspendTheCurrentEvent
+ 	PyMac_PRECHECK(AESuspendTheCurrentEvent);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 616,619 ****
--- 688,694 ----
  	AEEventHandlerUPP dispatcher__proc__ = upp_GenericEventHandler;
  	PyObject *dispatcher;
+ #ifndef AEResumeTheCurrentEvent
+ 	PyMac_PRECHECK(AEResumeTheCurrentEvent);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O",
  	                      AEDesc_Convert, &reply,
***************
*** 634,637 ****
--- 709,715 ----
  	PyObject *_res = NULL;
  	OSErr _err;
+ #ifndef AEGetTheCurrentEvent
+ 	PyMac_PRECHECK(AEGetTheCurrentEvent);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 647,650 ****
--- 725,731 ----
  	PyObject *_res = NULL;
  	OSErr _err;
+ #ifndef AESetTheCurrentEvent
+ 	PyMac_PRECHECK(AESetTheCurrentEvent);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 662,665 ****
--- 743,749 ----
  	short callbackFlags;
  	AEDesc theToken;
+ #ifndef AEResolve
+ 	PyMac_PRECHECK(AEResolve);
+ #endif
  	if (!PyArg_ParseTuple(_args, "h",
  	                      &callbackFlags))
***************
*** 816,819 ****
--- 900,906 ----
  	DescType toType;
  	AEDesc result;
+ #ifndef AECoercePtr
+ 	PyMac_PRECHECK(AECoercePtr);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&s#O&",
  	                      PyMac_GetOSType, &typeCode,
***************
*** 841,844 ****
--- 928,934 ----
  	int dataPtr__in_len__;
  	AEDesc result;
+ #ifndef AECreateDesc
+ 	PyMac_PRECHECK(AECreateDesc);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&s#",
  	                      PyMac_GetOSType, &typeCode,
***************
*** 864,867 ****
--- 954,960 ----
  	Boolean isRecord;
  	AEDescList resultList;
+ #ifndef AECreateList
+ 	PyMac_PRECHECK(AECreateList);
+ #endif
  	if (!PyArg_ParseTuple(_args, "s#b",
  	                      &factoringPtr__in__, &factoringPtr__in_len__,
***************
*** 888,891 ****
--- 981,987 ----
  	AETransactionID transactionID;
  	AppleEvent result;
+ #ifndef AECreateAppleEvent
+ 	PyMac_PRECHECK(AECreateAppleEvent);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&O&hl",
  	                      PyMac_GetOSType, &theAEEventClass,
***************
*** 918,921 ****
--- 1014,1020 ----
  	int dataPtr__in_len__;
  	AEDesc theAEDesc;
+ #ifndef AEReplaceDescData
+ 	PyMac_PRECHECK(AEReplaceDescData);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&s#",
  	                      PyMac_GetOSType, &typeCode,
***************
*** 938,941 ****
--- 1037,1043 ----
  	OSErr _err;
  	EventRecord theEventRecord;
+ #ifndef AEProcessAppleEvent
+ 	PyMac_PRECHECK(AEProcessAppleEvent);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetEventRecord, &theEventRecord))
***************
*** 953,956 ****
--- 1055,1061 ----
  	OSErr _err;
  	AEInteractAllowed level;
+ #ifndef AEGetInteractionAllowed
+ 	PyMac_PRECHECK(AEGetInteractionAllowed);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 967,970 ****
--- 1072,1078 ----
  	OSErr _err;
  	AEInteractAllowed level;
+ #ifndef AESetInteractionAllowed
+ 	PyMac_PRECHECK(AESetInteractionAllowed);
+ #endif
  	if (!PyArg_ParseTuple(_args, "b",
  	                      &level))
***************
*** 982,985 ****
--- 1090,1096 ----
  	OSErr _err;
  	long timeOutInTicks;
+ #ifndef AEInteractWithUser
+ 	PyMac_PRECHECK(AEInteractWithUser);
+ #endif
  	if (!PyArg_ParseTuple(_args, "l",
  	                      &timeOutInTicks))
***************
*** 1002,1005 ****
--- 1113,1119 ----
  	AEEventHandlerUPP handler__proc__ = upp_GenericEventHandler;
  	PyObject *handler;
+ #ifndef AEInstallEventHandler
+ 	PyMac_PRECHECK(AEInstallEventHandler);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&O",
  	                      PyMac_GetOSType, &theAEEventClass,
***************
*** 1024,1027 ****
--- 1138,1144 ----
  	AEEventClass theAEEventClass;
  	AEEventID theAEEventID;
+ #ifndef AERemoveEventHandler
+ 	PyMac_PRECHECK(AERemoveEventHandler);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&",
  	                      PyMac_GetOSType, &theAEEventClass,
***************
*** 1046,1049 ****
--- 1163,1169 ----
  	AEEventHandlerUPP handler__proc__ = upp_GenericEventHandler;
  	PyObject *handler;
+ #ifndef AEGetEventHandler
+ 	PyMac_PRECHECK(AEGetEventHandler);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&",
  	                      PyMac_GetOSType, &theAEEventClass,
***************
*** 1066,1069 ****
--- 1186,1192 ----
  	OSErr _err;
  	AEKeyword functionClass;
+ #ifndef AEInstallSpecialHandler
+ 	PyMac_PRECHECK(AEInstallSpecialHandler);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetOSType, &functionClass))
***************
*** 1083,1086 ****
--- 1206,1212 ----
  	OSErr _err;
  	AEKeyword functionClass;
+ #ifndef AERemoveSpecialHandler
+ 	PyMac_PRECHECK(AERemoveSpecialHandler);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetOSType, &functionClass))
***************
*** 1101,1104 ****
--- 1227,1233 ----
  	AEKeyword keyWord;
  	long result;
+ #ifndef AEManagerInfo
+ 	PyMac_PRECHECK(AEManagerInfo);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetOSType, &keyWord))
***************
*** 1116,1119 ****
--- 1245,1251 ----
  	PyObject *_res = NULL;
  	OSErr _err;
+ #ifndef AEObjectInit
+ 	PyMac_PRECHECK(AEObjectInit);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 1130,1133 ****
--- 1262,1268 ----
  	OSErr _err;
  	AEDesc theToken;
+ #ifndef AEDisposeToken
+ 	PyMac_PRECHECK(AEDisposeToken);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 1149,1152 ****
--- 1284,1290 ----
  	AEDesc keyData;
  	AEDesc token;
+ #ifndef AECallObjectAccessor
+ 	PyMac_PRECHECK(AECallObjectAccessor);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&O&O&O&",
  	                      PyMac_GetOSType, &desiredClass,

Index: aesupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ae/aesupport.py,v
retrieving revision 1.24.14.1
retrieving revision 1.24.14.2
diff -C2 -d -r1.24.14.1 -r1.24.14.2
*** aesupport.py	27 Feb 2002 22:48:37 -0000	1.24.14.1
--- aesupport.py	25 Mar 2002 10:21:42 -0000	1.24.14.2
***************
*** 78,83 ****
  
  
! AEFunction = OSErrFunctionGenerator
! AEMethod = OSErrMethodGenerator
  
  
--- 78,83 ----
  
  
! AEFunction = OSErrWeakLinkFunctionGenerator
! AEMethod = OSErrWeakLinkMethodGenerator