diff options
Diffstat (limited to 'navit/binding/python/pcoord.c')
-rw-r--r-- | navit/binding/python/pcoord.c | 77 |
1 files changed, 34 insertions, 43 deletions
diff --git a/navit/binding/python/pcoord.c b/navit/binding/python/pcoord.c index 4fe734a70..0c8d959fe 100644 --- a/navit/binding/python/pcoord.c +++ b/navit/binding/python/pcoord.c @@ -21,68 +21,59 @@ #include "coord.h" typedef struct { - PyObject_HEAD - struct pcoord pc; + PyObject_HEAD + struct pcoord pc; } pcoordObject; -static PyObject * -pcoord_func(pcoordObject *self, PyObject *args) -{ - const char *file; - int ret=0; - if (!PyArg_ParseTuple(args, "s", &file)) - return NULL; - return Py_BuildValue("i",ret); +static PyObject *pcoord_func(pcoordObject *self, PyObject *args) { + const char *file; + int ret=0; + if (!PyArg_ParseTuple(args, "s", &file)) + return NULL; + return Py_BuildValue("i",ret); } static PyMethodDef pcoord_methods[] = { - {"func", (PyCFunction) pcoord_func, METH_VARARGS }, - {NULL, NULL }, + {"func", (PyCFunction) pcoord_func, METH_VARARGS }, + {NULL, NULL }, }; -static PyObject * -pcoord_getattr_py(PyObject *self, char *name) -{ - return Py_FindMethod(pcoord_methods, self, name); +static PyObject *pcoord_getattr_py(PyObject *self, char *name) { + return Py_FindMethod(pcoord_methods, self, name); } -static void -pcoord_destroy_py(pcoordObject *self) -{ +static void pcoord_destroy_py(pcoordObject *self) { } PyTypeObject pcoord_Type = { - Obj_HEAD - .tp_name="pcoord", - .tp_basicsize=sizeof(pcoordObject), - .tp_dealloc=(destructor)pcoord_destroy_py, - .tp_getattr=pcoord_getattr_py, + Obj_HEAD + .tp_name="pcoord", + .tp_basicsize=sizeof(pcoordObject), + .tp_dealloc=(destructor)pcoord_destroy_py, + .tp_getattr=pcoord_getattr_py, }; -PyObject * -pcoord_py(PyObject *self, PyObject *args) -{ - pcoordObject *ret; - const char *str; - enum projection pro; - struct coord c; - if (!PyArg_ParseTuple(args, "si", &str, &pro)) - return NULL; - ret=PyObject_NEW(pcoordObject, &pcoord_Type); - coord_parse(str, pro, &c); - ret->pc.pro=pro; - ret->pc.x=c.x; - ret->pc.y=c.y; - dbg(lvl_debug,"0x%x,0x%x\n", c.x, c.y); - return (PyObject *)ret; +PyObject *pcoord_py(PyObject *self, PyObject *args) { + pcoordObject *ret; + const char *str; + enum projection pro; + struct coord c; + if (!PyArg_ParseTuple(args, "si", &str, &pro)) + return NULL; + ret=PyObject_NEW(pcoordObject, &pcoord_Type); + coord_parse(str, pro, &c); + ret->pc.pro=pro; + ret->pc.x=c.x; + ret->pc.y=c.y; + dbg(lvl_debug,"0x%x,0x%x", c.x, c.y); + return (PyObject *)ret; } struct pcoord * -pcoord_py_get(PyObject *self) -{ - return &((pcoordObject *)self)->pc; +pcoord_py_get(PyObject *self) { + return &((pcoordObject *)self)->pc; } |