mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
Remove bogus casts.
* Casting a string literal to `char *` and then immediately passing or assigning the result to a `const char *` makes no sense. * There is no need to cast `int` to `Py_ssize_t` as they have the same sign and the latter is at least as wide as the former.
This commit is contained in:
@ -889,7 +889,7 @@ def print_function_wrapper(name, output, export, include):
|
|||||||
include.write("PyObject * ")
|
include.write("PyObject * ")
|
||||||
include.write("libxml_%s(PyObject *self, PyObject *args);\n" % (name))
|
include.write("libxml_%s(PyObject *self, PyObject *args);\n" % (name))
|
||||||
|
|
||||||
export.write(" { (char *)\"%s\", libxml_%s, METH_VARARGS, NULL },\n" %
|
export.write(" { \"%s\", libxml_%s, METH_VARARGS, NULL },\n" %
|
||||||
(name, name))
|
(name, name))
|
||||||
|
|
||||||
if file == "python":
|
if file == "python":
|
||||||
@ -926,7 +926,7 @@ def print_function_wrapper(name, output, export, include):
|
|||||||
name)
|
name)
|
||||||
output.write(" return(NULL);\n")
|
output.write(" return(NULL);\n")
|
||||||
if format != "":
|
if format != "":
|
||||||
output.write("\n if (!PyArg_ParseTuple(args, (char *)\"%s\"%s))\n" %
|
output.write("\n if (!PyArg_ParseTuple(args, \"%s\"%s))\n" %
|
||||||
(format, format_args))
|
(format, format_args))
|
||||||
output.write(" return(NULL);\n")
|
output.write(" return(NULL);\n")
|
||||||
if c_convert != "":
|
if c_convert != "":
|
||||||
|
375
python/libxml.c
375
python/libxml.c
@ -115,7 +115,7 @@ libxml_xmlDebugMemory(PyObject * self ATTRIBUTE_UNUSED, PyObject * args)
|
|||||||
PyObject *py_retval;
|
PyObject *py_retval;
|
||||||
long ret;
|
long ret;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *) "i:xmlDebugMemory", &activate))
|
if (!PyArg_ParseTuple(args, "i:xmlDebugMemory", &activate))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
if (activate != 0) {
|
if (activate != 0) {
|
||||||
@ -210,7 +210,7 @@ xmlPythonFileCloseRaw (void * context) {
|
|||||||
|
|
||||||
file = (PyObject *) context;
|
file = (PyObject *) context;
|
||||||
if (file == NULL) return(-1);
|
if (file == NULL) return(-1);
|
||||||
ret = PyObject_CallMethod(file, (char *) "close", (char *) "()");
|
ret = PyObject_CallMethod(file, "close", "()");
|
||||||
if (ret != NULL) {
|
if (ret != NULL) {
|
||||||
Py_DECREF(ret);
|
Py_DECREF(ret);
|
||||||
}
|
}
|
||||||
@ -242,7 +242,7 @@ xmlPythonFileReadRaw (void * context, char * buffer, int len) {
|
|||||||
if (file == NULL) return(-1);
|
if (file == NULL) return(-1);
|
||||||
/* When read() returns a string, the length is in characters not bytes, so
|
/* When read() returns a string, the length is in characters not bytes, so
|
||||||
request at most len / 4 characters to leave space for UTF-8 encoding. */
|
request at most len / 4 characters to leave space for UTF-8 encoding. */
|
||||||
ret = PyObject_CallMethod(file, (char *) "read", (char *) "(i)", len / 4);
|
ret = PyObject_CallMethod(file, "read", "(i)", len / 4);
|
||||||
if (ret == NULL) {
|
if (ret == NULL) {
|
||||||
printf("xmlPythonFileReadRaw: result is NULL\n");
|
printf("xmlPythonFileReadRaw: result is NULL\n");
|
||||||
return(-1);
|
return(-1);
|
||||||
@ -320,7 +320,7 @@ xmlPythonFileRead (void * context, char * buffer, int len) {
|
|||||||
if (file == NULL) return(-1);
|
if (file == NULL) return(-1);
|
||||||
/* When io_read() returns a string, the length is in characters not bytes, so
|
/* When io_read() returns a string, the length is in characters not bytes, so
|
||||||
request at most len / 4 characters to leave space for UTF-8 encoding. */
|
request at most len / 4 characters to leave space for UTF-8 encoding. */
|
||||||
ret = PyObject_CallMethod(file, (char *) "io_read", (char *) "(i)", len / 4);
|
ret = PyObject_CallMethod(file, "io_read", "(i)", len / 4);
|
||||||
if (ret == NULL) {
|
if (ret == NULL) {
|
||||||
printf("xmlPythonFileRead: result is NULL\n");
|
printf("xmlPythonFileRead: result is NULL\n");
|
||||||
return(-1);
|
return(-1);
|
||||||
@ -396,11 +396,11 @@ xmlPythonFileWrite (void * context, const char * buffer, int len) {
|
|||||||
if (file == NULL) return(-1);
|
if (file == NULL) return(-1);
|
||||||
string = PY_IMPORT_STRING_SIZE(buffer, len);
|
string = PY_IMPORT_STRING_SIZE(buffer, len);
|
||||||
if (string == NULL) return(-1);
|
if (string == NULL) return(-1);
|
||||||
if (PyObject_HasAttrString(file, (char *) "io_write")) {
|
if (PyObject_HasAttrString(file, "io_write")) {
|
||||||
ret = PyObject_CallMethod(file, (char *) "io_write", (char *) "(O)",
|
ret = PyObject_CallMethod(file, "io_write", "(O)",
|
||||||
string);
|
string);
|
||||||
} else if (PyObject_HasAttrString(file, (char *) "write")) {
|
} else if (PyObject_HasAttrString(file, "write")) {
|
||||||
ret = PyObject_CallMethod(file, (char *) "write", (char *) "(O)",
|
ret = PyObject_CallMethod(file, "write", "(O)",
|
||||||
string);
|
string);
|
||||||
}
|
}
|
||||||
Py_DECREF(string);
|
Py_DECREF(string);
|
||||||
@ -433,10 +433,10 @@ xmlPythonFileClose (void * context) {
|
|||||||
|
|
||||||
file = (PyObject *) context;
|
file = (PyObject *) context;
|
||||||
if (file == NULL) return(-1);
|
if (file == NULL) return(-1);
|
||||||
if (PyObject_HasAttrString(file, (char *) "io_close")) {
|
if (PyObject_HasAttrString(file, "io_close")) {
|
||||||
ret = PyObject_CallMethod(file, (char *) "io_close", (char *) "()");
|
ret = PyObject_CallMethod(file, "io_close", "()");
|
||||||
} else if (PyObject_HasAttrString(file, (char *) "flush")) {
|
} else if (PyObject_HasAttrString(file, "flush")) {
|
||||||
ret = PyObject_CallMethod(file, (char *) "flush", (char *) "()");
|
ret = PyObject_CallMethod(file, "flush", "()");
|
||||||
}
|
}
|
||||||
if (ret != NULL) {
|
if (ret != NULL) {
|
||||||
Py_DECREF(ret);
|
Py_DECREF(ret);
|
||||||
@ -482,7 +482,7 @@ libxml_xmlCreateOutputBuffer(ATTRIBUTE_UNUSED PyObject *self, PyObject *args) {
|
|||||||
xmlOutputBufferPtr buffer;
|
xmlOutputBufferPtr buffer;
|
||||||
|
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"Oz:xmlOutputBufferCreate",
|
if (!PyArg_ParseTuple(args, "Oz:xmlOutputBufferCreate",
|
||||||
&file, &encoding))
|
&file, &encoding))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
if ((encoding != NULL) && (encoding[0] != 0)) {
|
if ((encoding != NULL) && (encoding[0] != 0)) {
|
||||||
@ -510,7 +510,7 @@ libxml_outputBufferGetPythonFile(ATTRIBUTE_UNUSED PyObject *self,
|
|||||||
PyObject *file;
|
PyObject *file;
|
||||||
xmlOutputBufferPtr obj;
|
xmlOutputBufferPtr obj;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"O:outputBufferGetPythonFile",
|
if (!PyArg_ParseTuple(args, "O:outputBufferGetPythonFile",
|
||||||
&buffer))
|
&buffer))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
@ -543,7 +543,7 @@ libxml_xmlOutputBufferClose(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
|||||||
xmlOutputBufferPtr out;
|
xmlOutputBufferPtr out;
|
||||||
PyObject *pyobj_out;
|
PyObject *pyobj_out;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"O:xmlOutputBufferClose", &pyobj_out))
|
if (!PyArg_ParseTuple(args, "O:xmlOutputBufferClose", &pyobj_out))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
out = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_out);
|
out = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_out);
|
||||||
/* Buffer may already have been destroyed elsewhere. This is harmless. */
|
/* Buffer may already have been destroyed elsewhere. This is harmless. */
|
||||||
@ -564,7 +564,7 @@ libxml_xmlOutputBufferFlush(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
|||||||
xmlOutputBufferPtr out;
|
xmlOutputBufferPtr out;
|
||||||
PyObject *pyobj_out;
|
PyObject *pyobj_out;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"O:xmlOutputBufferFlush", &pyobj_out))
|
if (!PyArg_ParseTuple(args, "O:xmlOutputBufferFlush", &pyobj_out))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
out = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_out);
|
out = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_out);
|
||||||
|
|
||||||
@ -583,7 +583,7 @@ libxml_xmlSaveFileTo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
|||||||
PyObject *pyobj_cur;
|
PyObject *pyobj_cur;
|
||||||
char * encoding;
|
char * encoding;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"OOz:xmlSaveFileTo", &pyobj_buf, &pyobj_cur, &encoding))
|
if (!PyArg_ParseTuple(args, "OOz:xmlSaveFileTo", &pyobj_buf, &pyobj_cur, &encoding))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
buf = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_buf);
|
buf = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_buf);
|
||||||
cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
|
cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
|
||||||
@ -607,7 +607,7 @@ libxml_xmlSaveFormatFileTo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
|||||||
char * encoding;
|
char * encoding;
|
||||||
int format;
|
int format;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"OOzi:xmlSaveFormatFileTo", &pyobj_buf, &pyobj_cur, &encoding, &format))
|
if (!PyArg_ParseTuple(args, "OOzi:xmlSaveFormatFileTo", &pyobj_buf, &pyobj_cur, &encoding, &format))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
buf = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_buf);
|
buf = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_buf);
|
||||||
cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
|
cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
|
||||||
@ -659,7 +659,7 @@ libxml_xmlCreateInputBuffer(ATTRIBUTE_UNUSED PyObject *self, PyObject *args) {
|
|||||||
xmlParserInputBufferPtr buffer;
|
xmlParserInputBufferPtr buffer;
|
||||||
|
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"Oz:xmlParserInputBufferCreate",
|
if (!PyArg_ParseTuple(args, "Oz:xmlParserInputBufferCreate",
|
||||||
&file, &encoding))
|
&file, &encoding))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
if ((encoding != NULL) && (encoding[0] != 0)) {
|
if ((encoding != NULL) && (encoding[0] != 0)) {
|
||||||
@ -692,11 +692,11 @@ pythonExternalEntityLoader(const char *URL, const char *ID,
|
|||||||
ctxtobj = libxml_xmlParserCtxtPtrWrap(ctxt);
|
ctxtobj = libxml_xmlParserCtxtPtrWrap(ctxt);
|
||||||
|
|
||||||
ret = PyObject_CallFunction(pythonExternalEntityLoaderObjext,
|
ret = PyObject_CallFunction(pythonExternalEntityLoaderObjext,
|
||||||
(char *) "(ssO)", URL, ID, ctxtobj);
|
"(ssO)", URL, ID, ctxtobj);
|
||||||
Py_XDECREF(ctxtobj);
|
Py_XDECREF(ctxtobj);
|
||||||
|
|
||||||
if (ret != NULL) {
|
if (ret != NULL) {
|
||||||
if (PyObject_HasAttrString(ret, (char *) "read")) {
|
if (PyObject_HasAttrString(ret, "read")) {
|
||||||
xmlParserInputBufferPtr buf;
|
xmlParserInputBufferPtr buf;
|
||||||
|
|
||||||
buf = xmlAllocParserInputBuffer(XML_CHAR_ENCODING_NONE);
|
buf = xmlAllocParserInputBuffer(XML_CHAR_ENCODING_NONE);
|
||||||
@ -732,7 +732,7 @@ libxml_xmlSetEntityLoader(ATTRIBUTE_UNUSED PyObject *self, PyObject *args) {
|
|||||||
PyObject *py_retval;
|
PyObject *py_retval;
|
||||||
PyObject *loader;
|
PyObject *loader;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"O:libxml_xmlSetEntityLoader",
|
if (!PyArg_ParseTuple(args, "O:libxml_xmlSetEntityLoader",
|
||||||
&loader))
|
&loader))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
@ -775,7 +775,7 @@ pythonInputOpenCallback(const char *URI)
|
|||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
|
|
||||||
ret = PyObject_CallFunction(pythonInputOpenCallbackObject,
|
ret = PyObject_CallFunction(pythonInputOpenCallbackObject,
|
||||||
(char *)"s", URI);
|
"s", URI);
|
||||||
if (ret == Py_None) {
|
if (ret == Py_None) {
|
||||||
Py_DECREF(Py_None);
|
Py_DECREF(Py_None);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -861,9 +861,9 @@ pythonStartElement(void *user_data, const xmlChar * name,
|
|||||||
int type = 0;
|
int type = 0;
|
||||||
|
|
||||||
handler = (PyObject *) user_data;
|
handler = (PyObject *) user_data;
|
||||||
if (PyObject_HasAttrString(handler, (char *) "startElement"))
|
if (PyObject_HasAttrString(handler, "startElement"))
|
||||||
type = 1;
|
type = 1;
|
||||||
else if (PyObject_HasAttrString(handler, (char *) "start"))
|
else if (PyObject_HasAttrString(handler, "start"))
|
||||||
type = 2;
|
type = 2;
|
||||||
if (type != 0) {
|
if (type != 0) {
|
||||||
/*
|
/*
|
||||||
@ -893,11 +893,11 @@ pythonStartElement(void *user_data, const xmlChar * name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (type == 1)
|
if (type == 1)
|
||||||
result = PyObject_CallMethod(handler, (char *) "startElement",
|
result = PyObject_CallMethod(handler, "startElement",
|
||||||
(char *) "sO", name, dict);
|
"sO", name, dict);
|
||||||
else if (type == 2)
|
else if (type == 2)
|
||||||
result = PyObject_CallMethod(handler, (char *) "start",
|
result = PyObject_CallMethod(handler, "start",
|
||||||
(char *) "sO", name, dict);
|
"sO", name, dict);
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
Py_XDECREF(dict);
|
Py_XDECREF(dict);
|
||||||
@ -912,9 +912,8 @@ pythonStartDocument(void *user_data)
|
|||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
|
||||||
handler = (PyObject *) user_data;
|
handler = (PyObject *) user_data;
|
||||||
if (PyObject_HasAttrString(handler, (char *) "startDocument")) {
|
if (PyObject_HasAttrString(handler, "startDocument")) {
|
||||||
result =
|
result = PyObject_CallMethod(handler, "startDocument", NULL);
|
||||||
PyObject_CallMethod(handler, (char *) "startDocument", NULL);
|
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
@ -928,9 +927,8 @@ pythonEndDocument(void *user_data)
|
|||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
|
||||||
handler = (PyObject *) user_data;
|
handler = (PyObject *) user_data;
|
||||||
if (PyObject_HasAttrString(handler, (char *) "endDocument")) {
|
if (PyObject_HasAttrString(handler, "endDocument")) {
|
||||||
result =
|
result = PyObject_CallMethod(handler, "endDocument", NULL);
|
||||||
PyObject_CallMethod(handler, (char *) "endDocument", NULL);
|
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
@ -948,15 +946,15 @@ pythonEndElement(void *user_data, const xmlChar * name)
|
|||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
|
||||||
handler = (PyObject *) user_data;
|
handler = (PyObject *) user_data;
|
||||||
if (PyObject_HasAttrString(handler, (char *) "endElement")) {
|
if (PyObject_HasAttrString(handler, "endElement")) {
|
||||||
result = PyObject_CallMethod(handler, (char *) "endElement",
|
result = PyObject_CallMethod(handler, "endElement",
|
||||||
(char *) "s", name);
|
"s", name);
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
} else if (PyObject_HasAttrString(handler, (char *) "end")) {
|
} else if (PyObject_HasAttrString(handler, "end")) {
|
||||||
result = PyObject_CallMethod(handler, (char *) "end",
|
result = PyObject_CallMethod(handler, "end",
|
||||||
(char *) "s", name);
|
"s", name);
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
@ -970,9 +968,9 @@ pythonReference(void *user_data, const xmlChar * name)
|
|||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
|
||||||
handler = (PyObject *) user_data;
|
handler = (PyObject *) user_data;
|
||||||
if (PyObject_HasAttrString(handler, (char *) "reference")) {
|
if (PyObject_HasAttrString(handler, "reference")) {
|
||||||
result = PyObject_CallMethod(handler, (char *) "reference",
|
result = PyObject_CallMethod(handler, "reference",
|
||||||
(char *) "s", name);
|
"s", name);
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
@ -987,17 +985,17 @@ pythonCharacters(void *user_data, const xmlChar * ch, int len)
|
|||||||
int type = 0;
|
int type = 0;
|
||||||
|
|
||||||
handler = (PyObject *) user_data;
|
handler = (PyObject *) user_data;
|
||||||
if (PyObject_HasAttrString(handler, (char *) "characters"))
|
if (PyObject_HasAttrString(handler, "characters"))
|
||||||
type = 1;
|
type = 1;
|
||||||
else if (PyObject_HasAttrString(handler, (char *) "data"))
|
else if (PyObject_HasAttrString(handler, "data"))
|
||||||
type = 2;
|
type = 2;
|
||||||
if (type != 0) {
|
if (type != 0) {
|
||||||
if (type == 1)
|
if (type == 1)
|
||||||
result = PyObject_CallMethod(handler, (char *) "characters",
|
result = PyObject_CallMethod(handler, "characters",
|
||||||
(char *) "s#", ch, (Py_ssize_t)len);
|
"s#", ch, len);
|
||||||
else if (type == 2)
|
else if (type == 2)
|
||||||
result = PyObject_CallMethod(handler, (char *) "data",
|
result = PyObject_CallMethod(handler, "data",
|
||||||
(char *) "s#", ch, (Py_ssize_t)len);
|
"s#", ch, len);
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
@ -1012,20 +1010,17 @@ pythonIgnorableWhitespace(void *user_data, const xmlChar * ch, int len)
|
|||||||
int type = 0;
|
int type = 0;
|
||||||
|
|
||||||
handler = (PyObject *) user_data;
|
handler = (PyObject *) user_data;
|
||||||
if (PyObject_HasAttrString(handler, (char *) "ignorableWhitespace"))
|
if (PyObject_HasAttrString(handler, "ignorableWhitespace"))
|
||||||
type = 1;
|
type = 1;
|
||||||
else if (PyObject_HasAttrString(handler, (char *) "data"))
|
else if (PyObject_HasAttrString(handler, "data"))
|
||||||
type = 2;
|
type = 2;
|
||||||
if (type != 0) {
|
if (type != 0) {
|
||||||
if (type == 1)
|
if (type == 1)
|
||||||
result =
|
result = PyObject_CallMethod(handler, "ignorableWhitespace",
|
||||||
PyObject_CallMethod(handler,
|
"s#", ch, len);
|
||||||
(char *) "ignorableWhitespace",
|
|
||||||
(char *) "s#", ch, (Py_ssize_t)len);
|
|
||||||
else if (type == 2)
|
else if (type == 2)
|
||||||
result =
|
result = PyObject_CallMethod(handler, "data",
|
||||||
PyObject_CallMethod(handler, (char *) "data",
|
"s#", ch, len);
|
||||||
(char *) "s#", ch, (Py_ssize_t)len);
|
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1038,10 +1033,9 @@ pythonProcessingInstruction(void *user_data,
|
|||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
|
||||||
handler = (PyObject *) user_data;
|
handler = (PyObject *) user_data;
|
||||||
if (PyObject_HasAttrString(handler, (char *) "processingInstruction")) {
|
if (PyObject_HasAttrString(handler, "processingInstruction")) {
|
||||||
result = PyObject_CallMethod(handler, (char *)
|
result = PyObject_CallMethod(handler, "processingInstruction",
|
||||||
"processingInstruction",
|
"ss", target, data);
|
||||||
(char *) "ss", target, data);
|
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1053,10 +1047,8 @@ pythonComment(void *user_data, const xmlChar * value)
|
|||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
|
||||||
handler = (PyObject *) user_data;
|
handler = (PyObject *) user_data;
|
||||||
if (PyObject_HasAttrString(handler, (char *) "comment")) {
|
if (PyObject_HasAttrString(handler, "comment")) {
|
||||||
result =
|
result = PyObject_CallMethod(handler, "comment", "s", value);
|
||||||
PyObject_CallMethod(handler, (char *) "comment", (char *) "s",
|
|
||||||
value);
|
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
@ -1072,14 +1064,12 @@ pythonWarning(void *user_data, const char *msg, ...)
|
|||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
handler = (PyObject *) user_data;
|
handler = (PyObject *) user_data;
|
||||||
if (PyObject_HasAttrString(handler, (char *) "warning")) {
|
if (PyObject_HasAttrString(handler, "warning")) {
|
||||||
va_start(args, msg);
|
va_start(args, msg);
|
||||||
vsnprintf(buf, 1023, msg, args);
|
vsnprintf(buf, 1023, msg, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
buf[1023] = 0;
|
buf[1023] = 0;
|
||||||
result =
|
result = PyObject_CallMethod(handler, "warning", "s", buf);
|
||||||
PyObject_CallMethod(handler, (char *) "warning", (char *) "s",
|
|
||||||
buf);
|
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
@ -1095,14 +1085,12 @@ pythonError(void *user_data, const char *msg, ...)
|
|||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
handler = (PyObject *) user_data;
|
handler = (PyObject *) user_data;
|
||||||
if (PyObject_HasAttrString(handler, (char *) "error")) {
|
if (PyObject_HasAttrString(handler, "error")) {
|
||||||
va_start(args, msg);
|
va_start(args, msg);
|
||||||
vsnprintf(buf, 1023, msg, args);
|
vsnprintf(buf, 1023, msg, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
buf[1023] = 0;
|
buf[1023] = 0;
|
||||||
result =
|
result = PyObject_CallMethod(handler, "error", "s", buf);
|
||||||
PyObject_CallMethod(handler, (char *) "error", (char *) "s",
|
|
||||||
buf);
|
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
@ -1118,14 +1106,12 @@ pythonFatalError(void *user_data, const char *msg, ...)
|
|||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
handler = (PyObject *) user_data;
|
handler = (PyObject *) user_data;
|
||||||
if (PyObject_HasAttrString(handler, (char *) "fatalError")) {
|
if (PyObject_HasAttrString(handler, "fatalError")) {
|
||||||
va_start(args, msg);
|
va_start(args, msg);
|
||||||
vsnprintf(buf, 1023, msg, args);
|
vsnprintf(buf, 1023, msg, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
buf[1023] = 0;
|
buf[1023] = 0;
|
||||||
result =
|
result = PyObject_CallMethod(handler, "fatalError", "s", buf);
|
||||||
PyObject_CallMethod(handler, (char *) "fatalError",
|
|
||||||
(char *) "s", buf);
|
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
@ -1140,19 +1126,15 @@ pythonCdataBlock(void *user_data, const xmlChar * ch, int len)
|
|||||||
int type = 0;
|
int type = 0;
|
||||||
|
|
||||||
handler = (PyObject *) user_data;
|
handler = (PyObject *) user_data;
|
||||||
if (PyObject_HasAttrString(handler, (char *) "cdataBlock"))
|
if (PyObject_HasAttrString(handler, "cdataBlock"))
|
||||||
type = 1;
|
type = 1;
|
||||||
else if (PyObject_HasAttrString(handler, (char *) "cdata"))
|
else if (PyObject_HasAttrString(handler, "cdata"))
|
||||||
type = 2;
|
type = 2;
|
||||||
if (type != 0) {
|
if (type != 0) {
|
||||||
if (type == 1)
|
if (type == 1)
|
||||||
result =
|
result = PyObject_CallMethod(handler, "cdataBlock", "s#", ch, len);
|
||||||
PyObject_CallMethod(handler, (char *) "cdataBlock",
|
|
||||||
(char *) "s#", ch, (Py_ssize_t)len);
|
|
||||||
else if (type == 2)
|
else if (type == 2)
|
||||||
result =
|
result = PyObject_CallMethod(handler, "cdata", "s#", ch, len);
|
||||||
PyObject_CallMethod(handler, (char *) "cdata",
|
|
||||||
(char *) "s#", ch, (Py_ssize_t)len);
|
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
@ -1168,11 +1150,9 @@ pythonExternalSubset(void *user_data,
|
|||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
|
||||||
handler = (PyObject *) user_data;
|
handler = (PyObject *) user_data;
|
||||||
if (PyObject_HasAttrString(handler, (char *) "externalSubset")) {
|
if (PyObject_HasAttrString(handler, "externalSubset")) {
|
||||||
result =
|
result = PyObject_CallMethod(handler, "externalSubset", "sss",
|
||||||
PyObject_CallMethod(handler, (char *) "externalSubset",
|
name, externalID, systemID);
|
||||||
(char *) "sss", name, externalID,
|
|
||||||
systemID);
|
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1188,9 +1168,9 @@ pythonEntityDecl(void *user_data,
|
|||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
|
||||||
handler = (PyObject *) user_data;
|
handler = (PyObject *) user_data;
|
||||||
if (PyObject_HasAttrString(handler, (char *) "entityDecl")) {
|
if (PyObject_HasAttrString(handler, "entityDecl")) {
|
||||||
result = PyObject_CallMethod(handler, (char *) "entityDecl",
|
result = PyObject_CallMethod(handler, "entityDecl",
|
||||||
(char *) "sisss", name, type,
|
"sisss", name, type,
|
||||||
publicId, systemId, content);
|
publicId, systemId, content);
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
@ -1210,9 +1190,9 @@ pythonNotationDecl(void *user_data,
|
|||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
|
||||||
handler = (PyObject *) user_data;
|
handler = (PyObject *) user_data;
|
||||||
if (PyObject_HasAttrString(handler, (char *) "notationDecl")) {
|
if (PyObject_HasAttrString(handler, "notationDecl")) {
|
||||||
result = PyObject_CallMethod(handler, (char *) "notationDecl",
|
result = PyObject_CallMethod(handler, "notationDecl",
|
||||||
(char *) "sss", name, publicId,
|
"sss", name, publicId,
|
||||||
systemId);
|
systemId);
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
@ -1236,7 +1216,7 @@ pythonAttributeDecl(void *user_data,
|
|||||||
int count;
|
int count;
|
||||||
|
|
||||||
handler = (PyObject *) user_data;
|
handler = (PyObject *) user_data;
|
||||||
if (PyObject_HasAttrString(handler, (char *) "attributeDecl")) {
|
if (PyObject_HasAttrString(handler, "attributeDecl")) {
|
||||||
count = 0;
|
count = 0;
|
||||||
for (node = tree; node != NULL; node = node->next) {
|
for (node = tree; node != NULL; node = node->next) {
|
||||||
count++;
|
count++;
|
||||||
@ -1249,8 +1229,8 @@ pythonAttributeDecl(void *user_data,
|
|||||||
Py_DECREF(newName);
|
Py_DECREF(newName);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
result = PyObject_CallMethod(handler, (char *) "attributeDecl",
|
result = PyObject_CallMethod(handler, "attributeDecl",
|
||||||
(char *) "ssiisO", elem, name, type,
|
"ssiisO", elem, name, type,
|
||||||
def, defaultValue, nameList);
|
def, defaultValue, nameList);
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
@ -1269,14 +1249,14 @@ pythonElementDecl(void *user_data,
|
|||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
|
||||||
handler = (PyObject *) user_data;
|
handler = (PyObject *) user_data;
|
||||||
if (PyObject_HasAttrString(handler, (char *) "elementDecl")) {
|
if (PyObject_HasAttrString(handler, "elementDecl")) {
|
||||||
/* TODO: wrap in an elementContent object */
|
/* TODO: wrap in an elementContent object */
|
||||||
printf
|
printf
|
||||||
("pythonElementDecl: xmlElementContentPtr wrapper missing !\n");
|
("pythonElementDecl: xmlElementContentPtr wrapper missing !\n");
|
||||||
obj = Py_None;
|
obj = Py_None;
|
||||||
/* Py_XINCREF(Py_None); isn't the reference just borrowed ??? */
|
/* Py_XINCREF(Py_None); isn't the reference just borrowed ??? */
|
||||||
result = PyObject_CallMethod(handler, (char *) "elementDecl",
|
result = PyObject_CallMethod(handler, "elementDecl",
|
||||||
(char *) "siO", name, type, obj);
|
"siO", name, type, obj);
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
@ -1294,11 +1274,9 @@ pythonUnparsedEntityDecl(void *user_data,
|
|||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
|
||||||
handler = (PyObject *) user_data;
|
handler = (PyObject *) user_data;
|
||||||
if (PyObject_HasAttrString(handler, (char *) "unparsedEntityDecl")) {
|
if (PyObject_HasAttrString(handler, "unparsedEntityDecl")) {
|
||||||
result =
|
result = PyObject_CallMethod(handler, "unparsedEntityDecl", "ssss",
|
||||||
PyObject_CallMethod(handler, (char *) "unparsedEntityDecl",
|
name, publicId, systemId, notationName);
|
||||||
(char *) "ssss", name, publicId, systemId,
|
|
||||||
notationName);
|
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
@ -1313,10 +1291,9 @@ pythonInternalSubset(void *user_data, const xmlChar * name,
|
|||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
|
||||||
handler = (PyObject *) user_data;
|
handler = (PyObject *) user_data;
|
||||||
if (PyObject_HasAttrString(handler, (char *) "internalSubset")) {
|
if (PyObject_HasAttrString(handler, "internalSubset")) {
|
||||||
result = PyObject_CallMethod(handler, (char *) "internalSubset",
|
result = PyObject_CallMethod(handler, "internalSubset", "sss", name,
|
||||||
(char *) "sss", name, ExternalID,
|
ExternalID, SystemID);
|
||||||
SystemID);
|
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
@ -1378,7 +1355,7 @@ libxml_xmlCreatePushParser(ATTRIBUTE_UNUSED PyObject * self,
|
|||||||
PyObject *pyret;
|
PyObject *pyret;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple
|
if (!PyArg_ParseTuple
|
||||||
(args, (char *) "Oziz:xmlCreatePushParser", &pyobj_SAX, &chunk,
|
(args, "Oziz:xmlCreatePushParser", &pyobj_SAX, &chunk,
|
||||||
&size, &URI))
|
&size, &URI))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
@ -1406,7 +1383,7 @@ libxml_htmlCreatePushParser(ATTRIBUTE_UNUSED PyObject * self,
|
|||||||
PyObject *pyret;
|
PyObject *pyret;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple
|
if (!PyArg_ParseTuple
|
||||||
(args, (char *) "Oziz:htmlCreatePushParser", &pyobj_SAX, &chunk,
|
(args, "Oziz:htmlCreatePushParser", &pyobj_SAX, &chunk,
|
||||||
&size, &URI))
|
&size, &URI))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
@ -1433,7 +1410,7 @@ libxml_xmlSAXParseFile(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
xmlSAXHandlerPtr SAX = NULL;
|
xmlSAXHandlerPtr SAX = NULL;
|
||||||
xmlParserCtxtPtr ctxt;
|
xmlParserCtxtPtr ctxt;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *) "Osi:xmlSAXParseFile", &pyobj_SAX,
|
if (!PyArg_ParseTuple(args, "Osi:xmlSAXParseFile", &pyobj_SAX,
|
||||||
&URI, &recover))
|
&URI, &recover))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
@ -1463,7 +1440,7 @@ libxml_htmlSAXParseFile(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
htmlParserCtxtPtr ctxt;
|
htmlParserCtxtPtr ctxt;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple
|
if (!PyArg_ParseTuple
|
||||||
(args, (char *) "Osz:htmlSAXParseFile", &pyobj_SAX, &URI,
|
(args, "Osz:htmlSAXParseFile", &pyobj_SAX, &URI,
|
||||||
&encoding))
|
&encoding))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
@ -1563,7 +1540,7 @@ libxml_xmlRegisterErrorHandler(ATTRIBUTE_UNUSED PyObject * self,
|
|||||||
PyObject *pyobj_ctx;
|
PyObject *pyobj_ctx;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple
|
if (!PyArg_ParseTuple
|
||||||
(args, (char *) "OO:xmlRegisterErrorHandler", &pyobj_f,
|
(args, "OO:xmlRegisterErrorHandler", &pyobj_f,
|
||||||
&pyobj_ctx))
|
&pyobj_ctx))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
@ -1651,7 +1628,7 @@ libxml_xmlParserCtxtSetErrorHandler(ATTRIBUTE_UNUSED PyObject *self, PyObject *a
|
|||||||
PyObject *pyobj_f;
|
PyObject *pyobj_f;
|
||||||
PyObject *pyobj_arg;
|
PyObject *pyobj_arg;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"OOO:xmlParserCtxtSetErrorHandler",
|
if (!PyArg_ParseTuple(args, "OOO:xmlParserCtxtSetErrorHandler",
|
||||||
&pyobj_ctxt, &pyobj_f, &pyobj_arg))
|
&pyobj_ctxt, &pyobj_f, &pyobj_arg))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
|
ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
|
||||||
@ -1694,7 +1671,7 @@ libxml_xmlParserCtxtGetErrorHandler(ATTRIBUTE_UNUSED PyObject *self, PyObject *a
|
|||||||
xmlParserCtxtPyCtxtPtr pyCtxt;
|
xmlParserCtxtPyCtxtPtr pyCtxt;
|
||||||
PyObject *pyobj_ctxt;
|
PyObject *pyobj_ctxt;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"O:xmlParserCtxtGetErrorHandler",
|
if (!PyArg_ParseTuple(args, "O:xmlParserCtxtGetErrorHandler",
|
||||||
&pyobj_ctxt))
|
&pyobj_ctxt))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
|
ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
|
||||||
@ -1723,7 +1700,7 @@ libxml_xmlFreeParserCtxt(ATTRIBUTE_UNUSED PyObject *self, PyObject *args) {
|
|||||||
PyObject *pyobj_ctxt;
|
PyObject *pyobj_ctxt;
|
||||||
xmlParserCtxtPyCtxtPtr pyCtxt;
|
xmlParserCtxtPyCtxtPtr pyCtxt;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeParserCtxt", &pyobj_ctxt))
|
if (!PyArg_ParseTuple(args, "O:xmlFreeParserCtxt", &pyobj_ctxt))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
|
ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
|
||||||
|
|
||||||
@ -1832,7 +1809,7 @@ libxml_xmlSetValidErrors(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
xmlValidCtxtPyCtxtPtr pyCtxt;
|
xmlValidCtxtPyCtxtPtr pyCtxt;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple
|
if (!PyArg_ParseTuple
|
||||||
(args, (char *) "OOO|O:xmlSetValidErrors", &pyobj_ctx, &pyobj_error, &pyobj_warn, &pyobj_arg))
|
(args, "OOO|O:xmlSetValidErrors", &pyobj_ctx, &pyobj_error, &pyobj_warn, &pyobj_arg))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
ctxt = PyValidCtxt_Get(pyobj_ctx);
|
ctxt = PyValidCtxt_Get(pyobj_ctx);
|
||||||
@ -1872,7 +1849,7 @@ libxml_xmlFreeValidCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
|||||||
xmlValidCtxtPyCtxtPtr pyCtxt;
|
xmlValidCtxtPyCtxtPtr pyCtxt;
|
||||||
PyObject *pyobj_cur;
|
PyObject *pyobj_cur;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeValidCtxt", &pyobj_cur))
|
if (!PyArg_ParseTuple(args, "O:xmlFreeValidCtxt", &pyobj_cur))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
cur = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_cur);
|
cur = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_cur);
|
||||||
|
|
||||||
@ -1943,7 +1920,7 @@ libxml_xmlTextReaderSetErrorHandler(ATTRIBUTE_UNUSED PyObject *self, PyObject *a
|
|||||||
PyObject *pyobj_arg;
|
PyObject *pyobj_arg;
|
||||||
PyObject *py_retval;
|
PyObject *py_retval;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"OOO:xmlTextReaderSetErrorHandler", &pyobj_reader, &pyobj_f, &pyobj_arg))
|
if (!PyArg_ParseTuple(args, "OOO:xmlTextReaderSetErrorHandler", &pyobj_reader, &pyobj_f, &pyobj_arg))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
|
reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
|
||||||
/* clear previous error handler */
|
/* clear previous error handler */
|
||||||
@ -1998,7 +1975,7 @@ libxml_xmlTextReaderGetErrorHandler(ATTRIBUTE_UNUSED PyObject *self, PyObject *a
|
|||||||
PyObject *pyobj_reader;
|
PyObject *pyobj_reader;
|
||||||
PyObject *py_retval;
|
PyObject *py_retval;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderSetErrorHandler", &pyobj_reader))
|
if (!PyArg_ParseTuple(args, "O:xmlTextReaderSetErrorHandler", &pyobj_reader))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
|
reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
|
||||||
xmlTextReaderGetErrorHandler(reader,&f,&arg);
|
xmlTextReaderGetErrorHandler(reader,&f,&arg);
|
||||||
@ -2030,7 +2007,7 @@ libxml_xmlFreeTextReader(ATTRIBUTE_UNUSED PyObject *self, PyObject *args) {
|
|||||||
xmlTextReaderErrorFunc f;
|
xmlTextReaderErrorFunc f;
|
||||||
void *arg;
|
void *arg;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeTextReader", &pyobj_reader))
|
if (!PyArg_ParseTuple(args, "O:xmlFreeTextReader", &pyobj_reader))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
if (!PyCapsule_CheckExact(pyobj_reader)) {
|
if (!PyCapsule_CheckExact(pyobj_reader)) {
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
@ -2176,7 +2153,7 @@ libxml_xmlRegisterXPathFunction(ATTRIBUTE_UNUSED PyObject * self,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple
|
if (!PyArg_ParseTuple
|
||||||
(args, (char *) "OszO:registerXPathFunction", &pyobj_ctx, &name,
|
(args, "OszO:registerXPathFunction", &pyobj_ctx, &name,
|
||||||
&ns_uri, &pyobj_f))
|
&ns_uri, &pyobj_f))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
@ -2233,7 +2210,7 @@ libxml_xmlXPathRegisterVariable(ATTRIBUTE_UNUSED PyObject * self,
|
|||||||
PyObject *pyobj_value;
|
PyObject *pyobj_value;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple
|
if (!PyArg_ParseTuple
|
||||||
(args, (char *) "OszO:xpathRegisterVariable", &pyobj_ctx, &name,
|
(args, "OszO:xpathRegisterVariable", &pyobj_ctx, &name,
|
||||||
&ns_uri, &pyobj_value))
|
&ns_uri, &pyobj_value))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
@ -2258,7 +2235,7 @@ libxml_name(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
xmlNodePtr cur;
|
xmlNodePtr cur;
|
||||||
const xmlChar *res;
|
const xmlChar *res;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *) "O:name", &obj))
|
if (!PyArg_ParseTuple(args, "O:name", &obj))
|
||||||
return NULL;
|
return NULL;
|
||||||
cur = PyxmlNode_Get(obj);
|
cur = PyxmlNode_Get(obj);
|
||||||
|
|
||||||
@ -2298,7 +2275,7 @@ libxml_doc(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
xmlNodePtr cur;
|
xmlNodePtr cur;
|
||||||
xmlDocPtr res;
|
xmlDocPtr res;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *) "O:doc", &obj))
|
if (!PyArg_ParseTuple(args, "O:doc", &obj))
|
||||||
return NULL;
|
return NULL;
|
||||||
cur = PyxmlNode_Get(obj);
|
cur = PyxmlNode_Get(obj);
|
||||||
|
|
||||||
@ -2331,7 +2308,7 @@ libxml_properties(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
xmlNodePtr cur;
|
xmlNodePtr cur;
|
||||||
xmlAttrPtr res;
|
xmlAttrPtr res;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *) "O:properties", &obj))
|
if (!PyArg_ParseTuple(args, "O:properties", &obj))
|
||||||
return NULL;
|
return NULL;
|
||||||
cur = PyxmlNode_Get(obj);
|
cur = PyxmlNode_Get(obj);
|
||||||
if ((cur != NULL) && (cur->type == XML_ELEMENT_NODE))
|
if ((cur != NULL) && (cur->type == XML_ELEMENT_NODE))
|
||||||
@ -2349,7 +2326,7 @@ libxml_next(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
xmlNodePtr cur;
|
xmlNodePtr cur;
|
||||||
xmlNodePtr res;
|
xmlNodePtr res;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *) "O:next", &obj))
|
if (!PyArg_ParseTuple(args, "O:next", &obj))
|
||||||
return NULL;
|
return NULL;
|
||||||
cur = PyxmlNode_Get(obj);
|
cur = PyxmlNode_Get(obj);
|
||||||
|
|
||||||
@ -2386,7 +2363,7 @@ libxml_prev(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
xmlNodePtr cur;
|
xmlNodePtr cur;
|
||||||
xmlNodePtr res;
|
xmlNodePtr res;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *) "O:prev", &obj))
|
if (!PyArg_ParseTuple(args, "O:prev", &obj))
|
||||||
return NULL;
|
return NULL;
|
||||||
cur = PyxmlNode_Get(obj);
|
cur = PyxmlNode_Get(obj);
|
||||||
|
|
||||||
@ -2419,7 +2396,7 @@ libxml_children(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
xmlNodePtr cur;
|
xmlNodePtr cur;
|
||||||
xmlNodePtr res;
|
xmlNodePtr res;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *) "O:children", &obj))
|
if (!PyArg_ParseTuple(args, "O:children", &obj))
|
||||||
return NULL;
|
return NULL;
|
||||||
cur = PyxmlNode_Get(obj);
|
cur = PyxmlNode_Get(obj);
|
||||||
|
|
||||||
@ -2455,7 +2432,7 @@ libxml_last(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
xmlNodePtr cur;
|
xmlNodePtr cur;
|
||||||
xmlNodePtr res;
|
xmlNodePtr res;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *) "O:last", &obj))
|
if (!PyArg_ParseTuple(args, "O:last", &obj))
|
||||||
return NULL;
|
return NULL;
|
||||||
cur = PyxmlNode_Get(obj);
|
cur = PyxmlNode_Get(obj);
|
||||||
|
|
||||||
@ -2491,7 +2468,7 @@ libxml_parent(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
xmlNodePtr cur;
|
xmlNodePtr cur;
|
||||||
xmlNodePtr res;
|
xmlNodePtr res;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *) "O:parent", &obj))
|
if (!PyArg_ParseTuple(args, "O:parent", &obj))
|
||||||
return NULL;
|
return NULL;
|
||||||
cur = PyxmlNode_Get(obj);
|
cur = PyxmlNode_Get(obj);
|
||||||
|
|
||||||
@ -2527,7 +2504,7 @@ libxml_type(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
xmlNodePtr cur;
|
xmlNodePtr cur;
|
||||||
const xmlChar *res = NULL;
|
const xmlChar *res = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *) "O:last", &obj))
|
if (!PyArg_ParseTuple(args, "O:last", &obj))
|
||||||
return NULL;
|
return NULL;
|
||||||
cur = PyxmlNode_Get(obj);
|
cur = PyxmlNode_Get(obj);
|
||||||
if (cur == NULL) {
|
if (cur == NULL) {
|
||||||
@ -2616,7 +2593,7 @@ libxml_xmlNodeGetNsDefs(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
PyObject *pyobj_node;
|
PyObject *pyobj_node;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple
|
if (!PyArg_ParseTuple
|
||||||
(args, (char *) "O:xmlNodeGetNsDefs", &pyobj_node))
|
(args, "O:xmlNodeGetNsDefs", &pyobj_node))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
|
node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
|
||||||
|
|
||||||
@ -2640,7 +2617,7 @@ libxml_xmlNodeRemoveNsDef(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
xmlNsPtr c_retval;
|
xmlNsPtr c_retval;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple
|
if (!PyArg_ParseTuple
|
||||||
(args, (char *) "Oz:xmlNodeRemoveNsDef", &pyobj_node, &href))
|
(args, "Oz:xmlNodeRemoveNsDef", &pyobj_node, &href))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
|
node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
|
||||||
ns = NULL;
|
ns = NULL;
|
||||||
@ -2686,7 +2663,7 @@ libxml_xmlNodeGetNs(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
xmlNodePtr node;
|
xmlNodePtr node;
|
||||||
PyObject *pyobj_node;
|
PyObject *pyobj_node;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *) "O:xmlNodeGetNs", &pyobj_node))
|
if (!PyArg_ParseTuple(args, "O:xmlNodeGetNs", &pyobj_node))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
|
node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
|
||||||
|
|
||||||
@ -2722,7 +2699,7 @@ libxml_serializeNode(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
xmlBufferPtr buf;
|
xmlBufferPtr buf;
|
||||||
int options = 0;
|
int options = 0;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *) "Ozi:serializeNode", &pyobj_node,
|
if (!PyArg_ParseTuple(args, "Ozi:serializeNode", &pyobj_node,
|
||||||
&encoding, &format))
|
&encoding, &format))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
|
node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
|
||||||
@ -2795,7 +2772,7 @@ libxml_saveNodeTo(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
xmlOutputBufferPtr buf;
|
xmlOutputBufferPtr buf;
|
||||||
xmlCharEncodingHandlerPtr handler = NULL;
|
xmlCharEncodingHandlerPtr handler = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *) "OOzi:serializeNode", &pyobj_node,
|
if (!PyArg_ParseTuple(args, "OOzi:serializeNode", &pyobj_node,
|
||||||
&py_file, &encoding, &format))
|
&py_file, &encoding, &format))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
|
node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
|
||||||
@ -2866,7 +2843,7 @@ libxml_xmlNewNode(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
xmlChar *name;
|
xmlChar *name;
|
||||||
xmlNodePtr node;
|
xmlNodePtr node;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *) "s:xmlNewNode", &name))
|
if (!PyArg_ParseTuple(args, "s:xmlNewNode", &name))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
node = (xmlNodePtr) xmlNewNode(NULL, name);
|
node = (xmlNodePtr) xmlNewNode(NULL, name);
|
||||||
|
|
||||||
@ -2893,7 +2870,7 @@ libxml_addLocalCatalog(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
xmlParserCtxtPtr ctxt;
|
xmlParserCtxtPtr ctxt;
|
||||||
PyObject *pyobj_ctxt;
|
PyObject *pyobj_ctxt;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"Os:addLocalCatalog", &pyobj_ctxt, &URL))
|
if (!PyArg_ParseTuple(args, "Os:addLocalCatalog", &pyobj_ctxt, &URL))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
|
ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
|
||||||
@ -3001,7 +2978,7 @@ libxml_xmlRelaxNGSetValidErrors(ATTRIBUTE_UNUSED PyObject * self, PyObject * arg
|
|||||||
xmlRelaxNGValidCtxtPyCtxtPtr pyCtxt;
|
xmlRelaxNGValidCtxtPyCtxtPtr pyCtxt;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple
|
if (!PyArg_ParseTuple
|
||||||
(args, (char *) "OOO|O:xmlRelaxNGSetValidErrors", &pyobj_ctx, &pyobj_error, &pyobj_warn, &pyobj_arg))
|
(args, "OOO|O:xmlRelaxNGSetValidErrors", &pyobj_ctx, &pyobj_error, &pyobj_warn, &pyobj_arg))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
ctxt = PyrelaxNgValidCtxt_Get(pyobj_ctx);
|
ctxt = PyrelaxNgValidCtxt_Get(pyobj_ctx);
|
||||||
@ -3047,7 +3024,7 @@ libxml_xmlRelaxNGFreeValidCtxt(ATTRIBUTE_UNUSED PyObject *self, PyObject *args)
|
|||||||
xmlRelaxNGValidCtxtPyCtxtPtr pyCtxt;
|
xmlRelaxNGValidCtxtPyCtxtPtr pyCtxt;
|
||||||
PyObject *pyobj_ctxt;
|
PyObject *pyobj_ctxt;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"O:xmlRelaxNGFreeValidCtxt", &pyobj_ctxt))
|
if (!PyArg_ParseTuple(args, "O:xmlRelaxNGFreeValidCtxt", &pyobj_ctxt))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
ctxt = (xmlRelaxNGValidCtxtPtr) PyrelaxNgValidCtxt_Get(pyobj_ctxt);
|
ctxt = (xmlRelaxNGValidCtxtPtr) PyrelaxNgValidCtxt_Get(pyobj_ctxt);
|
||||||
|
|
||||||
@ -3155,7 +3132,7 @@ libxml_xmlSchemaSetValidErrors(ATTRIBUTE_UNUSED PyObject * self, PyObject * args
|
|||||||
xmlSchemaValidCtxtPyCtxtPtr pyCtxt;
|
xmlSchemaValidCtxtPyCtxtPtr pyCtxt;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple
|
if (!PyArg_ParseTuple
|
||||||
(args, (char *) "OOO|O:xmlSchemaSetValidErrors", &pyobj_ctx, &pyobj_error, &pyobj_warn, &pyobj_arg))
|
(args, "OOO|O:xmlSchemaSetValidErrors", &pyobj_ctx, &pyobj_error, &pyobj_warn, &pyobj_arg))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
ctxt = PySchemaValidCtxt_Get(pyobj_ctx);
|
ctxt = PySchemaValidCtxt_Get(pyobj_ctx);
|
||||||
@ -3202,7 +3179,7 @@ libxml_xmlSchemaFreeValidCtxt(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
|||||||
xmlSchemaValidCtxtPyCtxtPtr pyCtxt;
|
xmlSchemaValidCtxtPyCtxtPtr pyCtxt;
|
||||||
PyObject *pyobj_ctxt;
|
PyObject *pyobj_ctxt;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"O:xmlSchemaFreeValidCtxt", &pyobj_ctxt))
|
if (!PyArg_ParseTuple(args, "O:xmlSchemaFreeValidCtxt", &pyobj_ctxt))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
ctxt = (xmlSchemaValidCtxtPtr) PySchemaValidCtxt_Get(pyobj_ctxt);
|
ctxt = (xmlSchemaValidCtxtPtr) PySchemaValidCtxt_Get(pyobj_ctxt);
|
||||||
|
|
||||||
@ -3367,7 +3344,7 @@ libxml_C14NDocDumpMemory(ATTRIBUTE_UNUSED PyObject * self,
|
|||||||
|
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *) "OOiOi:C14NDocDumpMemory",
|
if (!PyArg_ParseTuple(args, "OOiOi:C14NDocDumpMemory",
|
||||||
&pyobj_doc,
|
&pyobj_doc,
|
||||||
&pyobj_nodes,
|
&pyobj_nodes,
|
||||||
&exclusive,
|
&exclusive,
|
||||||
@ -3445,7 +3422,7 @@ libxml_C14NDocSaveTo(ATTRIBUTE_UNUSED PyObject * self,
|
|||||||
int result;
|
int result;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *) "OOiOiO:C14NDocSaveTo",
|
if (!PyArg_ParseTuple(args, "OOiOiO:C14NDocSaveTo",
|
||||||
&pyobj_doc,
|
&pyobj_doc,
|
||||||
&pyobj_nodes,
|
&pyobj_nodes,
|
||||||
&exclusive,
|
&exclusive,
|
||||||
@ -3523,10 +3500,10 @@ libxml_getObjDesc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
|||||||
PyObject *obj;
|
PyObject *obj;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"O:getObjDesc", &obj))
|
if (!PyArg_ParseTuple(args, "O:getObjDesc", &obj))
|
||||||
return NULL;
|
return NULL;
|
||||||
str = PyCapsule_GetPointer(obj, PyCapsule_GetName(obj));
|
str = PyCapsule_GetPointer(obj, PyCapsule_GetName(obj));
|
||||||
return Py_BuildValue((char *)"s", str);
|
return Py_BuildValue("s", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
@ -3535,16 +3512,16 @@ libxml_compareNodesEqual(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
|||||||
PyObject *py_node1, *py_node2;
|
PyObject *py_node1, *py_node2;
|
||||||
xmlNodePtr node1, node2;
|
xmlNodePtr node1, node2;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"OO:compareNodesEqual",
|
if (!PyArg_ParseTuple(args, "OO:compareNodesEqual",
|
||||||
&py_node1, &py_node2))
|
&py_node1, &py_node2))
|
||||||
return NULL;
|
return NULL;
|
||||||
/* To compare two node objects, we compare their pointer addresses */
|
/* To compare two node objects, we compare their pointer addresses */
|
||||||
node1 = PyxmlNode_Get(py_node1);
|
node1 = PyxmlNode_Get(py_node1);
|
||||||
node2 = PyxmlNode_Get(py_node2);
|
node2 = PyxmlNode_Get(py_node2);
|
||||||
if ( node1 == node2 )
|
if ( node1 == node2 )
|
||||||
return Py_BuildValue((char *)"i", 1);
|
return Py_BuildValue("i", 1);
|
||||||
else
|
else
|
||||||
return Py_BuildValue((char *)"i", 0);
|
return Py_BuildValue("i", 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3554,7 +3531,7 @@ libxml_nodeHash(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
|||||||
PyObject *py_node1;
|
PyObject *py_node1;
|
||||||
xmlNodePtr node1;
|
xmlNodePtr node1;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, (char *)"O:nodeHash", &py_node1))
|
if (!PyArg_ParseTuple(args, "O:nodeHash", &py_node1))
|
||||||
return NULL;
|
return NULL;
|
||||||
/* For simplicity, we use the node pointer address as a hash value */
|
/* For simplicity, we use the node pointer address as a hash value */
|
||||||
node1 = PyxmlNode_Get(py_node1);
|
node1 = PyxmlNode_Get(py_node1);
|
||||||
@ -3587,64 +3564,64 @@ libxml_deprecationWarning(const char *func) {
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
static PyMethodDef libxmlMethods[] = {
|
static PyMethodDef libxmlMethods[] = {
|
||||||
#include "libxml2-export.c"
|
#include "libxml2-export.c"
|
||||||
{(char *) "name", libxml_name, METH_VARARGS, NULL},
|
{"name", libxml_name, METH_VARARGS, NULL},
|
||||||
{(char *) "children", libxml_children, METH_VARARGS, NULL},
|
{"children", libxml_children, METH_VARARGS, NULL},
|
||||||
{(char *) "properties", libxml_properties, METH_VARARGS, NULL},
|
{"properties", libxml_properties, METH_VARARGS, NULL},
|
||||||
{(char *) "last", libxml_last, METH_VARARGS, NULL},
|
{"last", libxml_last, METH_VARARGS, NULL},
|
||||||
{(char *) "prev", libxml_prev, METH_VARARGS, NULL},
|
{"prev", libxml_prev, METH_VARARGS, NULL},
|
||||||
{(char *) "next", libxml_next, METH_VARARGS, NULL},
|
{"next", libxml_next, METH_VARARGS, NULL},
|
||||||
{(char *) "parent", libxml_parent, METH_VARARGS, NULL},
|
{"parent", libxml_parent, METH_VARARGS, NULL},
|
||||||
{(char *) "type", libxml_type, METH_VARARGS, NULL},
|
{"type", libxml_type, METH_VARARGS, NULL},
|
||||||
{(char *) "doc", libxml_doc, METH_VARARGS, NULL},
|
{"doc", libxml_doc, METH_VARARGS, NULL},
|
||||||
{(char *) "xmlNewNode", libxml_xmlNewNode, METH_VARARGS, NULL},
|
{"xmlNewNode", libxml_xmlNewNode, METH_VARARGS, NULL},
|
||||||
{(char *) "xmlNodeRemoveNsDef", libxml_xmlNodeRemoveNsDef, METH_VARARGS, NULL},
|
{"xmlNodeRemoveNsDef", libxml_xmlNodeRemoveNsDef, METH_VARARGS, NULL},
|
||||||
#ifdef LIBXML_VALID_ENABLED
|
#ifdef LIBXML_VALID_ENABLED
|
||||||
{(char *)"xmlSetValidErrors", libxml_xmlSetValidErrors, METH_VARARGS, NULL},
|
{"xmlSetValidErrors", libxml_xmlSetValidErrors, METH_VARARGS, NULL},
|
||||||
{(char *)"xmlFreeValidCtxt", libxml_xmlFreeValidCtxt, METH_VARARGS, NULL},
|
{"xmlFreeValidCtxt", libxml_xmlFreeValidCtxt, METH_VARARGS, NULL},
|
||||||
#endif /* LIBXML_VALID_ENABLED */
|
#endif /* LIBXML_VALID_ENABLED */
|
||||||
#ifdef LIBXML_OUTPUT_ENABLED
|
#ifdef LIBXML_OUTPUT_ENABLED
|
||||||
{(char *) "serializeNode", libxml_serializeNode, METH_VARARGS, NULL},
|
{"serializeNode", libxml_serializeNode, METH_VARARGS, NULL},
|
||||||
{(char *) "saveNodeTo", libxml_saveNodeTo, METH_VARARGS, NULL},
|
{"saveNodeTo", libxml_saveNodeTo, METH_VARARGS, NULL},
|
||||||
{(char *) "outputBufferCreate", libxml_xmlCreateOutputBuffer, METH_VARARGS, NULL},
|
{"outputBufferCreate", libxml_xmlCreateOutputBuffer, METH_VARARGS, NULL},
|
||||||
{(char *) "outputBufferGetPythonFile", libxml_outputBufferGetPythonFile, METH_VARARGS, NULL},
|
{"outputBufferGetPythonFile", libxml_outputBufferGetPythonFile, METH_VARARGS, NULL},
|
||||||
{(char *) "xmlOutputBufferClose", libxml_xmlOutputBufferClose, METH_VARARGS, NULL},
|
{"xmlOutputBufferClose", libxml_xmlOutputBufferClose, METH_VARARGS, NULL},
|
||||||
{ (char *)"xmlOutputBufferFlush", libxml_xmlOutputBufferFlush, METH_VARARGS, NULL },
|
{"xmlOutputBufferFlush", libxml_xmlOutputBufferFlush, METH_VARARGS, NULL },
|
||||||
{ (char *)"xmlSaveFileTo", libxml_xmlSaveFileTo, METH_VARARGS, NULL },
|
{"xmlSaveFileTo", libxml_xmlSaveFileTo, METH_VARARGS, NULL },
|
||||||
{ (char *)"xmlSaveFormatFileTo", libxml_xmlSaveFormatFileTo, METH_VARARGS, NULL },
|
{"xmlSaveFormatFileTo", libxml_xmlSaveFormatFileTo, METH_VARARGS, NULL },
|
||||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||||
{(char *) "inputBufferCreate", libxml_xmlCreateInputBuffer, METH_VARARGS, NULL},
|
{"inputBufferCreate", libxml_xmlCreateInputBuffer, METH_VARARGS, NULL},
|
||||||
{(char *) "setEntityLoader", libxml_xmlSetEntityLoader, METH_VARARGS, NULL},
|
{"setEntityLoader", libxml_xmlSetEntityLoader, METH_VARARGS, NULL},
|
||||||
{(char *)"xmlRegisterErrorHandler", libxml_xmlRegisterErrorHandler, METH_VARARGS, NULL },
|
{"xmlRegisterErrorHandler", libxml_xmlRegisterErrorHandler, METH_VARARGS, NULL },
|
||||||
{(char *)"xmlParserCtxtSetErrorHandler", libxml_xmlParserCtxtSetErrorHandler, METH_VARARGS, NULL },
|
{"xmlParserCtxtSetErrorHandler", libxml_xmlParserCtxtSetErrorHandler, METH_VARARGS, NULL },
|
||||||
{(char *)"xmlParserCtxtGetErrorHandler", libxml_xmlParserCtxtGetErrorHandler, METH_VARARGS, NULL },
|
{"xmlParserCtxtGetErrorHandler", libxml_xmlParserCtxtGetErrorHandler, METH_VARARGS, NULL },
|
||||||
{(char *)"xmlFreeParserCtxt", libxml_xmlFreeParserCtxt, METH_VARARGS, NULL },
|
{"xmlFreeParserCtxt", libxml_xmlFreeParserCtxt, METH_VARARGS, NULL },
|
||||||
#ifdef LIBXML_READER_ENABLED
|
#ifdef LIBXML_READER_ENABLED
|
||||||
{(char *)"xmlTextReaderSetErrorHandler", libxml_xmlTextReaderSetErrorHandler, METH_VARARGS, NULL },
|
{"xmlTextReaderSetErrorHandler", libxml_xmlTextReaderSetErrorHandler, METH_VARARGS, NULL },
|
||||||
{(char *)"xmlTextReaderGetErrorHandler", libxml_xmlTextReaderGetErrorHandler, METH_VARARGS, NULL },
|
{"xmlTextReaderGetErrorHandler", libxml_xmlTextReaderGetErrorHandler, METH_VARARGS, NULL },
|
||||||
{(char *)"xmlFreeTextReader", libxml_xmlFreeTextReader, METH_VARARGS, NULL },
|
{"xmlFreeTextReader", libxml_xmlFreeTextReader, METH_VARARGS, NULL },
|
||||||
#endif
|
#endif
|
||||||
#ifdef LIBXML_CATALOG_ENABLED
|
#ifdef LIBXML_CATALOG_ENABLED
|
||||||
{(char *)"addLocalCatalog", libxml_addLocalCatalog, METH_VARARGS, NULL },
|
{"addLocalCatalog", libxml_addLocalCatalog, METH_VARARGS, NULL },
|
||||||
#endif
|
#endif
|
||||||
#ifdef LIBXML_RELAXNG_ENABLED
|
#ifdef LIBXML_RELAXNG_ENABLED
|
||||||
{(char *)"xmlRelaxNGSetValidErrors", libxml_xmlRelaxNGSetValidErrors, METH_VARARGS, NULL},
|
{"xmlRelaxNGSetValidErrors", libxml_xmlRelaxNGSetValidErrors, METH_VARARGS, NULL},
|
||||||
{(char *)"xmlRelaxNGFreeValidCtxt", libxml_xmlRelaxNGFreeValidCtxt, METH_VARARGS, NULL},
|
{"xmlRelaxNGFreeValidCtxt", libxml_xmlRelaxNGFreeValidCtxt, METH_VARARGS, NULL},
|
||||||
#endif
|
#endif
|
||||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||||
{(char *)"xmlSchemaSetValidErrors", libxml_xmlSchemaSetValidErrors, METH_VARARGS, NULL},
|
{"xmlSchemaSetValidErrors", libxml_xmlSchemaSetValidErrors, METH_VARARGS, NULL},
|
||||||
{(char *)"xmlSchemaFreeValidCtxt", libxml_xmlSchemaFreeValidCtxt, METH_VARARGS, NULL},
|
{"xmlSchemaFreeValidCtxt", libxml_xmlSchemaFreeValidCtxt, METH_VARARGS, NULL},
|
||||||
#endif
|
#endif
|
||||||
#ifdef LIBXML_C14N_ENABLED
|
#ifdef LIBXML_C14N_ENABLED
|
||||||
#ifdef LIBXML_OUTPUT_ENABLED
|
#ifdef LIBXML_OUTPUT_ENABLED
|
||||||
{(char *)"xmlC14NDocDumpMemory", libxml_C14NDocDumpMemory, METH_VARARGS, NULL},
|
{"xmlC14NDocDumpMemory", libxml_C14NDocDumpMemory, METH_VARARGS, NULL},
|
||||||
{(char *)"xmlC14NDocSaveTo", libxml_C14NDocSaveTo, METH_VARARGS, NULL},
|
{"xmlC14NDocSaveTo", libxml_C14NDocSaveTo, METH_VARARGS, NULL},
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
{(char *) "getObjDesc", libxml_getObjDesc, METH_VARARGS, NULL},
|
{"getObjDesc", libxml_getObjDesc, METH_VARARGS, NULL},
|
||||||
{(char *) "compareNodesEqual", libxml_compareNodesEqual, METH_VARARGS, NULL},
|
{"compareNodesEqual", libxml_compareNodesEqual, METH_VARARGS, NULL},
|
||||||
{(char *) "nodeHash", libxml_nodeHash, METH_VARARGS, NULL},
|
{"nodeHash", libxml_nodeHash, METH_VARARGS, NULL},
|
||||||
{(char *) "xmlRegisterInputCallback", libxml_xmlRegisterInputCallback, METH_VARARGS, NULL},
|
{"xmlRegisterInputCallback", libxml_xmlRegisterInputCallback, METH_VARARGS, NULL},
|
||||||
{(char *) "xmlUnregisterInputCallback", libxml_xmlUnregisterInputCallback, METH_VARARGS, NULL},
|
{"xmlUnregisterInputCallback", libxml_xmlUnregisterInputCallback, METH_VARARGS, NULL},
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3684,7 +3661,7 @@ void initlibxml2mod(void)
|
|||||||
module = PyModule_Create(&moduledef);
|
module = PyModule_Create(&moduledef);
|
||||||
#else
|
#else
|
||||||
/* initialize the python extension module */
|
/* initialize the python extension module */
|
||||||
module = Py_InitModule((char *) "libxml2mod", libxmlMethods);
|
module = Py_InitModule("libxml2mod", libxmlMethods);
|
||||||
#endif
|
#endif
|
||||||
if (module == NULL)
|
if (module == NULL)
|
||||||
INITERROR;
|
INITERROR;
|
||||||
|
Reference in New Issue
Block a user