diff options
author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2010-11-21 21:30:12 +0000 |
---|---|---|
committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2010-11-21 21:30:12 +0000 |
commit | faf1817409cbd5550123e0e9feef562e98e4e75e (patch) | |
tree | 42de5c5f0b347aa865b9670fa3bad59d45a01904 /navit/binding/python/navigation.c | |
parent | 9c466478ff2dac553e14a97e62979cdeccec19fe (diff) | |
parent | 0a095f392cd1f4f45cb34061d64414108572926f (diff) | |
download | navit-svn-R0_2_0.tar.gz |
Now correct tagR0_2_0
git-svn-id: http://svn.code.sf.net/p/navit/code/tags/R0_2_0/navit@3708 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/binding/python/navigation.c')
-rw-r--r-- | navit/binding/python/navigation.c | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/navit/binding/python/navigation.c b/navit/binding/python/navigation.c new file mode 100644 index 00000000..75a421d5 --- /dev/null +++ b/navit/binding/python/navigation.c @@ -0,0 +1,82 @@ +/** + * Navit, a modular navigation system. + * Copyright (C) 2005-2008 Navit Team + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "common.h" +#include "navigation.h" + +typedef struct { + PyObject_HEAD + struct navigation *navigation; +} navigationObject; + +static PyObject * +navigation_get_map_py(navigationObject *self, PyObject *args) +{ + if (!PyArg_ParseTuple(args, "")) + return NULL; + return map_py_ref(navigation_get_map(self->navigation)); +} + + + +static PyMethodDef navigation_methods[] = { + {"get_map", (PyCFunction) navigation_get_map_py, METH_VARARGS }, + {NULL, NULL }, +}; + + +static PyObject * +navigation_getattr_py(PyObject *self, char *name) +{ + return Py_FindMethod(navigation_methods, self, name); +} + +static void +navigation_destroy_py(navigationObject *self) +{ +} + +PyTypeObject navigation_Type = { + Obj_HEAD + .tp_name="navigation", + .tp_basicsize=sizeof(navigationObject), + .tp_dealloc=(destructor)navigation_destroy_py, + .tp_getattr=navigation_getattr_py, +}; + +PyObject * +navigation_py(PyObject *self, PyObject *args) +{ + navigationObject *ret; + + ret=PyObject_NEW(navigationObject, &navigation_Type); + return (PyObject *)ret; +} + +PyObject * +navigation_py_ref(struct navigation *navigation) +{ + navigationObject *ret; + + ret=PyObject_NEW(navigationObject, &navigation_Type); + ret->navigation=navigation; + return (PyObject *)ret; +} + + |