blob: e351b03ff5c0098cb42dc9ef352c01d9eaf3758a [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{
Kai Henning2c212832009-10-12 22:30:32 +020049 if (xmlThrDefMutex == NULL)
MOD44d1eff2009-09-09 19:03:13 +020050 xmlThrDefMutex = xmlNewMutex();
Daniel Veillard781ac8b2003-05-15 22:11:36 +000051}
52
William M. Brack966668a2003-12-20 02:10:28 +000053/**
54 * xmlCleanupGlobals:
55 *
56 * Additional cleanup for multi-threading
57 */
Daniel Veillard75e389d2005-07-29 22:02:24 +000058void xmlCleanupGlobals(void)
Daniel Veillard781ac8b2003-05-15 22:11:36 +000059{
Daniel Veillard2009c4e2003-07-15 20:04:34 +000060 if (xmlThrDefMutex != NULL) {
Daniel Veillarddf101d82003-07-08 14:03:36 +000061 xmlFreeMutex(xmlThrDefMutex);
Daniel Veillard2009c4e2003-07-15 20:04:34 +000062 xmlThrDefMutex = NULL;
63 }
Daniel Veillardccc476f2008-03-04 13:19:49 +000064 __xmlGlobalInitMutexDestroy();
Daniel Veillard781ac8b2003-05-15 22:11:36 +000065}
66
Daniel Veillardb8478642001-10-12 17:29:10 +000067/************************************************************************
Daniel Veillardf8e3db02012-09-11 13:26:36 +080068 * *
Daniel Veillardb8478642001-10-12 17:29:10 +000069 * All the user accessible global variables of the library *
Daniel Veillardf8e3db02012-09-11 13:26:36 +080070 * *
Daniel Veillardb8478642001-10-12 17:29:10 +000071 ************************************************************************/
72
Daniel Veillardb8478642001-10-12 17:29:10 +000073/*
74 * Memory allocation routines
75 */
William M. Brack5ab479b2004-06-10 13:00:15 +000076#undef xmlFree
77#undef xmlMalloc
78#undef xmlMallocAtomic
79#undef xmlMemStrdup
80#undef xmlRealloc
81
Daniel Veillard7216cfd2002-11-08 15:10:00 +000082#if defined(DEBUG_MEMORY_LOCATION) || defined(DEBUG_MEMORY)
Daniel Veillardb8478642001-10-12 17:29:10 +000083xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
84xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +000085xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillardb8478642001-10-12 17:29:10 +000086xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
87xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
88#else
Daniel Veillard9d06d302002-01-22 18:15:52 +000089/**
90 * xmlFree:
91 * @mem: an already allocated block of memory
92 *
93 * The variable holding the libxml free() implementation
94 */
Daniel Veillardb8478642001-10-12 17:29:10 +000095xmlFreeFunc xmlFree = (xmlFreeFunc) free;
Daniel Veillard9d06d302002-01-22 18:15:52 +000096/**
97 * xmlMalloc:
98 * @size: the size requested in bytes
99 *
100 * The variable holding the libxml malloc() implementation
101 *
102 * Returns a pointer to the newly allocated block or NULL in case of error
103 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000104xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000105/**
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000106 * xmlMallocAtomic:
107 * @size: the size requested in bytes
108 *
109 * The variable holding the libxml malloc() implementation for atomic
110 * data (i.e. blocks not containings pointers), useful when using a
111 * garbage collecting allocator.
112 *
113 * Returns a pointer to the newly allocated block or NULL in case of error
114 */
115xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) malloc;
116/**
Daniel Veillard9d06d302002-01-22 18:15:52 +0000117 * xmlRealloc:
118 * @mem: an already allocated block of memory
119 * @size: the new size requested in bytes
120 *
121 * The variable holding the libxml realloc() implementation
122 *
123 * Returns a pointer to the newly reallocated block or NULL in case of error
124 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000125xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000126/**
127 * xmlMemStrdup:
128 * @str: a zero terminated string
129 *
130 * The variable holding the libxml strdup() implementation
131 *
132 * Returns the copy of the string or NULL in case of error
133 */
Daniel Veillardb82c1662001-12-09 14:00:54 +0000134xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000135#endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */
Daniel Veillardb8478642001-10-12 17:29:10 +0000136
Daniel Veillardd0463562001-10-13 09:15:48 +0000137#include <libxml/threads.h>
138#include <libxml/globals.h>
139#include <libxml/SAX.h>
140
141#undef docbDefaultSAXHandler
142#undef htmlDefaultSAXHandler
143#undef oldXMLWDcompatibility
144#undef xmlBufferAllocScheme
145#undef xmlDefaultBufferSize
146#undef xmlDefaultSAXHandler
147#undef xmlDefaultSAXLocator
148#undef xmlDoValidityCheckingDefaultValue
149#undef xmlGenericError
Daniel Veillard659e71e2003-10-10 14:10:40 +0000150#undef xmlStructuredError
Daniel Veillardd0463562001-10-13 09:15:48 +0000151#undef xmlGenericErrorContext
Wang Lam1de382e2009-08-24 17:34:25 +0200152#undef xmlStructuredErrorContext
Daniel Veillardd0463562001-10-13 09:15:48 +0000153#undef xmlGetWarningsDefaultValue
154#undef xmlIndentTreeOutput
Aleksey Sanin23002562002-05-24 07:18:40 +0000155#undef xmlTreeIndentString
Daniel Veillardd0463562001-10-13 09:15:48 +0000156#undef xmlKeepBlanksDefaultValue
157#undef xmlLineNumbersDefaultValue
158#undef xmlLoadExtDtdDefaultValue
159#undef xmlParserDebugEntities
160#undef xmlParserVersion
161#undef xmlPedanticParserDefaultValue
162#undef xmlSaveNoEmptyTags
163#undef xmlSubstituteEntitiesDefaultValue
Daniel Veillard8326e732003-01-07 00:19:07 +0000164#undef xmlRegisterNodeDefaultValue
165#undef xmlDeregisterNodeDefaultValue
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000166#undef xmlLastError
Daniel Veillardd0463562001-10-13 09:15:48 +0000167
Daniel Veillard0335a842004-06-02 16:18:40 +0000168#undef xmlParserInputBufferCreateFilenameValue
169#undef xmlOutputBufferCreateFilenameValue
Daniel Veillard9d06d302002-01-22 18:15:52 +0000170/**
171 * xmlParserVersion:
172 *
173 * Constant string describing the internal version of the library
174 */
William M. Brackf4025492004-08-18 21:08:46 +0000175const char *xmlParserVersion = LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA;
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000176
Daniel Veillard9d06d302002-01-22 18:15:52 +0000177/**
178 * xmlBufferAllocScheme:
179 *
180 * Global setting, default allocation policy for buffers, default is
181 * XML_BUFFER_ALLOC_EXACT
Daniel Veillardb8478642001-10-12 17:29:10 +0000182 */
183xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000184static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_EXACT;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000185/**
186 * xmlDefaultBufferSize:
187 *
188 * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
189 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000190int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000191static int xmlDefaultBufferSizeThrDef = BASE_BUFFER_SIZE;
Daniel Veillardb8478642001-10-12 17:29:10 +0000192
193/*
194 * Parser defaults
195 */
Daniel Veillardd0463562001-10-13 09:15:48 +0000196
Daniel Veillard9d06d302002-01-22 18:15:52 +0000197/**
198 * oldXMLWDcompatibility:
199 *
200 * Global setting, DEPRECATED.
201 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000202int oldXMLWDcompatibility = 0; /* DEPRECATED */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000203/**
204 * xmlParserDebugEntities:
205 *
206 * Global setting, asking the parser to print out debugging informations.
207 * while handling entities.
208 * Disabled by default
209 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000210int xmlParserDebugEntities = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000211static int xmlParserDebugEntitiesThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000212/**
213 * xmlDoValidityCheckingDefaultValue:
214 *
215 * Global setting, indicate that the parser should work in validating mode.
216 * Disabled by default.
217 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000218int xmlDoValidityCheckingDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000219static int xmlDoValidityCheckingDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000220/**
221 * xmlGetWarningsDefaultValue:
222 *
223 * Global setting, indicate that the parser should provide warnings.
224 * Activated by default.
225 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000226int xmlGetWarningsDefaultValue = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000227static int xmlGetWarningsDefaultValueThrDef = 1;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000228/**
229 * xmlLoadExtDtdDefaultValue:
230 *
231 * Global setting, indicate that the parser should load DTD while not
232 * validating.
233 * Disabled by default.
234 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000235int xmlLoadExtDtdDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000236static int xmlLoadExtDtdDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000237/**
238 * xmlPedanticParserDefaultValue:
239 *
240 * Global setting, indicate that the parser be pedantic
241 * Disabled by default.
242 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000243int xmlPedanticParserDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000244static int xmlPedanticParserDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000245/**
246 * xmlLineNumbersDefaultValue:
247 *
248 * Global setting, indicate that the parser should store the line number
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800249 * in the content field of elements in the DOM tree.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000250 * Disabled by default since this may not be safe for old classes of
251 * applicaton.
252 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000253int xmlLineNumbersDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000254static int xmlLineNumbersDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000255/**
256 * xmlKeepBlanksDefaultValue:
257 *
258 * Global setting, indicate that the parser should keep all blanks
259 * nodes found in the content
260 * Activated by default, this is actually needed to have the parser
261 * conformant to the XML Recommendation, however the option is kept
262 * for some applications since this was libxml1 default behaviour.
263 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000264int xmlKeepBlanksDefaultValue = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000265static int xmlKeepBlanksDefaultValueThrDef = 1;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000266/**
267 * xmlSubstituteEntitiesDefaultValue:
268 *
269 * Global setting, indicate that the parser should not generate entity
270 * references but replace them with the actual content of the entity
271 * Disabled by default, this should be activated when using XPath since
272 * the XPath data model requires entities replacement and the XPath
273 * engine does not handle entities references transparently.
274 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000275int xmlSubstituteEntitiesDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000276static int xmlSubstituteEntitiesDefaultValueThrDef = 0;
Daniel Veillardb8478642001-10-12 17:29:10 +0000277
Daniel Veillard5335dc52003-01-01 20:59:38 +0000278xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000279static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000280xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000281static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000282
Daniel Veillard0335a842004-06-02 16:18:40 +0000283xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue = NULL;
284static xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValueThrDef = NULL;
285
286xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue = NULL;
287static xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValueThrDef = NULL;
288
Daniel Veillardb8478642001-10-12 17:29:10 +0000289/*
290 * Error handling
291 */
292
293/* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
294/* Must initialize xmlGenericError in xmlInitParser */
Daniel Veillardffa3c742005-07-21 13:24:09 +0000295void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
Daniel Veillard635ef722001-10-29 11:48:19 +0000296 const char *msg,
297 ...);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000298/**
299 * xmlGenericError:
300 *
301 * Global setting: function used for generic error callbacks
302 */
Daniel Veillard635ef722001-10-29 11:48:19 +0000303xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000304static xmlGenericErrorFunc xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000305/**
Daniel Veillard659e71e2003-10-10 14:10:40 +0000306 * xmlStructuredError:
307 *
308 * Global setting: function used for structured error callbacks
309 */
310xmlStructuredErrorFunc xmlStructuredError = NULL;
311static xmlStructuredErrorFunc xmlStructuredErrorThrDef = NULL;
312/**
Daniel Veillard9d06d302002-01-22 18:15:52 +0000313 * xmlGenericErrorContext:
314 *
315 * Global setting passed to generic error callbacks
316 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000317void *xmlGenericErrorContext = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000318static void *xmlGenericErrorContextThrDef = NULL;
Wang Lam1de382e2009-08-24 17:34:25 +0200319/**
320 * xmlStructuredErrorContext:
321 *
322 * Global setting passed to structured error callbacks
323 */
324void *xmlStructuredErrorContext = NULL;
325static void *xmlStructuredErrorContextThrDef = NULL;
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000326xmlError xmlLastError;
Daniel Veillardb8478642001-10-12 17:29:10 +0000327
328/*
329 * output defaults
330 */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000331/**
332 * xmlIndentTreeOutput:
333 *
334 * Global setting, asking the serializer to indent the output tree by default
Aleksey Sanin23002562002-05-24 07:18:40 +0000335 * Enabled by default
Daniel Veillard9d06d302002-01-22 18:15:52 +0000336 */
Aleksey Sanin23002562002-05-24 07:18:40 +0000337int xmlIndentTreeOutput = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000338static int xmlIndentTreeOutputThrDef = 1;
Aleksey Sanin23002562002-05-24 07:18:40 +0000339
340/**
341 * xmlTreeIndentString:
342 *
343 * The string used to do one-level indent. By default is equal to " " (two spaces)
344 */
345const char *xmlTreeIndentString = " ";
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000346static const char *xmlTreeIndentStringThrDef = " ";
Aleksey Sanin23002562002-05-24 07:18:40 +0000347
Daniel Veillard9d06d302002-01-22 18:15:52 +0000348/**
349 * xmlSaveNoEmptyTags:
350 *
351 * Global setting, asking the serializer to not output empty tags
352 * as <empty/> but <empty></empty>. those two forms are undistinguishable
353 * once parsed.
354 * Disabled by default
355 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000356int xmlSaveNoEmptyTags = 0;
Daniel Veillard24505b02005-07-28 23:49:35 +0000357static int xmlSaveNoEmptyTagsThrDef = 0;
Daniel Veillardb8478642001-10-12 17:29:10 +0000358
Daniel Veillard81273902003-09-30 00:43:48 +0000359#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000360/**
361 * xmlDefaultSAXHandler:
362 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000363 * Default SAX version1 handler for XML, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000364 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000365xmlSAXHandlerV1 xmlDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000366 xmlSAX2InternalSubset,
367 xmlSAX2IsStandalone,
368 xmlSAX2HasInternalSubset,
369 xmlSAX2HasExternalSubset,
370 xmlSAX2ResolveEntity,
371 xmlSAX2GetEntity,
372 xmlSAX2EntityDecl,
373 xmlSAX2NotationDecl,
374 xmlSAX2AttributeDecl,
375 xmlSAX2ElementDecl,
376 xmlSAX2UnparsedEntityDecl,
377 xmlSAX2SetDocumentLocator,
378 xmlSAX2StartDocument,
379 xmlSAX2EndDocument,
380 xmlSAX2StartElement,
381 xmlSAX2EndElement,
382 xmlSAX2Reference,
383 xmlSAX2Characters,
384 xmlSAX2Characters,
385 xmlSAX2ProcessingInstruction,
386 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000387 xmlParserWarning,
388 xmlParserError,
389 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000390 xmlSAX2GetParameterEntity,
391 xmlSAX2CDataBlock,
392 xmlSAX2ExternalSubset,
393 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000394};
Daniel Veillard81273902003-09-30 00:43:48 +0000395#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillardb8478642001-10-12 17:29:10 +0000396
Daniel Veillard9d06d302002-01-22 18:15:52 +0000397/**
398 * xmlDefaultSAXLocator:
399 *
400 * The default SAX Locator
401 * { getPublicId, getSystemId, getLineNumber, getColumnNumber}
Daniel Veillardb8478642001-10-12 17:29:10 +0000402 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000403xmlSAXLocator xmlDefaultSAXLocator = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000404 xmlSAX2GetPublicId,
405 xmlSAX2GetSystemId,
406 xmlSAX2GetLineNumber,
407 xmlSAX2GetColumnNumber
Daniel Veillardb8478642001-10-12 17:29:10 +0000408};
409
410#ifdef LIBXML_HTML_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000411/**
412 * htmlDefaultSAXHandler:
413 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000414 * Default old SAX v1 handler for HTML, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000415 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000416xmlSAXHandlerV1 htmlDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000417 xmlSAX2InternalSubset,
Daniel Veillardb8478642001-10-12 17:29:10 +0000418 NULL,
419 NULL,
420 NULL,
421 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000422 xmlSAX2GetEntity,
Daniel Veillardb8478642001-10-12 17:29:10 +0000423 NULL,
424 NULL,
425 NULL,
426 NULL,
427 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000428 xmlSAX2SetDocumentLocator,
429 xmlSAX2StartDocument,
430 xmlSAX2EndDocument,
431 xmlSAX2StartElement,
432 xmlSAX2EndElement,
Daniel Veillardb8478642001-10-12 17:29:10 +0000433 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000434 xmlSAX2Characters,
435 xmlSAX2IgnorableWhitespace,
Daniel Veillardfc484dd2004-10-22 14:34:23 +0000436 xmlSAX2ProcessingInstruction,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000437 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000438 xmlParserWarning,
439 xmlParserError,
440 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000441 xmlSAX2GetParameterEntity,
442 xmlSAX2CDataBlock,
Daniel Veillardb8478642001-10-12 17:29:10 +0000443 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000444 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000445};
446#endif /* LIBXML_HTML_ENABLED */
447
448#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000449/**
450 * docbDefaultSAXHandler:
451 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000452 * Default old SAX v1 handler for SGML DocBook, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000453 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000454xmlSAXHandlerV1 docbDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000455 xmlSAX2InternalSubset,
456 xmlSAX2IsStandalone,
457 xmlSAX2HasInternalSubset,
458 xmlSAX2HasExternalSubset,
459 xmlSAX2ResolveEntity,
460 xmlSAX2GetEntity,
461 xmlSAX2EntityDecl,
Daniel Veillardb8478642001-10-12 17:29:10 +0000462 NULL,
463 NULL,
464 NULL,
465 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000466 xmlSAX2SetDocumentLocator,
467 xmlSAX2StartDocument,
468 xmlSAX2EndDocument,
469 xmlSAX2StartElement,
470 xmlSAX2EndElement,
471 xmlSAX2Reference,
472 xmlSAX2Characters,
473 xmlSAX2IgnorableWhitespace,
Daniel Veillardb8478642001-10-12 17:29:10 +0000474 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000475 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000476 xmlParserWarning,
477 xmlParserError,
478 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000479 xmlSAX2GetParameterEntity,
Daniel Veillardb8478642001-10-12 17:29:10 +0000480 NULL,
481 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000482 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000483};
484#endif /* LIBXML_DOCB_ENABLED */
485
486/**
487 * xmlInitializeGlobalState:
488 * @gs: a pointer to a newly allocated global state
489 *
490 * xmlInitializeGlobalState() initialize a global state with all the
491 * default values of the library.
492 */
493void
494xmlInitializeGlobalState(xmlGlobalStatePtr gs)
495{
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000496#ifdef DEBUG_GLOBALS
497 fprintf(stderr, "Initializing globals at %lu for thread %d\n",
498 (unsigned long) gs, xmlGetThreadId());
499#endif
500
Daniel Veillardb8478642001-10-12 17:29:10 +0000501 /*
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000502 * Perform initialization as required by libxml
Daniel Veillardb8478642001-10-12 17:29:10 +0000503 */
Daniel Veillard5805be22003-08-28 08:03:23 +0000504 if (xmlThrDefMutex == NULL)
505 xmlInitGlobals();
506
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000507 xmlMutexLock(xmlThrDefMutex);
William M. Brack8b2c7f12002-11-22 05:07:29 +0000508
Daniel Veillardbca3ad22005-08-23 22:14:02 +0000509#if defined(LIBXML_DOCB_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
Daniel Veillard092643b2003-09-25 14:29:29 +0000510 initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000511#endif
Akira TAGOH961b5352012-07-03 14:13:59 +0900512#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
Daniel Veillard092643b2003-09-25 14:29:29 +0000513 inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000514#endif
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000515
Daniel Veillardb8478642001-10-12 17:29:10 +0000516 gs->oldXMLWDcompatibility = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000517 gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
518 gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;
William M. Brack21e4ef22005-01-02 09:53:13 +0000519#if defined(LIBXML_SAX1_ENABLED) && defined(LIBXML_LEGACY_ENABLED)
Daniel Veillard092643b2003-09-25 14:29:29 +0000520 initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
Daniel Veillard81273902003-09-30 00:43:48 +0000521#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillard4432df22003-09-28 18:58:27 +0000522 gs->xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId;
523 gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
524 gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
525 gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800526 gs->xmlDoValidityCheckingDefaultValue =
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000527 xmlDoValidityCheckingDefaultValueThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000528#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
529 gs->xmlFree = (xmlFreeFunc) xmlMemFree;
530 gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000531 gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000532 gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
533 gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
534#else
535 gs->xmlFree = (xmlFreeFunc) free;
536 gs->xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000537 gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000538 gs->xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard572577e2002-01-18 16:23:55 +0000539 gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillardb8478642001-10-12 17:29:10 +0000540#endif
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000541 gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
542 gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
543 gs->xmlTreeIndentString = xmlTreeIndentStringThrDef;
544 gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
545 gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
546 gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
547 gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000548 gs->xmlParserVersion = LIBXML_VERSION_STRING;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000549 gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
550 gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800551 gs->xmlSubstituteEntitiesDefaultValue =
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000552 xmlSubstituteEntitiesDefaultValueThrDef;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000553
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000554 gs->xmlGenericError = xmlGenericErrorThrDef;
Daniel Veillard659e71e2003-10-10 14:10:40 +0000555 gs->xmlStructuredError = xmlStructuredErrorThrDef;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000556 gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
Wang Lam1de382e2009-08-24 17:34:25 +0200557 gs->xmlStructuredErrorContext = xmlStructuredErrorContextThrDef;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000558 gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
559 gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
Daniel Veillard0335a842004-06-02 16:18:40 +0000560
561 gs->xmlParserInputBufferCreateFilenameValue = xmlParserInputBufferCreateFilenameValueThrDef;
562 gs->xmlOutputBufferCreateFilenameValue = xmlOutputBufferCreateFilenameValueThrDef;
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000563 memset(&gs->xmlLastError, 0, sizeof(xmlError));
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000564
565 xmlMutexUnlock(xmlThrDefMutex);
566}
567
Daniel Veillard1e906612003-12-05 14:57:46 +0000568/**
569 * DOC_DISABLE : we ignore missing doc for the xmlThrDef functions,
570 * those are really internal work
571 */
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000572void
573xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
574 xmlMutexLock(xmlThrDefMutex);
575 xmlGenericErrorContextThrDef = ctx;
576 if (handler != NULL)
577 xmlGenericErrorThrDef = handler;
578 else
579 xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
580 xmlMutexUnlock(xmlThrDefMutex);
Daniel Veillardb8478642001-10-12 17:29:10 +0000581}
582
Daniel Veillard659e71e2003-10-10 14:10:40 +0000583void
584xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
585 xmlMutexLock(xmlThrDefMutex);
Wang Lam1de382e2009-08-24 17:34:25 +0200586 xmlStructuredErrorContextThrDef = ctx;
Daniel Veillard659e71e2003-10-10 14:10:40 +0000587 xmlStructuredErrorThrDef = handler;
588 xmlMutexUnlock(xmlThrDefMutex);
589}
590
Daniel Veillard5335dc52003-01-01 20:59:38 +0000591/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000592 * xmlRegisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000593 * @func: function pointer to the new RegisterNodeFunc
594 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000595 * Registers a callback for node creation
596 *
597 * Returns the old value of the registration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000598 */
599xmlRegisterNodeFunc
600xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
601{
602 xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue;
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800603
Daniel Veillarda880b122003-04-21 21:36:41 +0000604 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000605 xmlRegisterNodeDefaultValue = func;
606 return(old);
607}
608
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000609xmlRegisterNodeFunc
610xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
611{
612 xmlRegisterNodeFunc old;
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800613
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000614 xmlMutexLock(xmlThrDefMutex);
615 old = xmlRegisterNodeDefaultValueThrDef;
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800616
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000617 __xmlRegisterCallbacks = 1;
618 xmlRegisterNodeDefaultValueThrDef = func;
619 xmlMutexUnlock(xmlThrDefMutex);
620
621 return(old);
622}
623
Daniel Veillard5335dc52003-01-01 20:59:38 +0000624/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000625 * xmlDeregisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000626 * @func: function pointer to the new DeregisterNodeFunc
627 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000628 * Registers a callback for node destruction
629 *
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000630 * Returns the previous value of the deregistration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000631 */
632xmlDeregisterNodeFunc
633xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
634{
635 xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue;
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800636
Daniel Veillarda880b122003-04-21 21:36:41 +0000637 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000638 xmlDeregisterNodeDefaultValue = func;
639 return(old);
640}
641
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000642xmlDeregisterNodeFunc
643xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
644{
645 xmlDeregisterNodeFunc old;
646
647 xmlMutexLock(xmlThrDefMutex);
648 old = xmlDeregisterNodeDefaultValueThrDef;
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800649
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000650 __xmlRegisterCallbacks = 1;
651 xmlDeregisterNodeDefaultValueThrDef = func;
652 xmlMutexUnlock(xmlThrDefMutex);
653
654 return(old);
655}
656
Daniel Veillard0335a842004-06-02 16:18:40 +0000657xmlParserInputBufferCreateFilenameFunc
658xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
659{
660 xmlParserInputBufferCreateFilenameFunc old;
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800661
Daniel Veillard0335a842004-06-02 16:18:40 +0000662 xmlMutexLock(xmlThrDefMutex);
663 old = xmlParserInputBufferCreateFilenameValueThrDef;
Daniel Veillard1b243b42004-06-08 10:16:42 +0000664 if (old == NULL) {
665 old = __xmlParserInputBufferCreateFilename;
666 }
667
Daniel Veillard0335a842004-06-02 16:18:40 +0000668 xmlParserInputBufferCreateFilenameValueThrDef = func;
669 xmlMutexUnlock(xmlThrDefMutex);
670
671 return(old);
672}
673
Daniel Veillard0335a842004-06-02 16:18:40 +0000674xmlOutputBufferCreateFilenameFunc
675xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
676{
677 xmlOutputBufferCreateFilenameFunc old;
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800678
Daniel Veillard0335a842004-06-02 16:18:40 +0000679 xmlMutexLock(xmlThrDefMutex);
680 old = xmlOutputBufferCreateFilenameValueThrDef;
Daniel Veillard1b243b42004-06-08 10:16:42 +0000681#ifdef LIBXML_OUTPUT_ENABLED
682 if (old == NULL) {
683 old = __xmlOutputBufferCreateFilename;
684 }
685#endif
Daniel Veillard0335a842004-06-02 16:18:40 +0000686 xmlOutputBufferCreateFilenameValueThrDef = func;
687 xmlMutexUnlock(xmlThrDefMutex);
688
689 return(old);
690}
Daniel Veillard5335dc52003-01-01 20:59:38 +0000691
Daniel Veillarda4617b82001-11-04 20:19:12 +0000692#ifdef LIBXML_DOCB_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000693#undef docbDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000694xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000695__docbDefaultSAXHandler(void) {
696 if (IS_MAIN_THREAD)
697 return (&docbDefaultSAXHandler);
698 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000699 return (&xmlGetGlobalState()->docbDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000700}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000701#endif
Daniel Veillardb8478642001-10-12 17:29:10 +0000702
Daniel Veillarda4617b82001-11-04 20:19:12 +0000703#ifdef LIBXML_HTML_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000704#undef htmlDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000705xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000706__htmlDefaultSAXHandler(void) {
707 if (IS_MAIN_THREAD)
708 return (&htmlDefaultSAXHandler);
709 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000710 return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000711}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000712#endif
713
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000714#undef xmlLastError
715xmlError *
716__xmlLastError(void) {
717 if (IS_MAIN_THREAD)
718 return (&xmlLastError);
719 else
720 return (&xmlGetGlobalState()->xmlLastError);
721}
722
Daniel Veillarda4617b82001-11-04 20:19:12 +0000723/*
William M. Brack5ab479b2004-06-10 13:00:15 +0000724 * The following memory routines were apparently lost at some point,
725 * and were re-inserted at this point on June 10, 2004. Hope it's
726 * the right place for them :-)
727 */
728#if defined(LIBXML_THREAD_ALLOC_ENABLED) && defined(LIBXML_THREAD_ENABLED)
729#undef xmlMalloc
730xmlMallocFunc *
731__xmlMalloc(void){
732 if (IS_MAIN_THREAD)
733 return (&xmlMalloc);
734 else
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800735 return (&xmlGetGlobalState()->xmlMalloc);
William M. Brack5ab479b2004-06-10 13:00:15 +0000736}
737
738#undef xmlMallocAtomic
739xmlMallocFunc *
740__xmlMallocAtomic(void){
741 if (IS_MAIN_THREAD)
742 return (&xmlMallocAtomic);
743 else
744 return (&xmlGetGlobalState()->xmlMallocAtomic);
745}
746
747#undef xmlRealloc
748xmlReallocFunc *
749__xmlRealloc(void){
750 if (IS_MAIN_THREAD)
751 return (&xmlRealloc);
752 else
753 return (&xmlGetGlobalState()->xmlRealloc);
754}
755
756#undef xmlFree
757xmlFreeFunc *
758__xmlFree(void){
759 if (IS_MAIN_THREAD)
760 return (&xmlFree);
761 else
762 return (&xmlGetGlobalState()->xmlFree);
763}
764
765xmlStrdupFunc *
766__xmlMemStrdup(void){
767 if (IS_MAIN_THREAD)
768 return (&xmlMemStrdup);
769 else
770 return (&xmlGetGlobalState()->xmlMemStrdup);
771}
772
773#endif
774
775/*
Daniel Veillarda4617b82001-11-04 20:19:12 +0000776 * Everything starting from the line below is
777 * Automatically generated by build_glob.py.
778 * Do not modify the previous line.
779 */
780
Daniel Veillardb8478642001-10-12 17:29:10 +0000781
Daniel Veillardb8478642001-10-12 17:29:10 +0000782#undef oldXMLWDcompatibility
783int *
784__oldXMLWDcompatibility(void) {
785 if (IS_MAIN_THREAD)
786 return (&oldXMLWDcompatibility);
787 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000788 return (&xmlGetGlobalState()->oldXMLWDcompatibility);
Daniel Veillardb8478642001-10-12 17:29:10 +0000789}
790
Daniel Veillardb8478642001-10-12 17:29:10 +0000791#undef xmlBufferAllocScheme
792xmlBufferAllocationScheme *
793__xmlBufferAllocScheme(void) {
794 if (IS_MAIN_THREAD)
795 return (&xmlBufferAllocScheme);
796 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000797 return (&xmlGetGlobalState()->xmlBufferAllocScheme);
Daniel Veillardb8478642001-10-12 17:29:10 +0000798}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000799xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
800 xmlBufferAllocationScheme ret;
801 xmlMutexLock(xmlThrDefMutex);
802 ret = xmlBufferAllocSchemeThrDef;
803 xmlBufferAllocSchemeThrDef = v;
804 xmlMutexUnlock(xmlThrDefMutex);
805 return ret;
806}
Daniel Veillardb8478642001-10-12 17:29:10 +0000807
Daniel Veillardb8478642001-10-12 17:29:10 +0000808#undef xmlDefaultBufferSize
809int *
810__xmlDefaultBufferSize(void) {
811 if (IS_MAIN_THREAD)
812 return (&xmlDefaultBufferSize);
813 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000814 return (&xmlGetGlobalState()->xmlDefaultBufferSize);
Daniel Veillardb8478642001-10-12 17:29:10 +0000815}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000816int xmlThrDefDefaultBufferSize(int v) {
817 int ret;
818 xmlMutexLock(xmlThrDefMutex);
819 ret = xmlDefaultBufferSizeThrDef;
820 xmlDefaultBufferSizeThrDef = v;
821 xmlMutexUnlock(xmlThrDefMutex);
822 return ret;
823}
Daniel Veillardb8478642001-10-12 17:29:10 +0000824
Daniel Veillard81273902003-09-30 00:43:48 +0000825#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000826#undef xmlDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000827xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000828__xmlDefaultSAXHandler(void) {
829 if (IS_MAIN_THREAD)
830 return (&xmlDefaultSAXHandler);
831 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000832 return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000833}
Daniel Veillard81273902003-09-30 00:43:48 +0000834#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillardb8478642001-10-12 17:29:10 +0000835
Daniel Veillardb8478642001-10-12 17:29:10 +0000836#undef xmlDefaultSAXLocator
837xmlSAXLocator *
838__xmlDefaultSAXLocator(void) {
839 if (IS_MAIN_THREAD)
840 return (&xmlDefaultSAXLocator);
841 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000842 return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
Daniel Veillardb8478642001-10-12 17:29:10 +0000843}
844
Daniel Veillardb8478642001-10-12 17:29:10 +0000845#undef xmlDoValidityCheckingDefaultValue
846int *
847__xmlDoValidityCheckingDefaultValue(void) {
848 if (IS_MAIN_THREAD)
849 return (&xmlDoValidityCheckingDefaultValue);
850 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000851 return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000852}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000853int xmlThrDefDoValidityCheckingDefaultValue(int v) {
854 int ret;
855 xmlMutexLock(xmlThrDefMutex);
856 ret = xmlDoValidityCheckingDefaultValueThrDef;
857 xmlDoValidityCheckingDefaultValueThrDef = v;
858 xmlMutexUnlock(xmlThrDefMutex);
859 return ret;
860}
Daniel Veillardb8478642001-10-12 17:29:10 +0000861
Daniel Veillardb8478642001-10-12 17:29:10 +0000862#undef xmlGenericError
863xmlGenericErrorFunc *
864__xmlGenericError(void) {
865 if (IS_MAIN_THREAD)
866 return (&xmlGenericError);
867 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000868 return (&xmlGetGlobalState()->xmlGenericError);
Daniel Veillardb8478642001-10-12 17:29:10 +0000869}
870
Daniel Veillard659e71e2003-10-10 14:10:40 +0000871#undef xmlStructuredError
872xmlStructuredErrorFunc *
873__xmlStructuredError(void) {
874 if (IS_MAIN_THREAD)
875 return (&xmlStructuredError);
876 else
877 return (&xmlGetGlobalState()->xmlStructuredError);
878}
879
Daniel Veillardb8478642001-10-12 17:29:10 +0000880#undef xmlGenericErrorContext
881void * *
882__xmlGenericErrorContext(void) {
883 if (IS_MAIN_THREAD)
884 return (&xmlGenericErrorContext);
885 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000886 return (&xmlGetGlobalState()->xmlGenericErrorContext);
Daniel Veillardb8478642001-10-12 17:29:10 +0000887}
888
Wang Lam1de382e2009-08-24 17:34:25 +0200889#undef xmlStructuredErrorContext
890void * *
891__xmlStructuredErrorContext(void) {
892 if (IS_MAIN_THREAD)
893 return (&xmlStructuredErrorContext);
894 else
895 return (&xmlGetGlobalState()->xmlStructuredErrorContext);
896}
897
Daniel Veillardb8478642001-10-12 17:29:10 +0000898#undef xmlGetWarningsDefaultValue
899int *
900__xmlGetWarningsDefaultValue(void) {
901 if (IS_MAIN_THREAD)
902 return (&xmlGetWarningsDefaultValue);
903 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000904 return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000905}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000906int xmlThrDefGetWarningsDefaultValue(int v) {
907 int ret;
908 xmlMutexLock(xmlThrDefMutex);
909 ret = xmlGetWarningsDefaultValueThrDef;
910 xmlGetWarningsDefaultValueThrDef = v;
911 xmlMutexUnlock(xmlThrDefMutex);
912 return ret;
913}
Daniel Veillardb8478642001-10-12 17:29:10 +0000914
Daniel Veillardb8478642001-10-12 17:29:10 +0000915#undef xmlIndentTreeOutput
916int *
917__xmlIndentTreeOutput(void) {
918 if (IS_MAIN_THREAD)
919 return (&xmlIndentTreeOutput);
920 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000921 return (&xmlGetGlobalState()->xmlIndentTreeOutput);
Daniel Veillardb8478642001-10-12 17:29:10 +0000922}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000923int xmlThrDefIndentTreeOutput(int v) {
924 int ret;
925 xmlMutexLock(xmlThrDefMutex);
926 ret = xmlIndentTreeOutputThrDef;
927 xmlIndentTreeOutputThrDef = v;
928 xmlMutexUnlock(xmlThrDefMutex);
929 return ret;
930}
Daniel Veillardb8478642001-10-12 17:29:10 +0000931
Wang Lam1de382e2009-08-24 17:34:25 +0200932#undef xmlTreeIndentString
Aleksey Sanin23002562002-05-24 07:18:40 +0000933const char * *
934__xmlTreeIndentString(void) {
935 if (IS_MAIN_THREAD)
936 return (&xmlTreeIndentString);
937 else
938 return (&xmlGetGlobalState()->xmlTreeIndentString);
939}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000940const char * xmlThrDefTreeIndentString(const char * v) {
941 const char * ret;
942 xmlMutexLock(xmlThrDefMutex);
943 ret = xmlTreeIndentStringThrDef;
944 xmlTreeIndentStringThrDef = v;
945 xmlMutexUnlock(xmlThrDefMutex);
946 return ret;
947}
Aleksey Sanin23002562002-05-24 07:18:40 +0000948
Daniel Veillardb8478642001-10-12 17:29:10 +0000949#undef xmlKeepBlanksDefaultValue
950int *
951__xmlKeepBlanksDefaultValue(void) {
952 if (IS_MAIN_THREAD)
953 return (&xmlKeepBlanksDefaultValue);
954 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000955 return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000956}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000957int xmlThrDefKeepBlanksDefaultValue(int v) {
958 int ret;
959 xmlMutexLock(xmlThrDefMutex);
960 ret = xmlKeepBlanksDefaultValueThrDef;
961 xmlKeepBlanksDefaultValueThrDef = v;
962 xmlMutexUnlock(xmlThrDefMutex);
963 return ret;
964}
Daniel Veillardb8478642001-10-12 17:29:10 +0000965
Daniel Veillardb8478642001-10-12 17:29:10 +0000966#undef xmlLineNumbersDefaultValue
967int *
968__xmlLineNumbersDefaultValue(void) {
969 if (IS_MAIN_THREAD)
970 return (&xmlLineNumbersDefaultValue);
971 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000972 return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000973}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000974int xmlThrDefLineNumbersDefaultValue(int v) {
975 int ret;
976 xmlMutexLock(xmlThrDefMutex);
977 ret = xmlLineNumbersDefaultValueThrDef;
978 xmlLineNumbersDefaultValueThrDef = v;
979 xmlMutexUnlock(xmlThrDefMutex);
980 return ret;
981}
Daniel Veillardb8478642001-10-12 17:29:10 +0000982
Daniel Veillardb8478642001-10-12 17:29:10 +0000983#undef xmlLoadExtDtdDefaultValue
984int *
985__xmlLoadExtDtdDefaultValue(void) {
986 if (IS_MAIN_THREAD)
987 return (&xmlLoadExtDtdDefaultValue);
988 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000989 return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000990}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000991int xmlThrDefLoadExtDtdDefaultValue(int v) {
992 int ret;
993 xmlMutexLock(xmlThrDefMutex);
994 ret = xmlLoadExtDtdDefaultValueThrDef;
995 xmlLoadExtDtdDefaultValueThrDef = v;
996 xmlMutexUnlock(xmlThrDefMutex);
997 return ret;
998}
Daniel Veillardb8478642001-10-12 17:29:10 +0000999
Daniel Veillardb8478642001-10-12 17:29:10 +00001000#undef xmlParserDebugEntities
1001int *
1002__xmlParserDebugEntities(void) {
1003 if (IS_MAIN_THREAD)
1004 return (&xmlParserDebugEntities);
1005 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001006 return (&xmlGetGlobalState()->xmlParserDebugEntities);
Daniel Veillardb8478642001-10-12 17:29:10 +00001007}
Daniel Veillard781ac8b2003-05-15 22:11:36 +00001008int xmlThrDefParserDebugEntities(int v) {
1009 int ret;
1010 xmlMutexLock(xmlThrDefMutex);
1011 ret = xmlParserDebugEntitiesThrDef;
1012 xmlParserDebugEntitiesThrDef = v;
1013 xmlMutexUnlock(xmlThrDefMutex);
1014 return ret;
1015}
Daniel Veillardb8478642001-10-12 17:29:10 +00001016
Daniel Veillardb8478642001-10-12 17:29:10 +00001017#undef xmlParserVersion
1018const char * *
1019__xmlParserVersion(void) {
1020 if (IS_MAIN_THREAD)
1021 return (&xmlParserVersion);
1022 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001023 return (&xmlGetGlobalState()->xmlParserVersion);
Daniel Veillardb8478642001-10-12 17:29:10 +00001024}
1025
Daniel Veillardb8478642001-10-12 17:29:10 +00001026#undef xmlPedanticParserDefaultValue
1027int *
1028__xmlPedanticParserDefaultValue(void) {
1029 if (IS_MAIN_THREAD)
1030 return (&xmlPedanticParserDefaultValue);
1031 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001032 return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +00001033}
Daniel Veillard781ac8b2003-05-15 22:11:36 +00001034int xmlThrDefPedanticParserDefaultValue(int v) {
1035 int ret;
1036 xmlMutexLock(xmlThrDefMutex);
1037 ret = xmlPedanticParserDefaultValueThrDef;
1038 xmlPedanticParserDefaultValueThrDef = v;
1039 xmlMutexUnlock(xmlThrDefMutex);
1040 return ret;
1041}
Daniel Veillardb8478642001-10-12 17:29:10 +00001042
Daniel Veillardb8478642001-10-12 17:29:10 +00001043#undef xmlSaveNoEmptyTags
1044int *
1045__xmlSaveNoEmptyTags(void) {
1046 if (IS_MAIN_THREAD)
1047 return (&xmlSaveNoEmptyTags);
1048 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001049 return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
Daniel Veillardb8478642001-10-12 17:29:10 +00001050}
Daniel Veillard781ac8b2003-05-15 22:11:36 +00001051int xmlThrDefSaveNoEmptyTags(int v) {
1052 int ret;
1053 xmlMutexLock(xmlThrDefMutex);
1054 ret = xmlSaveNoEmptyTagsThrDef;
1055 xmlSaveNoEmptyTagsThrDef = v;
1056 xmlMutexUnlock(xmlThrDefMutex);
1057 return ret;
1058}
Daniel Veillardb8478642001-10-12 17:29:10 +00001059
Daniel Veillardb8478642001-10-12 17:29:10 +00001060#undef xmlSubstituteEntitiesDefaultValue
1061int *
1062__xmlSubstituteEntitiesDefaultValue(void) {
1063 if (IS_MAIN_THREAD)
1064 return (&xmlSubstituteEntitiesDefaultValue);
1065 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001066 return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +00001067}
Daniel Veillard781ac8b2003-05-15 22:11:36 +00001068int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
1069 int ret;
1070 xmlMutexLock(xmlThrDefMutex);
1071 ret = xmlSubstituteEntitiesDefaultValueThrDef;
1072 xmlSubstituteEntitiesDefaultValueThrDef = v;
1073 xmlMutexUnlock(xmlThrDefMutex);
1074 return ret;
1075}
Daniel Veillard5335dc52003-01-01 20:59:38 +00001076
1077#undef xmlRegisterNodeDefaultValue
1078xmlRegisterNodeFunc *
1079__xmlRegisterNodeDefaultValue(void) {
1080 if (IS_MAIN_THREAD)
1081 return (&xmlRegisterNodeDefaultValue);
1082 else
1083 return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue);
1084}
1085
1086#undef xmlDeregisterNodeDefaultValue
1087xmlDeregisterNodeFunc *
1088__xmlDeregisterNodeDefaultValue(void) {
1089 if (IS_MAIN_THREAD)
1090 return (&xmlDeregisterNodeDefaultValue);
1091 else
1092 return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue);
1093}
Daniel Veillard0335a842004-06-02 16:18:40 +00001094
1095#undef xmlParserInputBufferCreateFilenameValue
1096xmlParserInputBufferCreateFilenameFunc *
1097__xmlParserInputBufferCreateFilenameValue(void) {
1098 if (IS_MAIN_THREAD)
1099 return (&xmlParserInputBufferCreateFilenameValue);
1100 else
1101 return (&xmlGetGlobalState()->xmlParserInputBufferCreateFilenameValue);
1102}
1103
1104#undef xmlOutputBufferCreateFilenameValue
1105xmlOutputBufferCreateFilenameFunc *
1106__xmlOutputBufferCreateFilenameValue(void) {
1107 if (IS_MAIN_THREAD)
1108 return (&xmlOutputBufferCreateFilenameValue);
1109 else
1110 return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue);
William M. Brack803812b2004-06-03 02:11:24 +00001111}
Daniel Veillard5d4644e2005-04-01 13:11:58 +00001112
1113#define bottom_globals
1114#include "elfgcchack.h"