annotate PC/example_nt/example.c @ 74006:88198b93ff2f

Issue #13560: Add PyUnicode_EncodeLocale() * Use PyUnicode_EncodeLocale() in time.strftime() if wcsftime() is not available * Document my last changes in Misc/NEWS
author Victor Stinner <victor.stinner@haypocalc.com>
date Sat, 17 Dec 2011 04:13:41 +0100
parents cab14be0ada1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4223
180c1d3dac41 A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 #include "Python.h"
180c1d3dac41 A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff changeset
2
180c1d3dac41 A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff changeset
3 static PyObject *
13660
a1ce07218781 Miscelaneous ANSIfications. I'm assuming here 'main' should take (int,
Thomas Wouters <thomas@python.org>
parents: 4223
diff changeset
4 ex_foo(PyObject *self, PyObject *args)
4223
180c1d3dac41 A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff changeset
5 {
61466
cab14be0ada1 Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 50557
diff changeset
6 printf("Hello, world\n");
cab14be0ada1 Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 50557
diff changeset
7 Py_INCREF(Py_None);
cab14be0ada1 Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 50557
diff changeset
8 return Py_None;
4223
180c1d3dac41 A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff changeset
9 }
180c1d3dac41 A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff changeset
10
180c1d3dac41 A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff changeset
11 static PyMethodDef example_methods[] = {
61466
cab14be0ada1 Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 50557
diff changeset
12 {"foo", ex_foo, METH_VARARGS, "foo() doc string"},
cab14be0ada1 Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 50557
diff changeset
13 {NULL, NULL}
4223
180c1d3dac41 A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff changeset
14 };
180c1d3dac41 A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff changeset
15
50557
bd0e361bd642 Merged revisions 68169-68170 via svnmerge from
Georg Brandl <georg@python.org>
parents: 38669
diff changeset
16 static struct PyModuleDef examplemodule = {
61466
cab14be0ada1 Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 50557
diff changeset
17 PyModuleDef_HEAD_INIT,
cab14be0ada1 Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 50557
diff changeset
18 "example",
cab14be0ada1 Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 50557
diff changeset
19 "example module doc string",
cab14be0ada1 Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 50557
diff changeset
20 -1,
cab14be0ada1 Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 50557
diff changeset
21 example_methods,
cab14be0ada1 Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 50557
diff changeset
22 NULL,
cab14be0ada1 Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 50557
diff changeset
23 NULL,
cab14be0ada1 Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 50557
diff changeset
24 NULL,
cab14be0ada1 Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 50557
diff changeset
25 NULL
50557
bd0e361bd642 Merged revisions 68169-68170 via svnmerge from
Georg Brandl <georg@python.org>
parents: 38669
diff changeset
26 };
bd0e361bd642 Merged revisions 68169-68170 via svnmerge from
Georg Brandl <georg@python.org>
parents: 38669
diff changeset
27
38453
29ae5e0fc348 Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents: 13660
diff changeset
28 PyMODINIT_FUNC
50557
bd0e361bd642 Merged revisions 68169-68170 via svnmerge from
Georg Brandl <georg@python.org>
parents: 38669
diff changeset
29 PyInit_example(void)
4223
180c1d3dac41 A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff changeset
30 {
61466
cab14be0ada1 Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents: 50557
diff changeset
31 return PyModule_Create(&examplemodule);
4223
180c1d3dac41 A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff changeset
32 }