[Python-checkins] CVS: python/dist/src/Mac/Modules/mlte _Mltemodule.c,1.4,1.4.8.1

Jack Jansen jackjansen@users.sourceforge.net
Thu, 29 Nov 2001 05:22:35 -0800


Update of /cvsroot/python/python/dist/src/Mac/Modules/mlte
In directory usw-pr-cvs1:/tmp/cvs-serv22962/Python/Mac/Modules/mlte

Modified Files:
      Tag: r22b2-branch
	_Mltemodule.c 
Log Message:
Use the WeakLink generators where it makes sense. This allows the resulting module to be imported on older versions of MacOS that do not support all routines encasulated in the module. Using a routine thats unavailable results in a RuntimeError, "Routine not available on this platform".

Index: _Mltemodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/mlte/_Mltemodule.c,v
retrieving revision 1.4
retrieving revision 1.4.8.1
diff -C2 -d -r1.4 -r1.4.8.1
*** _Mltemodule.c	2001/09/05 10:29:49	1.4
--- _Mltemodule.c	2001/11/29 13:22:32	1.4.8.1
***************
*** 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 */
--- 6,11 ----
***************
*** 132,136 ****
--- 128,134 ----
  {
  	PyObject *_res = NULL;
+ #ifndef TXNDeleteObject
  	PyMac_PRECHECK(TXNDeleteObject);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 147,151 ****
--- 145,151 ----
  	UInt32 iHeight;
  	TXNFrameID iTXNFrameID;
+ #ifndef TXNResizeFrame
  	PyMac_PRECHECK(TXNResizeFrame);
+ #endif
  	if (!PyArg_ParseTuple(_args, "lll",
  	                      &iWidth,
***************
*** 170,174 ****
--- 170,176 ----
  	SInt32 iRight;
  	TXNFrameID iTXNFrameID;
+ #ifndef TXNSetFrameBounds
  	PyMac_PRECHECK(TXNSetFrameBounds);
+ #endif
  	if (!PyArg_ParseTuple(_args, "lllll",
  	                      &iTop,
***************
*** 193,197 ****
--- 195,201 ----
  	PyObject *_res = NULL;
  	EventRecord iEvent;
+ #ifndef TXNKeyDown
  	PyMac_PRECHECK(TXNKeyDown);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetEventRecord, &iEvent))
***************
*** 208,212 ****
--- 212,218 ----
  	PyObject *_res = NULL;
  	RgnHandle ioCursorRgn;
+ #ifndef TXNAdjustCursor
  	PyMac_PRECHECK(TXNAdjustCursor);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      OptResObj_Convert, &ioCursorRgn))
***************
*** 223,227 ****
--- 229,235 ----
  	PyObject *_res = NULL;
  	EventRecord iEvent;
+ #ifndef TXNClick
  	PyMac_PRECHECK(TXNClick);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetEventRecord, &iEvent))
***************
*** 241,245 ****
--- 249,255 ----
  	Boolean _rv;
  	EventRecord iEvent;
+ #ifndef TXNTSMCheck
  	PyMac_PRECHECK(TXNTSMCheck);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetEventRecord, &iEvent))
***************
*** 256,260 ****
--- 266,272 ----
  {
  	PyObject *_res = NULL;
+ #ifndef TXNSelectAll
  	PyMac_PRECHECK(TXNSelectAll);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 269,273 ****
--- 281,287 ----
  	PyObject *_res = NULL;
  	Boolean iBecomingFocused;
+ #ifndef TXNFocus
  	PyMac_PRECHECK(TXNFocus);
+ #endif
  	if (!PyArg_ParseTuple(_args, "b",
  	                      &iBecomingFocused))
***************
*** 283,287 ****
--- 297,303 ----
  {
  	PyObject *_res = NULL;
+ #ifndef TXNUpdate
  	PyMac_PRECHECK(TXNUpdate);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 296,300 ****
--- 312,318 ----
  	PyObject *_res = NULL;
  	GWorldPtr iDrawPort;
+ #ifndef TXNDraw
  	PyMac_PRECHECK(TXNDraw);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      OptGWorldObj_Convert, &iDrawPort))
***************
*** 310,314 ****
--- 328,334 ----
  {
  	PyObject *_res = NULL;
+ #ifndef TXNForceUpdate
  	PyMac_PRECHECK(TXNForceUpdate);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 323,327 ****
--- 343,349 ----
  	PyObject *_res = NULL;
  	UInt32 _rv;
+ #ifndef TXNGetSleepTicks
  	PyMac_PRECHECK(TXNGetSleepTicks);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 335,339 ****
--- 357,363 ----
  {
  	PyObject *_res = NULL;
+ #ifndef TXNIdle
  	PyMac_PRECHECK(TXNIdle);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 348,352 ****
--- 372,378 ----
  	PyObject *_res = NULL;
  	EventRecord iEvent;
+ #ifndef TXNGrowWindow
  	PyMac_PRECHECK(TXNGrowWindow);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetEventRecord, &iEvent))
***************
*** 363,367 ****
--- 389,395 ----
  	PyObject *_res = NULL;
  	short iPart;
+ #ifndef TXNZoomWindow
  	PyMac_PRECHECK(TXNZoomWindow);
+ #endif
  	if (!PyArg_ParseTuple(_args, "h",
  	                      &iPart))
***************
*** 379,383 ****
--- 407,413 ----
  	Boolean _rv;
  	TXNActionKey oTXNActionKey;
+ #ifndef TXNCanUndo
  	PyMac_PRECHECK(TXNCanUndo);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 393,397 ****
--- 423,429 ----
  {
  	PyObject *_res = NULL;
+ #ifndef TXNUndo
  	PyMac_PRECHECK(TXNUndo);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 407,411 ****
--- 439,445 ----
  	Boolean _rv;
  	TXNActionKey oTXNActionKey;
+ #ifndef TXNCanRedo
  	PyMac_PRECHECK(TXNCanRedo);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 421,425 ****
--- 455,461 ----
  {
  	PyObject *_res = NULL;
+ #ifndef TXNRedo
  	PyMac_PRECHECK(TXNRedo);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 434,438 ****
--- 470,476 ----
  	PyObject *_res = NULL;
  	OSStatus _err;
+ #ifndef TXNCut
  	PyMac_PRECHECK(TXNCut);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 448,452 ****
--- 486,492 ----
  	PyObject *_res = NULL;
  	OSStatus _err;
+ #ifndef TXNCopy
  	PyMac_PRECHECK(TXNCopy);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 462,466 ****
--- 502,508 ----
  	PyObject *_res = NULL;
  	OSStatus _err;
+ #ifndef TXNPaste
  	PyMac_PRECHECK(TXNPaste);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 476,480 ****
--- 518,524 ----
  	PyObject *_res = NULL;
  	OSStatus _err;
+ #ifndef TXNClear
  	PyMac_PRECHECK(TXNClear);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 491,495 ****
--- 535,541 ----
  	TXNOffset oStartOffset;
  	TXNOffset oEndOffset;
+ #ifndef TXNGetSelection
  	PyMac_PRECHECK(TXNGetSelection);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 507,511 ****
--- 553,559 ----
  	PyObject *_res = NULL;
  	Boolean iShowEnd;
+ #ifndef TXNShowSelection
  	PyMac_PRECHECK(TXNShowSelection);
+ #endif
  	if (!PyArg_ParseTuple(_args, "b",
  	                      &iShowEnd))
***************
*** 522,526 ****
--- 570,576 ----
  	PyObject *_res = NULL;
  	Boolean _rv;
+ #ifndef TXNIsSelectionEmpty
  	PyMac_PRECHECK(TXNIsSelectionEmpty);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 537,541 ****
--- 587,593 ----
  	TXNOffset iStartOffset;
  	TXNOffset iEndOffset;
+ #ifndef TXNSetSelection
  	PyMac_PRECHECK(TXNSetSelection);
+ #endif
  	if (!PyArg_ParseTuple(_args, "ll",
  	                      &iStartOffset,
***************
*** 558,562 ****
--- 610,616 ----
  	UInt32 iEndOffset;
  	ItemCount oRunCount;
+ #ifndef TXNCountRunsInRange
  	PyMac_PRECHECK(TXNCountRunsInRange);
+ #endif
  	if (!PyArg_ParseTuple(_args, "ll",
  	                      &iStartOffset,
***************
*** 577,581 ****
--- 631,637 ----
  	PyObject *_res = NULL;
  	ByteCount _rv;
+ #ifndef TXNDataSize
  	PyMac_PRECHECK(TXNDataSize);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 593,597 ****
--- 649,655 ----
  	TXNOffset iEndOffset;
  	Handle oDataHandle;
+ #ifndef TXNGetData
  	PyMac_PRECHECK(TXNGetData);
+ #endif
  	if (!PyArg_ParseTuple(_args, "ll",
  	                      &iStartOffset,
***************
*** 616,620 ****
--- 674,680 ----
  	Handle oDataHandle;
  	TXNDataType iEncoding;
+ #ifndef TXNGetDataEncoded
  	PyMac_PRECHECK(TXNGetDataEncoded);
+ #endif
  	if (!PyArg_ParseTuple(_args, "llO&",
  	                      &iStartOffset,
***************
*** 642,646 ****
--- 702,708 ----
  	TXNOffset iStartOffset;
  	TXNOffset iEndOffset;
+ #ifndef TXNSetDataFromFile
  	PyMac_PRECHECK(TXNSetDataFromFile);
+ #endif
  	if (!PyArg_ParseTuple(_args, "hO&lll",
  	                      &iFileRefNum,
***************
*** 672,676 ****
--- 734,740 ----
  	TXNOffset iStartOffset;
  	TXNOffset iEndOffset;
+ #ifndef TXNSetData
  	PyMac_PRECHECK(TXNSetData);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&s#ll",
  	                      PyMac_GetOSType, &iDataType,
***************
*** 695,699 ****
--- 759,765 ----
  	PyObject *_res = NULL;
  	ItemCount _rv;
+ #ifndef TXNGetChangeCount
  	PyMac_PRECHECK(TXNGetChangeCount);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 714,718 ****
--- 780,786 ----
  	SInt16 iDataReference;
  	SInt16 iResourceReference;
+ #ifndef TXNSave
  	PyMac_PRECHECK(TXNSave);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&lO&hh",
  	                      PyMac_GetOSType, &iType,
***************
*** 740,744 ****
--- 808,814 ----
  	PyObject *_res = NULL;
  	OSStatus _err;
+ #ifndef TXNRevert
  	PyMac_PRECHECK(TXNRevert);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 754,758 ****
--- 824,830 ----
  	PyObject *_res = NULL;
  	OSStatus _err;
+ #ifndef TXNPageSetup
  	PyMac_PRECHECK(TXNPageSetup);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 768,772 ****
--- 840,846 ----
  	PyObject *_res = NULL;
  	OSStatus _err;
+ #ifndef TXNPrint
  	PyMac_PRECHECK(TXNPrint);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 782,786 ****
--- 856,862 ----
  	PyObject *_res = NULL;
  	Rect oViewRect;
+ #ifndef TXNGetViewRect
  	PyMac_PRECHECK(TXNGetViewRect);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 798,802 ****
--- 874,880 ----
  	GWorldPtr iWindow;
  	Boolean iIsActualWindow;
+ #ifndef TXNAttachObjectToWindow
  	PyMac_PRECHECK(TXNAttachObjectToWindow);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&b",
  	                      GWorldObj_Convert, &iWindow,
***************
*** 816,820 ****
--- 894,900 ----
  	PyObject *_res = NULL;
  	Boolean _rv;
+ #ifndef TXNIsObjectAttachedToWindow
  	PyMac_PRECHECK(TXNIsObjectAttachedToWindow);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 834,838 ****
--- 914,920 ----
  	DragReference iDragReference;
  	Boolean iDifferentObjectSameWindow;
+ #ifndef TXNDragTracker
  	PyMac_PRECHECK(TXNDragTracker);
+ #endif
  	if (!PyArg_ParseTuple(_args, "lhO&O&b",
  	                      &iTXNFrameID,
***************
*** 862,866 ****
--- 944,950 ----
  	DragReference iDragReference;
  	Boolean iDifferentObjectSameWindow;
+ #ifndef TXNDragReceiver
  	PyMac_PRECHECK(TXNDragReceiver);
+ #endif
  	if (!PyArg_ParseTuple(_args, "lO&O&b",
  	                      &iTXNFrameID,
***************
*** 886,890 ****
--- 970,976 ----
  	TXNFrameID iTXNFrameID;
  	TXNScrollBarState iActiveState;
+ #ifndef TXNActivate
  	PyMac_PRECHECK(TXNActivate);
+ #endif
  	if (!PyArg_ParseTuple(_args, "ll",
  	                      &iTXNFrameID,
***************
*** 907,911 ****
--- 993,999 ----
  	SInt16 iMenuID;
  	SInt16 iMenuItem;
+ #ifndef TXNDoFontMenuSelection
  	PyMac_PRECHECK(TXNDoFontMenuSelection);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&hh",
  	                      TXNFontMenuObj_Convert, &iTXNFontMenuObject,
***************
*** 928,932 ****
--- 1016,1022 ----
  	OSStatus _err;
  	TXNFontMenuObject iTXNFontMenuObject;
+ #ifndef TXNPrepareFontMenu
  	PyMac_PRECHECK(TXNPrepareFontMenu);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      TXNFontMenuObj_Convert, &iTXNFontMenuObject))
***************
*** 1057,1061 ****
  
  PyTypeObject TXNObject_Type = {
! 	PyObject_HEAD_INIT(&PyType_Type)
  	0, /*ob_size*/
  	"TXNObject", /*tp_name*/
--- 1147,1151 ----
  
  PyTypeObject TXNObject_Type = {
! 	PyObject_HEAD_INIT(NULL)
  	0, /*ob_size*/
  	"TXNObject", /*tp_name*/
***************
*** 1120,1124 ****
--- 1210,1216 ----
  	OSStatus _err;
  	MenuHandle oFontMenuHandle;
+ #ifndef TXNGetFontMenuHandle
  	PyMac_PRECHECK(TXNGetFontMenuHandle);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 1135,1139 ****
--- 1227,1233 ----
  	PyObject *_res = NULL;
  	OSStatus _err;
+ #ifndef TXNDisposeFontMenuObject
  	PyMac_PRECHECK(TXNDisposeFontMenuObject);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 1169,1173 ****
  
  PyTypeObject TXNFontMenuObject_Type = {
! 	PyObject_HEAD_INIT(&PyType_Type)
  	0, /*ob_size*/
  	"TXNFontMenuObject", /*tp_name*/
--- 1263,1267 ----
  
  PyTypeObject TXNFontMenuObject_Type = {
! 	PyObject_HEAD_INIT(NULL)
  	0, /*ob_size*/
  	"TXNFontMenuObject", /*tp_name*/
***************
*** 1203,1207 ****
--- 1297,1303 ----
  	TXNObject oTXNObject;
  	TXNFrameID oTXNFrameID;
+ #ifndef TXNNewObject
  	PyMac_PRECHECK(TXNNewObject);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&O&llO&l",
  	                      OptFSSpecPtr_Convert, &iFileSpec,
***************
*** 1233,1237 ****
--- 1329,1335 ----
  {
  	PyObject *_res = NULL;
+ #ifndef TXNTerminateTextension
  	PyMac_PRECHECK(TXNTerminateTextension);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 1246,1250 ****
--- 1344,1350 ----
  	PyObject *_res = NULL;
  	Boolean _rv;
+ #ifndef TXNIsScrapPastable
  	PyMac_PRECHECK(TXNIsScrapPastable);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 1259,1263 ****
--- 1359,1365 ----
  	PyObject *_res = NULL;
  	OSStatus _err;
+ #ifndef TXNConvertToPublicScrap
  	PyMac_PRECHECK(TXNConvertToPublicScrap);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 1273,1277 ****
--- 1375,1381 ----
  	PyObject *_res = NULL;
  	OSStatus _err;
+ #ifndef TXNConvertFromPublicScrap
  	PyMac_PRECHECK(TXNConvertFromPublicScrap);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 1291,1295 ****
--- 1395,1401 ----
  	SInt16 iStartHierMenuID;
  	TXNFontMenuObject oTXNFontMenuObject;
+ #ifndef TXNNewFontMenuObject
  	PyMac_PRECHECK(TXNNewFontMenuObject);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&hh",
  	                      MenuObj_Convert, &iFontMenuHandle,
***************
*** 1312,1316 ****
--- 1418,1424 ----
  	TXNVersionValue _rv;
  	TXNFeatureBits oFeatureFlags;
+ #ifndef TXNVersionInformation
  	PyMac_PRECHECK(TXNVersionInformation);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;