1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

Fixed bug #141529 i.e. various problems when building with --without-html

* xmllint.c xmlsave.c python/generator.py python/libxml.c: Fixed
  bug #141529 i.e. various problems when building with --without-html
Daniel
This commit is contained in:
Daniel Veillard
2004-04-30 23:11:45 +00:00
parent a2d51fc316
commit 656ce948ab
5 changed files with 37 additions and 8 deletions

View File

@ -1,3 +1,8 @@
Sat May 1 01:08:44 CEST 2004 Daniel Veillard <daniel@veillard.com>
* xmllint.c xmlsave.c python/generator.py python/libxml.c: Fixed
bug #141529 i.e. various problems when building with --without-html
Fri Apr 30 18:12:31 CEST 2004 Daniel Veillard <daniel@veillard.com> Fri Apr 30 18:12:31 CEST 2004 Daniel Veillard <daniel@veillard.com>
* xmllint.c xmlreader.c: fixing bug #141384 where the reader didn't * xmllint.c xmlreader.c: fixing bug #141384 where the reader didn't

View File

@ -432,7 +432,7 @@ def print_function_wrapper(name, output, export, include):
include.write("#ifdef LIBXML_DEBUG_ENABLED\n"); include.write("#ifdef LIBXML_DEBUG_ENABLED\n");
export.write("#ifdef LIBXML_DEBUG_ENABLED\n"); export.write("#ifdef LIBXML_DEBUG_ENABLED\n");
output.write("#ifdef LIBXML_DEBUG_ENABLED\n"); output.write("#ifdef LIBXML_DEBUG_ENABLED\n");
elif file == "HTMLtree" or file == "HTMLparser": elif file == "HTMLtree" or file == "HTMLparser" or name[0:4] == "html":
include.write("#ifdef LIBXML_HTML_ENABLED\n"); include.write("#ifdef LIBXML_HTML_ENABLED\n");
export.write("#ifdef LIBXML_HTML_ENABLED\n"); export.write("#ifdef LIBXML_HTML_ENABLED\n");
output.write("#ifdef LIBXML_HTML_ENABLED\n"); output.write("#ifdef LIBXML_HTML_ENABLED\n");
@ -470,9 +470,17 @@ def print_function_wrapper(name, output, export, include):
if file == "python": if file == "python":
# Those have been manually generated # Those have been manually generated
if name[0:4] == "html":
include.write("#endif /* LIBXML_HTML_ENABLED */\n");
export.write("#endif /* LIBXML_HTML_ENABLED */\n");
output.write("#endif /* LIBXML_HTML_ENABLED */\n");
return 1 return 1
if file == "python_accessor" and ret[0] != "void" and ret[2] is None: if file == "python_accessor" and ret[0] != "void" and ret[2] is None:
# Those have been manually generated # Those have been manually generated
if name[0:4] == "html":
include.write("#endif /* LIBXML_HTML_ENABLED */\n");
export.write("#endif /* LIBXML_HTML_ENABLED */\n");
output.write("#endif /* LIBXML_HTML_ENABLED */\n");
return 1 return 1
output.write("PyObject *\n") output.write("PyObject *\n")
@ -501,7 +509,7 @@ def print_function_wrapper(name, output, export, include):
include.write("#endif /* LIBXML_DEBUG_ENABLED */\n"); include.write("#endif /* LIBXML_DEBUG_ENABLED */\n");
export.write("#endif /* LIBXML_DEBUG_ENABLED */\n"); export.write("#endif /* LIBXML_DEBUG_ENABLED */\n");
output.write("#endif /* LIBXML_DEBUG_ENABLED */\n"); output.write("#endif /* LIBXML_DEBUG_ENABLED */\n");
elif file == "HTMLtree" or file == "HTMLparser": elif file == "HTMLtree" or file == "HTMLparser" or name[0:4] == "html":
include.write("#endif /* LIBXML_HTML_ENABLED */\n"); include.write("#endif /* LIBXML_HTML_ENABLED */\n");
export.write("#endif /* LIBXML_HTML_ENABLED */\n"); export.write("#endif /* LIBXML_HTML_ENABLED */\n");
output.write("#endif /* LIBXML_HTML_ENABLED */\n"); output.write("#endif /* LIBXML_HTML_ENABLED */\n");

View File

@ -1190,6 +1190,7 @@ PyObject *
libxml_htmlCreatePushParser(ATTRIBUTE_UNUSED PyObject * self, libxml_htmlCreatePushParser(ATTRIBUTE_UNUSED PyObject * self,
PyObject * args) PyObject * args)
{ {
#ifdef LIBXML_HTML_ENABLED
const char *chunk; const char *chunk;
int size; int size;
const char *URI; const char *URI;
@ -1216,6 +1217,10 @@ libxml_htmlCreatePushParser(ATTRIBUTE_UNUSED PyObject * self,
XML_CHAR_ENCODING_NONE); XML_CHAR_ENCODING_NONE);
pyret = libxml_xmlParserCtxtPtrWrap(ret); pyret = libxml_xmlParserCtxtPtrWrap(ret);
return (pyret); return (pyret);
#else
Py_INCREF(Py_None);
return (Py_None);
#endif /* LIBXML_HTML_ENABLED */
} }
PyObject * PyObject *
@ -1249,6 +1254,7 @@ libxml_xmlSAXParseFile(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
PyObject * PyObject *
libxml_htmlSAXParseFile(ATTRIBUTE_UNUSED PyObject * self, PyObject * args) libxml_htmlSAXParseFile(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
{ {
#ifdef LIBXML_HTML_ENABLED
const char *URI; const char *URI;
const char *encoding; const char *encoding;
PyObject *pyobj_SAX = NULL; PyObject *pyobj_SAX = NULL;
@ -1273,6 +1279,10 @@ libxml_htmlSAXParseFile(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
htmlSAXParseFile(URI, encoding, SAX, pyobj_SAX); htmlSAXParseFile(URI, encoding, SAX, pyobj_SAX);
Py_INCREF(Py_None); Py_INCREF(Py_None);
return (Py_None); return (Py_None);
#else
Py_INCREF(Py_None);
return (Py_None);
#endif /* LIBXML_HTML_ENABLED */
} }
/************************************************************************ /************************************************************************
@ -2430,6 +2440,7 @@ libxml_serializeNode(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
xmlDocDumpFormatMemoryEnc(doc, &c_retval, &len, xmlDocDumpFormatMemoryEnc(doc, &c_retval, &len,
(const char *) encoding, format); (const char *) encoding, format);
py_retval = libxml_charPtrWrap((char *) c_retval); py_retval = libxml_charPtrWrap((char *) c_retval);
#ifdef LIBXML_HTML_ENABLED
} else if (node->type == XML_HTML_DOCUMENT_NODE) { } else if (node->type == XML_HTML_DOCUMENT_NODE) {
xmlOutputBufferPtr buf; xmlOutputBufferPtr buf;
xmlCharEncodingHandlerPtr handler = NULL; xmlCharEncodingHandlerPtr handler = NULL;
@ -2473,6 +2484,7 @@ libxml_serializeNode(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
} }
(void) xmlOutputBufferClose(buf); (void) xmlOutputBufferClose(buf);
py_retval = libxml_charPtrWrap((char *) c_retval); py_retval = libxml_charPtrWrap((char *) c_retval);
#endif /* LIBXML_HTML_ENABLED */
} else { } else {
if (node->type == XML_NAMESPACE_DECL) if (node->type == XML_NAMESPACE_DECL)
doc = NULL; doc = NULL;
@ -2508,6 +2520,7 @@ libxml_serializeNode(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
} }
(void) xmlOutputBufferClose(buf); (void) xmlOutputBufferClose(buf);
py_retval = libxml_charPtrWrap((char *) c_retval); py_retval = libxml_charPtrWrap((char *) c_retval);
#ifdef LIBXML_HTML_ENABLED
} else if (doc->type == XML_HTML_DOCUMENT_NODE) { } else if (doc->type == XML_HTML_DOCUMENT_NODE) {
xmlOutputBufferPtr buf; xmlOutputBufferPtr buf;
xmlCharEncodingHandlerPtr handler = NULL; xmlCharEncodingHandlerPtr handler = NULL;
@ -2549,6 +2562,7 @@ libxml_serializeNode(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
} }
(void) xmlOutputBufferClose(buf); (void) xmlOutputBufferClose(buf);
py_retval = libxml_charPtrWrap((char *) c_retval); py_retval = libxml_charPtrWrap((char *) c_retval);
#endif /* LIBXML_HTML_ENABLED */
} else { } else {
Py_INCREF(Py_None); Py_INCREF(Py_None);
return (Py_None); return (Py_None);
@ -2594,10 +2608,12 @@ libxml_saveNodeTo(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
} else { } else {
doc = node->doc; doc = node->doc;
} }
#ifdef LIBXML_HTML_ENABLED
if (doc->type == XML_HTML_DOCUMENT_NODE) { if (doc->type == XML_HTML_DOCUMENT_NODE) {
if (encoding == NULL) if (encoding == NULL)
encoding = (const char *) htmlGetMetaEncoding(doc); encoding = (const char *) htmlGetMetaEncoding(doc);
} }
#endif /* LIBXML_HTML_ENABLED */
if (encoding != NULL) { if (encoding != NULL) {
handler = xmlFindCharEncodingHandler(encoding); handler = xmlFindCharEncodingHandler(encoding);
if (handler == NULL) { if (handler == NULL) {
@ -2614,12 +2630,14 @@ libxml_saveNodeTo(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
buf = xmlOutputBufferCreateFile(output, handler); buf = xmlOutputBufferCreateFile(output, handler);
if (node->type == XML_DOCUMENT_NODE) { if (node->type == XML_DOCUMENT_NODE) {
len = xmlSaveFormatFileTo(buf, doc, encoding, format); len = xmlSaveFormatFileTo(buf, doc, encoding, format);
#ifdef LIBXML_HTML_ENABLED
} else if (node->type == XML_HTML_DOCUMENT_NODE) { } else if (node->type == XML_HTML_DOCUMENT_NODE) {
htmlDocContentDumpFormatOutput(buf, doc, encoding, format); htmlDocContentDumpFormatOutput(buf, doc, encoding, format);
len = xmlOutputBufferClose(buf); len = xmlOutputBufferClose(buf);
} else if (doc->type == XML_HTML_DOCUMENT_NODE) { } else if (doc->type == XML_HTML_DOCUMENT_NODE) {
htmlNodeDumpFormatOutput(buf, doc, node, encoding, format); htmlNodeDumpFormatOutput(buf, doc, node, encoding, format);
len = xmlOutputBufferClose(buf); len = xmlOutputBufferClose(buf);
#endif /* LIBXML_HTML_ENABLED */
} else { } else {
xmlNodeDumpOutput(buf, doc, node, 0, format, encoding); xmlNodeDumpOutput(buf, doc, node, 0, format, encoding);
len = xmlOutputBufferClose(buf); len = xmlOutputBufferClose(buf);

View File

@ -129,7 +129,7 @@ static xmlSchemaPtr wxschemas = NULL;
#endif #endif
static int repeat = 0; static int repeat = 0;
static int insert = 0; static int insert = 0;
#ifdef LIBXML_HTML_ENABLED #if defined(LIBXML_HTML_ENABLED) || defined(LIBXML_VALID_ENABLED)
static int html = 0; static int html = 0;
static int xmlout = 0; static int xmlout = 0;
#endif #endif
@ -1080,7 +1080,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
if ((timing) && (!repeat)) { if ((timing) && (!repeat)) {
startTimer(); startTimer();
} }
#ifdef LIBXML_VALID_ENABLED #ifdef LIBXML_HTML_ENABLED
if ((html) && (!xmlout)) { if ((html) && (!xmlout)) {
if (compress) { if (compress) {
htmlSaveFile(output ? output : "-", doc); htmlSaveFile(output ? output : "-", doc);

View File

@ -14,11 +14,11 @@
#include <libxml/parserInternals.h> #include <libxml/parserInternals.h>
#include <libxml/tree.h> #include <libxml/tree.h>
#include <libxml/xmlsave.h> #include <libxml/xmlsave.h>
#ifdef LIBXML_HTML_ENABLED
#include <libxml/HTMLtree.h>
#define MAX_INDENT 60 #define MAX_INDENT 60
#include <libxml/HTMLtree.h>
/************************************************************************ /************************************************************************
* * * *
* XHTML detection * * XHTML detection *
@ -63,8 +63,6 @@ xmlIsXHTML(const xmlChar *systemID, const xmlChar *publicID) {
} }
return(0); return(0);
} }
#endif /* LIBXML_HTML_ENABLED */
#ifdef LIBXML_OUTPUT_ENABLED #ifdef LIBXML_OUTPUT_ENABLED