Changeset 4038 for neercs/trunk/src/py_module.c
- Timestamp:
- Nov 25, 2009, 4:07:46 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
neercs/trunk/src/py_module.c
r4035 r4038 37 37 #include "neercs.h" 38 38 39 /* FIXME : Find a way to pass a user pointer to PyModuleDef or something */ 40 struct screen_list *screen_list; 41 42 static PyObject* 43 neercs_get(PyObject *self, PyObject *args) 44 { 45 char *s = NULL; 46 47 debug("Get using list at %p\n", screen_list); 48 49 if(!PyArg_ParseTuple(args, "s", &s)) 50 { 51 debug("py Can't parse\n"); 52 return NULL; 53 } 54 debug("py Argument : '%s'\n", s); 55 struct config_line *c = get_config(s); 56 debug("py config %p\n"); 57 58 if(c) 59 return Py_BuildValue("s", c->get(screen_list)); 60 else 61 return Py_BuildValue("s", "Invalid"); 62 63 } 39 64 40 65 static PyObject* … … 47 72 48 73 static PyMethodDef NeercsMethods[] = { 49 {"version", neercs_version, METH_VARARGS, 50 "Return the neercs version."},74 {"version", neercs_version, METH_VARARGS, "Return the neercs version."}, 75 {"get", neercs_get, METH_VARARGS, "Return the specified variable's value."}, 51 76 {NULL, NULL, 0, NULL} 52 77 }; … … 57 82 }; 58 83 59 PyObject* PyInit_neercs( void)84 PyObject* PyInit_neercs(struct screen_list* sl) 60 85 { 86 screen_list = sl; 61 87 PyObject* o = PyModule_Create(&NeercsModule); 62 88 PyImport_AppendInittab("neercs", &PyInit_neercs);
Note: See TracChangeset
for help on using the changeset viewer.