~ubuntu-branches/ubuntu/maverick/python3.1/maverick

« back to all changes in this revision

Viewing changes to Tools/modulator/Templates/module_tail

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-03-23 00:01:27 UTC
  • Revision ID: james.westby@ubuntu.com-20090323000127-5fstfxju4ufrhthq
Tags: upstream-3.1~a1+20090322
ImportĀ upstreamĀ versionĀ 3.1~a1+20090322

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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