annotate PC/example_nt/example.c @ 28501:00a56fbea69f 2.2

Backporting: revision 1.27 date: 2003/03/30 20:46:47; author: bwarsaw; state: Exp; lines: +3 -3 __unicode__(): Fix the logic for calculating whether to add a separating space or not between encoded chunks. Closes SF bug #710498.
author Barry Warsaw <barry@python.org>
date Fri, 04 Apr 2003 02:46:38 +0000
parents a1ce07218781
children 834fd9b3ceee
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 {
180c1d3dac41 A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff changeset
6 printf("Hello, world\n");
180c1d3dac41 A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff changeset
7 Py_INCREF(Py_None);
180c1d3dac41 A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff changeset
8 return Py_None;
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[] = {
180c1d3dac41 A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff changeset
12 {"foo", ex_foo, 1, "foo() doc string"},
180c1d3dac41 A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff changeset
13 {NULL, NULL}
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
180c1d3dac41 A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff changeset
16 void
13660
a1ce07218781 Miscelaneous ANSIfications. I'm assuming here 'main' should take (int,
Thomas Wouters <thomas@python.org>
parents: 4223
diff changeset
17 initexample(void)
4223
180c1d3dac41 A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff changeset
18 {
180c1d3dac41 A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff changeset
19 Py_InitModule("example", example_methods);
180c1d3dac41 A directory with a working example of how to build an extension.
Guido van Rossum <guido@python.org>
parents:
diff changeset
20 }