Skip to content

Commit

Permalink
added 2 new configure option: --with-reader --with-sax1 to allow remo…
Browse files Browse the repository at this point in the history
…ving

* Makefile.am SAX.c SAX2.c configure.in globals.c parser.c
  parserInternals.c testReader.c testSAX.c xmlIO.c xmllint.c
  xmlreader.c example/gjobread.c include/libxml/xmlversion.h.in:
  added 2 new configure option: --with-reader --with-sax1
  to allow removing the reader or non-xmlReadxxx() interfaces.
Daniel
  • Loading branch information
Daniel Veillard committed Sep 30, 2003
1 parent 652327a commit 8127390
Show file tree
Hide file tree
Showing 15 changed files with 201 additions and 19 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
@@ -1,3 +1,11 @@
Tue Sep 30 02:38:16 CEST 2003 Daniel Veillard <daniel@veillard.com>

* Makefile.am SAX.c SAX2.c configure.in globals.c parser.c
parserInternals.c testReader.c testSAX.c xmlIO.c xmllint.c
xmlreader.c example/gjobread.c include/libxml/xmlversion.h.in:
added 2 new configure option: --with-reader --with-sax1
to allow removing the reader or non-xmlReadxxx() interfaces.

Mon Sep 29 19:58:26 CEST 2003 Daniel Veillard <daniel@veillard.com>

* configure.in entities.c tree.c valid.c xmllint.c
Expand Down
2 changes: 1 addition & 1 deletion Makefile.am
Expand Up @@ -122,7 +122,7 @@ check-local: tests

testall : tests SVGtests SAXtests

tests: XMLtests XMLenttests NStests Readertests SAXtests @TEST_HTML@ @TEST_VALID@ URItests @TEST_XPATH@ @TEST_XPTR@ @TEST_XINCLUDE@ @TEST_C14N@ @TEST_DEBUG@ @TEST_CATALOG@ @TEST_REGEXPS@ @TEST_SCHEMAS@ @TEST_THREADS@ Timingtests @TEST_VTIME@
tests: XMLtests XMLenttests NStests Readertests @TEST_SAX@ @TEST_HTML@ @TEST_VALID@ URItests @TEST_XPATH@ @TEST_XPTR@ @TEST_XINCLUDE@ @TEST_C14N@ @TEST_DEBUG@ @TEST_CATALOG@ @TEST_REGEXPS@ @TEST_SCHEMAS@ @TEST_THREADS@ Timingtests @TEST_VTIME@
@(if [ "@PYTHON_SUBDIR@" != "" ] ; then cd python ; $(MAKE) tests ; fi)

valgrind:
Expand Down
2 changes: 2 additions & 0 deletions SAX.c
Expand Up @@ -28,6 +28,7 @@
#include <libxml/globals.h>
#include <libxml/SAX2.h>

#ifdef LIBXML_SAX1_ENABLED
/**
* initxmlDefaultSAXHandler:
* @hdlr: the SAX handler
Expand Down Expand Up @@ -75,6 +76,7 @@ initxmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr, int warning)

hdlr->initialized = 1;
}
#endif /* LIBXML_SAX1_ENABLED */

#ifdef LIBXML_HTML_ENABLED

Expand Down
19 changes: 13 additions & 6 deletions SAX2.c
Expand Up @@ -857,6 +857,7 @@ xmlSAX2EndDocument(void *ctx)
}
}

#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
/**
* xmlSAX2AttributeInternal:
* @ctx: the user data (XML parser context)
Expand Down Expand Up @@ -1588,8 +1589,8 @@ xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)
#endif
nodePop(ctxt);
}
#endif /* LIBXML_SAX1_ENABLED || LIBXML_HTML_ENABLE */

int nb_interned = 0;
/*
* xmlSAX2TextNode:
* @ctxt: the parser context
Expand Down Expand Up @@ -2429,6 +2430,7 @@ xmlSAX2CDataBlock(void *ctx, const xmlChar *value, int len)

static int xmlSAX2DefaultVersionValue = 2;

#ifdef LIBXML_SAX1_ENABLED
/**
* xmlSAXDefaultVersion:
* @version: the version, 1 or 2
Expand All @@ -2450,6 +2452,7 @@ xmlSAXDefaultVersion(int version)
xmlSAX2DefaultVersionValue = version;
return(ret);
}
#endif /* LIBXML_SAX1_ENABLED */

/**
* xmlSAXVersion:
Expand All @@ -2464,16 +2467,18 @@ int
xmlSAXVersion(xmlSAXHandler *hdlr, int version)
{
if (hdlr == NULL) return(-1);
if (version == 1) {
hdlr->startElement = xmlSAX2StartElement;
hdlr->endElement = xmlSAX2EndElement;
hdlr->initialized = 1;
} else if (version == 2) {
if (version == 2) {
hdlr->startElement = NULL;
hdlr->endElement = NULL;
hdlr->startElementNs = xmlSAX2StartElementNs;
hdlr->endElementNs = xmlSAX2EndElementNs;
hdlr->initialized = XML_SAX2_MAGIC;
#ifdef LIBXML_SAX1_ENABLED
} else if (version == 1) {
hdlr->startElement = xmlSAX2StartElement;
hdlr->endElement = xmlSAX2EndElement;
hdlr->initialized = 1;
#endif /* LIBXML_SAX1_ENABLED */
} else
return(-1);
hdlr->internalSubset = xmlSAX2InternalSubset;
Expand Down Expand Up @@ -2533,7 +2538,9 @@ xmlSAX2InitDefaultSAXHandler(xmlSAXHandler *hdlr, int warning)
void
xmlDefaultSAXHandlerInit(void)
{
#ifdef LIBXML_SAX1_ENABLED
xmlSAXVersion((xmlSAXHandlerPtr) &xmlDefaultSAXHandler, 1);
#endif /* LIBXML_SAX1_ENABLED */
}

#ifdef LIBXML_HTML_ENABLED
Expand Down
31 changes: 31 additions & 0 deletions configure.in
Expand Up @@ -623,6 +623,37 @@ else
fi
AC_SUBST(WITH_LEGACY)

AC_ARG_WITH(reader,
[ --with-reader add the xmlReader parsing interface (on)])
if test "$with_minimum" = "yes" -a "$with_reader" = ""
then
with_reader=no
fi
if test "$with_reader" = "no" ; then
echo Disabling the xmlReader parsing interface
WITH_READER=0
else
WITH_READER=1
fi
AC_SUBST(WITH_READER)

AC_ARG_WITH(sax1,
[ --with-sax1 add the older SAX1 interface (on)])
if test "$with_minimum" = "yes" -a "$with_sax1" = ""
then
with_sax1=no
fi
if test "$with_sax1" = "no" ; then
echo Disabling the older SAX1 interface
WITH_SAX1=0
TEST_SAX=
else
WITH_SAX1=1
TEST_SAX=SAXtests
fi
AC_SUBST(WITH_SAX1)
AC_SUBST(TEST_SAX)

AC_ARG_WITH(valid,
[ --with-valid add the DTD validation support (on)])
if test "$with_minimum" = "yes" -a "$with_valid" = ""
Expand Down
7 changes: 7 additions & 0 deletions example/gjobread.c
Expand Up @@ -184,11 +184,18 @@ parseGjobFile(char *filename) {
xmlNsPtr ns;
xmlNodePtr cur;

#ifdef LIBXML_SAX1_ENABLED
/*
* build an XML tree from a the file;
*/
doc = xmlParseFile(filename);
if (doc == NULL) return(NULL);
#else
/*
* the library has been compiled without some of the old interfaces
*/
return(NULL);
#endif /* LIBXML_SAX1_ENABLED */

/*
* Check the document is of the right kind
Expand Down
6 changes: 6 additions & 0 deletions globals.c
Expand Up @@ -325,6 +325,7 @@ static const char *xmlTreeIndentStringThrDef = " ";
int xmlSaveNoEmptyTags = 0;
int xmlSaveNoEmptyTagsThrDef = 0;

#ifdef LIBXML_SAX1_ENABLED
/**
* xmlDefaultSAXHandler:
*
Expand Down Expand Up @@ -360,6 +361,7 @@ xmlSAXHandlerV1 xmlDefaultSAXHandler = {
xmlSAX2ExternalSubset,
0,
};
#endif /* LIBXML_SAX1_ENABLED */

/**
* xmlDefaultSAXLocator:
Expand Down Expand Up @@ -483,7 +485,9 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
gs->oldXMLWDcompatibility = 0;
gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;
#ifdef LIBXML_SAX1_ENABLED
initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
#endif /* LIBXML_SAX1_ENABLED */
gs->xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId;
gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
Expand Down Expand Up @@ -674,6 +678,7 @@ int xmlThrDefDefaultBufferSize(int v) {
return ret;
}

#ifdef LIBXML_SAX1_ENABLED
#undef xmlDefaultSAXHandler
xmlSAXHandlerV1 *
__xmlDefaultSAXHandler(void) {
Expand All @@ -682,6 +687,7 @@ __xmlDefaultSAXHandler(void) {
else
return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
}
#endif /* LIBXML_SAX1_ENABLED */

#undef xmlDefaultSAXLocator
xmlSAXLocator *
Expand Down
18 changes: 18 additions & 0 deletions include/libxml/xmlversion.h.in
Expand Up @@ -101,6 +101,24 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#define LIBXML_OUTPUT_ENABLED
#endif

/**
* LIBXML_READER_ENABLED:
*
* Whether the xmlReader parsing interface is configured in
*/
#if @WITH_READER@
#define LIBXML_READER_ENABLED
#endif

/**
* LIBXML_SAX1_ENABLED:
*
* Whether the older SAX1 interface is configured in
*/
#if @WITH_SAX1@
#define LIBXML_SAX1_ENABLED
#endif

/**
* LIBXML_FTP_ENABLED:
*
Expand Down

0 comments on commit 8127390

Please sign in to comment.