[Python-checkins] CVS: python/dist/src/Mac/Modules/drag _Dragmodule.c,1.7,1.8

Jack Jansen jackjansen@users.sourceforge.net
Sun, 24 Mar 2002 15:03:43 -0800


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

Modified Files:
	_Dragmodule.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: _Dragmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/drag/_Dragmodule.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** _Dragmodule.c	4 Jan 2002 14:39:29 -0000	1.7
--- _Dragmodule.c	24 Mar 2002 23:03:41 -0000	1.8
***************
*** 92,95 ****
--- 92,98 ----
  	PyObject *_res = NULL;
  	OSErr _err;
+ #ifndef DisposeDrag
+ 	PyMac_PRECHECK(DisposeDrag);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 111,114 ****
--- 114,120 ----
  	int dataPtr__in_len__;
  	FlavorFlags theFlags;
+ #ifndef AddDragItemFlavor
+ 	PyMac_PRECHECK(AddDragItemFlavor);
+ #endif
  	if (!PyArg_ParseTuple(_args, "lO&z#l",
  	                      &theItemRef,
***************
*** 139,142 ****
--- 145,151 ----
  	int dataPtr__in_len__;
  	UInt32 dataOffset;
+ #ifndef SetDragItemFlavorData
+ 	PyMac_PRECHECK(SetDragItemFlavorData);
+ #endif
  	if (!PyArg_ParseTuple(_args, "lO&z#l",
  	                      &theItemRef,
***************
*** 165,168 ****
--- 174,180 ----
  	Point imageOffsetPt;
  	DragImageFlags theImageFlags;
+ #ifndef SetDragImage
+ 	PyMac_PRECHECK(SetDragImage);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&O&l",
  	                      ResObj_Convert, &imagePixMap,
***************
*** 188,191 ****
--- 200,206 ----
  	DragBehaviors inBehaviorsToSet;
  	DragBehaviors inBehaviorsToClear;
+ #ifndef ChangeDragBehaviors
+ 	PyMac_PRECHECK(ChangeDragBehaviors);
+ #endif
  	if (!PyArg_ParseTuple(_args, "ll",
  	                      &inBehaviorsToSet,
***************
*** 207,210 ****
--- 222,228 ----
  	EventRecord theEvent;
  	RgnHandle theRegion;
+ #ifndef TrackDrag
+ 	PyMac_PRECHECK(TrackDrag);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&",
  	                      PyMac_GetEventRecord, &theEvent,
***************
*** 225,228 ****
--- 243,249 ----
  	OSErr _err;
  	UInt16 numItems;
+ #ifndef CountDragItems
+ 	PyMac_PRECHECK(CountDragItems);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 241,244 ****
--- 262,268 ----
  	UInt16 index;
  	ItemReference theItemRef;
+ #ifndef GetDragItemReferenceNumber
+ 	PyMac_PRECHECK(GetDragItemReferenceNumber);
+ #endif
  	if (!PyArg_ParseTuple(_args, "H",
  	                      &index))
***************
*** 259,262 ****
--- 283,289 ----
  	ItemReference theItemRef;
  	UInt16 numFlavors;
+ #ifndef CountDragItemFlavors
+ 	PyMac_PRECHECK(CountDragItemFlavors);
+ #endif
  	if (!PyArg_ParseTuple(_args, "l",
  	                      &theItemRef))
***************
*** 278,281 ****
--- 305,311 ----
  	UInt16 index;
  	FlavorType theType;
+ #ifndef GetFlavorType
+ 	PyMac_PRECHECK(GetFlavorType);
+ #endif
  	if (!PyArg_ParseTuple(_args, "lH",
  	                      &theItemRef,
***************
*** 299,302 ****
--- 329,335 ----
  	FlavorType theType;
  	FlavorFlags theFlags;
+ #ifndef GetFlavorFlags
+ 	PyMac_PRECHECK(GetFlavorFlags);
+ #endif
  	if (!PyArg_ParseTuple(_args, "lO&",
  	                      &theItemRef,
***************
*** 320,323 ****
--- 353,359 ----
  	FlavorType theType;
  	Size dataSize;
+ #ifndef GetFlavorDataSize
+ 	PyMac_PRECHECK(GetFlavorDataSize);
+ #endif
  	if (!PyArg_ParseTuple(_args, "lO&",
  	                      &theItemRef,
***************
*** 344,347 ****
--- 380,386 ----
  	int dataPtr__in_len__;
  	UInt32 dataOffset;
+ #ifndef GetFlavorData
+ 	PyMac_PRECHECK(GetFlavorData);
+ #endif
  	if (!PyArg_ParseTuple(_args, "lO&il",
  	                      &theItemRef,
***************
*** 375,378 ****
--- 414,420 ----
  	ItemReference theItemRef;
  	Rect itemBounds;
+ #ifndef GetDragItemBounds
+ 	PyMac_PRECHECK(GetDragItemBounds);
+ #endif
  	if (!PyArg_ParseTuple(_args, "l",
  	                      &theItemRef))
***************
*** 393,396 ****
--- 435,441 ----
  	ItemReference theItemRef;
  	Rect itemBounds;
+ #ifndef SetDragItemBounds
+ 	PyMac_PRECHECK(SetDragItemBounds);
+ #endif
  	if (!PyArg_ParseTuple(_args, "lO&",
  	                      &theItemRef,
***************
*** 411,414 ****
--- 456,462 ----
  	OSErr _err;
  	AEDesc dropLocation;
+ #ifndef GetDropLocation
+ 	PyMac_PRECHECK(GetDropLocation);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 426,429 ****
--- 474,480 ----
  	OSErr _err;
  	AEDesc dropLocation;
+ #ifndef SetDropLocation
+ 	PyMac_PRECHECK(SetDropLocation);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      AEDesc_Convert, &dropLocation))
***************
*** 442,445 ****
--- 493,499 ----
  	OSErr _err;
  	DragAttributes flags;
+ #ifndef GetDragAttributes
+ 	PyMac_PRECHECK(GetDragAttributes);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 458,461 ****
--- 512,518 ----
  	Point mouse;
  	Point globalPinnedMouse;
+ #ifndef GetDragMouse
+ 	PyMac_PRECHECK(GetDragMouse);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 475,478 ****
--- 532,538 ----
  	OSErr _err;
  	Point globalPinnedMouse;
+ #ifndef SetDragMouse
+ 	PyMac_PRECHECK(SetDragMouse);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetPoint, &globalPinnedMouse))
***************
*** 491,494 ****
--- 551,557 ----
  	OSErr _err;
  	Point globalInitialMouse;
+ #ifndef GetDragOrigin
+ 	PyMac_PRECHECK(GetDragOrigin);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 508,511 ****
--- 571,577 ----
  	SInt16 mouseDownModifiers;
  	SInt16 mouseUpModifiers;
+ #ifndef GetDragModifiers
+ 	PyMac_PRECHECK(GetDragModifiers);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 528,531 ****
--- 594,600 ----
  	RgnHandle hiliteFrame;
  	Boolean inside;
+ #ifndef ShowDragHilite
+ 	PyMac_PRECHECK(ShowDragHilite);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&b",
  	                      ResObj_Convert, &hiliteFrame,
***************
*** 545,548 ****
--- 614,620 ----
  	PyObject *_res = NULL;
  	OSErr _err;
+ #ifndef HideDragHilite
+ 	PyMac_PRECHECK(HideDragHilite);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 560,563 ****
--- 632,638 ----
  	SInt16 dH;
  	SInt16 dV;
+ #ifndef DragPreScroll
+ 	PyMac_PRECHECK(DragPreScroll);
+ #endif
  	if (!PyArg_ParseTuple(_args, "hh",
  	                      &dH,
***************
*** 577,580 ****
--- 652,658 ----
  	PyObject *_res = NULL;
  	OSErr _err;
+ #ifndef DragPostScroll
+ 	PyMac_PRECHECK(DragPostScroll);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 591,594 ****
--- 669,675 ----
  	OSErr _err;
  	RgnHandle updateRgn;
+ #ifndef UpdateDragHilite
+ 	PyMac_PRECHECK(UpdateDragHilite);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      ResObj_Convert, &updateRgn))
***************
*** 702,705 ****
--- 783,789 ----
  	OSErr _err;
  	DragRef theDrag;
+ #ifndef NewDrag
+ 	PyMac_PRECHECK(NewDrag);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 717,720 ****
--- 801,807 ----
  	WindowPtr window;
  	RGBColor color;
+ #ifndef GetDragHiliteColor
+ 	PyMac_PRECHECK(GetDragHiliteColor);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      WinObj_Convert, &window))
***************
*** 733,736 ****
--- 820,826 ----
  	Boolean _rv;
  	Point initialMouse;
+ #ifndef WaitMouseMoved
+ 	PyMac_PRECHECK(WaitMouseMoved);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetPoint, &initialMouse))
***************
*** 750,753 ****
--- 840,846 ----
  	SInt16 zoomSteps;
  	ZoomAcceleration acceleration;
+ #ifndef ZoomRects
+ 	PyMac_PRECHECK(ZoomRects);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&hh",
  	                      PyMac_GetRect, &fromRect,
***************
*** 774,777 ****
--- 867,873 ----
  	SInt16 zoomSteps;
  	ZoomAcceleration acceleration;
+ #ifndef ZoomRegion
+ 	PyMac_PRECHECK(ZoomRegion);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&hh",
  	                      ResObj_Convert, &region,