[Python-checkins] CVS: python/dist/src/Mac/Modules/fm _Fmmodule.c,1.4.4.1,1.4.4.2 fmsupport.py,1.4.14.1,1.4.14.2

Jack Jansen jackjansen@users.sourceforge.net
Mon, 25 Mar 2002 02:57:01 -0800


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

Modified Files:
      Tag: release22-maint
	_Fmmodule.c fmsupport.py 
Log Message:
Backport of _Fmmodule.c 1.6 and fmsupport.py 1.6:
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: _Fmmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/fm/_Fmmodule.c,v
retrieving revision 1.4.4.1
retrieving revision 1.4.4.2
diff -C2 -d -r1.4.4.1 -r1.4.4.2
*** _Fmmodule.c	27 Feb 2002 23:13:04 -0000	1.4.4.1
--- _Fmmodule.c	25 Mar 2002 10:56:59 -0000	1.4.4.2
***************
*** 65,68 ****
--- 65,71 ----
  {
  	PyObject *_res = NULL;
+ #ifndef InitFonts
+ 	PyMac_PRECHECK(InitFonts);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 79,82 ****
--- 82,88 ----
  	short familyID;
  	Str255 name;
+ #ifndef GetFontName
+ 	PyMac_PRECHECK(GetFontName);
+ #endif
  	if (!PyArg_ParseTuple(_args, "h",
  	                      &familyID))
***************
*** 94,97 ****
--- 100,106 ----
  	Str255 name;
  	short familyID;
+ #ifndef GetFNum
+ 	PyMac_PRECHECK(GetFNum);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&",
  	                      PyMac_GetStr255, name))
***************
*** 110,113 ****
--- 119,125 ----
  	short fontNum;
  	short size;
+ #ifndef RealFont
+ 	PyMac_PRECHECK(RealFont);
+ #endif
  	if (!PyArg_ParseTuple(_args, "hh",
  	                      &fontNum,
***************
*** 127,130 ****
--- 139,145 ----
  	PyObject *_res = NULL;
  	Boolean lockFlag;
+ #ifndef SetFontLock
+ 	PyMac_PRECHECK(SetFontLock);
+ #endif
  	if (!PyArg_ParseTuple(_args, "b",
  	                      &lockFlag))
***************
*** 141,144 ****
--- 156,162 ----
  	PyObject *_res = NULL;
  	Boolean fscaleDisable;
+ #ifndef SetFScaleDisable
+ 	PyMac_PRECHECK(SetFScaleDisable);
+ #endif
  	if (!PyArg_ParseTuple(_args, "b",
  	                      &fscaleDisable))
***************
*** 154,157 ****
--- 172,178 ----
  	PyObject *_res = NULL;
  	FMetricRec theMetrics;
+ #ifndef FontMetrics
+ 	PyMac_PRECHECK(FontMetrics);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 166,169 ****
--- 187,193 ----
  	PyObject *_res = NULL;
  	Boolean fractEnable;
+ #ifndef SetFractEnable
+ 	PyMac_PRECHECK(SetFractEnable);
+ #endif
  	if (!PyArg_ParseTuple(_args, "b",
  	                      &fractEnable))
***************
*** 179,182 ****
--- 203,209 ----
  	PyObject *_res = NULL;
  	short _rv;
+ #ifndef GetDefFontSize
+ 	PyMac_PRECHECK(GetDefFontSize);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 193,196 ****
--- 220,226 ----
  	Point numer;
  	Point denom;
+ #ifndef IsOutline
+ 	PyMac_PRECHECK(IsOutline);
+ #endif
  	if (!PyArg_ParseTuple(_args, "O&O&",
  	                      PyMac_GetPoint, &numer,
***************
*** 208,211 ****
--- 238,244 ----
  	PyObject *_res = NULL;
  	Boolean outlinePreferred;
+ #ifndef SetOutlinePreferred
+ 	PyMac_PRECHECK(SetOutlinePreferred);
+ #endif
  	if (!PyArg_ParseTuple(_args, "b",
  	                      &outlinePreferred))
***************
*** 221,224 ****
--- 254,260 ----
  	PyObject *_res = NULL;
  	Boolean _rv;
+ #ifndef GetOutlinePreferred
+ 	PyMac_PRECHECK(GetOutlinePreferred);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 233,236 ****
--- 269,275 ----
  	PyObject *_res = NULL;
  	Boolean preserveGlyph;
+ #ifndef SetPreserveGlyph
+ 	PyMac_PRECHECK(SetPreserveGlyph);
+ #endif
  	if (!PyArg_ParseTuple(_args, "b",
  	                      &preserveGlyph))
***************
*** 246,249 ****
--- 285,291 ----
  	PyObject *_res = NULL;
  	Boolean _rv;
+ #ifndef GetPreserveGlyph
+ 	PyMac_PRECHECK(GetPreserveGlyph);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 260,263 ****
--- 302,308 ----
  	PyObject *_res = NULL;
  	OSErr _err;
+ #ifndef FlushFonts
+ 	PyMac_PRECHECK(FlushFonts);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 274,277 ****
--- 319,325 ----
  	PyObject *_res = NULL;
  	short _rv;
+ #ifndef GetSysFont
+ 	PyMac_PRECHECK(GetSysFont);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 286,289 ****
--- 334,340 ----
  	PyObject *_res = NULL;
  	short _rv;
+ #ifndef GetAppFont
+ 	PyMac_PRECHECK(GetAppFont);
+ #endif
  	if (!PyArg_ParseTuple(_args, ""))
  		return NULL;
***************
*** 301,304 ****
--- 352,358 ----
  	int inText__in_len__;
  	Rect bounds;
+ #ifndef QDTextBounds
+ 	PyMac_PRECHECK(QDTextBounds);
+ #endif
  	if (!PyArg_ParseTuple(_args, "s#",
  	                      &inText__in__, &inText__in_len__))

Index: fmsupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/fm/fmsupport.py,v
retrieving revision 1.4.14.1
retrieving revision 1.4.14.2
diff -C2 -d -r1.4.14.1 -r1.4.14.2
*** fmsupport.py	27 Feb 2002 23:13:06 -0000	1.4.14.1
--- fmsupport.py	25 Mar 2002 10:56:59 -0000	1.4.14.2
***************
*** 71,75 ****
  
  # Create the generator classes used to populate the lists
! Function = OSErrFunctionGenerator
  
  # Create and populate the lists
--- 71,75 ----
  
  # Create the generator classes used to populate the lists
! Function = OSErrWeakLinkFunctionGenerator
  
  # Create and populate the lists