Mercurial > cpython-lru_cache-weakref
annotate Tools/modulator/Templates/module_tail @ 5817:48b94de85bf3 legacy-trunk
Extensive changes by AMK.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 17 Jul 1997 16:29:42 +0000 |
| parents | 1ff12804ff2a |
| children |
| rev | line source |
|---|---|
|
2466
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1 |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2 /* List of methods defined in the module */ |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
3 |
|
2713
cd9d86ecc175
Templates converted to new naming conventions (thanks to Chak Tan)
Jack Jansen <jack.jansen@cwi.nl>
parents:
2466
diff
changeset
|
4 static struct PyMethodDef $abbrev$_methods[] = { |
|
cd9d86ecc175
Templates converted to new naming conventions (thanks to Chak Tan)
Jack Jansen <jack.jansen@cwi.nl>
parents:
2466
diff
changeset
|
5 $methodlist$ |
|
3443
1ff12804ff2a
A few missing casts (Richard Neitzel).
Guido van Rossum <guido@python.org>
parents:
2754
diff
changeset
|
6 {NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */ |
|
2466
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
7 }; |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
8 |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
9 |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
10 /* Initialization function for the module (*must* be called init$name$) */ |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
11 |
|
2754
a1087aa641cd
Jim Fulton's change to support doc strings
Jack Jansen <jack.jansen@cwi.nl>
parents:
2713
diff
changeset
|
12 static char $name$_module_documentation[] = |
|
a1087aa641cd
Jim Fulton's change to support doc strings
Jack Jansen <jack.jansen@cwi.nl>
parents:
2713
diff
changeset
|
13 "" |
|
a1087aa641cd
Jim Fulton's change to support doc strings
Jack Jansen <jack.jansen@cwi.nl>
parents:
2713
diff
changeset
|
14 ; |
|
a1087aa641cd
Jim Fulton's change to support doc strings
Jack Jansen <jack.jansen@cwi.nl>
parents:
2713
diff
changeset
|
15 |
|
2466
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
16 void |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
17 init$name$() |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
18 { |
|
2713
cd9d86ecc175
Templates converted to new naming conventions (thanks to Chak Tan)
Jack Jansen <jack.jansen@cwi.nl>
parents:
2466
diff
changeset
|
19 PyObject *m, *d; |
|
2466
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
20 |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
21 /* Create the module and add the functions */ |
|
2754
a1087aa641cd
Jim Fulton's change to support doc strings
Jack Jansen <jack.jansen@cwi.nl>
parents:
2713
diff
changeset
|
22 m = Py_InitModule4("$name$", $abbrev$_methods, |
|
a1087aa641cd
Jim Fulton's change to support doc strings
Jack Jansen <jack.jansen@cwi.nl>
parents:
2713
diff
changeset
|
23 $name$_module_documentation, |
|
a1087aa641cd
Jim Fulton's change to support doc strings
Jack Jansen <jack.jansen@cwi.nl>
parents:
2713
diff
changeset
|
24 (PyObject*)NULL,PYTHON_API_VERSION); |
|
2466
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
25 |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
26 /* Add some symbolic constants to the module */ |
|
2713
cd9d86ecc175
Templates converted to new naming conventions (thanks to Chak Tan)
Jack Jansen <jack.jansen@cwi.nl>
parents:
2466
diff
changeset
|
27 d = PyModule_GetDict(m); |
|
cd9d86ecc175
Templates converted to new naming conventions (thanks to Chak Tan)
Jack Jansen <jack.jansen@cwi.nl>
parents:
2466
diff
changeset
|
28 ErrorObject = PyString_FromString("$name$.error"); |
|
cd9d86ecc175
Templates converted to new naming conventions (thanks to Chak Tan)
Jack Jansen <jack.jansen@cwi.nl>
parents:
2466
diff
changeset
|
29 PyDict_SetItemString(d, "error", ErrorObject); |
|
2466
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
30 |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
31 /* XXXX Add constants here */ |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
32 |
|
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
33 /* Check for errors */ |
|
2713
cd9d86ecc175
Templates converted to new naming conventions (thanks to Chak Tan)
Jack Jansen <jack.jansen@cwi.nl>
parents:
2466
diff
changeset
|
34 if (PyErr_Occurred()) |
|
cd9d86ecc175
Templates converted to new naming conventions (thanks to Chak Tan)
Jack Jansen <jack.jansen@cwi.nl>
parents:
2466
diff
changeset
|
35 Py_FatalError("can't initialize module $name$"); |
|
2466
322fc596f1c4
checkin of Jack's original version
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
36 } |
|
2713
cd9d86ecc175
Templates converted to new naming conventions (thanks to Chak Tan)
Jack Jansen <jack.jansen@cwi.nl>
parents:
2466
diff
changeset
|
37 |
