[Python-checkins] CVS: python/dist/src/Mac/Modules/mlte mltesupport.py,1.1,1.2
Jack Jansen
jackjansen@users.sourceforge.net
Fri, 13 Jul 2001 15:27:23 -0700
Update of /cvsroot/python/python/dist/src/Mac/Modules/mlte
In directory usw-pr-cvs1:/tmp/cvs-serv32267/Python/Mac/Modules/mlte
Modified Files:
mltesupport.py
Log Message:
Fixed the mis-guessed parameters and added support for a few optional parameter types. There's a good chance that this is usable now (but there's no test code yet).
Index: mltesupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/mlte/mltesupport.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** mltesupport.py 2001/07/13 20:56:52 1.1
--- mltesupport.py 2001/07/13 22:27:20 1.2
***************
*** 43,49 ****
/*
! ** Parse/generate ADD records
*/
"""
--- 43,78 ----
/*
! ** Parse an optional fsspec
*/
+ static int
+ OptFSSpecPtr_Convert(PyObject *v, FSSpec **p_itself)
+ {
+ static FSSpec fss;
+ if (v == Py_None)
+ {
+ *p_itself = NULL;
+ return 1;
+ }
+ *p_itself = &fss;
+ return PyMac_GetFSSpec(v, *p_itself);
+ }
+ /*
+ ** Parse an optional rect
+ */
+ static int
+ OptRectPtr_Convert(PyObject *v, Rect **p_itself)
+ {
+ static Rect r;
+
+ if (v == Py_None)
+ {
+ *p_itself = NULL;
+ return 1;
+ }
+ *p_itself = &r;
+ return PyMac_GetRect(v, *p_itself);
+ }
+
"""
***************
*** 82,85 ****
--- 111,116 ----
MlteInBuffer = VarInputBufferType('void *', 'ByteCount', 'l')
+ OptFSSpecPtr = OpaqueByValueType("FSSpec *", "OptFSSpecPtr")
+ OptRectPtr = OpaqueByValueType("Rect *", "OptRectPtr")
# ADD object type here
***************
*** 132,135 ****
--- 163,186 ----
# ADD Manual generators here
+ inittextension_body = """
+ OSStatus _err;
+ TXNMacOSPreferredFontDescription * iDefaultFonts = NULL;
+ ItemCount iCountDefaultFonts = 0;
+ TXNInitOptions iUsageFlags;
+ PyMac_PRECHECK(TXNInitTextension);
+ if (!PyArg_ParseTuple(_args, "l", &iUsageFlags))
+ return NULL;
+ _err = TXNInitTextension(iDefaultFonts,
+ iCountDefaultFonts,
+ iUsageFlags);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+ """
+
+ f = ManualGenerator("TXNInitTextension", inittextension_body);
+ f.docstring = lambda: "(TXNInitOptions) -> None"
+ module.add(f)
# generate output (open the output file as late as possible)