]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Added converters for Fixed
authorJack Jansen <jack.jansen@cwi.nl>
Wed, 15 Nov 1995 15:19:29 +0000 (15:19 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Wed, 15 Nov 1995 15:19:29 +0000 (15:19 +0000)
Mac/Include/macglue.h
Mac/Python/macglue.c

index 3a51101abb9c24f5f23ccec307111794f45cc84a..9213f2f33f67b7eff55bff9b893ba65199aeecdc 100644 (file)
@@ -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 */
index 2528e2538c858162b2e43834870b382e6967af24..23415eb8b5cb2802c3e8b51d2fe93ef26b7fdd09 100644 (file)
@@ -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);
+}
+