mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Added converters for Fixed
This commit is contained in:
parent
b7abb18cd9
commit
fa4d5d0414
2 changed files with 25 additions and 0 deletions
|
@ -80,4 +80,6 @@ PyObject *PyMac_BuildPoint(Point); /* Convert Point to PyObject */
|
||||||
int PyMac_GetEventRecord(PyObject *, EventRecord *); /* argument parser for EventRecord */
|
int PyMac_GetEventRecord(PyObject *, EventRecord *); /* argument parser for EventRecord */
|
||||||
PyObject *PyMac_BuildEventRecord(EventRecord *); /* Convert EventRecord to PyObject */
|
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 */
|
void PyMac_InitApplet(void); /* Initialize and run an Applet */
|
||||||
|
|
|
@ -734,3 +734,26 @@ PyMac_BuildEventRecord(EventRecord *e)
|
||||||
e->where.v,
|
e->where.v,
|
||||||
e->modifiers);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue