blob: 9b4a551539c591f3cb18dc53534cc988b58c8e3c [file] [log] [blame]
Daniel Veillardb8478642001-10-12 17:29:10 +00001/*
2 * globals.c: definition and handling of the set of global variables
3 * of the library
4 *
5 * The bottom of this file is automatically generated by build_glob.py
6 * based on the description file global.data
7 *
8 * See Copyright for the status of this software.
9 *
10 * Gary Pennington <Gary.Pennington@uk.sun.com>
11 * daniel@veillard.com
12 */
13
Daniel Veillard34ce8be2002-03-18 19:37:11 +000014#define IN_LIBXML
Daniel Veillardb8478642001-10-12 17:29:10 +000015#include "libxml.h"
16
Daniel Veillarde7090612001-10-13 12:18:28 +000017#ifdef HAVE_STDLIB_H
Jaka Mocnik77d19ae2001-10-13 12:06:09 +000018#include <stdlib.h>
Daniel Veillarde7090612001-10-13 12:18:28 +000019#endif
Jaka Mocnik77d19ae2001-10-13 12:06:09 +000020#include <string.h>
21
Daniel Veillard3c01b1d2001-10-17 15:58:35 +000022#include <libxml/globals.h>
Daniel Veillarde7090612001-10-13 12:18:28 +000023#include <libxml/xmlmemory.h>
Daniel Veillard781ac8b2003-05-15 22:11:36 +000024#include <libxml/threads.h>
Daniel Veillarde7090612001-10-13 12:18:28 +000025
Daniel Veillard3c01b1d2001-10-17 15:58:35 +000026/* #define DEBUG_GLOBALS */
27
Daniel Veillardb8478642001-10-12 17:29:10 +000028/*
29 * Helpful Macro
30 */
Daniel Veillard3c01b1d2001-10-17 15:58:35 +000031#ifdef LIBXML_THREAD_ENABLED
32#define IS_MAIN_THREAD (xmlIsMainThread())
Daniel Veillardb8478642001-10-12 17:29:10 +000033#else
34#define IS_MAIN_THREAD 1
35#endif
36
Daniel Veillard781ac8b2003-05-15 22:11:36 +000037/*
38 * Mutex to protect "ForNewThreads" variables
39 */
40static xmlMutexPtr xmlThrDefMutex = NULL;
41
William M. Brack966668a2003-12-20 02:10:28 +000042/**
43 * xmlInitGlobals:
44 *
45 * Additional initialisation for multi-threading
46 */
Daniel Veillard75e389d2005-07-29 22:02:24 +000047void xmlInitGlobals(void)
Daniel Veillard781ac8b2003-05-15 22:11:36 +000048{
49 xmlThrDefMutex = xmlNewMutex();
50}
51
William M. Brack966668a2003-12-20 02:10:28 +000052/**
53 * xmlCleanupGlobals:
54 *
55 * Additional cleanup for multi-threading
56 */
Daniel Veillard75e389d2005-07-29 22:02:24 +000057void xmlCleanupGlobals(void)
Daniel Veillard781ac8b2003-05-15 22:11:36 +000058{
Daniel Veillard2009c4e2003-07-15 20:04:34 +000059 if (xmlThrDefMutex != NULL) {
Daniel Veillarddf101d82003-07-08 14:03:36 +000060 xmlFreeMutex(xmlThrDefMutex);
Daniel Veillard2009c4e2003-07-15 20:04:34 +000061 xmlThrDefMutex = NULL;
62 }
Daniel Veillardccc476f2008-03-04 13:19:49 +000063 __xmlGlobalInitMutexDestroy();
Daniel Veillard781ac8b2003-05-15 22:11:36 +000064}
65
Daniel Veillardb8478642001-10-12 17:29:10 +000066/************************************************************************
67 * *
68 * All the user accessible global variables of the library *
69 * *
70 ************************************************************************/
71
Daniel Veillardb8478642001-10-12 17:29:10 +000072/*
73 * Memory allocation routines
74 */
William M. Brack5ab479b2004-06-10 13:00:15 +000075#undef xmlFree
76#undef xmlMalloc
77#undef xmlMallocAtomic
78#undef xmlMemStrdup
79#undef xmlRealloc
80
Daniel Veillard7216cfd2002-11-08 15:10:00 +000081#if defined(DEBUG_MEMORY_LOCATION) || defined(DEBUG_MEMORY)
Daniel Veillardb8478642001-10-12 17:29:10 +000082xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
83xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +000084xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillardb8478642001-10-12 17:29:10 +000085xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
86xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
87#else
Daniel Veillard9d06d302002-01-22 18:15:52 +000088/**
89 * xmlFree:
90 * @mem: an already allocated block of memory
91 *
92 * The variable holding the libxml free() implementation
93 */
Daniel Veillardb8478642001-10-12 17:29:10 +000094xmlFreeFunc xmlFree = (xmlFreeFunc) free;
Daniel Veillard9d06d302002-01-22 18:15:52 +000095/**
96 * xmlMalloc:
97 * @size: the size requested in bytes
98 *
99 * The variable holding the libxml malloc() implementation
100 *
101 * Returns a pointer to the newly allocated block or NULL in case of error
102 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000103xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000104/**
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000105 * xmlMallocAtomic:
106 * @size: the size requested in bytes
107 *
108 * The variable holding the libxml malloc() implementation for atomic
109 * data (i.e. blocks not containings pointers), useful when using a
110 * garbage collecting allocator.
111 *
112 * Returns a pointer to the newly allocated block or NULL in case of error
113 */
114xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) malloc;
115/**
Daniel Veillard9d06d302002-01-22 18:15:52 +0000116 * xmlRealloc:
117 * @mem: an already allocated block of memory
118 * @size: the new size requested in bytes
119 *
120 * The variable holding the libxml realloc() implementation
121 *
122 * Returns a pointer to the newly reallocated block or NULL in case of error
123 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000124xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000125/**
126 * xmlMemStrdup:
127 * @str: a zero terminated string
128 *
129 * The variable holding the libxml strdup() implementation
130 *
131 * Returns the copy of the string or NULL in case of error
132 */
Daniel Veillardb82c1662001-12-09 14:00:54 +0000133xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000134#endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */
Daniel Veillardb8478642001-10-12 17:29:10 +0000135
Daniel Veillardd0463562001-10-13 09:15:48 +0000136#include <libxml/threads.h>
137#include <libxml/globals.h>
138#include <libxml/SAX.h>
139
140#undef docbDefaultSAXHandler
141#undef htmlDefaultSAXHandler
142#undef oldXMLWDcompatibility
143#undef xmlBufferAllocScheme
144#undef xmlDefaultBufferSize
145#undef xmlDefaultSAXHandler
146#undef xmlDefaultSAXLocator
147#undef xmlDoValidityCheckingDefaultValue
148#undef xmlGenericError
Daniel Veillard659e71e2003-10-10 14:10:40 +0000149#undef xmlStructuredError
Daniel Veillardd0463562001-10-13 09:15:48 +0000150#undef xmlGenericErrorContext
Wang Lam1de382e2009-08-24 17:34:25 +0200151#undef xmlStructuredErrorContext
Daniel Veillardd0463562001-10-13 09:15:48 +0000152#undef xmlGetWarningsDefaultValue
153#undef xmlIndentTreeOutput
Aleksey Sanin23002562002-05-24 07:18:40 +0000154#undef xmlTreeIndentString
Daniel Veillardd0463562001-10-13 09:15:48 +0000155#undef xmlKeepBlanksDefaultValue
156#undef xmlLineNumbersDefaultValue
157#undef xmlLoadExtDtdDefaultValue
158#undef xmlParserDebugEntities
159#undef xmlParserVersion
160#undef xmlPedanticParserDefaultValue
161#undef xmlSaveNoEmptyTags
162#undef xmlSubstituteEntitiesDefaultValue
Daniel Veillard8326e732003-01-07 00:19:07 +0000163#undef xmlRegisterNodeDefaultValue
164#undef xmlDeregisterNodeDefaultValue
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000165#undef xmlLastError
Daniel Veillardd0463562001-10-13 09:15:48 +0000166
Daniel Veillard0335a842004-06-02 16:18:40 +0000167#undef xmlParserInputBufferCreateFilenameValue
168#undef xmlOutputBufferCreateFilenameValue
Daniel Veillard9d06d302002-01-22 18:15:52 +0000169/**
170 * xmlParserVersion:
171 *
172 * Constant string describing the internal version of the library
173 */
William M. Brackf4025492004-08-18 21:08:46 +0000174const char *xmlParserVersion = LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA;
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000175
Daniel Veillard9d06d302002-01-22 18:15:52 +0000176/**
177 * xmlBufferAllocScheme:
178 *
179 * Global setting, default allocation policy for buffers, default is
180 * XML_BUFFER_ALLOC_EXACT
Daniel Veillardb8478642001-10-12 17:29:10 +0000181 */
182xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000183static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_EXACT;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000184/**
185 * xmlDefaultBufferSize:
186 *
187 * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
188 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000189int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000190static int xmlDefaultBufferSizeThrDef = BASE_BUFFER_SIZE;
Daniel Veillardb8478642001-10-12 17:29:10 +0000191
192/*
193 * Parser defaults
194 */
Daniel Veillardd0463562001-10-13 09:15:48 +0000195
Daniel Veillard9d06d302002-01-22 18:15:52 +0000196/**
197 * oldXMLWDcompatibility:
198 *
199 * Global setting, DEPRECATED.
200 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000201int oldXMLWDcompatibility = 0; /* DEPRECATED */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000202/**
203 * xmlParserDebugEntities:
204 *
205 * Global setting, asking the parser to print out debugging informations.
206 * while handling entities.
207 * Disabled by default
208 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000209int xmlParserDebugEntities = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000210static int xmlParserDebugEntitiesThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000211/**
212 * xmlDoValidityCheckingDefaultValue:
213 *
214 * Global setting, indicate that the parser should work in validating mode.
215 * Disabled by default.
216 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000217int xmlDoValidityCheckingDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000218static int xmlDoValidityCheckingDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000219/**
220 * xmlGetWarningsDefaultValue:
221 *
222 * Global setting, indicate that the parser should provide warnings.
223 * Activated by default.
224 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000225int xmlGetWarningsDefaultValue = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000226static int xmlGetWarningsDefaultValueThrDef = 1;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000227/**
228 * xmlLoadExtDtdDefaultValue:
229 *
230 * Global setting, indicate that the parser should load DTD while not
231 * validating.
232 * Disabled by default.
233 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000234int xmlLoadExtDtdDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000235static int xmlLoadExtDtdDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000236/**
237 * xmlPedanticParserDefaultValue:
238 *
239 * Global setting, indicate that the parser be pedantic
240 * Disabled by default.
241 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000242int xmlPedanticParserDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000243static int xmlPedanticParserDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000244/**
245 * xmlLineNumbersDefaultValue:
246 *
247 * Global setting, indicate that the parser should store the line number
248 * in the content field of elements in the DOM tree.
249 * Disabled by default since this may not be safe for old classes of
250 * applicaton.
251 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000252int xmlLineNumbersDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000253static int xmlLineNumbersDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000254/**
255 * xmlKeepBlanksDefaultValue:
256 *
257 * Global setting, indicate that the parser should keep all blanks
258 * nodes found in the content
259 * Activated by default, this is actually needed to have the parser
260 * conformant to the XML Recommendation, however the option is kept
261 * for some applications since this was libxml1 default behaviour.
262 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000263int xmlKeepBlanksDefaultValue = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000264static int xmlKeepBlanksDefaultValueThrDef = 1;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000265/**
266 * xmlSubstituteEntitiesDefaultValue:
267 *
268 * Global setting, indicate that the parser should not generate entity
269 * references but replace them with the actual content of the entity
270 * Disabled by default, this should be activated when using XPath since
271 * the XPath data model requires entities replacement and the XPath
272 * engine does not handle entities references transparently.
273 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000274int xmlSubstituteEntitiesDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000275static int xmlSubstituteEntitiesDefaultValueThrDef = 0;
Daniel Veillardb8478642001-10-12 17:29:10 +0000276
Daniel Veillard5335dc52003-01-01 20:59:38 +0000277xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000278static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000279xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000280static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000281
Daniel Veillard0335a842004-06-02 16:18:40 +0000282xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue = NULL;
283static xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValueThrDef = NULL;
284
285xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue = NULL;
286static xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValueThrDef = NULL;
287
Daniel Veillardb8478642001-10-12 17:29:10 +0000288/*
289 * Error handling
290 */
291
292/* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
293/* Must initialize xmlGenericError in xmlInitParser */
Daniel Veillardffa3c742005-07-21 13:24:09 +0000294void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
Daniel Veillard635ef722001-10-29 11:48:19 +0000295 const char *msg,
296 ...);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000297/**
298 * xmlGenericError:
299 *
300 * Global setting: function used for generic error callbacks
301 */
Daniel Veillard635ef722001-10-29 11:48:19 +0000302xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000303static xmlGenericErrorFunc xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000304/**
Daniel Veillard659e71e2003-10-10 14:10:40 +0000305 * xmlStructuredError:
306 *
307 * Global setting: function used for structured error callbacks
308 */
309xmlStructuredErrorFunc xmlStructuredError = NULL;
310static xmlStructuredErrorFunc xmlStructuredErrorThrDef = NULL;
311/**
Daniel Veillard9d06d302002-01-22 18:15:52 +0000312 * xmlGenericErrorContext:
313 *
314 * Global setting passed to generic error callbacks
315 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000316void *xmlGenericErrorContext = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000317static void *xmlGenericErrorContextThrDef = NULL;
Wang Lam1de382e2009-08-24 17:34:25 +0200318/**
319 * xmlStructuredErrorContext:
320 *
321 * Global setting passed to structured error callbacks
322 */
323void *xmlStructuredErrorContext = NULL;
324static void *xmlStructuredErrorContextThrDef = NULL;
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000325xmlError xmlLastError;
Daniel Veillardb8478642001-10-12 17:29:10 +0000326
327/*
328 * output defaults
329 */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000330/**
331 * xmlIndentTreeOutput:
332 *
333 * Global setting, asking the serializer to indent the output tree by default
Aleksey Sanin23002562002-05-24 07:18:40 +0000334 * Enabled by default
Daniel Veillard9d06d302002-01-22 18:15:52 +0000335 */
Aleksey Sanin23002562002-05-24 07:18:40 +0000336int xmlIndentTreeOutput = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000337static int xmlIndentTreeOutputThrDef = 1;
Aleksey Sanin23002562002-05-24 07:18:40 +0000338
339/**
340 * xmlTreeIndentString:
341 *
342 * The string used to do one-level indent. By default is equal to " " (two spaces)
343 */
344const char *xmlTreeIndentString = " ";
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000345static const char *xmlTreeIndentStringThrDef = " ";
Aleksey Sanin23002562002-05-24 07:18:40 +0000346
Daniel Veillard9d06d302002-01-22 18:15:52 +0000347/**
348 * xmlSaveNoEmptyTags:
349 *
350 * Global setting, asking the serializer to not output empty tags
351 * as <empty/> but <empty></empty>. those two forms are undistinguishable
352 * once parsed.
353 * Disabled by default
354 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000355int xmlSaveNoEmptyTags = 0;
Daniel Veillard24505b02005-07-28 23:49:35 +0000356static int xmlSaveNoEmptyTagsThrDef = 0;
Daniel Veillardb8478642001-10-12 17:29:10 +0000357
Daniel Veillard81273902003-09-30 00:43:48 +0000358#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000359/**
360 * xmlDefaultSAXHandler:
361 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000362 * Default SAX version1 handler for XML, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000363 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000364xmlSAXHandlerV1 xmlDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000365 xmlSAX2InternalSubset,
366 xmlSAX2IsStandalone,
367 xmlSAX2HasInternalSubset,
368 xmlSAX2HasExternalSubset,
369 xmlSAX2ResolveEntity,
370 xmlSAX2GetEntity,
371 xmlSAX2EntityDecl,
372 xmlSAX2NotationDecl,
373 xmlSAX2AttributeDecl,
374 xmlSAX2ElementDecl,
375 xmlSAX2UnparsedEntityDecl,
376 xmlSAX2SetDocumentLocator,
377 xmlSAX2StartDocument,
378 xmlSAX2EndDocument,
379 xmlSAX2StartElement,
380 xmlSAX2EndElement,
381 xmlSAX2Reference,
382 xmlSAX2Characters,
383 xmlSAX2Characters,
384 xmlSAX2ProcessingInstruction,
385 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000386 xmlParserWarning,
387 xmlParserError,
388 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000389 xmlSAX2GetParameterEntity,
390 xmlSAX2CDataBlock,
391 xmlSAX2ExternalSubset,
392 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000393};
Daniel Veillard81273902003-09-30 00:43:48 +0000394#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillardb8478642001-10-12 17:29:10 +0000395
Daniel Veillard9d06d302002-01-22 18:15:52 +0000396/**
397 * xmlDefaultSAXLocator:
398 *
399 * The default SAX Locator
400 * { getPublicId, getSystemId, getLineNumber, getColumnNumber}
Daniel Veillardb8478642001-10-12 17:29:10 +0000401 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000402xmlSAXLocator xmlDefaultSAXLocator = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000403 xmlSAX2GetPublicId,
404 xmlSAX2GetSystemId,
405 xmlSAX2GetLineNumber,
406 xmlSAX2GetColumnNumber
Daniel Veillardb8478642001-10-12 17:29:10 +0000407};
408
409#ifdef LIBXML_HTML_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000410/**
411 * htmlDefaultSAXHandler:
412 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000413 * Default old SAX v1 handler for HTML, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000414 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000415xmlSAXHandlerV1 htmlDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000416 xmlSAX2InternalSubset,
Daniel Veillardb8478642001-10-12 17:29:10 +0000417 NULL,
418 NULL,
419 NULL,
420 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000421 xmlSAX2GetEntity,
Daniel Veillardb8478642001-10-12 17:29:10 +0000422 NULL,
423 NULL,
424 NULL,
425 NULL,
426 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000427 xmlSAX2SetDocumentLocator,
428 xmlSAX2StartDocument,
429 xmlSAX2EndDocument,
430 xmlSAX2StartElement,
431 xmlSAX2EndElement,
Daniel Veillardb8478642001-10-12 17:29:10 +0000432 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000433 xmlSAX2Characters,
434 xmlSAX2IgnorableWhitespace,
Daniel Veillardfc484dd2004-10-22 14:34:23 +0000435 xmlSAX2ProcessingInstruction,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000436 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000437 xmlParserWarning,
438 xmlParserError,
439 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000440 xmlSAX2GetParameterEntity,
441 xmlSAX2CDataBlock,
Daniel Veillardb8478642001-10-12 17:29:10 +0000442 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000443 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000444};
445#endif /* LIBXML_HTML_ENABLED */
446
447#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000448/**
449 * docbDefaultSAXHandler:
450 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000451 * Default old SAX v1 handler for SGML DocBook, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000452 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000453xmlSAXHandlerV1 docbDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000454 xmlSAX2InternalSubset,
455 xmlSAX2IsStandalone,
456 xmlSAX2HasInternalSubset,
457 xmlSAX2HasExternalSubset,
458 xmlSAX2ResolveEntity,
459 xmlSAX2GetEntity,
460 xmlSAX2EntityDecl,
Daniel Veillardb8478642001-10-12 17:29:10 +0000461 NULL,
462 NULL,
463 NULL,
464 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000465 xmlSAX2SetDocumentLocator,
466 xmlSAX2StartDocument,
467 xmlSAX2EndDocument,
468 xmlSAX2StartElement,
469 xmlSAX2EndElement,
470 xmlSAX2Reference,
471 xmlSAX2Characters,
472 xmlSAX2IgnorableWhitespace,
Daniel Veillardb8478642001-10-12 17:29:10 +0000473 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000474 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000475 xmlParserWarning,
476 xmlParserError,
477 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000478 xmlSAX2GetParameterEntity,
Daniel Veillardb8478642001-10-12 17:29:10 +0000479 NULL,
480 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000481 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000482};
483#endif /* LIBXML_DOCB_ENABLED */
484
485/**
486 * xmlInitializeGlobalState:
487 * @gs: a pointer to a newly allocated global state
488 *
489 * xmlInitializeGlobalState() initialize a global state with all the
490 * default values of the library.
491 */
492void
493xmlInitializeGlobalState(xmlGlobalStatePtr gs)
494{
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000495#ifdef DEBUG_GLOBALS
496 fprintf(stderr, "Initializing globals at %lu for thread %d\n",
497 (unsigned long) gs, xmlGetThreadId());
498#endif
499
Daniel Veillardb8478642001-10-12 17:29:10 +0000500 /*
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000501 * Perform initialization as required by libxml
Daniel Veillardb8478642001-10-12 17:29:10 +0000502 */
Daniel Veillard5805be22003-08-28 08:03:23 +0000503 if (xmlThrDefMutex == NULL)
504 xmlInitGlobals();
505
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000506 xmlMutexLock(xmlThrDefMutex);
William M. Brack8b2c7f12002-11-22 05:07:29 +0000507
Daniel Veillardbca3ad22005-08-23 22:14:02 +0000508#if defined(LIBXML_DOCB_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
Daniel Veillard092643b2003-09-25 14:29:29 +0000509 initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000510#endif
Daniel Veillardd8467682005-06-08 17:42:42 +0000511#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED)
Daniel Veillard092643b2003-09-25 14:29:29 +0000512 inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000513#endif
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000514
Daniel Veillardb8478642001-10-12 17:29:10 +0000515 gs->oldXMLWDcompatibility = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000516 gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
517 gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;
William M. Brack21e4ef22005-01-02 09:53:13 +0000518#if defined(LIBXML_SAX1_ENABLED) && defined(LIBXML_LEGACY_ENABLED)
Daniel Veillard092643b2003-09-25 14:29:29 +0000519 initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
Daniel Veillard81273902003-09-30 00:43:48 +0000520#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillard4432df22003-09-28 18:58:27 +0000521 gs->xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId;
522 gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
523 gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
524 gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000525 gs->xmlDoValidityCheckingDefaultValue =
526 xmlDoValidityCheckingDefaultValueThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000527#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
528 gs->xmlFree = (xmlFreeFunc) xmlMemFree;
529 gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000530 gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000531 gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
532 gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
533#else
534 gs->xmlFree = (xmlFreeFunc) free;
535 gs->xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000536 gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000537 gs->xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard572577e2002-01-18 16:23:55 +0000538 gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillardb8478642001-10-12 17:29:10 +0000539#endif
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000540 gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
541 gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
542 gs->xmlTreeIndentString = xmlTreeIndentStringThrDef;
543 gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
544 gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
545 gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
546 gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000547 gs->xmlParserVersion = LIBXML_VERSION_STRING;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000548 gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
549 gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
550 gs->xmlSubstituteEntitiesDefaultValue =
551 xmlSubstituteEntitiesDefaultValueThrDef;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000552
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000553 gs->xmlGenericError = xmlGenericErrorThrDef;
Daniel Veillard659e71e2003-10-10 14:10:40 +0000554 gs->xmlStructuredError = xmlStructuredErrorThrDef;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000555 gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
Wang Lam1de382e2009-08-24 17:34:25 +0200556 gs->xmlStructuredErrorContext = xmlStructuredErrorContextThrDef;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000557 gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
558 gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
Daniel Veillard0335a842004-06-02 16:18:40 +0000559
560 gs->xmlParserInputBufferCreateFilenameValue = xmlParserInputBufferCreateFilenameValueThrDef;
561 gs->xmlOutputBufferCreateFilenameValue = xmlOutputBufferCreateFilenameValueThrDef;
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000562 memset(&gs->xmlLastError, 0, sizeof(xmlError));
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000563
564 xmlMutexUnlock(xmlThrDefMutex);
565}
566
Daniel Veillard1e906612003-12-05 14:57:46 +0000567/**
568 * DOC_DISABLE : we ignore missing doc for the xmlThrDef functions,
569 * those are really internal work
570 */
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000571void
572xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
573 xmlMutexLock(xmlThrDefMutex);
574 xmlGenericErrorContextThrDef = ctx;
575 if (handler != NULL)
576 xmlGenericErrorThrDef = handler;
577 else
578 xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
579 xmlMutexUnlock(xmlThrDefMutex);
Daniel Veillardb8478642001-10-12 17:29:10 +0000580}
581
Daniel Veillard659e71e2003-10-10 14:10:40 +0000582void
583xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
584 xmlMutexLock(xmlThrDefMutex);
Wang Lam1de382e2009-08-24 17:34:25 +0200585 xmlStructuredErrorContextThrDef = ctx;
Daniel Veillard659e71e2003-10-10 14:10:40 +0000586 xmlStructuredErrorThrDef = handler;
587 xmlMutexUnlock(xmlThrDefMutex);
588}
589
Daniel Veillard5335dc52003-01-01 20:59:38 +0000590/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000591 * xmlRegisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000592 * @func: function pointer to the new RegisterNodeFunc
593 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000594 * Registers a callback for node creation
595 *
596 * Returns the old value of the registration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000597 */
598xmlRegisterNodeFunc
599xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
600{
601 xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue;
602
Daniel Veillarda880b122003-04-21 21:36:41 +0000603 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000604 xmlRegisterNodeDefaultValue = func;
605 return(old);
606}
607
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000608xmlRegisterNodeFunc
609xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
610{
611 xmlRegisterNodeFunc old;
612
613 xmlMutexLock(xmlThrDefMutex);
614 old = xmlRegisterNodeDefaultValueThrDef;
615
616 __xmlRegisterCallbacks = 1;
617 xmlRegisterNodeDefaultValueThrDef = func;
618 xmlMutexUnlock(xmlThrDefMutex);
619
620 return(old);
621}
622
Daniel Veillard5335dc52003-01-01 20:59:38 +0000623/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000624 * xmlDeregisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000625 * @func: function pointer to the new DeregisterNodeFunc
626 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000627 * Registers a callback for node destruction
628 *
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000629 * Returns the previous value of the deregistration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000630 */
631xmlDeregisterNodeFunc
632xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
633{
634 xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue;
635
Daniel Veillarda880b122003-04-21 21:36:41 +0000636 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000637 xmlDeregisterNodeDefaultValue = func;
638 return(old);
639}
640
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000641xmlDeregisterNodeFunc
642xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
643{
644 xmlDeregisterNodeFunc old;
645
646 xmlMutexLock(xmlThrDefMutex);
647 old = xmlDeregisterNodeDefaultValueThrDef;
648
649 __xmlRegisterCallbacks = 1;
650 xmlDeregisterNodeDefaultValueThrDef = func;
651 xmlMutexUnlock(xmlThrDefMutex);
652
653 return(old);
654}
655
Daniel Veillard0335a842004-06-02 16:18:40 +0000656xmlParserInputBufferCreateFilenameFunc
657xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
658{
659 xmlParserInputBufferCreateFilenameFunc old;
660
661 xmlMutexLock(xmlThrDefMutex);
662 old = xmlParserInputBufferCreateFilenameValueThrDef;
Daniel Veillard1b243b42004-06-08 10:16:42 +0000663 if (old == NULL) {
664 old = __xmlParserInputBufferCreateFilename;
665 }
666
Daniel Veillard0335a842004-06-02 16:18:40 +0000667 xmlParserInputBufferCreateFilenameValueThrDef = func;
668 xmlMutexUnlock(xmlThrDefMutex);
669
670 return(old);
671}
672
Daniel Veillard0335a842004-06-02 16:18:40 +0000673xmlOutputBufferCreateFilenameFunc
674xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
675{
676 xmlOutputBufferCreateFilenameFunc old;
677
678 xmlMutexLock(xmlThrDefMutex);
679 old = xmlOutputBufferCreateFilenameValueThrDef;
Daniel Veillard1b243b42004-06-08 10:16:42 +0000680#ifdef LIBXML_OUTPUT_ENABLED
681 if (old == NULL) {
682 old = __xmlOutputBufferCreateFilename;
683 }
684#endif
Daniel Veillard0335a842004-06-02 16:18:40 +0000685 xmlOutputBufferCreateFilenameValueThrDef = func;
686 xmlMutexUnlock(xmlThrDefMutex);
687
688 return(old);
689}
Daniel Veillard5335dc52003-01-01 20:59:38 +0000690
Daniel Veillarda4617b82001-11-04 20:19:12 +0000691#ifdef LIBXML_DOCB_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000692#undef docbDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000693xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000694__docbDefaultSAXHandler(void) {
695 if (IS_MAIN_THREAD)
696 return (&docbDefaultSAXHandler);
697 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000698 return (&xmlGetGlobalState()->docbDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000699}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000700#endif
Daniel Veillardb8478642001-10-12 17:29:10 +0000701
Daniel Veillarda4617b82001-11-04 20:19:12 +0000702#ifdef LIBXML_HTML_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000703#undef htmlDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000704xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000705__htmlDefaultSAXHandler(void) {
706 if (IS_MAIN_THREAD)
707 return (&htmlDefaultSAXHandler);
708 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000709 return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000710}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000711#endif
712
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000713#undef xmlLastError
714xmlError *
715__xmlLastError(void) {
716 if (IS_MAIN_THREAD)
717 return (&xmlLastError);
718 else
719 return (&xmlGetGlobalState()->xmlLastError);
720}
721
Daniel Veillarda4617b82001-11-04 20:19:12 +0000722/*
William M. Brack5ab479b2004-06-10 13:00:15 +0000723 * The following memory routines were apparently lost at some point,
724 * and were re-inserted at this point on June 10, 2004. Hope it's
725 * the right place for them :-)
726 */
727#if defined(LIBXML_THREAD_ALLOC_ENABLED) && defined(LIBXML_THREAD_ENABLED)
728#undef xmlMalloc
729xmlMallocFunc *
730__xmlMalloc(void){
731 if (IS_MAIN_THREAD)
732 return (&xmlMalloc);
733 else
734 return (&xmlGetGlobalState()->xmlMalloc);
735}
736
737#undef xmlMallocAtomic
738xmlMallocFunc *
739__xmlMallocAtomic(void){
740 if (IS_MAIN_THREAD)
741 return (&xmlMallocAtomic);
742 else
743 return (&xmlGetGlobalState()->xmlMallocAtomic);
744}
745
746#undef xmlRealloc
747xmlReallocFunc *
748__xmlRealloc(void){
749 if (IS_MAIN_THREAD)
750 return (&xmlRealloc);
751 else
752 return (&xmlGetGlobalState()->xmlRealloc);
753}
754
755#undef xmlFree
756xmlFreeFunc *
757__xmlFree(void){
758 if (IS_MAIN_THREAD)
759 return (&xmlFree);
760 else
761 return (&xmlGetGlobalState()->xmlFree);
762}
763
764xmlStrdupFunc *
765__xmlMemStrdup(void){
766 if (IS_MAIN_THREAD)
767 return (&xmlMemStrdup);
768 else
769 return (&xmlGetGlobalState()->xmlMemStrdup);
770}
771
772#endif
773
774/*
Daniel Veillarda4617b82001-11-04 20:19:12 +0000775 * Everything starting from the line below is
776 * Automatically generated by build_glob.py.
777 * Do not modify the previous line.
778 */
779
Daniel Veillardb8478642001-10-12 17:29:10 +0000780
Daniel Veillardb8478642001-10-12 17:29:10 +0000781#undef oldXMLWDcompatibility
782int *
783__oldXMLWDcompatibility(void) {
784 if (IS_MAIN_THREAD)
785 return (&oldXMLWDcompatibility);
786 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000787 return (&xmlGetGlobalState()->oldXMLWDcompatibility);
Daniel Veillardb8478642001-10-12 17:29:10 +0000788}
789
Daniel Veillardb8478642001-10-12 17:29:10 +0000790#undef xmlBufferAllocScheme
791xmlBufferAllocationScheme *
792__xmlBufferAllocScheme(void) {
793 if (IS_MAIN_THREAD)
794 return (&xmlBufferAllocScheme);
795 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000796 return (&xmlGetGlobalState()->xmlBufferAllocScheme);
Daniel Veillardb8478642001-10-12 17:29:10 +0000797}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000798xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
799 xmlBufferAllocationScheme ret;
800 xmlMutexLock(xmlThrDefMutex);
801 ret = xmlBufferAllocSchemeThrDef;
802 xmlBufferAllocSchemeThrDef = v;
803 xmlMutexUnlock(xmlThrDefMutex);
804 return ret;
805}
Daniel Veillardb8478642001-10-12 17:29:10 +0000806
Daniel Veillardb8478642001-10-12 17:29:10 +0000807#undef xmlDefaultBufferSize
808int *
809__xmlDefaultBufferSize(void) {
810 if (IS_MAIN_THREAD)
811 return (&xmlDefaultBufferSize);
812 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000813 return (&xmlGetGlobalState()->xmlDefaultBufferSize);
Daniel Veillardb8478642001-10-12 17:29:10 +0000814}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000815int xmlThrDefDefaultBufferSize(int v) {
816 int ret;
817 xmlMutexLock(xmlThrDefMutex);
818 ret = xmlDefaultBufferSizeThrDef;
819 xmlDefaultBufferSizeThrDef = v;
820 xmlMutexUnlock(xmlThrDefMutex);
821 return ret;
822}
Daniel Veillardb8478642001-10-12 17:29:10 +0000823
Daniel Veillard81273902003-09-30 00:43:48 +0000824#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000825#undef xmlDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000826xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000827__xmlDefaultSAXHandler(void) {
828 if (IS_MAIN_THREAD)
829 return (&xmlDefaultSAXHandler);
830 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000831 return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000832}
Daniel Veillard81273902003-09-30 00:43:48 +0000833#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillardb8478642001-10-12 17:29:10 +0000834
Daniel Veillardb8478642001-10-12 17:29:10 +0000835#undef xmlDefaultSAXLocator
836xmlSAXLocator *
837__xmlDefaultSAXLocator(void) {
838 if (IS_MAIN_THREAD)
839 return (&xmlDefaultSAXLocator);
840 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000841 return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
Daniel Veillardb8478642001-10-12 17:29:10 +0000842}
843
Daniel Veillardb8478642001-10-12 17:29:10 +0000844#undef xmlDoValidityCheckingDefaultValue
845int *
846__xmlDoValidityCheckingDefaultValue(void) {
847 if (IS_MAIN_THREAD)
848 return (&xmlDoValidityCheckingDefaultValue);
849 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000850 return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000851}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000852int xmlThrDefDoValidityCheckingDefaultValue(int v) {
853 int ret;
854 xmlMutexLock(xmlThrDefMutex);
855 ret = xmlDoValidityCheckingDefaultValueThrDef;
856 xmlDoValidityCheckingDefaultValueThrDef = v;
857 xmlMutexUnlock(xmlThrDefMutex);
858 return ret;
859}
Daniel Veillardb8478642001-10-12 17:29:10 +0000860
Daniel Veillardb8478642001-10-12 17:29:10 +0000861#undef xmlGenericError
862xmlGenericErrorFunc *
863__xmlGenericError(void) {
864 if (IS_MAIN_THREAD)
865 return (&xmlGenericError);
866 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000867 return (&xmlGetGlobalState()->xmlGenericError);
Daniel Veillardb8478642001-10-12 17:29:10 +0000868}
869
Daniel Veillard659e71e2003-10-10 14:10:40 +0000870#undef xmlStructuredError
871xmlStructuredErrorFunc *
872__xmlStructuredError(void) {
873 if (IS_MAIN_THREAD)
874 return (&xmlStructuredError);
875 else
876 return (&xmlGetGlobalState()->xmlStructuredError);
877}
878
Daniel Veillardb8478642001-10-12 17:29:10 +0000879#undef xmlGenericErrorContext
880void * *
881__xmlGenericErrorContext(void) {
882 if (IS_MAIN_THREAD)
883 return (&xmlGenericErrorContext);
884 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000885 return (&xmlGetGlobalState()->xmlGenericErrorContext);
Daniel Veillardb8478642001-10-12 17:29:10 +0000886}
887
Wang Lam1de382e2009-08-24 17:34:25 +0200888#undef xmlStructuredErrorContext
889void * *
890__xmlStructuredErrorContext(void) {
891 if (IS_MAIN_THREAD)
892 return (&xmlStructuredErrorContext);
893 else
894 return (&xmlGetGlobalState()->xmlStructuredErrorContext);
895}
896
Daniel Veillardb8478642001-10-12 17:29:10 +0000897#undef xmlGetWarningsDefaultValue
898int *
899__xmlGetWarningsDefaultValue(void) {
900 if (IS_MAIN_THREAD)
901 return (&xmlGetWarningsDefaultValue);
902 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000903 return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000904}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000905int xmlThrDefGetWarningsDefaultValue(int v) {
906 int ret;
907 xmlMutexLock(xmlThrDefMutex);
908 ret = xmlGetWarningsDefaultValueThrDef;
909 xmlGetWarningsDefaultValueThrDef = v;
910 xmlMutexUnlock(xmlThrDefMutex);
911 return ret;
912}
Daniel Veillardb8478642001-10-12 17:29:10 +0000913
Daniel Veillardb8478642001-10-12 17:29:10 +0000914#undef xmlIndentTreeOutput
915int *
916__xmlIndentTreeOutput(void) {
917 if (IS_MAIN_THREAD)
918 return (&xmlIndentTreeOutput);
919 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000920 return (&xmlGetGlobalState()->xmlIndentTreeOutput);
Daniel Veillardb8478642001-10-12 17:29:10 +0000921}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000922int xmlThrDefIndentTreeOutput(int v) {
923 int ret;
924 xmlMutexLock(xmlThrDefMutex);
925 ret = xmlIndentTreeOutputThrDef;
926 xmlIndentTreeOutputThrDef = v;
927 xmlMutexUnlock(xmlThrDefMutex);
928 return ret;
929}
Daniel Veillardb8478642001-10-12 17:29:10 +0000930
Wang Lam1de382e2009-08-24 17:34:25 +0200931#undef xmlTreeIndentString
Aleksey Sanin23002562002-05-24 07:18:40 +0000932const char * *
933__xmlTreeIndentString(void) {
934 if (IS_MAIN_THREAD)
935 return (&xmlTreeIndentString);
936 else
937 return (&xmlGetGlobalState()->xmlTreeIndentString);
938}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000939const char * xmlThrDefTreeIndentString(const char * v) {
940 const char * ret;
941 xmlMutexLock(xmlThrDefMutex);
942 ret = xmlTreeIndentStringThrDef;
943 xmlTreeIndentStringThrDef = v;
944 xmlMutexUnlock(xmlThrDefMutex);
945 return ret;
946}
Aleksey Sanin23002562002-05-24 07:18:40 +0000947
Daniel Veillardb8478642001-10-12 17:29:10 +0000948#undef xmlKeepBlanksDefaultValue
949int *
950__xmlKeepBlanksDefaultValue(void) {
951 if (IS_MAIN_THREAD)
952 return (&xmlKeepBlanksDefaultValue);
953 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000954 return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000955}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000956int xmlThrDefKeepBlanksDefaultValue(int v) {
957 int ret;
958 xmlMutexLock(xmlThrDefMutex);
959 ret = xmlKeepBlanksDefaultValueThrDef;
960 xmlKeepBlanksDefaultValueThrDef = v;
961 xmlMutexUnlock(xmlThrDefMutex);
962 return ret;
963}
Daniel Veillardb8478642001-10-12 17:29:10 +0000964
Daniel Veillardb8478642001-10-12 17:29:10 +0000965#undef xmlLineNumbersDefaultValue
966int *
967__xmlLineNumbersDefaultValue(void) {
968 if (IS_MAIN_THREAD)
969 return (&xmlLineNumbersDefaultValue);
970 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000971 return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000972}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000973int xmlThrDefLineNumbersDefaultValue(int v) {
974 int ret;
975 xmlMutexLock(xmlThrDefMutex);
976 ret = xmlLineNumbersDefaultValueThrDef;
977 xmlLineNumbersDefaultValueThrDef = v;
978 xmlMutexUnlock(xmlThrDefMutex);
979 return ret;
980}
Daniel Veillardb8478642001-10-12 17:29:10 +0000981
Daniel Veillardb8478642001-10-12 17:29:10 +0000982#undef xmlLoadExtDtdDefaultValue
983int *
984__xmlLoadExtDtdDefaultValue(void) {
985 if (IS_MAIN_THREAD)
986 return (&xmlLoadExtDtdDefaultValue);
987 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000988 return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000989}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000990int xmlThrDefLoadExtDtdDefaultValue(int v) {
991 int ret;
992 xmlMutexLock(xmlThrDefMutex);
993 ret = xmlLoadExtDtdDefaultValueThrDef;
994 xmlLoadExtDtdDefaultValueThrDef = v;
995 xmlMutexUnlock(xmlThrDefMutex);
996 return ret;
997}
Daniel Veillardb8478642001-10-12 17:29:10 +0000998
Daniel Veillardb8478642001-10-12 17:29:10 +0000999#undef xmlParserDebugEntities
1000int *
1001__xmlParserDebugEntities(void) {
1002 if (IS_MAIN_THREAD)
1003 return (&xmlParserDebugEntities);
1004 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001005 return (&xmlGetGlobalState()->xmlParserDebugEntities);
Daniel Veillardb8478642001-10-12 17:29:10 +00001006}
Daniel Veillard781ac8b2003-05-15 22:11:36 +00001007int xmlThrDefParserDebugEntities(int v) {
1008 int ret;
1009 xmlMutexLock(xmlThrDefMutex);
1010 ret = xmlParserDebugEntitiesThrDef;
1011 xmlParserDebugEntitiesThrDef = v;
1012 xmlMutexUnlock(xmlThrDefMutex);
1013 return ret;
1014}
Daniel Veillardb8478642001-10-12 17:29:10 +00001015
Daniel Veillardb8478642001-10-12 17:29:10 +00001016#undef xmlParserVersion
1017const char * *
1018__xmlParserVersion(void) {
1019 if (IS_MAIN_THREAD)
1020 return (&xmlParserVersion);
1021 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001022 return (&xmlGetGlobalState()->xmlParserVersion);
Daniel Veillardb8478642001-10-12 17:29:10 +00001023}
1024
Daniel Veillardb8478642001-10-12 17:29:10 +00001025#undef xmlPedanticParserDefaultValue
1026int *
1027__xmlPedanticParserDefaultValue(void) {
1028 if (IS_MAIN_THREAD)
1029 return (&xmlPedanticParserDefaultValue);
1030 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001031 return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +00001032}
Daniel Veillard781ac8b2003-05-15 22:11:36 +00001033int xmlThrDefPedanticParserDefaultValue(int v) {
1034 int ret;
1035 xmlMutexLock(xmlThrDefMutex);
1036 ret = xmlPedanticParserDefaultValueThrDef;
1037 xmlPedanticParserDefaultValueThrDef = v;
1038 xmlMutexUnlock(xmlThrDefMutex);
1039 return ret;
1040}
Daniel Veillardb8478642001-10-12 17:29:10 +00001041
Daniel Veillardb8478642001-10-12 17:29:10 +00001042#undef xmlSaveNoEmptyTags
1043int *
1044__xmlSaveNoEmptyTags(void) {
1045 if (IS_MAIN_THREAD)
1046 return (&xmlSaveNoEmptyTags);
1047 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001048 return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
Daniel Veillardb8478642001-10-12 17:29:10 +00001049}
Daniel Veillard781ac8b2003-05-15 22:11:36 +00001050int xmlThrDefSaveNoEmptyTags(int v) {
1051 int ret;
1052 xmlMutexLock(xmlThrDefMutex);
1053 ret = xmlSaveNoEmptyTagsThrDef;
1054 xmlSaveNoEmptyTagsThrDef = v;
1055 xmlMutexUnlock(xmlThrDefMutex);
1056 return ret;
1057}
Daniel Veillardb8478642001-10-12 17:29:10 +00001058
Daniel Veillardb8478642001-10-12 17:29:10 +00001059#undef xmlSubstituteEntitiesDefaultValue
1060int *
1061__xmlSubstituteEntitiesDefaultValue(void) {
1062 if (IS_MAIN_THREAD)
1063 return (&xmlSubstituteEntitiesDefaultValue);
1064 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001065 return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +00001066}
Daniel Veillard781ac8b2003-05-15 22:11:36 +00001067int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
1068 int ret;
1069 xmlMutexLock(xmlThrDefMutex);
1070 ret = xmlSubstituteEntitiesDefaultValueThrDef;
1071 xmlSubstituteEntitiesDefaultValueThrDef = v;
1072 xmlMutexUnlock(xmlThrDefMutex);
1073 return ret;
1074}
Daniel Veillard5335dc52003-01-01 20:59:38 +00001075
1076#undef xmlRegisterNodeDefaultValue
1077xmlRegisterNodeFunc *
1078__xmlRegisterNodeDefaultValue(void) {
1079 if (IS_MAIN_THREAD)
1080 return (&xmlRegisterNodeDefaultValue);
1081 else
1082 return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue);
1083}
1084
1085#undef xmlDeregisterNodeDefaultValue
1086xmlDeregisterNodeFunc *
1087__xmlDeregisterNodeDefaultValue(void) {
1088 if (IS_MAIN_THREAD)
1089 return (&xmlDeregisterNodeDefaultValue);
1090 else
1091 return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue);
1092}
Daniel Veillard0335a842004-06-02 16:18:40 +00001093
1094#undef xmlParserInputBufferCreateFilenameValue
1095xmlParserInputBufferCreateFilenameFunc *
1096__xmlParserInputBufferCreateFilenameValue(void) {
1097 if (IS_MAIN_THREAD)
1098 return (&xmlParserInputBufferCreateFilenameValue);
1099 else
1100 return (&xmlGetGlobalState()->xmlParserInputBufferCreateFilenameValue);
1101}
1102
1103#undef xmlOutputBufferCreateFilenameValue
1104xmlOutputBufferCreateFilenameFunc *
1105__xmlOutputBufferCreateFilenameValue(void) {
1106 if (IS_MAIN_THREAD)
1107 return (&xmlOutputBufferCreateFilenameValue);
1108 else
1109 return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue);
William M. Brack803812b2004-06-03 02:11:24 +00001110}
Daniel Veillard5d4644e2005-04-01 13:11:58 +00001111
1112#define bottom_globals
1113#include "elfgcchack.h"