/[zanavi_public1]/navit/navit/binding/python/config.c
ZANavi

Contents of /navit/navit/binding/python/config.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations) (download)
Fri Oct 28 21:19:04 2011 UTC (12 years, 5 months ago) by zoff99
File MIME type: text/plain
File size: 1692 byte(s)
import files
1 /**
2 * Navit, a modular navigation system.
3 * Copyright (C) 2005-2008 Navit Team
4 *
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.
8 *
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.
13 *
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.
18 */
19
20 #include "common.h"
21 #include "item.h"
22 #include "config_.h"
23
24 typedef struct {
25 PyObject_HEAD
26 } configObject;
27
28 static PyObject *
29 config_navit(PyObject *self, PyObject *args)
30 {
31 struct attr navit;
32 if (config_get_attr(config, attr_navit, &navit, NULL))
33 return navit_py_ref(navit.u.navit);
34 return NULL;
35 }
36
37
38
39 static PyMethodDef config_methods[] = {
40 {"navit", (PyCFunction) config_navit, METH_VARARGS },
41 {NULL, NULL },
42 };
43
44
45 static PyObject *
46 config_getattr_py(PyObject *self, char *name)
47 {
48 return Py_FindMethod(config_methods, self, name);
49 }
50
51 static void
52 config_destroy_py(configObject *self)
53 {
54 }
55
56 PyTypeObject config_Type = {
57 Obj_HEAD
58 .tp_name="config",
59 .tp_basicsize=sizeof(configObject),
60 .tp_dealloc=(destructor)config_destroy_py,
61 .tp_getattr=config_getattr_py,
62 };
63
64 PyObject *
65 config_py(PyObject *self, PyObject *args)
66 {
67 configObject *ret;
68
69 dbg(0,"enter\n");
70 ret=PyObject_NEW(configObject, &config_Type);
71 return (PyObject *)ret;
72 }
73

   
Visit the ZANavi Wiki