2 * Navit, a modular navigation system.
3 * Copyright (C) 2005-2008 Navit Team
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
21 #include "navigation.h"
25 struct navigation *navigation;
29 navigation_get_map_py(navigationObject *self, PyObject *args)
31 if (!PyArg_ParseTuple(args, ""))
33 return map_py_ref(navigation_get_map(self->navigation));
38 static PyMethodDef navigation_methods[] = {
39 {"get_map", (PyCFunction) navigation_get_map_py, METH_VARARGS },
45 navigation_getattr_py(PyObject *self, char *name)
47 return Py_FindMethod(navigation_methods, self, name);
51 navigation_destroy_py(navigationObject *self)
55 PyTypeObject navigation_Type = {
57 .tp_name="navigation",
58 .tp_basicsize=sizeof(navigationObject),
59 .tp_dealloc=(destructor)navigation_destroy_py,
60 .tp_getattr=navigation_getattr_py,
64 navigation_py(PyObject *self, PyObject *args)
66 navigationObject *ret;
68 ret=PyObject_NEW(navigationObject, &navigation_Type);
69 return (PyObject *)ret;
73 navigation_py_ref(struct navigation *navigation)
75 navigationObject *ret;
77 ret=PyObject_NEW(navigationObject, &navigation_Type);
78 ret->navigation=navigation;
79 return (PyObject *)ret;