]> git.lizzy.rs Git - plan9front.git/blob - sys/src/cmd/python/Tools/modulator/Templates/module_tail
/sys/lib/dist/mkfile: test for .git directory
[plan9front.git] / sys / src / cmd / python / Tools / modulator / Templates / module_tail
1
2 /* List of methods defined in the module */
3
4 static 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
12 static char $name$_module_documentation[] = 
13 ""
14 ;
15
16 void
17 init$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