Hash :
dc3382ef
Author :
Date :
2023-09-20T12:58:03
globals: Move xmlRegisterNodeDefault to tree.c Code in globals.c must not try to access globals itself since the accessor macros aren't defined and we would only see the main variable.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
/*
* Summary: interface for all global variables of the library
* Description: all the global variables and thread handling for
* those variables is handled by this module.
*
* Copy: See Copyright for the status of this software.
*
* Author: Gary Pennington <Gary.Pennington@uk.sun.com>, Daniel Veillard
*/
#ifndef __XML_GLOBALS_H
#define __XML_GLOBALS_H
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include <libxml/SAX2.h>
#include <libxml/xmlmemory.h>
#ifdef __cplusplus
extern "C" {
#endif
XML_DEPRECATED
XMLPUBFUN void xmlInitGlobals(void);
XML_DEPRECATED
XMLPUBFUN void xmlCleanupGlobals(void);
/**
* xmlParserInputBufferCreateFilenameFunc:
* @URI: the URI to read from
* @enc: the requested source encoding
*
* Signature for the function doing the lookup for a suitable input method
* corresponding to an URI.
*
* Returns the new xmlParserInputBufferPtr in case of success or NULL if no
* method was found.
*/
typedef xmlParserInputBufferPtr (*xmlParserInputBufferCreateFilenameFunc) (const char *URI,
xmlCharEncoding enc);
/**
* xmlOutputBufferCreateFilenameFunc:
* @URI: the URI to write to
* @enc: the requested target encoding
*
* Signature for the function doing the lookup for a suitable output method
* corresponding to an URI.
*
* Returns the new xmlOutputBufferPtr in case of success or NULL if no
* method was found.
*/
typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI,
xmlCharEncodingHandlerPtr encoder,
int compression);
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func);
XMLPUBFUN xmlOutputBufferCreateFilenameFunc
xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc func);
typedef struct _xmlGlobalState xmlGlobalState;
typedef xmlGlobalState *xmlGlobalStatePtr;
XMLPUBFUN int xmlCheckThreadLocalStorage(void);
XML_DEPRECATED
XMLPUBFUN void xmlInitializeGlobalState(xmlGlobalStatePtr gs);
XML_DEPRECATED
XMLPUBFUN xmlGlobalStatePtr
xmlGetGlobalState(void);
XMLPUBFUN void xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler);
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 xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func);
XMLPUBFUN xmlDeregisterNodeFunc xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func);
XMLPUBFUN xmlOutputBufferCreateFilenameFunc
xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func);
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
xmlThrDefParserInputBufferCreateFilenameDefault(
xmlParserInputBufferCreateFilenameFunc func);
/** DOC_DISABLE */
#if defined(LIBXML_THREAD_ENABLED) && defined(_WIN32) && \
defined(LIBXML_STATIC_FOR_DLL)
int
xmlDllMain(void *hinstDLL, unsigned long fdwReason,
void *lpvReserved);
#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
#endif /* __XML_GLOBALS_H */