4 /* This simply wraps the config.py module so that it can be accessed from the
8 static PyObject *add, *get, *set, *reset;
10 void configwrap_startup()
14 /* get the ob module/dict */
15 c = PyImport_ImportModule("config"); /* new */
17 cdict = PyModule_GetDict(c); /* borrowed */
18 g_assert(cdict != NULL);
20 /* get the functions */
21 add = PyDict_GetItemString(cdict, "add");
22 g_assert(add != NULL);
23 get = PyDict_GetItemString(cdict, "get");
24 g_assert(get != NULL);
25 set = PyDict_GetItemString(cdict, "set");
26 g_assert(set != NULL);
27 reset = PyDict_GetItemString(cdict, "reset");
28 g_assert(reset != NULL);
33 void configwrap_shutdown()
41 void configwrap_add_int(char *modname, char *varname, char *friendname,
42 char *description, int defvalue)
46 r= PyObject_CallFunction(add, "sssssi", modname, varname,
47 friendname, description, "integer", defvalue);
52 int configwrap_get_int(char *modname, char *varname)
57 r = PyObject_CallFunction(get, "ss", modname, varname);
64 void configwrap_set_int(char *modname, char *varname, int value)
68 r = PyObject_CallFunction(set, "ssi", modname, varname, value);
73 void configwrap_reset(char *modname, char *varname)
77 r = PyObject_CallFunction(reset, "ss", modname, varname);