summaryrefslogtreecommitdiff
path: root/Modules/cStringIO.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2002-06-13 20:33:02 +0000
committerMartin v. Löwis <martin@v.loewis.de>2002-06-13 20:33:02 +0000
commit14f8b4cfcb98de74b9c6e9316539be9e2a5cd31f (patch)
tree7b150133cdd51df851c6bdaf261cd9ea30c149af /Modules/cStringIO.c
parent654c11ee3a2c9b72c040524c9cc4f95a1858f20b (diff)
downloadcpython-git-14f8b4cfcb98de74b9c6e9316539be9e2a5cd31f.tar.gz
Patch #568124: Add doc string macros.
Diffstat (limited to 'Modules/cStringIO.c')
-rw-r--r--Modules/cStringIO.c83
1 files changed, 35 insertions, 48 deletions
diff --git a/Modules/cStringIO.c b/Modules/cStringIO.c
index 1dbec84651..2f85f417d9 100644
--- a/Modules/cStringIO.c
+++ b/Modules/cStringIO.c
@@ -1,4 +1,9 @@
-static char cStringIO_module_documentation[] =
+
+#include "Python.h"
+#include "import.h"
+#include "cStringIO.h"
+
+PyDoc_STRVAR(cStringIO_module_documentation,
"A simple fast partial StringIO replacement.\n"
"\n"
"This module provides a simple useful replacement for\n"
@@ -25,12 +30,7 @@ static char cStringIO_module_documentation[] =
"If someone else wants to provide a more complete implementation,\n"
"go for it. :-) \n"
"\n"
-"cStringIO.c,v 1.29 1999/06/15 14:10:27 jim Exp\n"
-;
-
-#include "Python.h"
-#include "import.h"
-#include "cStringIO.h"
+"cStringIO.c,v 1.29 1999/06/15 14:10:27 jim Exp\n");
#define UNLESS(E) if (!(E))
@@ -74,7 +74,7 @@ typedef struct { /* Subtype of IOobject */
/* IOobject (common) methods */
-static char IO_flush__doc__[] = "flush(): does nothing.";
+PyDoc_STRVAR(IO_flush__doc__, "flush(): does nothing.");
static int
IO__opencheck(IOobject *self) {
@@ -96,12 +96,11 @@ IO_flush(IOobject *self, PyObject *args) {
return Py_None;
}
-static char IO_getval__doc__[] =
- "getvalue([use_pos]) -- Get the string value."
- "\n"
- "If use_pos is specified and is a true value, then the string returned\n"
- "will include only the text up to the current file position.\n"
-;
+PyDoc_STRVAR(IO_getval__doc__,
+"getvalue([use_pos]) -- Get the string value."
+"\n"
+"If use_pos is specified and is a true value, then the string returned\n"
+"will include only the text up to the current file position.\n");
static PyObject *
IO_cgetval(PyObject *self) {
@@ -127,7 +126,7 @@ IO_getval(IOobject *self, PyObject *args) {
return PyString_FromStringAndSize(self->buf, s);
}
-static char IO_isatty__doc__[] = "isatty(): always returns 0";
+PyDoc_STRVAR(IO_isatty__doc__, "isatty(): always returns 0");
static PyObject *
IO_isatty(IOobject *self, PyObject *args) {
@@ -137,9 +136,8 @@ IO_isatty(IOobject *self, PyObject *args) {
return PyInt_FromLong(0);
}
-static char IO_read__doc__[] =
-"read([s]) -- Read s characters, or the rest of the string"
-;
+PyDoc_STRVAR(IO_read__doc__,
+"read([s]) -- Read s characters, or the rest of the string");
static int
IO_cread(PyObject *self, char **output, int n) {
@@ -169,9 +167,7 @@ IO_read(IOobject *self, PyObject *args) {
return PyString_FromStringAndSize(output, n);
}
-static char IO_readline__doc__[] =
-"readline() -- Read one line"
-;
+PyDoc_STRVAR(IO_readline__doc__, "readline() -- Read one line");
static int
IO_creadline(PyObject *self, char **output) {
@@ -207,9 +203,7 @@ IO_readline(IOobject *self, PyObject *args) {
return PyString_FromStringAndSize(output, n);
}
-static char IO_readlines__doc__[] =
-"readlines() -- Read all lines"
-;
+PyDoc_STRVAR(IO_readlines__doc__, "readlines() -- Read all lines");
static PyObject *
IO_readlines(IOobject *self, PyObject *args) {
@@ -244,9 +238,8 @@ IO_readlines(IOobject *self, PyObject *args) {
return NULL;
}
-static char IO_reset__doc__[] =
-"reset() -- Reset the file position to the beginning"
-;
+PyDoc_STRVAR(IO_reset__doc__,
+"reset() -- Reset the file position to the beginning");
static PyObject *
IO_reset(IOobject *self, PyObject *args) {
@@ -260,8 +253,7 @@ IO_reset(IOobject *self, PyObject *args) {
return Py_None;
}
-static char IO_tell__doc__[] =
-"tell() -- get the current position.";
+PyDoc_STRVAR(IO_tell__doc__, "tell() -- get the current position.");
static PyObject *
IO_tell(IOobject *self, PyObject *args) {
@@ -272,8 +264,8 @@ IO_tell(IOobject *self, PyObject *args) {
return PyInt_FromLong(self->pos);
}
-static char IO_truncate__doc__[] =
-"truncate(): truncate the file at the current position.";
+PyDoc_STRVAR(IO_truncate__doc__,
+"truncate(): truncate the file at the current position.");
static PyObject *
IO_truncate(IOobject *self, PyObject *args) {
@@ -294,9 +286,9 @@ IO_truncate(IOobject *self, PyObject *args) {
/* Read-write object methods */
-static char O_seek__doc__[] =
+PyDoc_STRVAR(O_seek__doc__,
"seek(position) -- set the current position\n"
-"seek(position, mode) -- mode 0: absolute; 1: relative; 2: relative to EOF";
+"seek(position, mode) -- mode 0: absolute; 1: relative; 2: relative to EOF");
static PyObject *
O_seek(Oobject *self, PyObject *args) {
@@ -332,10 +324,9 @@ O_seek(Oobject *self, PyObject *args) {
return Py_None;
}
-static char O_write__doc__[] =
+PyDoc_STRVAR(O_write__doc__,
"write(s) -- Write a string to the file"
-"\n\nNote (hack:) writing None resets the buffer"
-;
+"\n\nNote (hack:) writing None resets the buffer");
static int
@@ -384,7 +375,7 @@ O_write(Oobject *self, PyObject *args) {
return Py_None;
}
-static char O_close__doc__[] = "close(): explicitly release resources held.";
+PyDoc_STRVAR(O_close__doc__, "close(): explicitly release resources held.");
static PyObject *
O_close(Oobject *self, PyObject *args) {
@@ -401,8 +392,8 @@ O_close(Oobject *self, PyObject *args) {
}
-static char O_writelines__doc__[] =
-"writelines(sequence_of_strings): write each string";
+PyDoc_STRVAR(O_writelines__doc__,
+"writelines(sequence_of_strings): write each string");
static PyObject *
O_writelines(Oobject *self, PyObject *args) {
PyObject *tmp = 0;
@@ -483,9 +474,7 @@ O_setattr(Oobject *self, char *name, PyObject *value) {
return 0;
}
-static char Otype__doc__[] =
-"Simple type for output to strings."
-;
+PyDoc_STRVAR(Otype__doc__, "Simple type for output to strings.");
static PyTypeObject Otype = {
PyObject_HEAD_INIT(NULL)
@@ -617,9 +606,8 @@ I_getiter(Iobject *self)
}
-static char Itype__doc__[] =
-"Simple type for treating strings as input file streams"
-;
+PyDoc_STRVAR(Itype__doc__,
+"Simple type for treating strings as input file streams");
static PyTypeObject Itype = {
PyObject_HEAD_INIT(NULL)
@@ -678,9 +666,8 @@ newIobject(PyObject *s) {
/* -------------------------------------------------------- */
-static char IO_StringIO__doc__[] =
-"StringIO([s]) -- Return a StringIO-like stream for reading or writing"
-;
+PyDoc_STRVAR(IO_StringIO__doc__,
+"StringIO([s]) -- Return a StringIO-like stream for reading or writing");
static PyObject *
IO_StringIO(PyObject *self, PyObject *args) {