/Tools/modulator/Templates/module_tail
#! | 37 lines | 26 code | 11 blank | 0 comment | 0 complexity | 6035d090ebce62f492ea2d5e939659ff MD5 | raw file
1 2/* List of methods defined in the module */ 3 4static struct PyMethodDef $abbrev$_methods[] = { 5 $methodlist$ 6 {NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */ 7}; 8 9 10/* Initialization function for the module (*must* be called init$name$) */ 11 12static char $name$_module_documentation[] = 13"" 14; 15 16void 17init$name$() 18{ 19 PyObject *m, *d; 20 21 /* Create the module and add the functions */ 22 m = Py_InitModule4("$name$", $abbrev$_methods, 23 $name$_module_documentation, 24 (PyObject*)NULL,PYTHON_API_VERSION); 25 26 /* Add some symbolic constants to the module */ 27 d = PyModule_GetDict(m); 28 ErrorObject = PyString_FromString("$name$.error"); 29 PyDict_SetItemString(d, "error", ErrorObject); 30 31 /* XXXX Add constants here */ 32 33 /* Check for errors */ 34 if (PyErr_Occurred()) 35 Py_FatalError("can't initialize module $name$"); 36} 37