[Python-checkins] CVS: python/dist/src/Mac/Modules/qdoffs _Qdoffsmodule.c,1.6,1.7

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


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

Modified Files:
	_Qdoffsmodule.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: _Qdoffsmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qdoffs/_Qdoffsmodule.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** _Qdoffsmodule.c	18 Dec 2001 15:36:52 -0000	1.6
--- _Qdoffsmodule.c	24 Mar 2002 23:02:42 -0000	1.7
***************
*** 81,84 ****
--- 81,87 ----
  	PyObject *_res = NULL;
  	GDHandle _rv;
+ #ifndef GetGWorldDevice
+ 	PyMac_PRECHECK(GetGWorldDevice);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 93,96 ****
--- 96,102 ----
  	PyObject *_res = NULL;
  	PixMapHandle _rv;
+ #ifndef GetGWorldPixMap
+ 	PyMac_PRECHECK(GetGWorldPixMap);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 105,108 ****
--- 111,117 ----
  	PyObject *_res = NULL;
  	GrafPtr _rv;
+ #ifndef as_GrafPtr
+ 	PyMac_PRECHECK(as_GrafPtr);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 170,173 ****
--- 179,185 ----
  	GDHandle aGDevice;
  	GWorldFlags flags;
+ #ifndef NewGWorld
+ 	PyMac_PRECHECK(NewGWorld);
+ #endif
  	if (!PyArg_ParseTuple(_args, "hO&O&O&l",
  	                      &PixelDepth,
***************
*** 194,197 ****
--- 206,212 ----
  	Boolean _rv;
  	PixMapHandle pm;
+ #ifndef LockPixels
+ 	PyMac_PRECHECK(LockPixels);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      ResObj_Convert, &pm))
***************
*** 207,210 ****
--- 222,228 ----
  	PyObject *_res = NULL;
  	PixMapHandle pm;
+ #ifndef UnlockPixels
+ 	PyMac_PRECHECK(UnlockPixels);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      ResObj_Convert, &pm))
***************
*** 226,229 ****
--- 244,250 ----
  	GDHandle aGDevice;
  	GWorldFlags flags;
+ #ifndef UpdateGWorld
+ 	PyMac_PRECHECK(UpdateGWorld);
+ #endif
  	if (!PyArg_ParseTuple(_args, "hO&O&O&l",
  	                      &pixelDepth,
***************
*** 250,253 ****
--- 271,277 ----
  	CGrafPtr port;
  	GDHandle gdh;
+ #ifndef GetGWorld
+ 	PyMac_PRECHECK(GetGWorld);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 265,268 ****
--- 289,295 ----
  	CGrafPtr port;
  	GDHandle gdh;
+ #ifndef SetGWorld
+ 	PyMac_PRECHECK(SetGWorld);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&",
  	                      GrafObj_Convert, &port,
***************
*** 280,283 ****
--- 307,313 ----
  	PyObject *_res = NULL;
  	CTabHandle ctab;
+ #ifndef CTabChanged
+ 	PyMac_PRECHECK(CTabChanged);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      OptResObj_Convert, &ctab))
***************
*** 293,296 ****
--- 323,329 ----
  	PyObject *_res = NULL;
  	PixPatHandle ppat;
+ #ifndef PixPatChanged
+ 	PyMac_PRECHECK(PixPatChanged);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      ResObj_Convert, &ppat))
***************
*** 306,309 ****
--- 339,345 ----
  	PyObject *_res = NULL;
  	GrafPtr port;
+ #ifndef PortChanged
+ 	PyMac_PRECHECK(PortChanged);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      GrafObj_Convert, &port))
***************
*** 319,322 ****
--- 355,361 ----
  	PyObject *_res = NULL;
  	GDHandle gdh;
+ #ifndef GDeviceChanged
+ 	PyMac_PRECHECK(GDeviceChanged);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      OptResObj_Convert, &gdh))
***************
*** 332,335 ****
--- 371,377 ----
  	PyObject *_res = NULL;
  	PixMapHandle pm;
+ #ifndef AllowPurgePixels
+ 	PyMac_PRECHECK(AllowPurgePixels);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      ResObj_Convert, &pm))
***************
*** 345,348 ****
--- 387,393 ----
  	PyObject *_res = NULL;
  	PixMapHandle pm;
+ #ifndef NoPurgePixels
+ 	PyMac_PRECHECK(NoPurgePixels);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      ResObj_Convert, &pm))
***************
*** 359,362 ****
--- 404,410 ----
  	GWorldFlags _rv;
  	PixMapHandle pm;
+ #ifndef GetPixelsState
+ 	PyMac_PRECHECK(GetPixelsState);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      ResObj_Convert, &pm))
***************
*** 373,376 ****
--- 421,427 ----
  	PixMapHandle pm;
  	GWorldFlags state;
+ #ifndef SetPixelsState
+ 	PyMac_PRECHECK(SetPixelsState);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&l",
  	                      ResObj_Convert, &pm,
***************
*** 389,392 ****
--- 440,446 ----
  	long _rv;
  	PixMapHandle pm;
+ #ifndef GetPixRowBytes
+ 	PyMac_PRECHECK(GetPixRowBytes);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      ResObj_Convert, &pm))
***************
*** 406,409 ****
--- 460,466 ----
  	GDHandle gdh;
  	PixMapHandle offscreenPixMap;
+ #ifndef NewScreenBuffer
+ 	PyMac_PRECHECK(NewScreenBuffer);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&b",
  	                      PyMac_GetRect, &globalRect,
***************
*** 425,428 ****
--- 482,488 ----
  	PyObject *_res = NULL;
  	PixMapHandle offscreenPixMap;
+ #ifndef DisposeScreenBuffer
+ 	PyMac_PRECHECK(DisposeScreenBuffer);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      ResObj_Convert, &offscreenPixMap))
***************
*** 439,442 ****
--- 499,505 ----
  	Boolean _rv;
  	GrafPtr port;
+ #ifndef QDDone
+ 	PyMac_PRECHECK(QDDone);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      GrafObj_Convert, &port))
***************
*** 452,455 ****
--- 515,521 ----
  	PyObject *_res = NULL;
  	long _rv;
+ #ifndef OffscreenVersion
+ 	PyMac_PRECHECK(OffscreenVersion);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 468,471 ****
--- 534,540 ----
  	GDHandle gdh;
  	PixMapHandle offscreenPixMap;
+ #ifndef NewTempScreenBuffer
+ 	PyMac_PRECHECK(NewTempScreenBuffer);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&b",
  	                      PyMac_GetRect, &globalRect,
***************
*** 488,491 ****
--- 557,563 ----
  	Boolean _rv;
  	PixMapHandle pmHandle;
+ #ifndef PixMap32Bit
+ 	PyMac_PRECHECK(PixMap32Bit);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      ResObj_Convert, &pmHandle))