1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-25 10:50:08 +03:00

globals: Define globals using macros

Declare and define globals and helper functions by (ab)using the
preprocessor.
This commit is contained in:
Nick Wellnhofer 2023-09-18 21:25:35 +02:00
parent bf6bd16154
commit 39a275a541
4 changed files with 333 additions and 1020 deletions

View File

@ -1,121 +0,0 @@
#!/usr/bin/env python3
###
#
# build_glob.py : Build the global_functions.h and global_functions.c
# files which are required to implement the user
# interface to global variables now that thread specific
# data (TSD) is used to emulate global state.
#
# See Copyright for the status of this software.
# Gary.Pennington@sun.com
###
class globvar:
def __init__(self, type, name):
self.type=type
self.name=name
def striplinesep(line):
while line and line[-1] in ('\r','\n'):
line = line[:-1]
return line
def writeline(file, line=None):
if line:
file.write(line)
file.write("\n")
if __name__ == "__main__":
globals={}
global_data=open("global.data").readlines()
global_code=open("globals.c").readlines()
global_hdr=open("include/libxml/globals.h").readlines()
global_functions_hdr=open("include/libxml/globals.h", "w+")
global_functions_impl=open("globals.c", "w+")
#
# Rebuild the beginning of the file up to the
# Automatically generated string
#
for line in global_hdr:
line = striplinesep(line)
if line == " * Automatically generated by build_glob.py.":
break
writeline(global_functions_hdr, line)
writeline(global_functions_hdr, " * Automatically generated by build_glob.py.")
writeline(global_functions_hdr, " * Do not modify the previous line.")
writeline(global_functions_hdr, " */")
writeline(global_functions_hdr)
for line in global_code:
line = striplinesep(line)
if line == " * Automatically generated by build_glob.py.":
break
writeline(global_functions_impl, line)
writeline(global_functions_impl, " * Automatically generated by build_glob.py.")
writeline(global_functions_impl, " * Do not modify the previous line.")
writeline(global_functions_impl, " */")
writeline(global_functions_impl)
# Now process the data and write it to the appropriate output file
for line in global_data:
if line[0]=='#':
continue
line = striplinesep(line)
fields = line.split(",")
# Update the header file
writeline(global_functions_hdr)
global_functions_hdr.write("XMLPUBFUN "+fields[0]+" *\n\t")
if fields[2]:
global_functions_hdr.write("(*")
global_functions_hdr.write("__"+fields[1]+"(void)")
if fields[2]:
global_functions_hdr.write(")"+fields[2])
writeline(global_functions_hdr,";")
writeline(global_functions_hdr, "#ifdef LIBXML_THREAD_ENABLED")
writeline(global_functions_hdr,"#define "+fields[1]+" \\")
writeline(global_functions_hdr,"(*(__"+fields[1]+"()))")
writeline(global_functions_hdr,"#else")
if fields[2]:
writeline(global_functions_hdr,"XMLPUBVAR "+fields[0]+" "+fields[1]+fields[2]+";")
else:
writeline(global_functions_hdr,"XMLPUBVAR "+fields[0]+" "+fields[1]+";")
writeline(global_functions_hdr,"#endif")
# set/get for per-thread global defaults
if fields[3]:
writeline(global_functions_hdr,"XMLPUBFUN "+fields[0]+" "+fields[1][:3]+"ThrDef"+fields[1][3:]+"("+fields[0]+" v);")
# Update the implementation file
writeline(global_functions_impl)
# writeline(global_functions_impl, "extern "+fields[0]+" "+fields[1]+";")
writeline(global_functions_impl, "#undef\t"+fields[1])
writeline(global_functions_impl, fields[0]+" *")
if fields[2]:
global_functions_impl.write("(*")
global_functions_impl.write("__"+fields[1]+"(void)")
if fields[2]:
writeline(global_functions_impl, ")[]")
writeline(global_functions_impl, " {")
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 (&xmlGetGlobalState()->"+fields[1]+");")
writeline(global_functions_impl, "}")
# set/get for per-thread global defaults
if fields[3]:
writeline(global_functions_impl,fields[0]+" "+fields[1][:3]+"ThrDef"+fields[1][3:]+"("+fields[0]+" v) {")
writeline(global_functions_impl," "+fields[0]+" ret;");
writeline(global_functions_impl," xmlMutexLock(xmlThrDefMutex);")
writeline(global_functions_impl," ret = "+fields[1][:3]+fields[1][3:]+"ThrDef;")
writeline(global_functions_impl," "+fields[1][:3]+fields[1][3:]+"ThrDef = v;")
writeline(global_functions_impl," xmlMutexUnlock(xmlThrDefMutex);")
writeline(global_functions_impl," return ret;")
writeline(global_functions_impl,"}")
# Terminate the header file with appropriate boilerplate
writeline(global_functions_hdr)
writeline(global_functions_hdr, "#ifdef __cplusplus")
writeline(global_functions_hdr, "}")
writeline(global_functions_hdr, "#endif")
writeline(global_functions_hdr)
writeline(global_functions_hdr, "#endif /* __XML_GLOBALS_H */")

View File

@ -1,29 +0,0 @@
#type,name,array?,threadGlobalDefault accessor?
int,oldXMLWDcompatibility,,
xmlBufferAllocationScheme,xmlBufferAllocScheme,,1
int,xmlDefaultBufferSize,,1
xmlSAXHandlerV1,xmlDefaultSAXHandler,,
xmlSAXLocator,xmlDefaultSAXLocator,,
int,xmlDoValidityCheckingDefaultValue,,1
xmlGenericErrorFunc,xmlGenericError,,
xmlStructuredErrorFunc,xmlStructuredError,,
void *,xmlGenericErrorContext,,
void *,xmlStructuredErrorContext,,
int,xmlGetWarningsDefaultValue,,1
int,xmlIndentTreeOutput,,1
const char *,xmlTreeIndentString,,1
int,xmlKeepBlanksDefaultValue,,1
int,xmlLineNumbersDefaultValue,,1
int,xmlLoadExtDtdDefaultValue,,1
int,xmlParserDebugEntities,,1
const char *,xmlParserVersion,,
int,xmlPedanticParserDefaultValue,,1
int,xmlSaveNoEmptyTags,,1
#const xmlChar,xmlStringComment,[],1
#const xmlChar,xmlStringText,[],1
#const xmlChar,xmlStringTextNoenc,[],1
int,xmlSubstituteEntitiesDefaultValue,,1
xmlRegisterNodeFunc,xmlRegisterNodeDefaultValue,,
xmlDeregisterNodeFunc,xmlDeregisterNodeDefaultValue,,
xmlParserInputBufferCreateFilenameFunc,xmlParserInputBufferCreateFilenameValue,,
xmlOutputBufferCreateFilenameFunc,xmlOutputBufferCreateFilenameValue,,

714
globals.c
View File

@ -2,9 +2,6 @@
* globals.c: definition and handling of the set of global variables
* of the library
*
* The bottom of this file is automatically generated by build_glob.py
* based on the description file global.data
*
* See Copyright for the status of this software.
*
* Gary Pennington <Gary.Pennington@uk.sun.com>
@ -17,9 +14,11 @@
#include <stdlib.h>
#include <string.h>
#define XML_GLOBALS_NO_REDEFINITION
#include <libxml/globals.h>
#include <libxml/xmlmemory.h>
#include <libxml/threads.h>
#include <libxml/SAX.h>
#include "private/error.h"
#include "private/globals.h"
@ -40,54 +39,13 @@
*/
static xmlMutex xmlThrDefMutex;
#define XML_DECLARE_MEMBER(name, type, attrs) \
type gs_##name;
struct _xmlGlobalState {
const char *gsParserVersion;
xmlSAXLocator gsDefaultSAXLocator;
#ifdef LIBXML_SAX1_ENABLED
xmlSAXHandlerV1 gsDefaultSAXHandler;
#ifdef LIBXML_HTML_ENABLED
xmlSAXHandlerV1 gsHtmlDefaultSAXHandler;
#endif
#endif
xmlFreeFunc gsFree;
xmlMallocFunc gsMalloc;
xmlStrdupFunc gsMemStrdup;
xmlReallocFunc gsRealloc;
xmlGenericErrorFunc gsGenericError;
xmlStructuredErrorFunc gsStructuredError;
void *gsGenericErrorContext;
int gsOldXMLWDcompatibility;
xmlBufferAllocationScheme gsBufferAllocScheme;
int gsDefaultBufferSize;
int gsSubstituteEntitiesDefaultValue;
int gsDoValidityCheckingDefaultValue;
int gsGetWarningsDefaultValue;
int gsKeepBlanksDefaultValue;
int gsLineNumbersDefaultValue;
int gsLoadExtDtdDefaultValue;
int gsParserDebugEntities;
int gsPedanticParserDefaultValue;
int gsSaveNoEmptyTags;
int gsIndentTreeOutput;
const char *gsTreeIndentString;
xmlRegisterNodeFunc gsRegisterNodeDefaultValue;
xmlDeregisterNodeFunc gsDeregisterNodeDefaultValue;
xmlMallocFunc gsMallocAtomic;
xmlError gsLastError;
xmlParserInputBufferCreateFilenameFunc gsParserInputBufferCreateFilenameValue;
xmlOutputBufferCreateFilenameFunc gsOutputBufferCreateFilenameValue;
void *gsStructuredErrorContext;
#define XML_OP XML_DECLARE_MEMBER
XML_GLOBALS
#undef XML_OP
};
#ifdef LIBXML_THREAD_ENABLED
@ -168,11 +126,6 @@ static CRITICAL_SECTION cleanup_helpers_cs;
/*
* Memory allocation routines
*/
#undef xmlFree
#undef xmlMalloc
#undef xmlMallocAtomic
#undef xmlMemStrdup
#undef xmlRealloc
#if defined(DEBUG_MEMORY_LOCATION)
xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
@ -241,38 +194,6 @@ xmlPosixStrdup(const char *cur) {
xmlStrdupFunc xmlMemStrdup = xmlPosixStrdup;
#endif /* DEBUG_MEMORY_LOCATION */
#include <libxml/threads.h>
#include <libxml/globals.h>
#include <libxml/SAX.h>
#undef htmlDefaultSAXHandler
#undef oldXMLWDcompatibility
#undef xmlBufferAllocScheme
#undef xmlDefaultBufferSize
#undef xmlDefaultSAXHandler
#undef xmlDefaultSAXLocator
#undef xmlDoValidityCheckingDefaultValue
#undef xmlGenericError
#undef xmlStructuredError
#undef xmlGenericErrorContext
#undef xmlStructuredErrorContext
#undef xmlGetWarningsDefaultValue
#undef xmlIndentTreeOutput
#undef xmlTreeIndentString
#undef xmlKeepBlanksDefaultValue
#undef xmlLineNumbersDefaultValue
#undef xmlLoadExtDtdDefaultValue
#undef xmlParserDebugEntities
#undef xmlParserVersion
#undef xmlPedanticParserDefaultValue
#undef xmlSaveNoEmptyTags
#undef xmlSubstituteEntitiesDefaultValue
#undef xmlRegisterNodeDefaultValue
#undef xmlDeregisterNodeDefaultValue
#undef xmlLastError
#undef xmlParserInputBufferCreateFilenameValue
#undef xmlOutputBufferCreateFilenameValue
/**
* xmlParserVersion:
*
@ -706,57 +627,53 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
xmlMutexLock(&xmlThrDefMutex);
#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
inithtmlDefaultSAXHandler(&gs->gsHtmlDefaultSAXHandler);
inithtmlDefaultSAXHandler(&gs->gs_htmlDefaultSAXHandler);
#endif
gs->gsOldXMLWDcompatibility = 0;
gs->gsBufferAllocScheme = xmlBufferAllocSchemeThrDef;
gs->gsDefaultBufferSize = xmlDefaultBufferSizeThrDef;
gs->gs_oldXMLWDcompatibility = 0;
gs->gs_xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
gs->gs_xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;
#if defined(LIBXML_SAX1_ENABLED) && defined(LIBXML_LEGACY_ENABLED)
initxmlDefaultSAXHandler(&gs->gsDefaultSAXHandler, 1);
initxmlDefaultSAXHandler(&gs->gs_xmlDefaultSAXHandler, 1);
#endif /* LIBXML_SAX1_ENABLED */
gs->gsDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId;
gs->gsDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
gs->gsDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
gs->gsDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
gs->gsDoValidityCheckingDefaultValue =
gs->gs_xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId;
gs->gs_xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
gs->gs_xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
gs->gs_xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
gs->gs_xmlDoValidityCheckingDefaultValue =
xmlDoValidityCheckingDefaultValueThrDef;
#if defined(DEBUG_MEMORY_LOCATION)
gs->gsFree = (xmlFreeFunc) xmlMemFree;
gs->gsMalloc = (xmlMallocFunc) xmlMemMalloc;
gs->gsMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
gs->gsRealloc = (xmlReallocFunc) xmlMemRealloc;
gs->gsMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
#else
gs->gsFree = (xmlFreeFunc) free;
gs->gsMalloc = (xmlMallocFunc) malloc;
gs->gsMallocAtomic = (xmlMallocFunc) malloc;
gs->gsRealloc = (xmlReallocFunc) realloc;
gs->gsMemStrdup = (xmlStrdupFunc) xmlStrdup;
gs->gs_xmlFree = (xmlFreeFunc) xmlMemFree;
gs->gs_xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
gs->gs_xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
gs->gs_xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
gs->gs_xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
#endif
gs->gsGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
gs->gsIndentTreeOutput = xmlIndentTreeOutputThrDef;
gs->gsTreeIndentString = xmlTreeIndentStringThrDef;
gs->gsKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
gs->gsLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
gs->gsLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
gs->gsParserDebugEntities = xmlParserDebugEntitiesThrDef;
gs->gsParserVersion = LIBXML_VERSION_STRING;
gs->gsPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
gs->gsSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
gs->gsSubstituteEntitiesDefaultValue =
gs->gs_xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
gs->gs_xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
gs->gs_xmlTreeIndentString = xmlTreeIndentStringThrDef;
gs->gs_xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
gs->gs_xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
gs->gs_xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
gs->gs_xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
gs->gs_xmlParserVersion = LIBXML_VERSION_STRING;
gs->gs_xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
gs->gs_xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
gs->gs_xmlSubstituteEntitiesDefaultValue =
xmlSubstituteEntitiesDefaultValueThrDef;
gs->gsGenericError = xmlGenericErrorThrDef;
gs->gsStructuredError = xmlStructuredErrorThrDef;
gs->gsGenericErrorContext = xmlGenericErrorContextThrDef;
gs->gsStructuredErrorContext = xmlStructuredErrorContextThrDef;
gs->gsRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
gs->gsDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
gs->gs_xmlGenericError = xmlGenericErrorThrDef;
gs->gs_xmlStructuredError = xmlStructuredErrorThrDef;
gs->gs_xmlGenericErrorContext = xmlGenericErrorContextThrDef;
gs->gs_xmlStructuredErrorContext = xmlStructuredErrorContextThrDef;
gs->gs_xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
gs->gs_xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
gs->gsParserInputBufferCreateFilenameValue = xmlParserInputBufferCreateFilenameValueThrDef;
gs->gsOutputBufferCreateFilenameValue = xmlOutputBufferCreateFilenameValueThrDef;
memset(&gs->gsLastError, 0, sizeof(xmlError));
gs->gs_xmlParserInputBufferCreateFilenameValue =
xmlParserInputBufferCreateFilenameValueThrDef;
gs->gs_xmlOutputBufferCreateFilenameValue =
xmlOutputBufferCreateFilenameValueThrDef;
memset(&gs->gs_xmlLastError, 0, sizeof(xmlError));
xmlMutexUnlock(&xmlThrDefMutex);
}
@ -775,7 +692,7 @@ xmlFreeGlobalState(void *state)
xmlGlobalState *gs = (xmlGlobalState *) state;
/* free any memory allocated in the thread's xmlLastError */
xmlResetError(&(gs->gsLastError));
xmlResetError(&(gs->gs_xmlLastError));
free(state);
}
@ -995,6 +912,123 @@ xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
xmlMutexUnlock(&xmlThrDefMutex);
}
xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
xmlBufferAllocationScheme ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlBufferAllocSchemeThrDef;
xmlBufferAllocSchemeThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
int xmlThrDefDefaultBufferSize(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlDefaultBufferSizeThrDef;
xmlDefaultBufferSizeThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
int xmlThrDefDoValidityCheckingDefaultValue(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlDoValidityCheckingDefaultValueThrDef;
xmlDoValidityCheckingDefaultValueThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
int xmlThrDefGetWarningsDefaultValue(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlGetWarningsDefaultValueThrDef;
xmlGetWarningsDefaultValueThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
int xmlThrDefIndentTreeOutput(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlIndentTreeOutputThrDef;
xmlIndentTreeOutputThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
const char * xmlThrDefTreeIndentString(const char * v) {
const char * ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlTreeIndentStringThrDef;
xmlTreeIndentStringThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
int xmlThrDefKeepBlanksDefaultValue(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlKeepBlanksDefaultValueThrDef;
xmlKeepBlanksDefaultValueThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
int xmlThrDefLineNumbersDefaultValue(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlLineNumbersDefaultValueThrDef;
xmlLineNumbersDefaultValueThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
int xmlThrDefLoadExtDtdDefaultValue(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlLoadExtDtdDefaultValueThrDef;
xmlLoadExtDtdDefaultValueThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
int xmlThrDefParserDebugEntities(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlParserDebugEntitiesThrDef;
xmlParserDebugEntitiesThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
int xmlThrDefPedanticParserDefaultValue(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlPedanticParserDefaultValueThrDef;
xmlPedanticParserDefaultValueThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
int xmlThrDefSaveNoEmptyTags(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlSaveNoEmptyTagsThrDef;
xmlSaveNoEmptyTagsThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlSubstituteEntitiesDefaultValueThrDef;
xmlSubstituteEntitiesDefaultValueThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
/**
* xmlRegisterNodeDefault:
* @func: function pointer to the new RegisterNodeFunc
@ -1096,413 +1130,19 @@ xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc fun
return(old);
}
#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_SAX1_ENABLED)
#undef htmlDefaultSAXHandler
xmlSAXHandlerV1 *
__htmlDefaultSAXHandler(void) {
if (IS_MAIN_THREAD)
return (&htmlDefaultSAXHandler);
else
return (&xmlGetGlobalState()->gsHtmlDefaultSAXHandler);
}
/* Define thread-local storage accessors with macro magic */
#ifdef LIBXML_THREAD_ENABLED
#define XML_DEFINE_GLOBAL_WRAPPER(name, type, attrs) \
type *__##name(void) { \
if (IS_MAIN_THREAD) \
return (&name); \
else \
return (&xmlGetGlobalState()->gs_##name); \
}
#define XML_OP XML_DEFINE_GLOBAL_WRAPPER
XML_GLOBALS
#undef XML_OP
#endif
#undef xmlLastError
xmlError *
__xmlLastError(void) {
if (IS_MAIN_THREAD)
return (&xmlLastError);
else
return (&xmlGetGlobalState()->gsLastError);
}
/*
* The following memory routines were apparently lost at some point,
* and were re-inserted at this point on June 10, 2004. Hope it's
* the right place for them :-)
*/
#if defined(LIBXML_THREAD_ALLOC_ENABLED) && defined(LIBXML_THREAD_ENABLED)
#undef xmlMalloc
xmlMallocFunc *
__xmlMalloc(void){
if (IS_MAIN_THREAD)
return (&xmlMalloc);
else
return (&xmlGetGlobalState()->gsMalloc);
}
#undef xmlMallocAtomic
xmlMallocFunc *
__xmlMallocAtomic(void){
if (IS_MAIN_THREAD)
return (&xmlMallocAtomic);
else
return (&xmlGetGlobalState()->gsMallocAtomic);
}
#undef xmlRealloc
xmlReallocFunc *
__xmlRealloc(void){
if (IS_MAIN_THREAD)
return (&xmlRealloc);
else
return (&xmlGetGlobalState()->gsRealloc);
}
#undef xmlFree
xmlFreeFunc *
__xmlFree(void){
if (IS_MAIN_THREAD)
return (&xmlFree);
else
return (&xmlGetGlobalState()->gsFree);
}
xmlStrdupFunc *
__xmlMemStrdup(void){
if (IS_MAIN_THREAD)
return (&xmlMemStrdup);
else
return (&xmlGetGlobalState()->gsMemStrdup);
}
#endif
/*
* Everything starting from the line below is
* Automatically generated by build_glob.py.
* Do not modify the previous line.
*/
#undef oldXMLWDcompatibility
int *
__oldXMLWDcompatibility(void) {
if (IS_MAIN_THREAD)
return (&oldXMLWDcompatibility);
else
return (&xmlGetGlobalState()->gsOldXMLWDcompatibility);
}
#undef xmlBufferAllocScheme
xmlBufferAllocationScheme *
__xmlBufferAllocScheme(void) {
if (IS_MAIN_THREAD)
return (&xmlBufferAllocScheme);
else
return (&xmlGetGlobalState()->gsBufferAllocScheme);
}
xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
xmlBufferAllocationScheme ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlBufferAllocSchemeThrDef;
xmlBufferAllocSchemeThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
#undef xmlDefaultBufferSize
int *
__xmlDefaultBufferSize(void) {
if (IS_MAIN_THREAD)
return (&xmlDefaultBufferSize);
else
return (&xmlGetGlobalState()->gsDefaultBufferSize);
}
int xmlThrDefDefaultBufferSize(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlDefaultBufferSizeThrDef;
xmlDefaultBufferSizeThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
#ifdef LIBXML_SAX1_ENABLED
#undef xmlDefaultSAXHandler
xmlSAXHandlerV1 *
__xmlDefaultSAXHandler(void) {
if (IS_MAIN_THREAD)
return (&xmlDefaultSAXHandler);
else
return (&xmlGetGlobalState()->gsDefaultSAXHandler);
}
#endif /* LIBXML_SAX1_ENABLED */
#undef xmlDefaultSAXLocator
xmlSAXLocator *
__xmlDefaultSAXLocator(void) {
if (IS_MAIN_THREAD)
return (&xmlDefaultSAXLocator);
else
return (&xmlGetGlobalState()->gsDefaultSAXLocator);
}
#undef xmlDoValidityCheckingDefaultValue
int *
__xmlDoValidityCheckingDefaultValue(void) {
if (IS_MAIN_THREAD)
return (&xmlDoValidityCheckingDefaultValue);
else
return (&xmlGetGlobalState()->gsDoValidityCheckingDefaultValue);
}
int xmlThrDefDoValidityCheckingDefaultValue(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlDoValidityCheckingDefaultValueThrDef;
xmlDoValidityCheckingDefaultValueThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
#undef xmlGenericError
xmlGenericErrorFunc *
__xmlGenericError(void) {
if (IS_MAIN_THREAD)
return (&xmlGenericError);
else
return (&xmlGetGlobalState()->gsGenericError);
}
#undef xmlStructuredError
xmlStructuredErrorFunc *
__xmlStructuredError(void) {
if (IS_MAIN_THREAD)
return (&xmlStructuredError);
else
return (&xmlGetGlobalState()->gsStructuredError);
}
#undef xmlGenericErrorContext
void * *
__xmlGenericErrorContext(void) {
if (IS_MAIN_THREAD)
return (&xmlGenericErrorContext);
else
return (&xmlGetGlobalState()->gsGenericErrorContext);
}
#undef xmlStructuredErrorContext
void * *
__xmlStructuredErrorContext(void) {
if (IS_MAIN_THREAD)
return (&xmlStructuredErrorContext);
else
return (&xmlGetGlobalState()->gsStructuredErrorContext);
}
#undef xmlGetWarningsDefaultValue
int *
__xmlGetWarningsDefaultValue(void) {
if (IS_MAIN_THREAD)
return (&xmlGetWarningsDefaultValue);
else
return (&xmlGetGlobalState()->gsGetWarningsDefaultValue);
}
int xmlThrDefGetWarningsDefaultValue(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlGetWarningsDefaultValueThrDef;
xmlGetWarningsDefaultValueThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
#undef xmlIndentTreeOutput
int *
__xmlIndentTreeOutput(void) {
if (IS_MAIN_THREAD)
return (&xmlIndentTreeOutput);
else
return (&xmlGetGlobalState()->gsIndentTreeOutput);
}
int xmlThrDefIndentTreeOutput(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlIndentTreeOutputThrDef;
xmlIndentTreeOutputThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
#undef xmlTreeIndentString
const char * *
__xmlTreeIndentString(void) {
if (IS_MAIN_THREAD)
return (&xmlTreeIndentString);
else
return (&xmlGetGlobalState()->gsTreeIndentString);
}
const char * xmlThrDefTreeIndentString(const char * v) {
const char * ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlTreeIndentStringThrDef;
xmlTreeIndentStringThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
#undef xmlKeepBlanksDefaultValue
int *
__xmlKeepBlanksDefaultValue(void) {
if (IS_MAIN_THREAD)
return (&xmlKeepBlanksDefaultValue);
else
return (&xmlGetGlobalState()->gsKeepBlanksDefaultValue);
}
int xmlThrDefKeepBlanksDefaultValue(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlKeepBlanksDefaultValueThrDef;
xmlKeepBlanksDefaultValueThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
#undef xmlLineNumbersDefaultValue
int *
__xmlLineNumbersDefaultValue(void) {
if (IS_MAIN_THREAD)
return (&xmlLineNumbersDefaultValue);
else
return (&xmlGetGlobalState()->gsLineNumbersDefaultValue);
}
int xmlThrDefLineNumbersDefaultValue(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlLineNumbersDefaultValueThrDef;
xmlLineNumbersDefaultValueThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
#undef xmlLoadExtDtdDefaultValue
int *
__xmlLoadExtDtdDefaultValue(void) {
if (IS_MAIN_THREAD)
return (&xmlLoadExtDtdDefaultValue);
else
return (&xmlGetGlobalState()->gsLoadExtDtdDefaultValue);
}
int xmlThrDefLoadExtDtdDefaultValue(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlLoadExtDtdDefaultValueThrDef;
xmlLoadExtDtdDefaultValueThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
#undef xmlParserDebugEntities
int *
__xmlParserDebugEntities(void) {
if (IS_MAIN_THREAD)
return (&xmlParserDebugEntities);
else
return (&xmlGetGlobalState()->gsParserDebugEntities);
}
int xmlThrDefParserDebugEntities(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlParserDebugEntitiesThrDef;
xmlParserDebugEntitiesThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
#undef xmlParserVersion
const char * *
__xmlParserVersion(void) {
if (IS_MAIN_THREAD)
return (&xmlParserVersion);
else
return (&xmlGetGlobalState()->gsParserVersion);
}
#undef xmlPedanticParserDefaultValue
int *
__xmlPedanticParserDefaultValue(void) {
if (IS_MAIN_THREAD)
return (&xmlPedanticParserDefaultValue);
else
return (&xmlGetGlobalState()->gsPedanticParserDefaultValue);
}
int xmlThrDefPedanticParserDefaultValue(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlPedanticParserDefaultValueThrDef;
xmlPedanticParserDefaultValueThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
#undef xmlSaveNoEmptyTags
int *
__xmlSaveNoEmptyTags(void) {
if (IS_MAIN_THREAD)
return (&xmlSaveNoEmptyTags);
else
return (&xmlGetGlobalState()->gsSaveNoEmptyTags);
}
int xmlThrDefSaveNoEmptyTags(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlSaveNoEmptyTagsThrDef;
xmlSaveNoEmptyTagsThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
#undef xmlSubstituteEntitiesDefaultValue
int *
__xmlSubstituteEntitiesDefaultValue(void) {
if (IS_MAIN_THREAD)
return (&xmlSubstituteEntitiesDefaultValue);
else
return (&xmlGetGlobalState()->gsSubstituteEntitiesDefaultValue);
}
int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
int ret;
xmlMutexLock(&xmlThrDefMutex);
ret = xmlSubstituteEntitiesDefaultValueThrDef;
xmlSubstituteEntitiesDefaultValueThrDef = v;
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
#undef xmlRegisterNodeDefaultValue
xmlRegisterNodeFunc *
__xmlRegisterNodeDefaultValue(void) {
if (IS_MAIN_THREAD)
return (&xmlRegisterNodeDefaultValue);
else
return (&xmlGetGlobalState()->gsRegisterNodeDefaultValue);
}
#undef xmlDeregisterNodeDefaultValue
xmlDeregisterNodeFunc *
__xmlDeregisterNodeDefaultValue(void) {
if (IS_MAIN_THREAD)
return (&xmlDeregisterNodeDefaultValue);
else
return (&xmlGetGlobalState()->gsDeregisterNodeDefaultValue);
}
#undef xmlParserInputBufferCreateFilenameValue
xmlParserInputBufferCreateFilenameFunc *
__xmlParserInputBufferCreateFilenameValue(void) {
if (IS_MAIN_THREAD)
return (&xmlParserInputBufferCreateFilenameValue);
else
return (&xmlGetGlobalState()->gsParserInputBufferCreateFilenameValue);
}
#undef xmlOutputBufferCreateFilenameValue
xmlOutputBufferCreateFilenameFunc *
__xmlOutputBufferCreateFilenameValue(void) {
if (IS_MAIN_THREAD)
return (&xmlOutputBufferCreateFilenameValue);
else
return (&xmlGetGlobalState()->gsOutputBufferCreateFilenameValue);
}

View File

@ -3,9 +3,6 @@
* Description: all the global variables and thread handling for
* those variables is handled by this module.
*
* The bottom of this file is automatically generated by build_glob.py
* based on the description file global.data
*
* Copy: See Copyright for the status of this software.
*
* Author: Gary Pennington <Gary.Pennington@uk.sun.com>, Daniel Veillard
@ -93,6 +90,25 @@ XMLPUBFUN void xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handl
XMLPUBFUN void xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler);
XML_DEPRECATED
XMLPUBFUN xmlBufferAllocationScheme
xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v);
XML_DEPRECATED
XMLPUBFUN int xmlThrDefDefaultBufferSize(int v);
XMLPUBFUN int xmlThrDefDoValidityCheckingDefaultValue(int v);
XMLPUBFUN int xmlThrDefGetWarningsDefaultValue(int v);
XMLPUBFUN int xmlThrDefIndentTreeOutput(int v);
XMLPUBFUN const char * xmlThrDefTreeIndentString(const char * v);
XMLPUBFUN int xmlThrDefKeepBlanksDefaultValue(int v);
XML_DEPRECATED
XMLPUBFUN int xmlThrDefLineNumbersDefaultValue(int v);
XMLPUBFUN int xmlThrDefLoadExtDtdDefaultValue(int v);
XMLPUBFUN int xmlThrDefParserDebugEntities(int v);
XML_DEPRECATED
XMLPUBFUN int xmlThrDefPedanticParserDefaultValue(int v);
XMLPUBFUN int xmlThrDefSaveNoEmptyTags(int v);
XMLPUBFUN int xmlThrDefSubstituteEntitiesDefaultValue(int v);
XMLPUBFUN xmlRegisterNodeFunc xmlRegisterNodeDefault(xmlRegisterNodeFunc func);
XMLPUBFUN xmlRegisterNodeFunc xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func);
XMLPUBFUN xmlDeregisterNodeFunc xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func);
@ -104,336 +120,6 @@ XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
xmlThrDefParserInputBufferCreateFilenameDefault(
xmlParserInputBufferCreateFilenameFunc func);
/*
* In general the memory allocation entry points are not kept
* thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED
* - xmlMalloc
* - xmlMallocAtomic
* - xmlRealloc
* - xmlMemStrdup
* - xmlFree
*/
#ifdef LIBXML_THREAD_ALLOC_ENABLED
/** DOC_DISABLE */
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlMallocFunc * __xmlMalloc(void);
#define xmlMalloc \
(*(__xmlMalloc()))
#else
XMLPUBVAR xmlMallocFunc xmlMalloc;
#endif
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlMallocFunc * __xmlMallocAtomic(void);
#define xmlMallocAtomic \
(*(__xmlMallocAtomic()))
#else
XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
#endif
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlReallocFunc * __xmlRealloc(void);
#define xmlRealloc \
(*(__xmlRealloc()))
#else
XMLPUBVAR xmlReallocFunc xmlRealloc;
#endif
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlFreeFunc * __xmlFree(void);
#define xmlFree \
(*(__xmlFree()))
#else
XMLPUBVAR xmlFreeFunc xmlFree;
#endif
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlStrdupFunc * __xmlMemStrdup(void);
#define xmlMemStrdup \
(*(__xmlMemStrdup()))
#else
XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
#endif
/** DOC_ENABLE */
#else /* !LIBXML_THREAD_ALLOC_ENABLED */
XMLPUBVAR xmlMallocFunc xmlMalloc;
XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
XMLPUBVAR xmlReallocFunc xmlRealloc;
XMLPUBVAR xmlFreeFunc xmlFree;
XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
#endif /* LIBXML_THREAD_ALLOC_ENABLED */
#ifdef LIBXML_HTML_ENABLED
XML_DEPRECATED
XMLPUBFUN xmlSAXHandlerV1 * __htmlDefaultSAXHandler(void);
#ifdef LIBXML_THREAD_ENABLED
#define htmlDefaultSAXHandler \
(*(__htmlDefaultSAXHandler()))
#else
XML_DEPRECATED
XMLPUBVAR xmlSAXHandlerV1 htmlDefaultSAXHandler;
#endif
#endif
XMLPUBFUN xmlError * __xmlLastError(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlLastError \
(*(__xmlLastError()))
#else
XMLPUBVAR xmlError xmlLastError;
#endif
/*
* Everything starting from the line below is
* Automatically generated by build_glob.py.
* Do not modify the previous line.
*/
XML_DEPRECATED
XMLPUBFUN int * __oldXMLWDcompatibility(void);
#ifdef LIBXML_THREAD_ENABLED
#define oldXMLWDcompatibility \
(*(__oldXMLWDcompatibility()))
#else
XML_DEPRECATED
XMLPUBVAR int oldXMLWDcompatibility;
#endif
XML_DEPRECATED
XMLPUBFUN xmlBufferAllocationScheme * __xmlBufferAllocScheme(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlBufferAllocScheme \
(*(__xmlBufferAllocScheme()))
#else
XML_DEPRECATED
XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme;
#endif
XML_DEPRECATED
XMLPUBFUN xmlBufferAllocationScheme
xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v);
XML_DEPRECATED
XMLPUBFUN int * __xmlDefaultBufferSize(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDefaultBufferSize \
(*(__xmlDefaultBufferSize()))
#else
XML_DEPRECATED
XMLPUBVAR int xmlDefaultBufferSize;
#endif
XML_DEPRECATED
XMLPUBFUN int xmlThrDefDefaultBufferSize(int v);
XML_DEPRECATED
XMLPUBFUN xmlSAXHandlerV1 * __xmlDefaultSAXHandler(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDefaultSAXHandler \
(*(__xmlDefaultSAXHandler()))
#else
XML_DEPRECATED
XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler;
#endif
XML_DEPRECATED
XMLPUBFUN xmlSAXLocator * __xmlDefaultSAXLocator(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDefaultSAXLocator \
(*(__xmlDefaultSAXLocator()))
#else
XML_DEPRECATED
XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator;
#endif
XMLPUBFUN int * __xmlDoValidityCheckingDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDoValidityCheckingDefaultValue \
(*(__xmlDoValidityCheckingDefaultValue()))
#else
XMLPUBVAR int xmlDoValidityCheckingDefaultValue;
#endif
XMLPUBFUN int xmlThrDefDoValidityCheckingDefaultValue(int v);
XMLPUBFUN xmlGenericErrorFunc * __xmlGenericError(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlGenericError \
(*(__xmlGenericError()))
#else
XMLPUBVAR xmlGenericErrorFunc xmlGenericError;
#endif
XMLPUBFUN xmlStructuredErrorFunc * __xmlStructuredError(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlStructuredError \
(*(__xmlStructuredError()))
#else
XMLPUBVAR xmlStructuredErrorFunc xmlStructuredError;
#endif
XMLPUBFUN void * * __xmlGenericErrorContext(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlGenericErrorContext \
(*(__xmlGenericErrorContext()))
#else
XMLPUBVAR void * xmlGenericErrorContext;
#endif
XMLPUBFUN void * * __xmlStructuredErrorContext(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlStructuredErrorContext \
(*(__xmlStructuredErrorContext()))
#else
XMLPUBVAR void * xmlStructuredErrorContext;
#endif
XMLPUBFUN int * __xmlGetWarningsDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlGetWarningsDefaultValue \
(*(__xmlGetWarningsDefaultValue()))
#else
XMLPUBVAR int xmlGetWarningsDefaultValue;
#endif
XMLPUBFUN int xmlThrDefGetWarningsDefaultValue(int v);
XMLPUBFUN int * __xmlIndentTreeOutput(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlIndentTreeOutput \
(*(__xmlIndentTreeOutput()))
#else
XMLPUBVAR int xmlIndentTreeOutput;
#endif
XMLPUBFUN int xmlThrDefIndentTreeOutput(int v);
XMLPUBFUN const char * * __xmlTreeIndentString(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlTreeIndentString \
(*(__xmlTreeIndentString()))
#else
XMLPUBVAR const char * xmlTreeIndentString;
#endif
XMLPUBFUN const char * xmlThrDefTreeIndentString(const char * v);
XMLPUBFUN int * __xmlKeepBlanksDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlKeepBlanksDefaultValue \
(*(__xmlKeepBlanksDefaultValue()))
#else
XMLPUBVAR int xmlKeepBlanksDefaultValue;
#endif
XMLPUBFUN int xmlThrDefKeepBlanksDefaultValue(int v);
XML_DEPRECATED
XMLPUBFUN int * __xmlLineNumbersDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlLineNumbersDefaultValue \
(*(__xmlLineNumbersDefaultValue()))
#else
XML_DEPRECATED
XMLPUBVAR int xmlLineNumbersDefaultValue;
#endif
XML_DEPRECATED
XMLPUBFUN int xmlThrDefLineNumbersDefaultValue(int v);
XMLPUBFUN int * __xmlLoadExtDtdDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlLoadExtDtdDefaultValue \
(*(__xmlLoadExtDtdDefaultValue()))
#else
XMLPUBVAR int xmlLoadExtDtdDefaultValue;
#endif
XMLPUBFUN int xmlThrDefLoadExtDtdDefaultValue(int v);
XMLPUBFUN int * __xmlParserDebugEntities(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlParserDebugEntities \
(*(__xmlParserDebugEntities()))
#else
XMLPUBVAR int xmlParserDebugEntities;
#endif
XMLPUBFUN int xmlThrDefParserDebugEntities(int v);
XMLPUBFUN const char * * __xmlParserVersion(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlParserVersion \
(*(__xmlParserVersion()))
#else
XMLPUBVAR const char * xmlParserVersion;
#endif
XML_DEPRECATED
XMLPUBFUN int * __xmlPedanticParserDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlPedanticParserDefaultValue \
(*(__xmlPedanticParserDefaultValue()))
#else
XML_DEPRECATED
XMLPUBVAR int xmlPedanticParserDefaultValue;
#endif
XML_DEPRECATED
XMLPUBFUN int xmlThrDefPedanticParserDefaultValue(int v);
XMLPUBFUN int * __xmlSaveNoEmptyTags(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlSaveNoEmptyTags \
(*(__xmlSaveNoEmptyTags()))
#else
XMLPUBVAR int xmlSaveNoEmptyTags;
#endif
XMLPUBFUN int xmlThrDefSaveNoEmptyTags(int v);
XMLPUBFUN int * __xmlSubstituteEntitiesDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlSubstituteEntitiesDefaultValue \
(*(__xmlSubstituteEntitiesDefaultValue()))
#else
XMLPUBVAR int xmlSubstituteEntitiesDefaultValue;
#endif
XMLPUBFUN int xmlThrDefSubstituteEntitiesDefaultValue(int v);
XML_DEPRECATED
XMLPUBFUN xmlRegisterNodeFunc * __xmlRegisterNodeDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlRegisterNodeDefaultValue \
(*(__xmlRegisterNodeDefaultValue()))
#else
XML_DEPRECATED
XMLPUBVAR xmlRegisterNodeFunc xmlRegisterNodeDefaultValue;
#endif
XML_DEPRECATED
XMLPUBFUN xmlDeregisterNodeFunc * __xmlDeregisterNodeDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDeregisterNodeDefaultValue \
(*(__xmlDeregisterNodeDefaultValue()))
#else
XML_DEPRECATED
XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
#endif
XML_DEPRECATED
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * \
__xmlParserInputBufferCreateFilenameValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlParserInputBufferCreateFilenameValue \
(*(__xmlParserInputBufferCreateFilenameValue()))
#else
XML_DEPRECATED
XMLPUBVAR xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue;
#endif
XML_DEPRECATED
XMLPUBFUN xmlOutputBufferCreateFilenameFunc * __xmlOutputBufferCreateFilenameValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlOutputBufferCreateFilenameValue \
(*(__xmlOutputBufferCreateFilenameValue()))
#else
XML_DEPRECATED
XMLPUBVAR xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue;
#endif
/** DOC_DISABLE */
#if defined(LIBXML_THREAD_ENABLED) && defined(_WIN32) && \
!defined(HAVE_COMPILER_TLS) && defined(LIBXML_STATIC_FOR_DLL)
@ -443,6 +129,143 @@ xmlDllMain(void *hinstDLL, unsigned long fdwReason,
#endif
/** DOC_ENABLE */
/* Declare globals with macro magic */
#define XML_EMPTY
#define XML_GLOBALS_CORE \
XML_OP(xmlLastError, xmlError, XML_EMPTY) \
XML_OP(oldXMLWDcompatibility, int, XML_DEPRECATED) \
XML_OP(xmlBufferAllocScheme, xmlBufferAllocationScheme, XML_DEPRECATED) \
XML_OP(xmlDefaultBufferSize, int, XML_DEPRECATED) \
XML_OP(xmlDefaultSAXHandler, xmlSAXHandlerV1, XML_DEPRECATED) \
XML_OP(xmlDefaultSAXLocator, xmlSAXLocator, XML_DEPRECATED) \
XML_OP(xmlDoValidityCheckingDefaultValue, int, XML_EMPTY) \
XML_OP(xmlGenericError, xmlGenericErrorFunc, XML_EMPTY) \
XML_OP(xmlStructuredError, xmlStructuredErrorFunc, XML_EMPTY) \
XML_OP(xmlGenericErrorContext, void *, XML_EMPTY) \
XML_OP(xmlStructuredErrorContext, void *, XML_EMPTY) \
XML_OP(xmlGetWarningsDefaultValue, int, XML_EMPTY) \
XML_OP(xmlIndentTreeOutput, int, XML_EMPTY) \
XML_OP(xmlTreeIndentString, const char *, XML_EMPTY) \
XML_OP(xmlKeepBlanksDefaultValue, int, XML_EMPTY) \
XML_OP(xmlLineNumbersDefaultValue, int, XML_DEPRECATED) \
XML_OP(xmlLoadExtDtdDefaultValue, int, XML_EMPTY) \
XML_OP(xmlParserDebugEntities, int, XML_EMPTY) \
XML_OP(xmlParserVersion, const char *, XML_EMPTY) \
XML_OP(xmlPedanticParserDefaultValue, int, XML_DEPRECATED) \
XML_OP(xmlSaveNoEmptyTags, int, XML_EMPTY) \
XML_OP(xmlSubstituteEntitiesDefaultValue, int, XML_EMPTY) \
XML_OP(xmlRegisterNodeDefaultValue, xmlRegisterNodeFunc, XML_DEPRECATED) \
XML_OP(xmlDeregisterNodeDefaultValue, xmlDeregisterNodeFunc, \
XML_DEPRECATED) \
XML_OP(xmlParserInputBufferCreateFilenameValue, \
xmlParserInputBufferCreateFilenameFunc, XML_DEPRECATED) \
XML_OP(xmlOutputBufferCreateFilenameValue, \
xmlOutputBufferCreateFilenameFunc, XML_DEPRECATED)
#ifdef LIBXML_HTML_ENABLED
#define XML_GLOBALS_HTML \
XML_OP(htmlDefaultSAXHandler, xmlSAXHandlerV1, XML_DEPRECATED)
#else
#define XML_GLOBALS_HTML
#endif
/*
* In general the memory allocation entry points are not kept
* thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED
* - xmlMalloc
* - xmlMallocAtomic
* - xmlRealloc
* - xmlMemStrdup
* - xmlFree
*/
#ifdef LIBXML_THREAD_ALLOC_ENABLED
#define XML_GLOBALS_ALLOC \
XML_OP(xmlMalloc, xmlMallocFunc, XML_EMPTY) \
XML_OP(xmlMallocAtomic, xmlMallocFunc, XML_EMPTY) \
XML_OP(xmlRealloc, xmlReallocFunc, XML_EMPTY) \
XML_OP(xmlFree, xmlFreeFunc, XML_EMPTY) \
XML_OP(xmlMemStrdup, xmlStrdupFunc, XML_EMPTY)
#else
#define XML_GLOBALS_ALLOC
XMLPUBVAR xmlMallocFunc xmlMalloc;
XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
XMLPUBVAR xmlReallocFunc xmlRealloc;
XMLPUBVAR xmlFreeFunc xmlFree;
XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
#endif
#define XML_GLOBALS \
XML_GLOBALS_CORE \
XML_GLOBALS_HTML \
XML_GLOBALS_ALLOC
#ifdef LIBXML_THREAD_ENABLED
#define XML_DECLARE_GLOBAL(name, type, attrs) \
attrs XMLPUBFUN type *__##name(void);
#else
#define XML_DECLARE_GLOBAL(name, type, attrs) \
attrs XMLPUBVAR type name;
#endif
#define XML_OP XML_DECLARE_GLOBAL
XML_GLOBALS
#undef XML_OP
#if defined(LIBXML_THREAD_ENABLED) && !defined(XML_GLOBALS_NO_REDEFINITION)
#define XML_GLOBAL_MACRO(name) (*__##name())
#define xmlLastError XML_GLOBAL_MACRO(xmlLastError)
#define oldXMLWDcompatibility XML_GLOBAL_MACRO(oldXMLWDcompatibility)
#define xmlBufferAllocScheme XML_GLOBAL_MACRO(xmlBufferAllocScheme)
#define xmlDefaultBufferSize XML_GLOBAL_MACRO(xmlDefaultBufferSize)
#define xmlDefaultSAXHandler XML_GLOBAL_MACRO(xmlDefaultSAXHandler)
#define xmlDefaultSAXLocator XML_GLOBAL_MACRO(xmlDefaultSAXLocator)
#define xmlDoValidityCheckingDefaultValue \
XML_GLOBAL_MACRO(xmlDoValidityCheckingDefaultValue)
#define xmlGenericError XML_GLOBAL_MACRO(xmlGenericError)
#define xmlStructuredError XML_GLOBAL_MACRO(xmlStructuredError)
#define xmlGenericErrorContext XML_GLOBAL_MACRO(xmlGenericErrorContext)
#define xmlStructuredErrorContext XML_GLOBAL_MACRO(xmlStructuredErrorContext)
#define xmlGetWarningsDefaultValue \
XML_GLOBAL_MACRO(xmlGetWarningsDefaultValue)
#define xmlIndentTreeOutput XML_GLOBAL_MACRO(xmlIndentTreeOutput)
#define xmlTreeIndentString XML_GLOBAL_MACRO(xmlTreeIndentString)
#define xmlKeepBlanksDefaultValue XML_GLOBAL_MACRO(xmlKeepBlanksDefaultValue)
#define xmlLineNumbersDefaultValue \
XML_GLOBAL_MACRO(xmlLineNumbersDefaultValue)
#define xmlLoadExtDtdDefaultValue XML_GLOBAL_MACRO(xmlLoadExtDtdDefaultValue)
#define xmlParserDebugEntities XML_GLOBAL_MACRO(xmlParserDebugEntities)
#define xmlParserVersion XML_GLOBAL_MACRO(xmlParserVersion)
#define xmlPedanticParserDefaultValue \
XML_GLOBAL_MACRO(xmlPedanticParserDefaultValue)
#define xmlSaveNoEmptyTags XML_GLOBAL_MACRO(xmlSaveNoEmptyTags)
#define xmlSubstituteEntitiesDefaultValue \
XML_GLOBAL_MACRO(xmlSubstituteEntitiesDefaultValue)
#define xmlRegisterNodeDefaultValue \
XML_GLOBAL_MACRO(xmlRegisterNodeDefaultValue)
#define xmlDeregisterNodeDefaultValue \
XML_GLOBAL_MACRO(xmlDeregisterNodeDefaultValue)
#define xmlParserInputBufferCreateFilenameValue \
XML_GLOBAL_MACRO(xmlParserInputBufferCreateFilenameValue)
#define xmlOutputBufferCreateFilenameValue \
XML_GLOBAL_MACRO(xmlOutputBufferCreateFilenameValue)
#ifdef LIBXML_HTML_ENABLED
#define htmlDefaultSAXHandler XML_GLOBAL_MACRO(htmlDefaultSAXHandler)
#endif
#ifdef LIBXML_THREAD_ALLOC_ENABLED
#define xmlMalloc XML_GLOBAL_MACRO(xmlMalloc)
#define xmlMallocAtomic XML_GLOBAL_MACRO(xmlMallocAtomic)
#define xmlRealloc XML_GLOBAL_MACRO(xmlRealloc)
#define xmlFree XML_GLOBAL_MACRO(xmlFree)
#define xmlMemStrdup XML_GLOBAL_MACRO(xmlMemStrdup)
#endif
#endif
#ifdef __cplusplus
}
#endif