blob: 38bf0f0e2c74b026be1dfb6fa00101ef9572a3dc [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 Veillard781ac8b2003-05-15 22:11:36 +000063}
64
Daniel Veillardb8478642001-10-12 17:29:10 +000065/************************************************************************
66 * *
67 * All the user accessible global variables of the library *
68 * *
69 ************************************************************************/
70
Daniel Veillardb8478642001-10-12 17:29:10 +000071/*
72 * Memory allocation routines
73 */
William M. Brack5ab479b2004-06-10 13:00:15 +000074#undef xmlFree
75#undef xmlMalloc
76#undef xmlMallocAtomic
77#undef xmlMemStrdup
78#undef xmlRealloc
79
Daniel Veillard7216cfd2002-11-08 15:10:00 +000080#if defined(DEBUG_MEMORY_LOCATION) || defined(DEBUG_MEMORY)
Daniel Veillardb8478642001-10-12 17:29:10 +000081xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
82xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +000083xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillardb8478642001-10-12 17:29:10 +000084xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
85xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
86#else
Daniel Veillard9d06d302002-01-22 18:15:52 +000087/**
88 * xmlFree:
89 * @mem: an already allocated block of memory
90 *
91 * The variable holding the libxml free() implementation
92 */
Daniel Veillardb8478642001-10-12 17:29:10 +000093xmlFreeFunc xmlFree = (xmlFreeFunc) free;
Daniel Veillard9d06d302002-01-22 18:15:52 +000094/**
95 * xmlMalloc:
96 * @size: the size requested in bytes
97 *
98 * The variable holding the libxml malloc() implementation
99 *
100 * Returns a pointer to the newly allocated block or NULL in case of error
101 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000102xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000103/**
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000104 * xmlMallocAtomic:
105 * @size: the size requested in bytes
106 *
107 * The variable holding the libxml malloc() implementation for atomic
108 * data (i.e. blocks not containings pointers), useful when using a
109 * garbage collecting allocator.
110 *
111 * Returns a pointer to the newly allocated block or NULL in case of error
112 */
113xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) malloc;
114/**
Daniel Veillard9d06d302002-01-22 18:15:52 +0000115 * xmlRealloc:
116 * @mem: an already allocated block of memory
117 * @size: the new size requested in bytes
118 *
119 * The variable holding the libxml realloc() implementation
120 *
121 * Returns a pointer to the newly reallocated block or NULL in case of error
122 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000123xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000124/**
125 * xmlMemStrdup:
126 * @str: a zero terminated string
127 *
128 * The variable holding the libxml strdup() implementation
129 *
130 * Returns the copy of the string or NULL in case of error
131 */
Daniel Veillardb82c1662001-12-09 14:00:54 +0000132xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000133#endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */
Daniel Veillardb8478642001-10-12 17:29:10 +0000134
Daniel Veillardd0463562001-10-13 09:15:48 +0000135#include <libxml/threads.h>
136#include <libxml/globals.h>
137#include <libxml/SAX.h>
138
139#undef docbDefaultSAXHandler
140#undef htmlDefaultSAXHandler
141#undef oldXMLWDcompatibility
142#undef xmlBufferAllocScheme
143#undef xmlDefaultBufferSize
144#undef xmlDefaultSAXHandler
145#undef xmlDefaultSAXLocator
146#undef xmlDoValidityCheckingDefaultValue
147#undef xmlGenericError
Daniel Veillard659e71e2003-10-10 14:10:40 +0000148#undef xmlStructuredError
Daniel Veillardd0463562001-10-13 09:15:48 +0000149#undef xmlGenericErrorContext
150#undef xmlGetWarningsDefaultValue
151#undef xmlIndentTreeOutput
Aleksey Sanin23002562002-05-24 07:18:40 +0000152#undef xmlTreeIndentString
Daniel Veillardd0463562001-10-13 09:15:48 +0000153#undef xmlKeepBlanksDefaultValue
154#undef xmlLineNumbersDefaultValue
155#undef xmlLoadExtDtdDefaultValue
156#undef xmlParserDebugEntities
157#undef xmlParserVersion
158#undef xmlPedanticParserDefaultValue
159#undef xmlSaveNoEmptyTags
160#undef xmlSubstituteEntitiesDefaultValue
Daniel Veillard8326e732003-01-07 00:19:07 +0000161#undef xmlRegisterNodeDefaultValue
162#undef xmlDeregisterNodeDefaultValue
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000163#undef xmlLastError
Daniel Veillardd0463562001-10-13 09:15:48 +0000164
Daniel Veillard0335a842004-06-02 16:18:40 +0000165#undef xmlParserInputBufferCreateFilenameValue
166#undef xmlOutputBufferCreateFilenameValue
Daniel Veillard9d06d302002-01-22 18:15:52 +0000167/**
168 * xmlParserVersion:
169 *
170 * Constant string describing the internal version of the library
171 */
William M. Brackf4025492004-08-18 21:08:46 +0000172const char *xmlParserVersion = LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA;
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000173
Daniel Veillard9d06d302002-01-22 18:15:52 +0000174/**
175 * xmlBufferAllocScheme:
176 *
177 * Global setting, default allocation policy for buffers, default is
178 * XML_BUFFER_ALLOC_EXACT
Daniel Veillardb8478642001-10-12 17:29:10 +0000179 */
180xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000181static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_EXACT;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000182/**
183 * xmlDefaultBufferSize:
184 *
185 * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
186 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000187int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000188static int xmlDefaultBufferSizeThrDef = BASE_BUFFER_SIZE;
Daniel Veillardb8478642001-10-12 17:29:10 +0000189
190/*
191 * Parser defaults
192 */
Daniel Veillardd0463562001-10-13 09:15:48 +0000193
Daniel Veillard9d06d302002-01-22 18:15:52 +0000194/**
195 * oldXMLWDcompatibility:
196 *
197 * Global setting, DEPRECATED.
198 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000199int oldXMLWDcompatibility = 0; /* DEPRECATED */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000200/**
201 * xmlParserDebugEntities:
202 *
203 * Global setting, asking the parser to print out debugging informations.
204 * while handling entities.
205 * Disabled by default
206 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000207int xmlParserDebugEntities = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000208static int xmlParserDebugEntitiesThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000209/**
210 * xmlDoValidityCheckingDefaultValue:
211 *
212 * Global setting, indicate that the parser should work in validating mode.
213 * Disabled by default.
214 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000215int xmlDoValidityCheckingDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000216static int xmlDoValidityCheckingDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000217/**
218 * xmlGetWarningsDefaultValue:
219 *
220 * Global setting, indicate that the parser should provide warnings.
221 * Activated by default.
222 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000223int xmlGetWarningsDefaultValue = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000224static int xmlGetWarningsDefaultValueThrDef = 1;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000225/**
226 * xmlLoadExtDtdDefaultValue:
227 *
228 * Global setting, indicate that the parser should load DTD while not
229 * validating.
230 * Disabled by default.
231 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000232int xmlLoadExtDtdDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000233static int xmlLoadExtDtdDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000234/**
235 * xmlPedanticParserDefaultValue:
236 *
237 * Global setting, indicate that the parser be pedantic
238 * Disabled by default.
239 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000240int xmlPedanticParserDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000241static int xmlPedanticParserDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000242/**
243 * xmlLineNumbersDefaultValue:
244 *
245 * Global setting, indicate that the parser should store the line number
246 * in the content field of elements in the DOM tree.
247 * Disabled by default since this may not be safe for old classes of
248 * applicaton.
249 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000250int xmlLineNumbersDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000251static int xmlLineNumbersDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000252/**
253 * xmlKeepBlanksDefaultValue:
254 *
255 * Global setting, indicate that the parser should keep all blanks
256 * nodes found in the content
257 * Activated by default, this is actually needed to have the parser
258 * conformant to the XML Recommendation, however the option is kept
259 * for some applications since this was libxml1 default behaviour.
260 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000261int xmlKeepBlanksDefaultValue = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000262static int xmlKeepBlanksDefaultValueThrDef = 1;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000263/**
264 * xmlSubstituteEntitiesDefaultValue:
265 *
266 * Global setting, indicate that the parser should not generate entity
267 * references but replace them with the actual content of the entity
268 * Disabled by default, this should be activated when using XPath since
269 * the XPath data model requires entities replacement and the XPath
270 * engine does not handle entities references transparently.
271 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000272int xmlSubstituteEntitiesDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000273static int xmlSubstituteEntitiesDefaultValueThrDef = 0;
Daniel Veillardb8478642001-10-12 17:29:10 +0000274
Daniel Veillard5335dc52003-01-01 20:59:38 +0000275xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000276static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000277xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000278static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000279
Daniel Veillard0335a842004-06-02 16:18:40 +0000280xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue = NULL;
281static xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValueThrDef = NULL;
282
283xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue = NULL;
284static xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValueThrDef = NULL;
285
Daniel Veillardb8478642001-10-12 17:29:10 +0000286/*
287 * Error handling
288 */
289
290/* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
291/* Must initialize xmlGenericError in xmlInitParser */
Daniel Veillardffa3c742005-07-21 13:24:09 +0000292void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
Daniel Veillard635ef722001-10-29 11:48:19 +0000293 const char *msg,
294 ...);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000295/**
296 * xmlGenericError:
297 *
298 * Global setting: function used for generic error callbacks
299 */
Daniel Veillard635ef722001-10-29 11:48:19 +0000300xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000301static xmlGenericErrorFunc xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000302/**
Daniel Veillard659e71e2003-10-10 14:10:40 +0000303 * xmlStructuredError:
304 *
305 * Global setting: function used for structured error callbacks
306 */
307xmlStructuredErrorFunc xmlStructuredError = NULL;
308static xmlStructuredErrorFunc xmlStructuredErrorThrDef = NULL;
309/**
Daniel Veillard9d06d302002-01-22 18:15:52 +0000310 * xmlGenericErrorContext:
311 *
312 * Global setting passed to generic error callbacks
313 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000314void *xmlGenericErrorContext = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000315static void *xmlGenericErrorContextThrDef = NULL;
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000316xmlError xmlLastError;
Daniel Veillardb8478642001-10-12 17:29:10 +0000317
318/*
319 * output defaults
320 */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000321/**
322 * xmlIndentTreeOutput:
323 *
324 * Global setting, asking the serializer to indent the output tree by default
Aleksey Sanin23002562002-05-24 07:18:40 +0000325 * Enabled by default
Daniel Veillard9d06d302002-01-22 18:15:52 +0000326 */
Aleksey Sanin23002562002-05-24 07:18:40 +0000327int xmlIndentTreeOutput = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000328static int xmlIndentTreeOutputThrDef = 1;
Aleksey Sanin23002562002-05-24 07:18:40 +0000329
330/**
331 * xmlTreeIndentString:
332 *
333 * The string used to do one-level indent. By default is equal to " " (two spaces)
334 */
335const char *xmlTreeIndentString = " ";
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000336static const char *xmlTreeIndentStringThrDef = " ";
Aleksey Sanin23002562002-05-24 07:18:40 +0000337
Daniel Veillard9d06d302002-01-22 18:15:52 +0000338/**
339 * xmlSaveNoEmptyTags:
340 *
341 * Global setting, asking the serializer to not output empty tags
342 * as <empty/> but <empty></empty>. those two forms are undistinguishable
343 * once parsed.
344 * Disabled by default
345 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000346int xmlSaveNoEmptyTags = 0;
Daniel Veillard24505b02005-07-28 23:49:35 +0000347static int xmlSaveNoEmptyTagsThrDef = 0;
Daniel Veillardb8478642001-10-12 17:29:10 +0000348
Daniel Veillard81273902003-09-30 00:43:48 +0000349#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000350/**
351 * xmlDefaultSAXHandler:
352 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000353 * Default SAX version1 handler for XML, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000354 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000355xmlSAXHandlerV1 xmlDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000356 xmlSAX2InternalSubset,
357 xmlSAX2IsStandalone,
358 xmlSAX2HasInternalSubset,
359 xmlSAX2HasExternalSubset,
360 xmlSAX2ResolveEntity,
361 xmlSAX2GetEntity,
362 xmlSAX2EntityDecl,
363 xmlSAX2NotationDecl,
364 xmlSAX2AttributeDecl,
365 xmlSAX2ElementDecl,
366 xmlSAX2UnparsedEntityDecl,
367 xmlSAX2SetDocumentLocator,
368 xmlSAX2StartDocument,
369 xmlSAX2EndDocument,
370 xmlSAX2StartElement,
371 xmlSAX2EndElement,
372 xmlSAX2Reference,
373 xmlSAX2Characters,
374 xmlSAX2Characters,
375 xmlSAX2ProcessingInstruction,
376 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000377 xmlParserWarning,
378 xmlParserError,
379 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000380 xmlSAX2GetParameterEntity,
381 xmlSAX2CDataBlock,
382 xmlSAX2ExternalSubset,
383 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000384};
Daniel Veillard81273902003-09-30 00:43:48 +0000385#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillardb8478642001-10-12 17:29:10 +0000386
Daniel Veillard9d06d302002-01-22 18:15:52 +0000387/**
388 * xmlDefaultSAXLocator:
389 *
390 * The default SAX Locator
391 * { getPublicId, getSystemId, getLineNumber, getColumnNumber}
Daniel Veillardb8478642001-10-12 17:29:10 +0000392 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000393xmlSAXLocator xmlDefaultSAXLocator = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000394 xmlSAX2GetPublicId,
395 xmlSAX2GetSystemId,
396 xmlSAX2GetLineNumber,
397 xmlSAX2GetColumnNumber
Daniel Veillardb8478642001-10-12 17:29:10 +0000398};
399
400#ifdef LIBXML_HTML_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000401/**
402 * htmlDefaultSAXHandler:
403 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000404 * Default old SAX v1 handler for HTML, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000405 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000406xmlSAXHandlerV1 htmlDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000407 xmlSAX2InternalSubset,
Daniel Veillardb8478642001-10-12 17:29:10 +0000408 NULL,
409 NULL,
410 NULL,
411 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000412 xmlSAX2GetEntity,
Daniel Veillardb8478642001-10-12 17:29:10 +0000413 NULL,
414 NULL,
415 NULL,
416 NULL,
417 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000418 xmlSAX2SetDocumentLocator,
419 xmlSAX2StartDocument,
420 xmlSAX2EndDocument,
421 xmlSAX2StartElement,
422 xmlSAX2EndElement,
Daniel Veillardb8478642001-10-12 17:29:10 +0000423 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000424 xmlSAX2Characters,
425 xmlSAX2IgnorableWhitespace,
Daniel Veillardfc484dd2004-10-22 14:34:23 +0000426 xmlSAX2ProcessingInstruction,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000427 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000428 xmlParserWarning,
429 xmlParserError,
430 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000431 xmlSAX2GetParameterEntity,
432 xmlSAX2CDataBlock,
Daniel Veillardb8478642001-10-12 17:29:10 +0000433 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000434 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000435};
436#endif /* LIBXML_HTML_ENABLED */
437
438#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000439/**
440 * docbDefaultSAXHandler:
441 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000442 * Default old SAX v1 handler for SGML DocBook, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000443 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000444xmlSAXHandlerV1 docbDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000445 xmlSAX2InternalSubset,
446 xmlSAX2IsStandalone,
447 xmlSAX2HasInternalSubset,
448 xmlSAX2HasExternalSubset,
449 xmlSAX2ResolveEntity,
450 xmlSAX2GetEntity,
451 xmlSAX2EntityDecl,
Daniel Veillardb8478642001-10-12 17:29:10 +0000452 NULL,
453 NULL,
454 NULL,
455 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000456 xmlSAX2SetDocumentLocator,
457 xmlSAX2StartDocument,
458 xmlSAX2EndDocument,
459 xmlSAX2StartElement,
460 xmlSAX2EndElement,
461 xmlSAX2Reference,
462 xmlSAX2Characters,
463 xmlSAX2IgnorableWhitespace,
Daniel Veillardb8478642001-10-12 17:29:10 +0000464 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000465 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000466 xmlParserWarning,
467 xmlParserError,
468 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000469 xmlSAX2GetParameterEntity,
Daniel Veillardb8478642001-10-12 17:29:10 +0000470 NULL,
471 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000472 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000473};
474#endif /* LIBXML_DOCB_ENABLED */
475
476/**
477 * xmlInitializeGlobalState:
478 * @gs: a pointer to a newly allocated global state
479 *
480 * xmlInitializeGlobalState() initialize a global state with all the
481 * default values of the library.
482 */
483void
484xmlInitializeGlobalState(xmlGlobalStatePtr gs)
485{
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000486#ifdef DEBUG_GLOBALS
487 fprintf(stderr, "Initializing globals at %lu for thread %d\n",
488 (unsigned long) gs, xmlGetThreadId());
489#endif
490
Daniel Veillardb8478642001-10-12 17:29:10 +0000491 /*
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000492 * Perform initialization as required by libxml
Daniel Veillardb8478642001-10-12 17:29:10 +0000493 */
Daniel Veillard5805be22003-08-28 08:03:23 +0000494 if (xmlThrDefMutex == NULL)
495 xmlInitGlobals();
496
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000497 xmlMutexLock(xmlThrDefMutex);
William M. Brack8b2c7f12002-11-22 05:07:29 +0000498
Daniel Veillardd8467682005-06-08 17:42:42 +0000499#if defined(LIBXML_DOCB_ENABLED) && defined(LIBXML_LEGACY_ENABLED)
Daniel Veillard092643b2003-09-25 14:29:29 +0000500 initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000501#endif
Daniel Veillardd8467682005-06-08 17:42:42 +0000502#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED)
Daniel Veillard092643b2003-09-25 14:29:29 +0000503 inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000504#endif
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000505
Daniel Veillardb8478642001-10-12 17:29:10 +0000506 gs->oldXMLWDcompatibility = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000507 gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
508 gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;
William M. Brack21e4ef22005-01-02 09:53:13 +0000509#if defined(LIBXML_SAX1_ENABLED) && defined(LIBXML_LEGACY_ENABLED)
Daniel Veillard092643b2003-09-25 14:29:29 +0000510 initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
Daniel Veillard81273902003-09-30 00:43:48 +0000511#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillard4432df22003-09-28 18:58:27 +0000512 gs->xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId;
513 gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
514 gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
515 gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000516 gs->xmlDoValidityCheckingDefaultValue =
517 xmlDoValidityCheckingDefaultValueThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000518#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
519 gs->xmlFree = (xmlFreeFunc) xmlMemFree;
520 gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000521 gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000522 gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
523 gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
524#else
525 gs->xmlFree = (xmlFreeFunc) free;
526 gs->xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000527 gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000528 gs->xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard572577e2002-01-18 16:23:55 +0000529 gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillardb8478642001-10-12 17:29:10 +0000530#endif
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000531 gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
532 gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
533 gs->xmlTreeIndentString = xmlTreeIndentStringThrDef;
534 gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
535 gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
536 gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
537 gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000538 gs->xmlParserVersion = LIBXML_VERSION_STRING;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000539 gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
540 gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
541 gs->xmlSubstituteEntitiesDefaultValue =
542 xmlSubstituteEntitiesDefaultValueThrDef;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000543
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000544 gs->xmlGenericError = xmlGenericErrorThrDef;
Daniel Veillard659e71e2003-10-10 14:10:40 +0000545 gs->xmlStructuredError = xmlStructuredErrorThrDef;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000546 gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
547 gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
548 gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
Daniel Veillard0335a842004-06-02 16:18:40 +0000549
550 gs->xmlParserInputBufferCreateFilenameValue = xmlParserInputBufferCreateFilenameValueThrDef;
551 gs->xmlOutputBufferCreateFilenameValue = xmlOutputBufferCreateFilenameValueThrDef;
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000552 memset(&gs->xmlLastError, 0, sizeof(xmlError));
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000553
554 xmlMutexUnlock(xmlThrDefMutex);
555}
556
Daniel Veillard1e906612003-12-05 14:57:46 +0000557/**
558 * DOC_DISABLE : we ignore missing doc for the xmlThrDef functions,
559 * those are really internal work
560 */
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000561void
562xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
563 xmlMutexLock(xmlThrDefMutex);
564 xmlGenericErrorContextThrDef = ctx;
565 if (handler != NULL)
566 xmlGenericErrorThrDef = handler;
567 else
568 xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
569 xmlMutexUnlock(xmlThrDefMutex);
Daniel Veillardb8478642001-10-12 17:29:10 +0000570}
571
Daniel Veillard659e71e2003-10-10 14:10:40 +0000572void
573xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
574 xmlMutexLock(xmlThrDefMutex);
575 xmlGenericErrorContextThrDef = ctx;
576 xmlStructuredErrorThrDef = handler;
577 xmlMutexUnlock(xmlThrDefMutex);
578}
579
Daniel Veillard5335dc52003-01-01 20:59:38 +0000580/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000581 * xmlRegisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000582 * @func: function pointer to the new RegisterNodeFunc
583 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000584 * Registers a callback for node creation
585 *
586 * Returns the old value of the registration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000587 */
588xmlRegisterNodeFunc
589xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
590{
591 xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue;
592
Daniel Veillarda880b122003-04-21 21:36:41 +0000593 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000594 xmlRegisterNodeDefaultValue = func;
595 return(old);
596}
597
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000598xmlRegisterNodeFunc
599xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
600{
601 xmlRegisterNodeFunc old;
602
603 xmlMutexLock(xmlThrDefMutex);
604 old = xmlRegisterNodeDefaultValueThrDef;
605
606 __xmlRegisterCallbacks = 1;
607 xmlRegisterNodeDefaultValueThrDef = func;
608 xmlMutexUnlock(xmlThrDefMutex);
609
610 return(old);
611}
612
Daniel Veillard5335dc52003-01-01 20:59:38 +0000613/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000614 * xmlDeregisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000615 * @func: function pointer to the new DeregisterNodeFunc
616 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000617 * Registers a callback for node destruction
618 *
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000619 * Returns the previous value of the deregistration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000620 */
621xmlDeregisterNodeFunc
622xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
623{
624 xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue;
625
Daniel Veillarda880b122003-04-21 21:36:41 +0000626 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000627 xmlDeregisterNodeDefaultValue = func;
628 return(old);
629}
630
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000631xmlDeregisterNodeFunc
632xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
633{
634 xmlDeregisterNodeFunc old;
635
636 xmlMutexLock(xmlThrDefMutex);
637 old = xmlDeregisterNodeDefaultValueThrDef;
638
639 __xmlRegisterCallbacks = 1;
640 xmlDeregisterNodeDefaultValueThrDef = func;
641 xmlMutexUnlock(xmlThrDefMutex);
642
643 return(old);
644}
645
Daniel Veillard0335a842004-06-02 16:18:40 +0000646xmlParserInputBufferCreateFilenameFunc
647xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
648{
649 xmlParserInputBufferCreateFilenameFunc old;
650
651 xmlMutexLock(xmlThrDefMutex);
652 old = xmlParserInputBufferCreateFilenameValueThrDef;
Daniel Veillard1b243b42004-06-08 10:16:42 +0000653 if (old == NULL) {
654 old = __xmlParserInputBufferCreateFilename;
655 }
656
Daniel Veillard0335a842004-06-02 16:18:40 +0000657 xmlParserInputBufferCreateFilenameValueThrDef = func;
658 xmlMutexUnlock(xmlThrDefMutex);
659
660 return(old);
661}
662
Daniel Veillard0335a842004-06-02 16:18:40 +0000663xmlOutputBufferCreateFilenameFunc
664xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
665{
666 xmlOutputBufferCreateFilenameFunc old;
667
668 xmlMutexLock(xmlThrDefMutex);
669 old = xmlOutputBufferCreateFilenameValueThrDef;
Daniel Veillard1b243b42004-06-08 10:16:42 +0000670#ifdef LIBXML_OUTPUT_ENABLED
671 if (old == NULL) {
672 old = __xmlOutputBufferCreateFilename;
673 }
674#endif
Daniel Veillard0335a842004-06-02 16:18:40 +0000675 xmlOutputBufferCreateFilenameValueThrDef = func;
676 xmlMutexUnlock(xmlThrDefMutex);
677
678 return(old);
679}
Daniel Veillard5335dc52003-01-01 20:59:38 +0000680
Daniel Veillarda4617b82001-11-04 20:19:12 +0000681#ifdef LIBXML_DOCB_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000682#undef docbDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000683xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000684__docbDefaultSAXHandler(void) {
685 if (IS_MAIN_THREAD)
686 return (&docbDefaultSAXHandler);
687 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000688 return (&xmlGetGlobalState()->docbDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000689}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000690#endif
Daniel Veillardb8478642001-10-12 17:29:10 +0000691
Daniel Veillarda4617b82001-11-04 20:19:12 +0000692#ifdef LIBXML_HTML_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000693#undef htmlDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000694xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000695__htmlDefaultSAXHandler(void) {
696 if (IS_MAIN_THREAD)
697 return (&htmlDefaultSAXHandler);
698 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000699 return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000700}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000701#endif
702
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000703#undef xmlLastError
704xmlError *
705__xmlLastError(void) {
706 if (IS_MAIN_THREAD)
707 return (&xmlLastError);
708 else
709 return (&xmlGetGlobalState()->xmlLastError);
710}
711
Daniel Veillarda4617b82001-11-04 20:19:12 +0000712/*
William M. Brack5ab479b2004-06-10 13:00:15 +0000713 * The following memory routines were apparently lost at some point,
714 * and were re-inserted at this point on June 10, 2004. Hope it's
715 * the right place for them :-)
716 */
717#if defined(LIBXML_THREAD_ALLOC_ENABLED) && defined(LIBXML_THREAD_ENABLED)
718#undef xmlMalloc
719xmlMallocFunc *
720__xmlMalloc(void){
721 if (IS_MAIN_THREAD)
722 return (&xmlMalloc);
723 else
724 return (&xmlGetGlobalState()->xmlMalloc);
725}
726
727#undef xmlMallocAtomic
728xmlMallocFunc *
729__xmlMallocAtomic(void){
730 if (IS_MAIN_THREAD)
731 return (&xmlMallocAtomic);
732 else
733 return (&xmlGetGlobalState()->xmlMallocAtomic);
734}
735
736#undef xmlRealloc
737xmlReallocFunc *
738__xmlRealloc(void){
739 if (IS_MAIN_THREAD)
740 return (&xmlRealloc);
741 else
742 return (&xmlGetGlobalState()->xmlRealloc);
743}
744
745#undef xmlFree
746xmlFreeFunc *
747__xmlFree(void){
748 if (IS_MAIN_THREAD)
749 return (&xmlFree);
750 else
751 return (&xmlGetGlobalState()->xmlFree);
752}
753
754xmlStrdupFunc *
755__xmlMemStrdup(void){
756 if (IS_MAIN_THREAD)
757 return (&xmlMemStrdup);
758 else
759 return (&xmlGetGlobalState()->xmlMemStrdup);
760}
761
762#endif
763
764/*
Daniel Veillarda4617b82001-11-04 20:19:12 +0000765 * Everything starting from the line below is
766 * Automatically generated by build_glob.py.
767 * Do not modify the previous line.
768 */
769
Daniel Veillardb8478642001-10-12 17:29:10 +0000770
Daniel Veillardb8478642001-10-12 17:29:10 +0000771#undef oldXMLWDcompatibility
772int *
773__oldXMLWDcompatibility(void) {
774 if (IS_MAIN_THREAD)
775 return (&oldXMLWDcompatibility);
776 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000777 return (&xmlGetGlobalState()->oldXMLWDcompatibility);
Daniel Veillardb8478642001-10-12 17:29:10 +0000778}
779
Daniel Veillardb8478642001-10-12 17:29:10 +0000780#undef xmlBufferAllocScheme
781xmlBufferAllocationScheme *
782__xmlBufferAllocScheme(void) {
783 if (IS_MAIN_THREAD)
784 return (&xmlBufferAllocScheme);
785 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000786 return (&xmlGetGlobalState()->xmlBufferAllocScheme);
Daniel Veillardb8478642001-10-12 17:29:10 +0000787}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000788xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
789 xmlBufferAllocationScheme ret;
790 xmlMutexLock(xmlThrDefMutex);
791 ret = xmlBufferAllocSchemeThrDef;
792 xmlBufferAllocSchemeThrDef = v;
793 xmlMutexUnlock(xmlThrDefMutex);
794 return ret;
795}
Daniel Veillardb8478642001-10-12 17:29:10 +0000796
Daniel Veillardb8478642001-10-12 17:29:10 +0000797#undef xmlDefaultBufferSize
798int *
799__xmlDefaultBufferSize(void) {
800 if (IS_MAIN_THREAD)
801 return (&xmlDefaultBufferSize);
802 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000803 return (&xmlGetGlobalState()->xmlDefaultBufferSize);
Daniel Veillardb8478642001-10-12 17:29:10 +0000804}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000805int xmlThrDefDefaultBufferSize(int v) {
806 int ret;
807 xmlMutexLock(xmlThrDefMutex);
808 ret = xmlDefaultBufferSizeThrDef;
809 xmlDefaultBufferSizeThrDef = v;
810 xmlMutexUnlock(xmlThrDefMutex);
811 return ret;
812}
Daniel Veillardb8478642001-10-12 17:29:10 +0000813
Daniel Veillard81273902003-09-30 00:43:48 +0000814#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000815#undef xmlDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000816xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000817__xmlDefaultSAXHandler(void) {
818 if (IS_MAIN_THREAD)
819 return (&xmlDefaultSAXHandler);
820 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000821 return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000822}
Daniel Veillard81273902003-09-30 00:43:48 +0000823#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillardb8478642001-10-12 17:29:10 +0000824
Daniel Veillardb8478642001-10-12 17:29:10 +0000825#undef xmlDefaultSAXLocator
826xmlSAXLocator *
827__xmlDefaultSAXLocator(void) {
828 if (IS_MAIN_THREAD)
829 return (&xmlDefaultSAXLocator);
830 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000831 return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
Daniel Veillardb8478642001-10-12 17:29:10 +0000832}
833
Daniel Veillardb8478642001-10-12 17:29:10 +0000834#undef xmlDoValidityCheckingDefaultValue
835int *
836__xmlDoValidityCheckingDefaultValue(void) {
837 if (IS_MAIN_THREAD)
838 return (&xmlDoValidityCheckingDefaultValue);
839 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000840 return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000841}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000842int xmlThrDefDoValidityCheckingDefaultValue(int v) {
843 int ret;
844 xmlMutexLock(xmlThrDefMutex);
845 ret = xmlDoValidityCheckingDefaultValueThrDef;
846 xmlDoValidityCheckingDefaultValueThrDef = v;
847 xmlMutexUnlock(xmlThrDefMutex);
848 return ret;
849}
Daniel Veillardb8478642001-10-12 17:29:10 +0000850
Daniel Veillardb8478642001-10-12 17:29:10 +0000851#undef xmlGenericError
852xmlGenericErrorFunc *
853__xmlGenericError(void) {
854 if (IS_MAIN_THREAD)
855 return (&xmlGenericError);
856 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000857 return (&xmlGetGlobalState()->xmlGenericError);
Daniel Veillardb8478642001-10-12 17:29:10 +0000858}
859
Daniel Veillard659e71e2003-10-10 14:10:40 +0000860#undef xmlStructuredError
861xmlStructuredErrorFunc *
862__xmlStructuredError(void) {
863 if (IS_MAIN_THREAD)
864 return (&xmlStructuredError);
865 else
866 return (&xmlGetGlobalState()->xmlStructuredError);
867}
868
Daniel Veillardb8478642001-10-12 17:29:10 +0000869#undef xmlGenericErrorContext
870void * *
871__xmlGenericErrorContext(void) {
872 if (IS_MAIN_THREAD)
873 return (&xmlGenericErrorContext);
874 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000875 return (&xmlGetGlobalState()->xmlGenericErrorContext);
Daniel Veillardb8478642001-10-12 17:29:10 +0000876}
877
Daniel Veillardb8478642001-10-12 17:29:10 +0000878#undef xmlGetWarningsDefaultValue
879int *
880__xmlGetWarningsDefaultValue(void) {
881 if (IS_MAIN_THREAD)
882 return (&xmlGetWarningsDefaultValue);
883 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000884 return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000885}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000886int xmlThrDefGetWarningsDefaultValue(int v) {
887 int ret;
888 xmlMutexLock(xmlThrDefMutex);
889 ret = xmlGetWarningsDefaultValueThrDef;
890 xmlGetWarningsDefaultValueThrDef = v;
891 xmlMutexUnlock(xmlThrDefMutex);
892 return ret;
893}
Daniel Veillardb8478642001-10-12 17:29:10 +0000894
Daniel Veillardb8478642001-10-12 17:29:10 +0000895#undef xmlIndentTreeOutput
896int *
897__xmlIndentTreeOutput(void) {
898 if (IS_MAIN_THREAD)
899 return (&xmlIndentTreeOutput);
900 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000901 return (&xmlGetGlobalState()->xmlIndentTreeOutput);
Daniel Veillardb8478642001-10-12 17:29:10 +0000902}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000903int xmlThrDefIndentTreeOutput(int v) {
904 int ret;
905 xmlMutexLock(xmlThrDefMutex);
906 ret = xmlIndentTreeOutputThrDef;
907 xmlIndentTreeOutputThrDef = v;
908 xmlMutexUnlock(xmlThrDefMutex);
909 return ret;
910}
Daniel Veillardb8478642001-10-12 17:29:10 +0000911
Aleksey Sanin23002562002-05-24 07:18:40 +0000912#undef xmlTreeIndentString
913const char * *
914__xmlTreeIndentString(void) {
915 if (IS_MAIN_THREAD)
916 return (&xmlTreeIndentString);
917 else
918 return (&xmlGetGlobalState()->xmlTreeIndentString);
919}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000920const char * xmlThrDefTreeIndentString(const char * v) {
921 const char * ret;
922 xmlMutexLock(xmlThrDefMutex);
923 ret = xmlTreeIndentStringThrDef;
924 xmlTreeIndentStringThrDef = v;
925 xmlMutexUnlock(xmlThrDefMutex);
926 return ret;
927}
Aleksey Sanin23002562002-05-24 07:18:40 +0000928
Daniel Veillardb8478642001-10-12 17:29:10 +0000929#undef xmlKeepBlanksDefaultValue
930int *
931__xmlKeepBlanksDefaultValue(void) {
932 if (IS_MAIN_THREAD)
933 return (&xmlKeepBlanksDefaultValue);
934 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000935 return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000936}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000937int xmlThrDefKeepBlanksDefaultValue(int v) {
938 int ret;
939 xmlMutexLock(xmlThrDefMutex);
940 ret = xmlKeepBlanksDefaultValueThrDef;
941 xmlKeepBlanksDefaultValueThrDef = v;
942 xmlMutexUnlock(xmlThrDefMutex);
943 return ret;
944}
Daniel Veillardb8478642001-10-12 17:29:10 +0000945
Daniel Veillardb8478642001-10-12 17:29:10 +0000946#undef xmlLineNumbersDefaultValue
947int *
948__xmlLineNumbersDefaultValue(void) {
949 if (IS_MAIN_THREAD)
950 return (&xmlLineNumbersDefaultValue);
951 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000952 return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000953}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000954int xmlThrDefLineNumbersDefaultValue(int v) {
955 int ret;
956 xmlMutexLock(xmlThrDefMutex);
957 ret = xmlLineNumbersDefaultValueThrDef;
958 xmlLineNumbersDefaultValueThrDef = v;
959 xmlMutexUnlock(xmlThrDefMutex);
960 return ret;
961}
Daniel Veillardb8478642001-10-12 17:29:10 +0000962
Daniel Veillardb8478642001-10-12 17:29:10 +0000963#undef xmlLoadExtDtdDefaultValue
964int *
965__xmlLoadExtDtdDefaultValue(void) {
966 if (IS_MAIN_THREAD)
967 return (&xmlLoadExtDtdDefaultValue);
968 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000969 return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000970}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000971int xmlThrDefLoadExtDtdDefaultValue(int v) {
972 int ret;
973 xmlMutexLock(xmlThrDefMutex);
974 ret = xmlLoadExtDtdDefaultValueThrDef;
975 xmlLoadExtDtdDefaultValueThrDef = v;
976 xmlMutexUnlock(xmlThrDefMutex);
977 return ret;
978}
Daniel Veillardb8478642001-10-12 17:29:10 +0000979
Daniel Veillardb8478642001-10-12 17:29:10 +0000980#undef xmlParserDebugEntities
981int *
982__xmlParserDebugEntities(void) {
983 if (IS_MAIN_THREAD)
984 return (&xmlParserDebugEntities);
985 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000986 return (&xmlGetGlobalState()->xmlParserDebugEntities);
Daniel Veillardb8478642001-10-12 17:29:10 +0000987}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000988int xmlThrDefParserDebugEntities(int v) {
989 int ret;
990 xmlMutexLock(xmlThrDefMutex);
991 ret = xmlParserDebugEntitiesThrDef;
992 xmlParserDebugEntitiesThrDef = v;
993 xmlMutexUnlock(xmlThrDefMutex);
994 return ret;
995}
Daniel Veillardb8478642001-10-12 17:29:10 +0000996
Daniel Veillardb8478642001-10-12 17:29:10 +0000997#undef xmlParserVersion
998const char * *
999__xmlParserVersion(void) {
1000 if (IS_MAIN_THREAD)
1001 return (&xmlParserVersion);
1002 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001003 return (&xmlGetGlobalState()->xmlParserVersion);
Daniel Veillardb8478642001-10-12 17:29:10 +00001004}
1005
Daniel Veillardb8478642001-10-12 17:29:10 +00001006#undef xmlPedanticParserDefaultValue
1007int *
1008__xmlPedanticParserDefaultValue(void) {
1009 if (IS_MAIN_THREAD)
1010 return (&xmlPedanticParserDefaultValue);
1011 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001012 return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +00001013}
Daniel Veillard781ac8b2003-05-15 22:11:36 +00001014int xmlThrDefPedanticParserDefaultValue(int v) {
1015 int ret;
1016 xmlMutexLock(xmlThrDefMutex);
1017 ret = xmlPedanticParserDefaultValueThrDef;
1018 xmlPedanticParserDefaultValueThrDef = v;
1019 xmlMutexUnlock(xmlThrDefMutex);
1020 return ret;
1021}
Daniel Veillardb8478642001-10-12 17:29:10 +00001022
Daniel Veillardb8478642001-10-12 17:29:10 +00001023#undef xmlSaveNoEmptyTags
1024int *
1025__xmlSaveNoEmptyTags(void) {
1026 if (IS_MAIN_THREAD)
1027 return (&xmlSaveNoEmptyTags);
1028 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001029 return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
Daniel Veillardb8478642001-10-12 17:29:10 +00001030}
Daniel Veillard781ac8b2003-05-15 22:11:36 +00001031int xmlThrDefSaveNoEmptyTags(int v) {
1032 int ret;
1033 xmlMutexLock(xmlThrDefMutex);
1034 ret = xmlSaveNoEmptyTagsThrDef;
1035 xmlSaveNoEmptyTagsThrDef = v;
1036 xmlMutexUnlock(xmlThrDefMutex);
1037 return ret;
1038}
Daniel Veillardb8478642001-10-12 17:29:10 +00001039
Daniel Veillardb8478642001-10-12 17:29:10 +00001040#undef xmlSubstituteEntitiesDefaultValue
1041int *
1042__xmlSubstituteEntitiesDefaultValue(void) {
1043 if (IS_MAIN_THREAD)
1044 return (&xmlSubstituteEntitiesDefaultValue);
1045 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001046 return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +00001047}
Daniel Veillard781ac8b2003-05-15 22:11:36 +00001048int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
1049 int ret;
1050 xmlMutexLock(xmlThrDefMutex);
1051 ret = xmlSubstituteEntitiesDefaultValueThrDef;
1052 xmlSubstituteEntitiesDefaultValueThrDef = v;
1053 xmlMutexUnlock(xmlThrDefMutex);
1054 return ret;
1055}
Daniel Veillard5335dc52003-01-01 20:59:38 +00001056
1057#undef xmlRegisterNodeDefaultValue
1058xmlRegisterNodeFunc *
1059__xmlRegisterNodeDefaultValue(void) {
1060 if (IS_MAIN_THREAD)
1061 return (&xmlRegisterNodeDefaultValue);
1062 else
1063 return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue);
1064}
1065
1066#undef xmlDeregisterNodeDefaultValue
1067xmlDeregisterNodeFunc *
1068__xmlDeregisterNodeDefaultValue(void) {
1069 if (IS_MAIN_THREAD)
1070 return (&xmlDeregisterNodeDefaultValue);
1071 else
1072 return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue);
1073}
Daniel Veillard0335a842004-06-02 16:18:40 +00001074
1075#undef xmlParserInputBufferCreateFilenameValue
1076xmlParserInputBufferCreateFilenameFunc *
1077__xmlParserInputBufferCreateFilenameValue(void) {
1078 if (IS_MAIN_THREAD)
1079 return (&xmlParserInputBufferCreateFilenameValue);
1080 else
1081 return (&xmlGetGlobalState()->xmlParserInputBufferCreateFilenameValue);
1082}
1083
1084#undef xmlOutputBufferCreateFilenameValue
1085xmlOutputBufferCreateFilenameFunc *
1086__xmlOutputBufferCreateFilenameValue(void) {
1087 if (IS_MAIN_THREAD)
1088 return (&xmlOutputBufferCreateFilenameValue);
1089 else
1090 return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue);
William M. Brack803812b2004-06-03 02:11:24 +00001091}
Daniel Veillard5d4644e2005-04-01 13:11:58 +00001092
1093#define bottom_globals
1094#include "elfgcchack.h"