#ifndef Py_BUILD_CORE_BUILTIN
#define Py_BUILD_CORE_MODULE …
#endif
#include "Python.h"
#include "pycore_import.h"
#include "pycore_pyhash.h"
#include "pycore_traceback.h"
#include <stdbool.h>
#include <stddef.h>
#include "expat.h"
#include "pyexpat.h"
#define XML_COMBINED_VERSION …
static XML_Memory_Handling_Suite ExpatMemoryHandler = …;
enum HandlerTypes { … };
pyexpat_state;
static inline pyexpat_state*
pyexpat_get_state(PyObject *module)
{ … }
xmlparseobject;
#include "clinic/pyexpat.c.h"
#define CHARACTER_DATA_BUFFER_SIZE …
xmlhandlersetter;
xmlhandler;
struct HandlerInfo { … };
static struct HandlerInfo handler_info[64];
static int
set_error_attr(PyObject *err, const char *name, int value)
{ … }
static PyObject *
set_error(pyexpat_state *state, xmlparseobject *self, enum XML_Error code)
{ … }
static int
have_handler(xmlparseobject *self, int type)
{ … }
static PyObject *
conv_string_to_unicode(const XML_Char *str)
{ … }
static PyObject *
conv_string_len_to_unicode(const XML_Char *str, int len)
{ … }
static void clear_handlers(xmlparseobject *self, int initial);
static int
error_external_entity_ref_handler(XML_Parser parser,
const XML_Char *context,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *publicId)
{ … }
static void
noop_character_data_handler(void *userData, const XML_Char *data, int len)
{ … }
static void
flag_error(xmlparseobject *self)
{ … }
static PyObject*
call_with_frame(const char *funcname, int lineno, PyObject* func, PyObject* args,
xmlparseobject *self)
{ … }
static PyObject*
string_intern(xmlparseobject *self, const char* str)
{ … }
static int
call_character_handler(xmlparseobject *self, const XML_Char *buffer, int len)
{ … }
static int
flush_character_buffer(xmlparseobject *self)
{ … }
static void
my_CharacterDataHandler(void *userData, const XML_Char *data, int len)
{ … }
static void
my_StartElementHandler(void *userData,
const XML_Char *name, const XML_Char *atts[])
{ … }
#define RC_HANDLER(RC, NAME, PARAMS, INIT, PARAM_FORMAT, CONVERSION, \
RETURN, GETUSERDATA) …
#define VOID_HANDLER(NAME, PARAMS, PARAM_FORMAT) …
#define INT_HANDLER(NAME, PARAMS, PARAM_FORMAT) …
VOID_HANDLER(…) …
VOID_HANDLER(…) …
VOID_HANDLER(…) …
VOID_HANDLER(…) …
VOID_HANDLER(…) …
static PyObject *
conv_content_model(XML_Content * const model,
PyObject *(*conv_string)(const XML_Char *))
{ … }
static void
my_ElementDeclHandler(void *userData,
const XML_Char *name,
XML_Content *model)
{ … }
VOID_HANDLER(…) …
#if XML_COMBINED_VERSION >= 19504
VOID_HANDLER(…) …
#endif
VOID_HANDLER(…) …
VOID_HANDLER(…) …
VOID_HANDLER(…) …
VOID_HANDLER(…) …
VOID_HANDLER(…) …
VOID_HANDLER(…) …
VOID_HANDLER(…) …
VOID_HANDLER(…) …
#define my_DefaultHandlerExpand …
INT_HANDLER(…) …
RC_HANDLER(…)
VOID_HANDLER(…) …
VOID_HANDLER(…) …
static PyObject *
get_parse_result(pyexpat_state *state, xmlparseobject *self, int rv)
{ … }
#define MAX_CHUNK_SIZE …
static PyObject *
pyexpat_xmlparser_SetReparseDeferralEnabled_impl(xmlparseobject *self,
int enabled)
{ … }
static PyObject *
pyexpat_xmlparser_GetReparseDeferralEnabled_impl(xmlparseobject *self)
{ … }
static PyObject *
pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyTypeObject *cls,
PyObject *data, int isfinal)
{ … }
#define BUF_SIZE …
static int
readinst(char *buf, int buf_size, PyObject *meth)
{ … }
static PyObject *
pyexpat_xmlparser_ParseFile_impl(xmlparseobject *self, PyTypeObject *cls,
PyObject *file)
{ … }
static PyObject *
pyexpat_xmlparser_SetBase_impl(xmlparseobject *self, const char *base)
{ … }
static PyObject *
pyexpat_xmlparser_GetBase_impl(xmlparseobject *self)
{ … }
static PyObject *
pyexpat_xmlparser_GetInputContext_impl(xmlparseobject *self)
{ … }
static PyObject *
pyexpat_xmlparser_ExternalEntityParserCreate_impl(xmlparseobject *self,
PyTypeObject *cls,
const char *context,
const char *encoding)
{ … }
static PyObject *
pyexpat_xmlparser_SetParamEntityParsing_impl(xmlparseobject *self, int flag)
{ … }
#if XML_COMBINED_VERSION >= 19505
static PyObject *
pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, PyTypeObject *cls,
int flag)
{ … }
#endif
static struct PyMethodDef xmlparse_methods[] = …;
static const unsigned char template_buffer[256] = …;
static int
PyUnknownEncodingHandler(void *encodingHandlerData,
const XML_Char *name,
XML_Encoding *info)
{ … }
static PyObject *
newxmlparseobject(pyexpat_state *state, const char *encoding,
const char *namespace_separator, PyObject *intern)
{ … }
static int
xmlparse_traverse(xmlparseobject *op, visitproc visit, void *arg)
{ … }
static int
xmlparse_clear(xmlparseobject *op)
{ … }
static void
xmlparse_dealloc(xmlparseobject *self)
{ … }
static PyObject *
xmlparse_handler_getter(xmlparseobject *self, struct HandlerInfo *hi)
{ … }
static int
xmlparse_handler_setter(xmlparseobject *self, PyObject *v, struct HandlerInfo *hi)
{ … }
#define INT_GETTER …
INT_GETTER
INT_GETTER
INT_GETTER
INT_GETTER
INT_GETTER
INT_GETTER
INT_GETTER
#undef INT_GETTER
static PyObject *
xmlparse_buffer_text_getter(xmlparseobject *self, void *closure)
{ … }
static int
xmlparse_buffer_text_setter(xmlparseobject *self, PyObject *v, void *closure)
{ … }
static PyObject *
xmlparse_buffer_size_getter(xmlparseobject *self, void *closure)
{ … }
static int
xmlparse_buffer_size_setter(xmlparseobject *self, PyObject *v, void *closure)
{ … }
static PyObject *
xmlparse_buffer_used_getter(xmlparseobject *self, void *closure)
{ … }
static PyObject *
xmlparse_namespace_prefixes_getter(xmlparseobject *self, void *closure)
{ … }
static int
xmlparse_namespace_prefixes_setter(xmlparseobject *self, PyObject *v, void *closure)
{ … }
static PyObject *
xmlparse_ordered_attributes_getter(xmlparseobject *self, void *closure)
{ … }
static int
xmlparse_ordered_attributes_setter(xmlparseobject *self, PyObject *v, void *closure)
{ … }
static PyObject *
xmlparse_specified_attributes_getter(xmlparseobject *self, void *closure)
{ … }
static int
xmlparse_specified_attributes_setter(xmlparseobject *self, PyObject *v, void *closure)
{ … }
static PyMemberDef xmlparse_members[] = …;
#define XMLPARSE_GETTER_DEF …
#define XMLPARSE_GETTER_SETTER_DEF …
static PyGetSetDef xmlparse_getsetlist[] = …;
#undef XMLPARSE_GETTER_DEF
#undef XMLPARSE_GETTER_SETTER_DEF
PyDoc_STRVAR(Xmlparsetype__doc__, "XML parser");
static PyType_Slot _xml_parse_type_spec_slots[] = …;
static PyType_Spec _xml_parse_type_spec = …;
static PyObject *
pyexpat_ParserCreate_impl(PyObject *module, const char *encoding,
const char *namespace_separator, PyObject *intern)
{ … }
static PyObject *
pyexpat_ErrorString_impl(PyObject *module, long code)
{ … }
static struct PyMethodDef pyexpat_methods[] = …;
PyDoc_STRVAR(pyexpat_module_documentation,
"Python wrapper for Expat parser.");
#ifndef MODULE_NAME
#define MODULE_NAME …
#endif
static int init_handler_descrs(pyexpat_state *state)
{ … }
static PyObject *
add_submodule(PyObject *mod, const char *fullname)
{ … }
struct ErrorInfo { … };
static
struct ErrorInfo error_info_of[] = …;
static int
add_error(PyObject *errors_module, PyObject *codes_dict,
PyObject *rev_codes_dict, size_t error_index)
{ … }
static int
add_errors_module(PyObject *mod)
{ … }
static int
add_model_module(PyObject *mod)
{ … }
#if XML_COMBINED_VERSION > 19505
static int
add_features(PyObject *mod)
{ … }
#endif
static void
pyexpat_capsule_destructor(PyObject *capsule)
{ … }
static int
pyexpat_exec(PyObject *mod)
{ … }
static int
pyexpat_traverse(PyObject *module, visitproc visit, void *arg)
{ … }
static int
pyexpat_clear(PyObject *module)
{ … }
static void
pyexpat_free(void *module)
{ … }
static PyModuleDef_Slot pyexpat_slots[] = …;
static struct PyModuleDef pyexpatmodule = …;
PyMODINIT_FUNC
PyInit_pyexpat(void)
{ … }
static void
clear_handlers(xmlparseobject *self, int initial)
{ … }
static struct HandlerInfo handler_info[] = …;