[Python-checkins] CVS: python/dist/src/Mac/Modules/evt _Evtmodule.c,1.5,1.5.4.1 evtsupport.py,1.14,1.14.4.1

Jack Jansen jackjansen@users.sourceforge.net
Mon, 25 Mar 2002 03:14:31 -0800


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

Modified Files:
      Tag: release22-maint
	_Evtmodule.c evtsupport.py 
Log Message:
Backport of _Evtmodule.c 1.6, evtsupport.py 1.15:
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: _Evtmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/evt/_Evtmodule.c,v
retrieving revision 1.5
retrieving revision 1.5.4.1
diff -C2 -d -r1.5 -r1.5.4.1
*** _Evtmodule.c	17 Dec 2001 11:46:45 -0000	1.5
--- _Evtmodule.c	25 Mar 2002 11:14:28 -0000	1.5.4.1
***************
*** 34,37 ****
--- 34,40 ----
  	PyObject *_res = NULL;
  	Point mouseLoc;
+ #ifndef GetMouse
+ 	PyMac_PRECHECK(GetMouse);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 46,49 ****
--- 49,55 ----
  	PyObject *_res = NULL;
  	Boolean _rv;
+ #ifndef Button
+ 	PyMac_PRECHECK(Button);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 58,61 ****
--- 64,70 ----
  	PyObject *_res = NULL;
  	Boolean _rv;
+ #ifndef StillDown
+ 	PyMac_PRECHECK(StillDown);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 70,73 ****
--- 79,85 ----
  	PyObject *_res = NULL;
  	Boolean _rv;
+ #ifndef WaitMouseUp
+ 	PyMac_PRECHECK(WaitMouseUp);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 82,85 ****
--- 94,100 ----
  	PyObject *_res = NULL;
  	UInt32 _rv;
+ #ifndef GetCaretTime
+ 	PyMac_PRECHECK(GetCaretTime);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 94,97 ****
--- 109,115 ----
  	PyObject *_res = NULL;
  	KeyMap theKeys__out__;
+ #ifndef GetKeys
+ 	PyMac_PRECHECK(GetKeys);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 106,109 ****
--- 124,130 ----
  	PyObject *_res = NULL;
  	UInt32 _rv;
+ #ifndef GetDblTime
+ 	PyMac_PRECHECK(GetDblTime);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 118,121 ****
--- 139,145 ----
  	PyObject *_res = NULL;
  	EventMask value;
+ #ifndef SetEventMask
+ 	PyMac_PRECHECK(SetEventMask);
+ #endif
  	if (!PyArg_ParseTuple(_args, "H",
  	                      &value))
***************
*** 133,136 ****
--- 157,163 ----
  	EventMask eventMask;
  	EventRecord theEvent;
+ #ifndef GetNextEvent
+ 	PyMac_PRECHECK(GetNextEvent);
+ #endif
  	if (!PyArg_ParseTuple(_args, "H",
  	                      &eventMask))
***************
*** 150,153 ****
--- 177,183 ----
  	EventMask eventMask;
  	EventRecord theEvent;
+ #ifndef EventAvail
+ 	PyMac_PRECHECK(EventAvail);
+ #endif
  	if (!PyArg_ParseTuple(_args, "H",
  	                      &eventMask))
***************
*** 167,170 ****
--- 197,203 ----
  	EventKind eventNum;
  	UInt32 eventMsg;
+ #ifndef PostEvent
+ 	PyMac_PRECHECK(PostEvent);
+ #endif
  	if (!PyArg_ParseTuple(_args, "Hl",
  	                      &eventNum,
***************
*** 187,190 ****
--- 220,226 ----
  	EventMask mask;
  	EventRecord theEvent;
+ #ifndef OSEventAvail
+ 	PyMac_PRECHECK(OSEventAvail);
+ #endif
  	if (!PyArg_ParseTuple(_args, "H",
  	                      &mask))
***************
*** 207,210 ****
--- 243,249 ----
  	EventMask mask;
  	EventRecord theEvent;
+ #ifndef GetOSEvent
+ 	PyMac_PRECHECK(GetOSEvent);
+ #endif
  	if (!PyArg_ParseTuple(_args, "H",
  	                      &mask))
***************
*** 224,227 ****
--- 263,269 ----
  	EventMask whichMask;
  	EventMask stopMask;
+ #ifndef FlushEvents
+ 	PyMac_PRECHECK(FlushEvents);
+ #endif
  	if (!PyArg_ParseTuple(_args, "HH",
  	                      &whichMask,
***************
*** 242,245 ****
--- 284,290 ----
  	EventRecord theEvent;
  	WindowPtr theWindow;
+ #ifndef SystemClick
+ 	PyMac_PRECHECK(SystemClick);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&",
  	                      PyMac_GetEventRecord, &theEvent,
***************
*** 259,262 ****
--- 304,310 ----
  {
  	PyObject *_res = NULL;
+ #ifndef SystemTask
+ 	PyMac_PRECHECK(SystemTask);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 275,278 ****
--- 323,329 ----
  	Boolean _rv;
  	EventRecord theEvent;
+ #ifndef SystemEvent
+ 	PyMac_PRECHECK(SystemEvent);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetEventRecord, &theEvent))
***************
*** 291,294 ****
--- 342,348 ----
  	PyObject *_res = NULL;
  	Point globalMouse;
+ #ifndef GetGlobalMouse
+ 	PyMac_PRECHECK(GetGlobalMouse);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 306,309 ****
--- 360,366 ----
  	PyObject *_res = NULL;
  	UInt32 _rv;
+ #ifndef GetCurrentKeyModifiers
+ 	PyMac_PRECHECK(GetCurrentKeyModifiers);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 321,324 ****
--- 378,384 ----
  	PyObject *_res = NULL;
  	Boolean _rv;
+ #ifndef CheckEventQueueForUserCancel
+ 	PyMac_PRECHECK(CheckEventQueueForUserCancel);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 334,337 ****
--- 394,400 ----
  	PyObject *_res = NULL;
  	short code;
+ #ifndef KeyScript
+ 	PyMac_PRECHECK(KeyScript);
+ #endif
  	if (!PyArg_ParseTuple(_args, "h",
  	                      &code))
***************
*** 349,352 ****
--- 412,418 ----
  	EventRecord event;
  	short test;
+ #ifndef IsCmdChar
+ 	PyMac_PRECHECK(IsCmdChar);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&h",
  	                      PyMac_GetEventRecord, &event,
***************
*** 364,367 ****
--- 430,436 ----
  	PyObject *_res = NULL;
  	SInt16 _rv;
+ #ifndef LMGetKeyThresh
+ 	PyMac_PRECHECK(LMGetKeyThresh);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 376,379 ****
--- 445,451 ----
  	PyObject *_res = NULL;
  	SInt16 value;
+ #ifndef LMSetKeyThresh
+ 	PyMac_PRECHECK(LMSetKeyThresh);
+ #endif
  	if (!PyArg_ParseTuple(_args, "h",
  	                      &value))
***************
*** 389,392 ****
--- 461,467 ----
  	PyObject *_res = NULL;
  	SInt16 _rv;
+ #ifndef LMGetKeyRepThresh
+ 	PyMac_PRECHECK(LMGetKeyRepThresh);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 401,404 ****
--- 476,482 ----
  	PyObject *_res = NULL;
  	SInt16 value;
+ #ifndef LMSetKeyRepThresh
+ 	PyMac_PRECHECK(LMSetKeyRepThresh);
+ #endif
  	if (!PyArg_ParseTuple(_args, "h",
  	                      &value))
***************
*** 414,417 ****
--- 492,498 ----
  	PyObject *_res = NULL;
  	UInt8 _rv;
+ #ifndef LMGetKbdLast
+ 	PyMac_PRECHECK(LMGetKbdLast);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 426,429 ****
--- 507,513 ----
  	PyObject *_res = NULL;
  	UInt8 value;
+ #ifndef LMSetKbdLast
+ 	PyMac_PRECHECK(LMSetKbdLast);
+ #endif
  	if (!PyArg_ParseTuple(_args, "b",
  	                      &value))
***************
*** 439,442 ****
--- 523,529 ----
  	PyObject *_res = NULL;
  	UInt8 _rv;
+ #ifndef LMGetKbdType
+ 	PyMac_PRECHECK(LMGetKbdType);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 451,454 ****
--- 538,544 ----
  	PyObject *_res = NULL;
  	UInt8 value;
+ #ifndef LMSetKbdType
+ 	PyMac_PRECHECK(LMSetKbdType);
+ #endif
  	if (!PyArg_ParseTuple(_args, "b",
  	                      &value))
***************
*** 464,467 ****
--- 554,560 ----
  	PyObject *_res = NULL;
  	UInt32 _rv;
+ #ifndef TickCount
+ 	PyMac_PRECHECK(TickCount);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;

Index: evtsupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/evt/evtsupport.py,v
retrieving revision 1.14
retrieving revision 1.14.4.1
diff -C2 -d -r1.14 -r1.14.4.1
*** evtsupport.py	17 Dec 2001 11:46:50 -0000	1.14
--- evtsupport.py	25 Mar 2002 11:14:28 -0000	1.14.4.1
***************
*** 65,70 ****
  
  # Create the generator classes used to populate the lists
! Function = OSErrFunctionGenerator
! ##Method = OSErrMethodGenerator
  
  # Create and populate the lists
--- 65,70 ----
  
  # Create the generator classes used to populate the lists
! Function = OSErrWeakLinkFunctionGenerator
! ##Method = OSErrWeakLinkMethodGenerator
  
  # Create and populate the lists