mirror of
https://github.com/python/cpython.git
synced 2025-10-21 22:22:48 +00:00
Patch #568124: Add doc string macros.
This commit is contained in:
parent
654c11ee3a
commit
14f8b4cfcb
63 changed files with 1509 additions and 1625 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue