summaryrefslogtreecommitdiff
path: root/Modules/pyexpat.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-04-03 23:53:51 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2015-04-03 23:53:51 +0300
commit1009bf18b38a8d36298575191dd8fdf43f8f9097 (patch)
tree18860fdef30c931dc2ea177059e96b69a49fa04f /Modules/pyexpat.c
parent0759f84d6260bad1234b802212e73fdc5873d261 (diff)
downloadcpython-git-1009bf18b38a8d36298575191dd8fdf43f8f9097.tar.gz
Issue #23501: Argumen Clinic now generates code into separate files by default.
Diffstat (limited to 'Modules/pyexpat.c')
-rw-r--r--Modules/pyexpat.c307
1 files changed, 14 insertions, 293 deletions
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index ce65354497..52064a59b5 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -68,6 +68,8 @@ typedef struct {
PyObject **handlers;
} xmlparseobject;
+#include "clinic/pyexpat.c.h"
+
#define CHARACTER_DATA_BUFFER_SIZE 8192
static PyTypeObject Xmlparsetype;
@@ -713,40 +715,9 @@ Parse XML data.
`isfinal' should be true at end of input.
[clinic start generated code]*/
-PyDoc_STRVAR(pyexpat_xmlparser_Parse__doc__,
-"Parse($self, data, isFinal=0, /)\n"
-"--\n"
-"\n"
-"Parse XML data.\n"
-"\n"
-"`isfinal\' should be true at end of input.");
-
-#define PYEXPAT_XMLPARSER_PARSE_METHODDEF \
- {"Parse", (PyCFunction)pyexpat_xmlparser_Parse, METH_VARARGS, pyexpat_xmlparser_Parse__doc__},
-
-static PyObject *
-pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyObject *data, int isFinal);
-
-static PyObject *
-pyexpat_xmlparser_Parse(xmlparseobject *self, PyObject *args)
-{
- PyObject *return_value = NULL;
- PyObject *data;
- int isFinal = 0;
-
- if (!PyArg_ParseTuple(args,
- "O|i:Parse",
- &data, &isFinal))
- goto exit;
- return_value = pyexpat_xmlparser_Parse_impl(self, data, isFinal);
-
-exit:
- return return_value;
-}
-
static PyObject *
pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyObject *data, int isFinal)
-/*[clinic end generated code: output=65b1652b01f20856 input=e37b81b8948ca7e0]*/
+/*[clinic end generated code: output=2d4dc77f4d434854 input=e37b81b8948ca7e0]*/
{
const char *s;
Py_ssize_t slen;
@@ -836,18 +807,9 @@ pyexpat.xmlparser.ParseFile
Parse XML data from file-like object.
[clinic start generated code]*/
-PyDoc_STRVAR(pyexpat_xmlparser_ParseFile__doc__,
-"ParseFile($self, file, /)\n"
-"--\n"
-"\n"
-"Parse XML data from file-like object.");
-
-#define PYEXPAT_XMLPARSER_PARSEFILE_METHODDEF \
- {"ParseFile", (PyCFunction)pyexpat_xmlparser_ParseFile, METH_O, pyexpat_xmlparser_ParseFile__doc__},
-
static PyObject *
pyexpat_xmlparser_ParseFile(xmlparseobject *self, PyObject *file)
-/*[clinic end generated code: output=2e13803c3d8c22b2 input=fbb5a12b6038d735]*/
+/*[clinic end generated code: output=2adc6a13100cc42b input=fbb5a12b6038d735]*/
{
int rv = 1;
PyObject *readmethod = NULL;
@@ -894,37 +856,9 @@ pyexpat.xmlparser.SetBase
Set the base URL for the parser.
[clinic start generated code]*/
-PyDoc_STRVAR(pyexpat_xmlparser_SetBase__doc__,
-"SetBase($self, base, /)\n"
-"--\n"
-"\n"
-"Set the base URL for the parser.");
-
-#define PYEXPAT_XMLPARSER_SETBASE_METHODDEF \
- {"SetBase", (PyCFunction)pyexpat_xmlparser_SetBase, METH_VARARGS, pyexpat_xmlparser_SetBase__doc__},
-
-static PyObject *
-pyexpat_xmlparser_SetBase_impl(xmlparseobject *self, const char *base);
-
-static PyObject *
-pyexpat_xmlparser_SetBase(xmlparseobject *self, PyObject *args)
-{
- PyObject *return_value = NULL;
- const char *base;
-
- if (!PyArg_ParseTuple(args,
- "s:SetBase",
- &base))
- goto exit;
- return_value = pyexpat_xmlparser_SetBase_impl(self, base);
-
-exit:
- return return_value;
-}
-
static PyObject *
pyexpat_xmlparser_SetBase_impl(xmlparseobject *self, const char *base)
-/*[clinic end generated code: output=5bdb49f6689a5f93 input=c684e5de895ee1a8]*/
+/*[clinic end generated code: output=c212ddceb607b539 input=c684e5de895ee1a8]*/
{
if (!XML_SetBase(self->itself, base)) {
return PyErr_NoMemory();
@@ -938,27 +872,9 @@ pyexpat.xmlparser.GetBase
Return base URL string for the parser.
[clinic start generated code]*/
-PyDoc_STRVAR(pyexpat_xmlparser_GetBase__doc__,
-"GetBase($self, /)\n"
-"--\n"
-"\n"
-"Return base URL string for the parser.");
-
-#define PYEXPAT_XMLPARSER_GETBASE_METHODDEF \
- {"GetBase", (PyCFunction)pyexpat_xmlparser_GetBase, METH_NOARGS, pyexpat_xmlparser_GetBase__doc__},
-
-static PyObject *
-pyexpat_xmlparser_GetBase_impl(xmlparseobject *self);
-
-static PyObject *
-pyexpat_xmlparser_GetBase(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
-{
- return pyexpat_xmlparser_GetBase_impl(self);
-}
-
static PyObject *
pyexpat_xmlparser_GetBase_impl(xmlparseobject *self)
-/*[clinic end generated code: output=ef6046ee28f2b8ee input=918d71c38009620e]*/
+/*[clinic end generated code: output=2886cb21f9a8739a input=918d71c38009620e]*/
{
return Py_BuildValue("z", XML_GetBase(self->itself));
}
@@ -972,30 +888,9 @@ If the event was generated by a large amount of text (such as a start tag
for an element with many attributes), not all of the text may be available.
[clinic start generated code]*/
-PyDoc_STRVAR(pyexpat_xmlparser_GetInputContext__doc__,
-"GetInputContext($self, /)\n"
-"--\n"
-"\n"
-"Return the untranslated text of the input that caused the current event.\n"
-"\n"
-"If the event was generated by a large amount of text (such as a start tag\n"
-"for an element with many attributes), not all of the text may be available.");
-
-#define PYEXPAT_XMLPARSER_GETINPUTCONTEXT_METHODDEF \
- {"GetInputContext", (PyCFunction)pyexpat_xmlparser_GetInputContext, METH_NOARGS, pyexpat_xmlparser_GetInputContext__doc__},
-
-static PyObject *
-pyexpat_xmlparser_GetInputContext_impl(xmlparseobject *self);
-
-static PyObject *
-pyexpat_xmlparser_GetInputContext(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
-{
- return pyexpat_xmlparser_GetInputContext_impl(self);
-}
-
static PyObject *
pyexpat_xmlparser_GetInputContext_impl(xmlparseobject *self)
-/*[clinic end generated code: output=62ff03390f074cd2 input=034df8712db68379]*/
+/*[clinic end generated code: output=a88026d683fc22cc input=034df8712db68379]*/
{
if (self->in_callback) {
int offset, size;
@@ -1022,38 +917,9 @@ pyexpat.xmlparser.ExternalEntityParserCreate
Create a parser for parsing an external entity based on the information passed to the ExternalEntityRefHandler.
[clinic start generated code]*/
-PyDoc_STRVAR(pyexpat_xmlparser_ExternalEntityParserCreate__doc__,
-"ExternalEntityParserCreate($self, context, encoding=None, /)\n"
-"--\n"
-"\n"
-"Create a parser for parsing an external entity based on the information passed to the ExternalEntityRefHandler.");
-
-#define PYEXPAT_XMLPARSER_EXTERNALENTITYPARSERCREATE_METHODDEF \
- {"ExternalEntityParserCreate", (PyCFunction)pyexpat_xmlparser_ExternalEntityParserCreate, METH_VARARGS, pyexpat_xmlparser_ExternalEntityParserCreate__doc__},
-
-static PyObject *
-pyexpat_xmlparser_ExternalEntityParserCreate_impl(xmlparseobject *self, const char *context, const char *encoding);
-
-static PyObject *
-pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args)
-{
- PyObject *return_value = NULL;
- const char *context;
- const char *encoding = NULL;
-
- if (!PyArg_ParseTuple(args,
- "z|s:ExternalEntityParserCreate",
- &context, &encoding))
- goto exit;
- return_value = pyexpat_xmlparser_ExternalEntityParserCreate_impl(self, context, encoding);
-
-exit:
- return return_value;
-}
-
static PyObject *
pyexpat_xmlparser_ExternalEntityParserCreate_impl(xmlparseobject *self, const char *context, const char *encoding)
-/*[clinic end generated code: output=4948c35f3dd01133 input=283206575d960272]*/
+/*[clinic end generated code: output=942f300ed0e56054 input=283206575d960272]*/
{
xmlparseobject *new_parser;
int i;
@@ -1127,42 +993,9 @@ XML_PARAM_ENTITY_PARSING_ALWAYS. Returns true if setting the flag
was successful.
[clinic start generated code]*/
-PyDoc_STRVAR(pyexpat_xmlparser_SetParamEntityParsing__doc__,
-"SetParamEntityParsing($self, flag, /)\n"
-"--\n"
-"\n"
-"Controls parsing of parameter entities (including the external DTD subset).\n"
-"\n"
-"Possible flag values are XML_PARAM_ENTITY_PARSING_NEVER,\n"
-"XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE and\n"
-"XML_PARAM_ENTITY_PARSING_ALWAYS. Returns true if setting the flag\n"
-"was successful.");
-
-#define PYEXPAT_XMLPARSER_SETPARAMENTITYPARSING_METHODDEF \
- {"SetParamEntityParsing", (PyCFunction)pyexpat_xmlparser_SetParamEntityParsing, METH_VARARGS, pyexpat_xmlparser_SetParamEntityParsing__doc__},
-
-static PyObject *
-pyexpat_xmlparser_SetParamEntityParsing_impl(xmlparseobject *self, int flag);
-
-static PyObject *
-pyexpat_xmlparser_SetParamEntityParsing(xmlparseobject *self, PyObject *args)
-{
- PyObject *return_value = NULL;
- int flag;
-
- if (!PyArg_ParseTuple(args,
- "i:SetParamEntityParsing",
- &flag))
- goto exit;
- return_value = pyexpat_xmlparser_SetParamEntityParsing_impl(self, flag);
-
-exit:
- return return_value;
-}
-
static PyObject *
pyexpat_xmlparser_SetParamEntityParsing_impl(xmlparseobject *self, int flag)
-/*[clinic end generated code: output=0f820882bc7768cc input=8aea19b4b15e9af1]*/
+/*[clinic end generated code: output=18668ee8e760d64c input=8aea19b4b15e9af1]*/
{
flag = XML_SetParamEntityParsing(self->itself, flag);
return PyLong_FromLong(flag);
@@ -1183,41 +1016,9 @@ application, while still getting the advantage of providing document type
information to the parser. 'flag' defaults to True if not provided.
[clinic start generated code]*/
-PyDoc_STRVAR(pyexpat_xmlparser_UseForeignDTD__doc__,
-"UseForeignDTD($self, flag=True, /)\n"
-"--\n"
-"\n"
-"Allows the application to provide an artificial external subset if one is not specified as part of the document instance.\n"
-"\n"
-"This readily allows the use of a \'default\' document type controlled by the\n"
-"application, while still getting the advantage of providing document type\n"
-"information to the parser. \'flag\' defaults to True if not provided.");
-
-#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF \
- {"UseForeignDTD", (PyCFunction)pyexpat_xmlparser_UseForeignDTD, METH_VARARGS, pyexpat_xmlparser_UseForeignDTD__doc__},
-
-static PyObject *
-pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, int flag);
-
-static PyObject *
-pyexpat_xmlparser_UseForeignDTD(xmlparseobject *self, PyObject *args)
-{
- PyObject *return_value = NULL;
- int flag = 1;
-
- if (!PyArg_ParseTuple(args,
- "|p:UseForeignDTD",
- &flag))
- goto exit;
- return_value = pyexpat_xmlparser_UseForeignDTD_impl(self, flag);
-
-exit:
- return return_value;
-}
-
static PyObject *
pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, int flag)
-/*[clinic end generated code: output=22e924ae6cad67d6 input=78144c519d116a6e]*/
+/*[clinic end generated code: output=cfaa9aa50bb0f65c input=78144c519d116a6e]*/
{
enum XML_Error rc;
@@ -1234,25 +1035,9 @@ pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, int flag)
pyexpat.xmlparser.__dir__
[clinic start generated code]*/
-PyDoc_STRVAR(pyexpat_xmlparser___dir____doc__,
-"__dir__($self, /)\n"
-"--");
-
-#define PYEXPAT_XMLPARSER___DIR___METHODDEF \
- {"__dir__", (PyCFunction)pyexpat_xmlparser___dir__, METH_NOARGS, pyexpat_xmlparser___dir____doc__},
-
-static PyObject *
-pyexpat_xmlparser___dir___impl(xmlparseobject *self);
-
-static PyObject *
-pyexpat_xmlparser___dir__(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
-{
- return pyexpat_xmlparser___dir___impl(self);
-}
-
static PyObject *
pyexpat_xmlparser___dir___impl(xmlparseobject *self)
-/*[clinic end generated code: output=1ed6efe83bc304cc input=76aa455f2a661384]*/
+/*[clinic end generated code: output=bc22451efb9e4d17 input=76aa455f2a661384]*/
{
#define APPEND(list, str) \
do { \
@@ -1765,41 +1550,9 @@ pyexpat.ParserCreate
Return a new XML parser object.
[clinic start generated code]*/
-PyDoc_STRVAR(pyexpat_ParserCreate__doc__,
-"ParserCreate($module, /, encoding=None, namespace_separator=None,\n"
-" intern=None)\n"
-"--\n"
-"\n"
-"Return a new XML parser object.");
-
-#define PYEXPAT_PARSERCREATE_METHODDEF \
- {"ParserCreate", (PyCFunction)pyexpat_ParserCreate, METH_VARARGS|METH_KEYWORDS, pyexpat_ParserCreate__doc__},
-
-static PyObject *
-pyexpat_ParserCreate_impl(PyModuleDef *module, const char *encoding, const char *namespace_separator, PyObject *intern);
-
-static PyObject *
-pyexpat_ParserCreate(PyModuleDef *module, PyObject *args, PyObject *kwargs)
-{
- PyObject *return_value = NULL;
- static char *_keywords[] = {"encoding", "namespace_separator", "intern", NULL};
- const char *encoding = NULL;
- const char *namespace_separator = NULL;
- PyObject *intern = NULL;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "|zzO:ParserCreate", _keywords,
- &encoding, &namespace_separator, &intern))
- goto exit;
- return_value = pyexpat_ParserCreate_impl(module, encoding, namespace_separator, intern);
-
-exit:
- return return_value;
-}
-
static PyObject *
pyexpat_ParserCreate_impl(PyModuleDef *module, const char *encoding, const char *namespace_separator, PyObject *intern)
-/*[clinic end generated code: output=4fc027dd33b7a2ac input=71b9f471aa6f8f86]*/
+/*[clinic end generated code: output=b839b60992d8ce71 input=71b9f471aa6f8f86]*/
{
PyObject *result;
int intern_decref = 0;
@@ -1842,37 +1595,9 @@ pyexpat.ErrorString
Returns string error for given number.
[clinic start generated code]*/
-PyDoc_STRVAR(pyexpat_ErrorString__doc__,
-"ErrorString($module, code, /)\n"
-"--\n"
-"\n"
-"Returns string error for given number.");
-
-#define PYEXPAT_ERRORSTRING_METHODDEF \
- {"ErrorString", (PyCFunction)pyexpat_ErrorString, METH_VARARGS, pyexpat_ErrorString__doc__},
-
-static PyObject *
-pyexpat_ErrorString_impl(PyModuleDef *module, long code);
-
-static PyObject *
-pyexpat_ErrorString(PyModuleDef *module, PyObject *args)
-{
- PyObject *return_value = NULL;
- long code;
-
- if (!PyArg_ParseTuple(args,
- "l:ErrorString",
- &code))
- goto exit;
- return_value = pyexpat_ErrorString_impl(module, code);
-
-exit:
- return return_value;
-}
-
static PyObject *
pyexpat_ErrorString_impl(PyModuleDef *module, long code)
-/*[clinic end generated code: output=c70f3cd82bfaf067 input=cc67de010d9e62b3]*/
+/*[clinic end generated code: output=d87668108b6868e5 input=cc67de010d9e62b3]*/
{
return Py_BuildValue("z", XML_ErrorString((int)code));
}
@@ -2252,8 +1977,4 @@ static struct HandlerInfo handler_info[] = {
/*[clinic input]
dump buffer
[clinic start generated code]*/
-
-#ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
- #define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
-#endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
-/*[clinic end generated code: output=a7880cb78bbd58ce input=524ce2e021e4eba6]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=524ce2e021e4eba6]*/