Mercurial > cpython-lru_cache-weakref
annotate Include/cStringIO.h @ 58765:2ba7677bfa95 legacy-trunk
testCopysign was defined twice in test_math; combine the definitions
| author | Mark Dickinson <dickinsm@gmail.com> |
|---|---|
| date | Sat, 06 Feb 2010 23:11:25 +0000 |
| parents | 86a2679dca46 |
| children | d11fbc796499 |
| rev | line source |
|---|---|
|
25554
36124157b317
SF # 607253, header file problems by Ralf W. Grosse-Kunstleve
Neal Norwitz <nnorwitz@gmail.com>
parents:
24580
diff
changeset
|
1 #ifndef Py_CSTRINGIO_H |
|
36124157b317
SF # 607253, header file problems by Ralf W. Grosse-Kunstleve
Neal Norwitz <nnorwitz@gmail.com>
parents:
24580
diff
changeset
|
2 #define Py_CSTRINGIO_H |
|
22688
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
18064
diff
changeset
|
3 #ifdef __cplusplus |
|
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
18064
diff
changeset
|
4 extern "C" { |
|
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
18064
diff
changeset
|
5 #endif |
| 4598 | 6 /* |
| 7 | |
| 8 This header provides access to cStringIO objects from C. | |
| 9 Functions are provided for calling cStringIO objects and | |
| 10 macros are provided for testing whether you have cStringIO | |
| 11 objects. | |
| 12 | |
| 13 Before calling any of the functions or macros, you must initialize | |
| 14 the routines with: | |
| 15 | |
|
9944
396a38ea9b84
There's a macro PycString_IMPORT which the documentation listed as
Guido van Rossum <guido@python.org>
parents:
9605
diff
changeset
|
16 PycString_IMPORT |
| 4598 | 17 |
| 18 This would typically be done in your init function. | |
| 19 | |
| 20 */ | |
|
24580
ca20be24381f
Remove function definition from cStringIO.h.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
22805
diff
changeset
|
21 #define PycString_IMPORT \ |
|
ca20be24381f
Remove function definition from cStringIO.h.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
22805
diff
changeset
|
22 PycStringIO = (struct PycStringIO_CAPI*)PyCObject_Import("cStringIO", \ |
|
ca20be24381f
Remove function definition from cStringIO.h.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
22805
diff
changeset
|
23 "cStringIO_CAPI") |
| 4598 | 24 |
|
13620
5b727ab37092
Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either
Thomas Wouters <thomas@python.org>
parents:
13447
diff
changeset
|
25 /* Basic functions to manipulate cStringIO objects from C */ |
| 4598 | 26 |
|
5279
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
27 static struct PycStringIO_CAPI { |
|
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
28 |
|
27291
7039375226a7
SF bug #670229: doc improvement for cStringIO.h
Raymond Hettinger <python@rcn.com>
parents:
25554
diff
changeset
|
29 /* Read a string from an input object. If the last argument |
|
7039375226a7
SF bug #670229: doc improvement for cStringIO.h
Raymond Hettinger <python@rcn.com>
parents:
25554
diff
changeset
|
30 is -1, the remainder will be read. |
|
7039375226a7
SF bug #670229: doc improvement for cStringIO.h
Raymond Hettinger <python@rcn.com>
parents:
25554
diff
changeset
|
31 */ |
|
36501
7fdc639bc5b4
Merge ssize_t branch.
Martin v. Löwis <martin@v.loewis.de>
parents:
35999
diff
changeset
|
32 int(*cread)(PyObject *, char **, Py_ssize_t); |
| 4598 | 33 |
|
27291
7039375226a7
SF bug #670229: doc improvement for cStringIO.h
Raymond Hettinger <python@rcn.com>
parents:
25554
diff
changeset
|
34 /* Read a line from an input object. Returns the length of the read |
|
7039375226a7
SF bug #670229: doc improvement for cStringIO.h
Raymond Hettinger <python@rcn.com>
parents:
25554
diff
changeset
|
35 line as an int and a pointer inside the object buffer as char** (so |
|
7039375226a7
SF bug #670229: doc improvement for cStringIO.h
Raymond Hettinger <python@rcn.com>
parents:
25554
diff
changeset
|
36 the caller doesn't have to provide its own buffer as destination). |
|
7039375226a7
SF bug #670229: doc improvement for cStringIO.h
Raymond Hettinger <python@rcn.com>
parents:
25554
diff
changeset
|
37 */ |
|
13447
a89f7f268de4
Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.
Tim Peters <tim.peters@gmail.com>
parents:
9944
diff
changeset
|
38 int(*creadline)(PyObject *, char **); |
| 4598 | 39 |
|
27291
7039375226a7
SF bug #670229: doc improvement for cStringIO.h
Raymond Hettinger <python@rcn.com>
parents:
25554
diff
changeset
|
40 /* Write a string to an output object*/ |
|
36501
7fdc639bc5b4
Merge ssize_t branch.
Martin v. Löwis <martin@v.loewis.de>
parents:
35999
diff
changeset
|
41 int(*cwrite)(PyObject *, const char *, Py_ssize_t); |
| 4598 | 42 |
|
27291
7039375226a7
SF bug #670229: doc improvement for cStringIO.h
Raymond Hettinger <python@rcn.com>
parents:
25554
diff
changeset
|
43 /* Get the output object as a Python string (returns new reference). */ |
|
13447
a89f7f268de4
Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.
Tim Peters <tim.peters@gmail.com>
parents:
9944
diff
changeset
|
44 PyObject *(*cgetvalue)(PyObject *); |
| 4598 | 45 |
|
5279
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
46 /* Create a new output object */ |
|
13447
a89f7f268de4
Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.
Tim Peters <tim.peters@gmail.com>
parents:
9944
diff
changeset
|
47 PyObject *(*NewOutput)(int); |
| 4598 | 48 |
|
27291
7039375226a7
SF bug #670229: doc improvement for cStringIO.h
Raymond Hettinger <python@rcn.com>
parents:
25554
diff
changeset
|
49 /* Create an input object from a Python string |
|
7039375226a7
SF bug #670229: doc improvement for cStringIO.h
Raymond Hettinger <python@rcn.com>
parents:
25554
diff
changeset
|
50 (copies the Python string reference). |
|
7039375226a7
SF bug #670229: doc improvement for cStringIO.h
Raymond Hettinger <python@rcn.com>
parents:
25554
diff
changeset
|
51 */ |
|
13447
a89f7f268de4
Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.
Tim Peters <tim.peters@gmail.com>
parents:
9944
diff
changeset
|
52 PyObject *(*NewInput)(PyObject *); |
| 4598 | 53 |
|
5279
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
54 /* The Python types for cStringIO input and output objects. |
|
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
55 Note that you can do input on an output object. |
|
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
56 */ |
|
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
57 PyTypeObject *InputType, *OutputType; |
|
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
58 |
|
24580
ca20be24381f
Remove function definition from cStringIO.h.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
22805
diff
changeset
|
59 } *PycStringIO; |
| 4598 | 60 |
| 61 /* These can be used to test if you have one */ | |
| 4902 | 62 #define PycStringIO_InputCheck(O) \ |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
42334
diff
changeset
|
63 (Py_TYPE(O)==PycStringIO->InputType) |
| 4902 | 64 #define PycStringIO_OutputCheck(O) \ |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
42334
diff
changeset
|
65 (Py_TYPE(O)==PycStringIO->OutputType) |
| 4598 | 66 |
|
22688
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
18064
diff
changeset
|
67 #ifdef __cplusplus |
|
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
18064
diff
changeset
|
68 } |
|
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
18064
diff
changeset
|
69 #endif |
|
25554
36124157b317
SF # 607253, header file problems by Ralf W. Grosse-Kunstleve
Neal Norwitz <nnorwitz@gmail.com>
parents:
24580
diff
changeset
|
70 #endif /* !Py_CSTRINGIO_H */ |
