From: Jack Jansen Date: Wed, 15 Nov 1995 15:19:29 +0000 (+0000) Subject: Added converters for Fixed X-Git-Tag: v1.4b1~464 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fa4d5d0414da24c2fa4ffc617ed6ee2d33c3ddd2;p=thirdparty%2FPython%2Fcpython.git Added converters for Fixed --- diff --git a/Mac/Include/macglue.h b/Mac/Include/macglue.h index 3a51101abb9c..9213f2f33f67 100644 --- a/Mac/Include/macglue.h +++ b/Mac/Include/macglue.h @@ -80,4 +80,6 @@ PyObject *PyMac_BuildPoint(Point); /* Convert Point to PyObject */ int PyMac_GetEventRecord(PyObject *, EventRecord *); /* argument parser for EventRecord */ PyObject *PyMac_BuildEventRecord(EventRecord *); /* Convert EventRecord to PyObject */ +int PyMac_GetFixed(PyObject *, Fixed *); /* argument parser for Fixed */ +PyObject *PyMac_BuildFixed(Fixed); /* Convert Fixed to PyObject */ void PyMac_InitApplet(void); /* Initialize and run an Applet */ diff --git a/Mac/Python/macglue.c b/Mac/Python/macglue.c index 2528e2538c85..23415eb8b5cb 100644 --- a/Mac/Python/macglue.c +++ b/Mac/Python/macglue.c @@ -734,3 +734,26 @@ PyMac_BuildEventRecord(EventRecord *e) e->where.v, e->modifiers); } + +/* Convert Python object to Fixed */ +int +PyMac_GetFixed(PyObject *v, Fixed *f) +{ + double d; + + if( !PyArg_Parse(v, "d", &d)) + return 0; + *f = (Fixed)(d * 0x10000); +} + +/* Convert a Point to a Python object */ +PyObject * +PyMac_BuildFixed(Fixed f) +{ + double d; + + d = f; + d = d / 0x10000; + return Py_BuildValue("d", d); +} +