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

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


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

Modified Files:
	_TEmodule.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: _TEmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/te/_TEmodule.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** _TEmodule.c	18 Dec 2001 15:36:19 -0000	1.7
--- _TEmodule.c	24 Mar 2002 23:02:01 -0000	1.8
***************
*** 110,113 ****
--- 110,116 ----
  	long text__len__;
  	int text__in_len__;
+ #ifndef TESetText
+ 	PyMac_PRECHECK(TESetText);
+ #endif
  	if (!PyArg_ParseTuple(_args, "s#",
  	                      &text__in__, &text__in_len__))
***************
*** 125,128 ****
--- 128,134 ----
  	PyObject *_res = NULL;
  	CharsHandle _rv;
+ #ifndef TEGetText
+ 	PyMac_PRECHECK(TEGetText);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 136,139 ****
--- 142,148 ----
  {
  	PyObject *_res = NULL;
+ #ifndef TEIdle
+ 	PyMac_PRECHECK(TEIdle);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 149,152 ****
--- 158,164 ----
  	long selStart;
  	long selEnd;
+ #ifndef TESetSelect
+ 	PyMac_PRECHECK(TESetSelect);
+ #endif
  	if (!PyArg_ParseTuple(_args, "ll",
  	                      &selStart,
***************
*** 164,167 ****
--- 176,182 ----
  {
  	PyObject *_res = NULL;
+ #ifndef TEActivate
+ 	PyMac_PRECHECK(TEActivate);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 175,178 ****
--- 190,196 ----
  {
  	PyObject *_res = NULL;
+ #ifndef TEDeactivate
+ 	PyMac_PRECHECK(TEDeactivate);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 187,190 ****
--- 205,211 ----
  	PyObject *_res = NULL;
  	CharParameter key;
+ #ifndef TEKey
+ 	PyMac_PRECHECK(TEKey);
+ #endif
  	if (!PyArg_ParseTuple(_args, "h",
  	                      &key))
***************
*** 200,203 ****
--- 221,227 ----
  {
  	PyObject *_res = NULL;
+ #ifndef TECut
+ 	PyMac_PRECHECK(TECut);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 211,214 ****
--- 235,241 ----
  {
  	PyObject *_res = NULL;
+ #ifndef TECopy
+ 	PyMac_PRECHECK(TECopy);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 222,225 ****
--- 249,255 ----
  {
  	PyObject *_res = NULL;
+ #ifndef TEPaste
+ 	PyMac_PRECHECK(TEPaste);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 233,236 ****
--- 263,269 ----
  {
  	PyObject *_res = NULL;
+ #ifndef TEDelete
+ 	PyMac_PRECHECK(TEDelete);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 247,250 ****
--- 280,286 ----
  	long text__len__;
  	int text__in_len__;
+ #ifndef TEInsert
+ 	PyMac_PRECHECK(TEInsert);
+ #endif
  	if (!PyArg_ParseTuple(_args, "s#",
  	                      &text__in__, &text__in_len__))
***************
*** 262,265 ****
--- 298,304 ----
  	PyObject *_res = NULL;
  	short just;
+ #ifndef TESetAlignment
+ 	PyMac_PRECHECK(TESetAlignment);
+ #endif
  	if (!PyArg_ParseTuple(_args, "h",
  	                      &just))
***************
*** 276,279 ****
--- 315,321 ----
  	PyObject *_res = NULL;
  	Rect rUpdate;
+ #ifndef TEUpdate
+ 	PyMac_PRECHECK(TEUpdate);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetRect, &rUpdate))
***************
*** 291,294 ****
--- 333,339 ----
  	short dh;
  	short dv;
+ #ifndef TEScroll
+ 	PyMac_PRECHECK(TEScroll);
+ #endif
  	if (!PyArg_ParseTuple(_args, "hh",
  	                      &dh,
***************
*** 306,309 ****
--- 351,357 ----
  {
  	PyObject *_res = NULL;
+ #ifndef TESelView
+ 	PyMac_PRECHECK(TESelView);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 319,322 ****
--- 367,373 ----
  	short dh;
  	short dv;
+ #ifndef TEPinScroll
+ 	PyMac_PRECHECK(TEPinScroll);
+ #endif
  	if (!PyArg_ParseTuple(_args, "hh",
  	                      &dh,
***************
*** 335,338 ****
--- 386,392 ----
  	PyObject *_res = NULL;
  	Boolean fAuto;
+ #ifndef TEAutoView
+ 	PyMac_PRECHECK(TEAutoView);
+ #endif
  	if (!PyArg_ParseTuple(_args, "b",
  	                      &fAuto))
***************
*** 348,351 ****
--- 402,408 ----
  {
  	PyObject *_res = NULL;
+ #ifndef TECalText
+ 	PyMac_PRECHECK(TECalText);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 361,364 ****
--- 418,424 ----
  	short _rv;
  	Point pt;
+ #ifndef TEGetOffset
+ 	PyMac_PRECHECK(TEGetOffset);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetPoint, &pt))
***************
*** 376,379 ****
--- 436,442 ----
  	Point _rv;
  	short offset;
+ #ifndef TEGetPoint
+ 	PyMac_PRECHECK(TEGetPoint);
+ #endif
  	if (!PyArg_ParseTuple(_args, "h",
  	                      &offset))
***************
*** 391,394 ****
--- 454,460 ----
  	Point pt;
  	Boolean fExtend;
+ #ifndef TEClick
+ 	PyMac_PRECHECK(TEClick);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&b",
  	                      PyMac_GetPoint, &pt,
***************
*** 407,410 ****
--- 473,479 ----
  	PyObject *_res = NULL;
  	TEStyleHandle theHandle;
+ #ifndef TESetStyleHandle
+ 	PyMac_PRECHECK(TESetStyleHandle);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      ResObj_Convert, &theHandle))
***************
*** 421,424 ****
--- 490,496 ----
  	PyObject *_res = NULL;
  	TEStyleHandle _rv;
+ #ifndef TEGetStyleHandle
+ 	PyMac_PRECHECK(TEGetStyleHandle);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 436,439 ****
--- 508,514 ----
  	short lineHeight;
  	short fontAscent;
+ #ifndef TEGetStyle
+ 	PyMac_PRECHECK(TEGetStyle);
+ #endif
  	if (!PyArg_ParseTuple(_args, "h",
  	                      &offset))
***************
*** 454,457 ****
--- 529,535 ----
  {
  	PyObject *_res = NULL;
+ #ifndef TEStylePaste
+ 	PyMac_PRECHECK(TEStylePaste);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 468,471 ****
--- 546,552 ----
  	TextStyle newStyle;
  	Boolean fRedraw;
+ #ifndef TESetStyle
+ 	PyMac_PRECHECK(TESetStyle);
+ #endif
  	if (!PyArg_ParseTuple(_args, "hO&b",
  	                      &mode,
***************
*** 489,492 ****
--- 570,576 ----
  	TextStyle newStyle;
  	Boolean fRedraw;
+ #ifndef TEReplaceStyle
+ 	PyMac_PRECHECK(TEReplaceStyle);
+ #endif
  	if (!PyArg_ParseTuple(_args, "hO&O&b",
  	                      &mode,
***************
*** 509,512 ****
--- 593,599 ----
  	PyObject *_res = NULL;
  	StScrpHandle _rv;
+ #ifndef TEGetStyleScrapHandle
+ 	PyMac_PRECHECK(TEGetStyleScrapHandle);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 524,527 ****
--- 611,617 ----
  	int text__in_len__;
  	StScrpHandle hST;
+ #ifndef TEStyleInsert
+ 	PyMac_PRECHECK(TEStyleInsert);
+ #endif
  	if (!PyArg_ParseTuple(_args, "s#O&",
  	                      &text__in__, &text__in_len__,
***************
*** 543,546 ****
--- 633,639 ----
  	long endLine;
  	long startLine;
+ #ifndef TEGetHeight
+ 	PyMac_PRECHECK(TEGetHeight);
+ #endif
  	if (!PyArg_ParseTuple(_args, "ll",
  	                      &endLine,
***************
*** 561,564 ****
--- 654,660 ----
  	short mode;
  	TextStyle aStyle;
+ #ifndef TEContinuousStyle
+ 	PyMac_PRECHECK(TEContinuousStyle);
+ #endif
  	if (!PyArg_ParseTuple(_args, "hO&",
  	                      &mode,
***************
*** 582,585 ****
--- 678,684 ----
  	StScrpHandle newStyles;
  	Boolean fRedraw;
+ #ifndef TEUseStyleScrap
+ 	PyMac_PRECHECK(TEUseStyleScrap);
+ #endif
  	if (!PyArg_ParseTuple(_args, "llO&b",
  	                      &rangeStart,
***************
*** 604,607 ****
--- 703,709 ----
  	long rangeStart;
  	long rangeEnd;
+ #ifndef TENumStyles
+ 	PyMac_PRECHECK(TENumStyles);
+ #endif
  	if (!PyArg_ParseTuple(_args, "ll",
  	                      &rangeStart,
***************
*** 622,625 ****
--- 724,730 ----
  	short feature;
  	short action;
+ #ifndef TEFeatureFlag
+ 	PyMac_PRECHECK(TEFeatureFlag);
+ #endif
  	if (!PyArg_ParseTuple(_args, "hh",
  	                      &feature,
***************
*** 639,642 ****
--- 744,750 ----
  	OSErr _err;
  	RgnHandle region;
+ #ifndef TEGetHiliteRgn
+ 	PyMac_PRECHECK(TEGetHiliteRgn);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      ResObj_Convert, &region))
***************
*** 654,657 ****
--- 762,768 ----
  	PyObject *_res = NULL;
  	Handle _rv;
+ #ifndef as_Resource
+ 	PyMac_PRECHECK(as_Resource);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 819,822 ****
--- 930,936 ----
  	PyObject *_res = NULL;
  	Handle _rv;
+ #ifndef TEScrapHandle
+ 	PyMac_PRECHECK(TEScrapHandle);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 831,834 ****
--- 945,951 ----
  	PyObject *_res = NULL;
  	long _rv;
+ #ifndef TEGetScrapLength
+ 	PyMac_PRECHECK(TEGetScrapLength);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 845,848 ****
--- 962,968 ----
  	Rect destRect;
  	Rect viewRect;
+ #ifndef TENew
+ 	PyMac_PRECHECK(TENew);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&",
  	                      PyMac_GetRect, &destRect,
***************
*** 864,867 ****
--- 984,990 ----
  	Rect box;
  	short just;
+ #ifndef TETextBox
+ 	PyMac_PRECHECK(TETextBox);
+ #endif
  	if (!PyArg_ParseTuple(_args, "s#O&h",
  	                      &text__in__, &text__in_len__,
***************
*** 884,887 ****
--- 1007,1013 ----
  	Rect destRect;
  	Rect viewRect;
+ #ifndef TEStyleNew
+ 	PyMac_PRECHECK(TEStyleNew);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&",
  	                      PyMac_GetRect, &destRect,
***************
*** 899,902 ****
--- 1025,1031 ----
  	PyObject *_res = NULL;
  	long length;
+ #ifndef TESetScrapLength
+ 	PyMac_PRECHECK(TESetScrapLength);
+ #endif
  	if (!PyArg_ParseTuple(_args, "l",
  	                      &length))
***************
*** 912,915 ****
--- 1041,1047 ----
  	PyObject *_res = NULL;
  	OSErr _err;
+ #ifndef TEFromScrap
+ 	PyMac_PRECHECK(TEFromScrap);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 925,928 ****
--- 1057,1063 ----
  	PyObject *_res = NULL;
  	OSErr _err;
+ #ifndef TEToScrap
+ 	PyMac_PRECHECK(TEToScrap);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 940,943 ****
--- 1075,1081 ----
  	PyObject *_res = NULL;
  	Handle _rv;
+ #ifndef TEGetScrapHandle
+ 	PyMac_PRECHECK(TEGetScrapHandle);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 955,958 ****
--- 1093,1099 ----
  	PyObject *_res = NULL;
  	Handle value;
+ #ifndef TESetScrapHandle
+ 	PyMac_PRECHECK(TESetScrapHandle);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      ResObj_Convert, &value))
***************
*** 969,972 ****
--- 1110,1116 ----
  	PyObject *_res = NULL;
  	UInt8 _rv;
+ #ifndef LMGetWordRedraw
+ 	PyMac_PRECHECK(LMGetWordRedraw);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 981,984 ****
--- 1125,1131 ----
  	PyObject *_res = NULL;
  	UInt8 value;
+ #ifndef LMSetWordRedraw
+ 	PyMac_PRECHECK(LMSetWordRedraw);
+ #endif
  	if (!PyArg_ParseTuple(_args, "b",
  	                      &value))
***************
*** 995,998 ****
--- 1142,1148 ----
  	TEHandle _rv;
  	Handle h;
+ #ifndef as_TE
+ 	PyMac_PRECHECK(as_TE);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      ResObj_Convert, &h))