Commit d0463560 authored by Daniel Veillard's avatar Daniel Veillard

Applied the last patches from Gary, cleanup, activated threading all user

* include/libxml/SAX.h include/libxml/globals.h include/libxml/parser.h
  include/libxml/parserInternals.h include/libxml/tree.h
  include/libxml/xmlerror.h HTMLparser.c SAX.c error.c globals.c
  nanoftp.c nanohttp.c parser.c parserInternals.c testDocbook.c
  testHTML.c testSAX.c tree.c uri.c xlink.c xmlmemory.c:
  Applied the last patches from Gary, cleanup, activated threading
  all user accessible global variables are now handled in globals.[ch]
  Still a bit rought but make tests passes with either
  --with-threads defined at configure time or not.
* Makefile.am example/Makefile.am: added globals.[ch] and threads
  linking options
Daniel
parent b847864f
Sat Oct 13 11:08:20 CEST 2001 Daniel Veillard <daniel@veillard.com>
* include/libxml/SAX.h include/libxml/globals.h include/libxml/parser.h
include/libxml/parserInternals.h include/libxml/tree.h
include/libxml/xmlerror.h HTMLparser.c SAX.c error.c globals.c
nanoftp.c nanohttp.c parser.c parserInternals.c testDocbook.c
testHTML.c testSAX.c tree.c uri.c xlink.c xmlmemory.c:
Applied the last patches from Gary, cleanup, activated threading
all user accessible global variables are now handled in globals.[ch]
Still a bit rought but make tests passes with either
--with-threads defined at configure time or not.
* Makefile.am example/Makefile.am: added globals.[ch] and threads
linking options
Fri Oct 12 19:25:55 CEST 2001 Daniel Veillard <daniel@veillard.com>
* Makefile.am include/libxml/Makefile.am
......
......@@ -3557,6 +3557,8 @@ static int
htmlParseDocument(htmlParserCtxtPtr ctxt) {
xmlDtdPtr dtd;
xmlInitParser();
htmlDefaultSAXHandlerInit();
ctxt->html = 1;
......@@ -4669,6 +4671,8 @@ htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data,
htmlParserInputPtr inputStream;
xmlParserInputBufferPtr buf;
xmlInitParser();
buf = xmlAllocParserInputBuffer(enc);
if (buf == NULL) return(NULL);
......@@ -4745,6 +4749,8 @@ htmlSAXParseDoc(xmlChar *cur, const char *encoding, htmlSAXHandlerPtr sax, void
htmlDocPtr ret;
htmlParserCtxtPtr ctxt;
xmlInitParser();
if (cur == NULL) return(NULL);
......@@ -4869,6 +4875,8 @@ htmlSAXParseFile(const char *filename, const char *encoding, htmlSAXHandlerPtr s
htmlParserCtxtPtr ctxt;
htmlSAXHandlerPtr oldsax = NULL;
xmlInitParser();
ctxt = htmlCreateFileParserCtxt(filename, encoding);
if (ctxt == NULL) return(NULL);
if (sax != NULL) {
......
......@@ -23,14 +23,14 @@ libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \
parser.c tree.c hash.c list.c xmlIO.c xmlmemory.c uri.c \
valid.c xlink.c HTMLparser.c HTMLtree.c debugXML.c xpath.c \
xpointer.c xinclude.c nanohttp.c nanoftp.c DOCBparser.c \
catalog.c threads.c strio.c trio.c
catalog.c globals.c threads.c strio.c trio.c
else
libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \
parser.c tree.c hash.c list.c xmlIO.c xmlmemory.c uri.c \
valid.c xlink.c HTMLparser.c HTMLtree.c debugXML.c xpath.c \
xpointer.c xinclude.c nanohttp.c nanoftp.c DOCBparser.c \
catalog.c threads.c
catalog.c globals.c threads.c
endif
......
This diff is collapsed.
......@@ -78,9 +78,9 @@ if __name__ == "__main__":
writeline(global_functions_hdr,"(*(__"+fields[1]+"()))")
writeline(global_functions_hdr,"#else")
if len(fields) == 3:
writeline(global_functions_hdr,"extern "+fields[0]+" "+fields[1]+fields[2]+";")
writeline(global_functions_hdr,"LIBXML_DLL_IMPORT extern "+fields[0]+" "+fields[1]+fields[2]+";")
else:
writeline(global_functions_hdr,"extern "+fields[0]+" "+fields[1]+";")
writeline(global_functions_hdr,"LIBXML_DLL_IMPORT extern "+fields[0]+" "+fields[1]+";")
writeline(global_functions_hdr,"#endif")
# Update the implementation file
writeline(global_functions_impl)
......@@ -96,7 +96,7 @@ if __name__ == "__main__":
writeline(global_functions_impl, " if (IS_MAIN_THREAD)")
writeline(global_functions_impl, "\treturn (&"+fields[1]+");")
writeline(global_functions_impl, " else")
writeline(global_functions_impl, "\treturn (&get_glob_struct()->"+fields[1]+");")
writeline(global_functions_impl, "\treturn (&xmlGetGlobalState()->"+fields[1]+");")
writeline(global_functions_impl, "}")
# Terminate the header file with appropriate boilerplate
writeline(global_functions_hdr)
......
......@@ -69,9 +69,14 @@ xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
va_end(args);
}
xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc;
void *xmlGenericErrorContext = NULL;
void
initGenericErrorDefaultFunc(xmlGenericErrorFunc *handler)
{
if (handler == NULL)
xmlGenericError = xmlGenericErrorDefaultFunc;
else
(*handler) = xmlGenericErrorDefaultFunc;
}
/**
* xmlSetGenericErrorFunc:
......
......@@ -7,5 +7,5 @@ INCLUDES = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include -I@srcdir@
LDADD = $(top_builddir)/libxml2.la @Z_LIBS@ $(ICONV_LIBS) -lm
LDADD = $(top_builddir)/libxml2.la @THREAD_LIBS@ @Z_LIBS@ $(ICONV_LIBS) -lm
......@@ -13,8 +13,7 @@
#include "libxml.h"
#include <libxml/threads.h>
#include <libxml/globals.h>
#include <libxml/xmlmemory.h>
/*
* Helpful Macro
......@@ -38,10 +37,16 @@
************************************************************************/
const char *xmlParserVersion = LIBXML_VERSION_STRING;
/*
* Memory allocation routines
*/
#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
extern void xmlMemFree(void *ptr);
extern void * xmlMemMalloc(size_t size);
extern void * xmlMemRealloc(void *ptr,size_t size);
extern char * xmlMemoryStrdup(const char *str);
xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
......@@ -53,6 +58,36 @@ xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) strdup;
#endif
#include <libxml/threads.h>
#include <libxml/globals.h>
#include <libxml/SAX.h>
#undef docbDefaultSAXHandler
#undef htmlDefaultSAXHandler
#undef oldXMLWDcompatibility
#undef xmlBufferAllocScheme
#undef xmlDefaultBufferSize
#undef xmlDefaultSAXHandler
#undef xmlDefaultSAXLocator
#undef xmlDoValidityCheckingDefaultValue
#undef xmlGenericError
#undef xmlGenericErrorContext
#undef xmlGetWarningsDefaultValue
#undef xmlIndentTreeOutput
#undef xmlKeepBlanksDefaultValue
#undef xmlLineNumbersDefaultValue
#undef xmlLoadExtDtdDefaultValue
#undef xmlParserDebugEntities
#undef xmlParserVersion
#undef xmlPedanticParserDefaultValue
#undef xmlSaveNoEmptyTags
#undef xmlSubstituteEntitiesDefaultValue
#undef xmlFree
#undef xmlMalloc
#undef xmlMemStrdup
#undef xmlRealloc
/*
* Buffers stuff
*/
......@@ -62,6 +97,7 @@ int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
/*
* Parser defaults
*/
int oldXMLWDcompatibility = 0; /* DEPRECATED */
int xmlParserDebugEntities = 0;
int xmlDoValidityCheckingDefaultValue = 0;
......@@ -264,7 +300,7 @@ __docbDefaultSAXHandler(void) {
if (IS_MAIN_THREAD)
return (&docbDefaultSAXHandler);
else
return (&get_glob_struct()->docbDefaultSAXHandler);
return (&xmlGetGlobalState()->docbDefaultSAXHandler);
}
extern xmlSAXHandler htmlDefaultSAXHandler;
......@@ -274,7 +310,7 @@ __htmlDefaultSAXHandler(void) {
if (IS_MAIN_THREAD)
return (&htmlDefaultSAXHandler);
else
return (&get_glob_struct()->htmlDefaultSAXHandler);
return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
}
extern int oldXMLWDcompatibility;
......@@ -284,7 +320,7 @@ __oldXMLWDcompatibility(void) {
if (IS_MAIN_THREAD)
return (&oldXMLWDcompatibility);
else
return (&get_glob_struct()->oldXMLWDcompatibility);
return (&xmlGetGlobalState()->oldXMLWDcompatibility);
}
extern xmlBufferAllocationScheme xmlBufferAllocScheme;
......@@ -294,7 +330,7 @@ __xmlBufferAllocScheme(void) {
if (IS_MAIN_THREAD)
return (&xmlBufferAllocScheme);
else
return (&get_glob_struct()->xmlBufferAllocScheme);
return (&xmlGetGlobalState()->xmlBufferAllocScheme);
}
extern int xmlDefaultBufferSize;
......@@ -304,7 +340,7 @@ __xmlDefaultBufferSize(void) {
if (IS_MAIN_THREAD)
return (&xmlDefaultBufferSize);
else
return (&get_glob_struct()->xmlDefaultBufferSize);
return (&xmlGetGlobalState()->xmlDefaultBufferSize);
}
extern xmlSAXHandler xmlDefaultSAXHandler;
......@@ -314,7 +350,7 @@ __xmlDefaultSAXHandler(void) {
if (IS_MAIN_THREAD)
return (&xmlDefaultSAXHandler);
else
return (&get_glob_struct()->xmlDefaultSAXHandler);
return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
}
extern xmlSAXLocator xmlDefaultSAXLocator;
......@@ -324,7 +360,7 @@ __xmlDefaultSAXLocator(void) {
if (IS_MAIN_THREAD)
return (&xmlDefaultSAXLocator);
else
return (&get_glob_struct()->xmlDefaultSAXLocator);
return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
}
extern int xmlDoValidityCheckingDefaultValue;
......@@ -334,7 +370,7 @@ __xmlDoValidityCheckingDefaultValue(void) {
if (IS_MAIN_THREAD)
return (&xmlDoValidityCheckingDefaultValue);
else
return (&get_glob_struct()->xmlDoValidityCheckingDefaultValue);
return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
}
extern xmlFreeFunc xmlFree;
......@@ -344,7 +380,7 @@ __xmlFree(void) {
if (IS_MAIN_THREAD)
return (&xmlFree);
else
return (&get_glob_struct()->xmlFree);
return (&xmlGetGlobalState()->xmlFree);
}
extern xmlGenericErrorFunc xmlGenericError;
......@@ -354,7 +390,7 @@ __xmlGenericError(void) {
if (IS_MAIN_THREAD)
return (&xmlGenericError);
else
return (&get_glob_struct()->xmlGenericError);
return (&xmlGetGlobalState()->xmlGenericError);
}
extern void * xmlGenericErrorContext;
......@@ -364,7 +400,7 @@ __xmlGenericErrorContext(void) {
if (IS_MAIN_THREAD)
return (&xmlGenericErrorContext);
else
return (&get_glob_struct()->xmlGenericErrorContext);
return (&xmlGetGlobalState()->xmlGenericErrorContext);
}
extern int xmlGetWarningsDefaultValue;
......@@ -374,7 +410,7 @@ __xmlGetWarningsDefaultValue(void) {
if (IS_MAIN_THREAD)
return (&xmlGetWarningsDefaultValue);
else
return (&get_glob_struct()->xmlGetWarningsDefaultValue);
return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
}
extern int xmlIndentTreeOutput;
......@@ -384,7 +420,7 @@ __xmlIndentTreeOutput(void) {
if (IS_MAIN_THREAD)
return (&xmlIndentTreeOutput);
else
return (&get_glob_struct()->xmlIndentTreeOutput);
return (&xmlGetGlobalState()->xmlIndentTreeOutput);
}
extern int xmlKeepBlanksDefaultValue;
......@@ -394,7 +430,7 @@ __xmlKeepBlanksDefaultValue(void) {
if (IS_MAIN_THREAD)
return (&xmlKeepBlanksDefaultValue);
else
return (&get_glob_struct()->xmlKeepBlanksDefaultValue);
return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
}
extern int xmlLineNumbersDefaultValue;
......@@ -404,7 +440,7 @@ __xmlLineNumbersDefaultValue(void) {
if (IS_MAIN_THREAD)
return (&xmlLineNumbersDefaultValue);
else
return (&get_glob_struct()->xmlLineNumbersDefaultValue);
return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
}
extern int xmlLoadExtDtdDefaultValue;
......@@ -414,7 +450,7 @@ __xmlLoadExtDtdDefaultValue(void) {
if (IS_MAIN_THREAD)
return (&xmlLoadExtDtdDefaultValue);
else
return (&get_glob_struct()->xmlLoadExtDtdDefaultValue);
return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
}
extern xmlMallocFunc xmlMalloc;
......@@ -424,7 +460,7 @@ __xmlMalloc(void) {
if (IS_MAIN_THREAD)
return (&xmlMalloc);
else
return (&get_glob_struct()->xmlMalloc);
return (&xmlGetGlobalState()->xmlMalloc);
}
extern xmlStrdupFunc xmlMemStrdup;
......@@ -434,7 +470,7 @@ __xmlMemStrdup(void) {
if (IS_MAIN_THREAD)
return (&xmlMemStrdup);
else
return (&get_glob_struct()->xmlMemStrdup);
return (&xmlGetGlobalState()->xmlMemStrdup);
}
extern int xmlParserDebugEntities;
......@@ -444,7 +480,7 @@ __xmlParserDebugEntities(void) {
if (IS_MAIN_THREAD)
return (&xmlParserDebugEntities);
else
return (&get_glob_struct()->xmlParserDebugEntities);
return (&xmlGetGlobalState()->xmlParserDebugEntities);
}
extern const char * xmlParserVersion;
......@@ -454,7 +490,7 @@ __xmlParserVersion(void) {
if (IS_MAIN_THREAD)
return (&xmlParserVersion);
else
return (&get_glob_struct()->xmlParserVersion);
return (&xmlGetGlobalState()->xmlParserVersion);
}
extern int xmlPedanticParserDefaultValue;
......@@ -464,7 +500,7 @@ __xmlPedanticParserDefaultValue(void) {
if (IS_MAIN_THREAD)
return (&xmlPedanticParserDefaultValue);
else
return (&get_glob_struct()->xmlPedanticParserDefaultValue);
return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
}
extern xmlReallocFunc xmlRealloc;
......@@ -474,7 +510,7 @@ __xmlRealloc(void) {
if (IS_MAIN_THREAD)
return (&xmlRealloc);
else
return (&get_glob_struct()->xmlRealloc);
return (&xmlGetGlobalState()->xmlRealloc);
}
extern int xmlSaveNoEmptyTags;
......@@ -484,7 +520,7 @@ __xmlSaveNoEmptyTags(void) {
if (IS_MAIN_THREAD)
return (&xmlSaveNoEmptyTags);
else
return (&get_glob_struct()->xmlSaveNoEmptyTags);
return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
}
extern int xmlSubstituteEntitiesDefaultValue;
......@@ -494,5 +530,5 @@ __xmlSubstituteEntitiesDefaultValue(void) {
if (IS_MAIN_THREAD)
return (&xmlSubstituteEntitiesDefaultValue);
else
return (&get_glob_struct()->xmlSubstituteEntitiesDefaultValue);
return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
}
......@@ -111,6 +111,14 @@ void cdataBlock (void *ctx,
const xmlChar *value,
int len);
void initxmlDefaultSAXHandler (xmlSAXHandler *hdlr,
int warning);
#ifdef LIBXML_HTML_ENABLED
void inithtmlDefaultSAXHandler (xmlSAXHandler *hdlr);
#endif
#ifdef LIBXML_DOCB_ENABLED
void initdocbDefaultSAXHandler (xmlSAXHandler *hdlr);
#endif
void xmlDefaultSAXHandlerInit (void);
void htmlDefaultSAXHandlerInit (void);
void docbDefaultSAXHandlerInit (void);
......
......@@ -25,6 +25,7 @@ extern "C" {
* Externally global symbols which need to be protected for backwards
* compatibility support.
*/
#undef docbDefaultSAXHandler
#undef htmlDefaultSAXHandler
#undef oldXMLWDcompatibility
......@@ -48,42 +49,43 @@ extern "C" {
#undef xmlPedanticParserDefaultValue
#undef xmlRealloc
#undef xmlSaveNoEmptyTags
/* #undef xmlStringComment */
/* #undef xmlStringText */
/* #undef xmlStringTextNoenc */
#undef xmlSubstituteEntitiesDefaultValue
typedef struct _xmlGlobalState xmlGlobalState;
typedef xmlGlobalState *xmlGlobalStatePtr;
struct _xmlGlobalState
{
const char *xmlParserVersion;
xmlFreeFunc xmlFree;
xmlMallocFunc xmlMalloc;
xmlStrdupFunc xmlMemStrdup;
xmlReallocFunc xmlRealloc;
xmlGenericErrorFunc xmlGenericError;
void *xmlGenericErrorContext;
xmlSAXLocator xmlDefaultSAXLocator;
xmlSAXHandler xmlDefaultSAXHandler;
xmlSAXHandler docbDefaultSAXHandler;
xmlSAXHandler htmlDefaultSAXHandler;
int oldXMLWDcompatibility;
xmlBufferAllocationScheme xmlBufferAllocScheme;
int xmlDefaultBufferSize;
xmlSAXHandler xmlDefaultSAXHandler;
xmlSAXLocator xmlDefaultSAXLocator;
int xmlSubstituteEntitiesDefaultValue;
int xmlDoValidityCheckingDefaultValue;
xmlFreeFunc xmlFree;
xmlGenericErrorFunc xmlGenericError;
void *xmlGenericErrorContext;
int xmlGetWarningsDefaultValue;
int xmlIndentTreeOutput;
int xmlKeepBlanksDefaultValue;
int xmlLineNumbersDefaultValue;
int xmlLoadExtDtdDefaultValue;
xmlMallocFunc xmlMalloc;
xmlStrdupFunc xmlMemStrdup;
int xmlParserDebugEntities;
const char *xmlParserVersion;
int xmlPedanticParserDefaultValue;
xmlReallocFunc xmlRealloc;
int xmlSaveNoEmptyTags;
/* const xmlChar xmlStringComment[8]; */
/* const xmlChar xmlStringText[5]; */
/* const xmlChar xmlStringTextNoenc[10]; */
int xmlSubstituteEntitiesDefaultValue;
int xmlIndentTreeOutput;
};
void xmlInitializeGlobalState(xmlGlobalStatePtr gs);
......@@ -100,7 +102,7 @@ extern xmlSAXHandler *__docbDefaultSAXHandler(void);
#define docbDefaultSAXHandler \
(*(__docbDefaultSAXHandler()))
#else
extern xmlSAXHandler docbDefaultSAXHandler;
LIBXML_DLL_IMPORT extern xmlSAXHandler docbDefaultSAXHandler;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -108,7 +110,7 @@ extern xmlSAXHandler *__htmlDefaultSAXHandler(void);
#define htmlDefaultSAXHandler \
(*(__htmlDefaultSAXHandler()))
#else
extern xmlSAXHandler htmlDefaultSAXHandler;
LIBXML_DLL_IMPORT extern xmlSAXHandler htmlDefaultSAXHandler;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -116,7 +118,7 @@ extern int *__oldXMLWDcompatibility(void);
#define oldXMLWDcompatibility \
(*(__oldXMLWDcompatibility()))
#else
extern int oldXMLWDcompatibility;
LIBXML_DLL_IMPORT extern int oldXMLWDcompatibility;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -124,7 +126,7 @@ extern xmlBufferAllocationScheme *__xmlBufferAllocScheme(void);
#define xmlBufferAllocScheme \
(*(__xmlBufferAllocScheme()))
#else
extern xmlBufferAllocationScheme xmlBufferAllocScheme;
LIBXML_DLL_IMPORT extern xmlBufferAllocationScheme xmlBufferAllocScheme;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -132,7 +134,7 @@ extern int *__xmlDefaultBufferSize(void);
#define xmlDefaultBufferSize \
(*(__xmlDefaultBufferSize()))
#else
extern int xmlDefaultBufferSize;
LIBXML_DLL_IMPORT extern int xmlDefaultBufferSize;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -140,7 +142,7 @@ extern xmlSAXHandler *__xmlDefaultSAXHandler(void);
#define xmlDefaultSAXHandler \
(*(__xmlDefaultSAXHandler()))
#else
extern xmlSAXHandler xmlDefaultSAXHandler;
LIBXML_DLL_IMPORT extern xmlSAXHandler xmlDefaultSAXHandler;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -148,7 +150,7 @@ extern xmlSAXLocator *__xmlDefaultSAXLocator(void);
#define xmlDefaultSAXLocator \
(*(__xmlDefaultSAXLocator()))
#else
extern xmlSAXLocator xmlDefaultSAXLocator;
LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -156,7 +158,7 @@ extern int *__xmlDoValidityCheckingDefaultValue(void);
#define xmlDoValidityCheckingDefaultValue \
(*(__xmlDoValidityCheckingDefaultValue()))
#else
extern int xmlDoValidityCheckingDefaultValue;
LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -164,7 +166,7 @@ extern xmlFreeFunc *__xmlFree(void);
#define xmlFree \
(*(__xmlFree()))
#else
extern xmlFreeFunc xmlFree;
LIBXML_DLL_IMPORT extern xmlFreeFunc xmlFree;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -172,7 +174,7 @@ extern xmlGenericErrorFunc *__xmlGenericError(void);
#define xmlGenericError \
(*(__xmlGenericError()))
#else
extern xmlGenericErrorFunc xmlGenericError;
LIBXML_DLL_IMPORT extern xmlGenericErrorFunc xmlGenericError;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -180,7 +182,7 @@ extern void * *__xmlGenericErrorContext(void);
#define xmlGenericErrorContext \
(*(__xmlGenericErrorContext()))
#else
extern void * xmlGenericErrorContext;
LIBXML_DLL_IMPORT extern void * xmlGenericErrorContext;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -188,7 +190,7 @@ extern int *__xmlGetWarningsDefaultValue(void);
#define xmlGetWarningsDefaultValue \
(*(__xmlGetWarningsDefaultValue()))
#else
extern int xmlGetWarningsDefaultValue;
LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -196,7 +198,7 @@ extern int *__xmlIndentTreeOutput(void);
#define xmlIndentTreeOutput \
(*(__xmlIndentTreeOutput()))
#else
extern int xmlIndentTreeOutput;
LIBXML_DLL_IMPORT extern int xmlIndentTreeOutput;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -204,7 +206,7 @@ extern int *__xmlKeepBlanksDefaultValue(void);
#define xmlKeepBlanksDefaultValue \
(*(__xmlKeepBlanksDefaultValue()))
#else
extern int xmlKeepBlanksDefaultValue;
LIBXML_DLL_IMPORT extern int xmlKeepBlanksDefaultValue;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -212,7 +214,7 @@ extern int *__xmlLineNumbersDefaultValue(void);
#define xmlLineNumbersDefaultValue \
(*(__xmlLineNumbersDefaultValue()))
#else
extern int xmlLineNumbersDefaultValue;
LIBXML_DLL_IMPORT extern int xmlLineNumbersDefaultValue;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -220,7 +222,7 @@ extern int *__xmlLoadExtDtdDefaultValue(void);
#define xmlLoadExtDtdDefaultValue \
(*(__xmlLoadExtDtdDefaultValue()))
#else
extern int xmlLoadExtDtdDefaultValue;
LIBXML_DLL_IMPORT extern int xmlLoadExtDtdDefaultValue;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -228,7 +230,7 @@ extern xmlMallocFunc *__xmlMalloc(void);
#define xmlMalloc \
(*(__xmlMalloc()))
#else
extern xmlMallocFunc xmlMalloc;
LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMalloc;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -236,7 +238,7 @@ extern xmlStrdupFunc *__xmlMemStrdup(void);
#define xmlMemStrdup \
(*(__xmlMemStrdup()))
#else
extern xmlStrdupFunc xmlMemStrdup;
LIBXML_DLL_IMPORT extern xmlStrdupFunc xmlMemStrdup;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -244,7 +246,7 @@ extern int *__xmlParserDebugEntities(void);
#define xmlParserDebugEntities \
(*(__xmlParserDebugEntities()))
#else
extern int xmlParserDebugEntities;
LIBXML_DLL_IMPORT extern int xmlParserDebugEntities;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -252,7 +254,7 @@ extern const char * *__xmlParserVersion(void);
#define xmlParserVersion \
(*(__xmlParserVersion()))
#else
extern const char * xmlParserVersion;
LIBXML_DLL_IMPORT extern const char * xmlParserVersion;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -260,7 +262,7 @@ extern int *__xmlPedanticParserDefaultValue(void);
#define xmlPedanticParserDefaultValue \
(*(__xmlPedanticParserDefaultValue()))
#else
extern int xmlPedanticParserDefaultValue;
LIBXML_DLL_IMPORT extern int xmlPedanticParserDefaultValue;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -268,7 +270,7 @@ extern xmlReallocFunc *__xmlRealloc(void);
#define xmlRealloc \
(*(__xmlRealloc()))
#else
extern xmlReallocFunc xmlRealloc;
LIBXML_DLL_IMPORT extern xmlReallocFunc xmlRealloc;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -276,7 +278,7 @@ extern int *__xmlSaveNoEmptyTags(void);
#define xmlSaveNoEmptyTags \
(*(__xmlSaveNoEmptyTags()))
#else
extern int xmlSaveNoEmptyTags;
LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags;
#endif
#ifdef LIBXML_THREAD_ENABLED
......@@ -284,7 +286,7 @@ extern int *__xmlSubstituteEntitiesDefaultValue(void);
#define xmlSubstituteEntitiesDefaultValue \
(*(__xmlSubstituteEntitiesDefaultValue()))
#else
extern int xmlSubstituteEntitiesDefaultValue;
LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
#endif
#ifdef __cplusplus
......
......@@ -13,7 +13,9 @@
#include <libxml/valid.h>
#include <libxml/xmlIO.h>
#include <libxml/entities.h>
#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L)
#include <pthread.h>
#endif
#ifdef __cplusplus
extern "C" {
......@@ -319,6 +321,7 @@ struct _xmlSAXHandler {
getParameterEntitySAXFunc getParameterEntity;
cdataBlockSAXFunc cdataBlock;
externalSubsetSAXFunc externalSubset;
int initialized;
};
/**
......@@ -571,6 +574,12 @@ xmlParserInputPtr
xmlLoadExternalEntity (const char *URL,
const char *ID,
xmlParserCtxtPtr context);
#include <libxml/globals.h>
/*
* Parser Locking
*/
int xmlLockContext(xmlParserCtxtPtr ctxt);
int xmlUnlockContext(xmlParserCtxtPtr ctxt);
#ifdef __cplusplus
}
......
......@@ -173,19 +173,6 @@ extern "C" {
#define MOVETO_STARTTAG(p) \
while ((*p) && (*(p) != '<')) (p)++
/**
* Global vaiables affecting the default parser behaviour.
*/
LIBXML_DLL_IMPORT extern int xmlParserDebugEntities;
LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
LIBXML_DLL_IMPORT extern int xmlParserDebugEntities;
LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue;
LIBXML_DLL_IMPORT extern int xmlLoadExtDtdDefaultValue;
LIBXML_DLL_IMPORT extern int xmlPedanticParserDefaultValue;
LIBXML_DLL_IMPORT extern int xmlKeepBlanksDefaultValue;
/**
* Global variables used for predefined strings
*/
......
......@@ -25,6 +25,8 @@
extern "C" {
#endif
#define BASE_BUFFER_SIZE 4000
/**
* XML_XML_NAMESPACE:
*
......
......@@ -2,6 +2,7 @@
#define __XML_ERROR_H__
#include <libxml/parser.h>
#ifdef __cplusplus
extern "C" {
#endif
......@@ -144,18 +145,12 @@ typedef enum {
typedef void (*xmlGenericErrorFunc) (void *ctx, const char *msg, ...);
/*
* Those are the default error function and associated context to use
* when when there is an error and no parsing or validity context available
*/
LIBXML_DLL_IMPORT extern xmlGenericErrorFunc xmlGenericError;
LIBXML_DLL_IMPORT extern void *xmlGenericErrorContext;
/*
* Use the following function to reset the two previous global variables.
* Use the following function to reset the two global variables
* xmlGenericError and xmlGenericErrorContext.
*/
void xmlSetGenericErrorFunc (void *ctx,
xmlGenericErrorFunc handler);
void initGenericErrorDefaultFunc(xmlGenericErrorFunc *handler);
/*
* Default message routines used by SAX and Valid context for error
......