blob: cbc66253d14c05d61d4ba8dbbe1af11383cae00b [file] [log] [blame]
Daniel Veillardb8478642001-10-12 17:29:10 +00001/*
2 * globals.c: definition and handling of the set of global variables
3 * of the library
4 *
5 * The bottom of this file is automatically generated by build_glob.py
6 * based on the description file global.data
7 *
8 * See Copyright for the status of this software.
9 *
10 * Gary Pennington <Gary.Pennington@uk.sun.com>
11 * daniel@veillard.com
12 */
13
Daniel Veillard34ce8be2002-03-18 19:37:11 +000014#define IN_LIBXML
Daniel Veillardb8478642001-10-12 17:29:10 +000015#include "libxml.h"
16
Daniel Veillarde7090612001-10-13 12:18:28 +000017#ifdef HAVE_STDLIB_H
Jaka Mocnik77d19ae2001-10-13 12:06:09 +000018#include <stdlib.h>
Daniel Veillarde7090612001-10-13 12:18:28 +000019#endif
Jaka Mocnik77d19ae2001-10-13 12:06:09 +000020#include <string.h>
21
Daniel Veillard3c01b1d2001-10-17 15:58:35 +000022#include <libxml/globals.h>
Daniel Veillarde7090612001-10-13 12:18:28 +000023#include <libxml/xmlmemory.h>
Daniel Veillard781ac8b2003-05-15 22:11:36 +000024#include <libxml/threads.h>
Daniel Veillarde7090612001-10-13 12:18:28 +000025
Daniel Veillard3c01b1d2001-10-17 15:58:35 +000026/* #define DEBUG_GLOBALS */
27
Daniel Veillardb8478642001-10-12 17:29:10 +000028/*
29 * Helpful Macro
30 */
Daniel Veillard3c01b1d2001-10-17 15:58:35 +000031#ifdef LIBXML_THREAD_ENABLED
32#define IS_MAIN_THREAD (xmlIsMainThread())
Daniel Veillardb8478642001-10-12 17:29:10 +000033#else
34#define IS_MAIN_THREAD 1
35#endif
36
Daniel Veillard781ac8b2003-05-15 22:11:36 +000037/*
38 * Mutex to protect "ForNewThreads" variables
39 */
40static xmlMutexPtr xmlThrDefMutex = NULL;
41
William M. Brack966668a2003-12-20 02:10:28 +000042/**
43 * xmlInitGlobals:
44 *
45 * Additional initialisation for multi-threading
46 */
Daniel Veillard75e389d2005-07-29 22:02:24 +000047void xmlInitGlobals(void)
Daniel Veillard781ac8b2003-05-15 22:11:36 +000048{
49 xmlThrDefMutex = xmlNewMutex();
50}
51
William M. Brack966668a2003-12-20 02:10:28 +000052/**
53 * xmlCleanupGlobals:
54 *
55 * Additional cleanup for multi-threading
56 */
Daniel Veillard75e389d2005-07-29 22:02:24 +000057void xmlCleanupGlobals(void)
Daniel Veillard781ac8b2003-05-15 22:11:36 +000058{
Daniel Veillard2009c4e2003-07-15 20:04:34 +000059 if (xmlThrDefMutex != NULL) {
Daniel Veillarddf101d82003-07-08 14:03:36 +000060 xmlFreeMutex(xmlThrDefMutex);
Daniel Veillard2009c4e2003-07-15 20:04:34 +000061 xmlThrDefMutex = NULL;
62 }
Daniel Veillardccc476f2008-03-04 13:19:49 +000063 __xmlGlobalInitMutexDestroy();
Daniel Veillard781ac8b2003-05-15 22:11:36 +000064}
65
Daniel Veillardb8478642001-10-12 17:29:10 +000066/************************************************************************
67 * *
68 * All the user accessible global variables of the library *
69 * *
70 ************************************************************************/
71
Daniel Veillardb8478642001-10-12 17:29:10 +000072/*
73 * Memory allocation routines
74 */
William M. Brack5ab479b2004-06-10 13:00:15 +000075#undef xmlFree
76#undef xmlMalloc
77#undef xmlMallocAtomic
78#undef xmlMemStrdup
79#undef xmlRealloc
80
Daniel Veillard7216cfd2002-11-08 15:10:00 +000081#if defined(DEBUG_MEMORY_LOCATION) || defined(DEBUG_MEMORY)
Daniel Veillardb8478642001-10-12 17:29:10 +000082xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
83xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +000084xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillardb8478642001-10-12 17:29:10 +000085xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
86xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
87#else
Daniel Veillard9d06d302002-01-22 18:15:52 +000088/**
89 * xmlFree:
90 * @mem: an already allocated block of memory
91 *
92 * The variable holding the libxml free() implementation
93 */
Daniel Veillardb8478642001-10-12 17:29:10 +000094xmlFreeFunc xmlFree = (xmlFreeFunc) free;
Daniel Veillard9d06d302002-01-22 18:15:52 +000095/**
96 * xmlMalloc:
97 * @size: the size requested in bytes
98 *
99 * The variable holding the libxml malloc() implementation
100 *
101 * Returns a pointer to the newly allocated block or NULL in case of error
102 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000103xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000104/**
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000105 * xmlMallocAtomic:
106 * @size: the size requested in bytes
107 *
108 * The variable holding the libxml malloc() implementation for atomic
109 * data (i.e. blocks not containings pointers), useful when using a
110 * garbage collecting allocator.
111 *
112 * Returns a pointer to the newly allocated block or NULL in case of error
113 */
114xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) malloc;
115/**
Daniel Veillard9d06d302002-01-22 18:15:52 +0000116 * xmlRealloc:
117 * @mem: an already allocated block of memory
118 * @size: the new size requested in bytes
119 *
120 * The variable holding the libxml realloc() implementation
121 *
122 * Returns a pointer to the newly reallocated block or NULL in case of error
123 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000124xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000125/**
126 * xmlMemStrdup:
127 * @str: a zero terminated string
128 *
129 * The variable holding the libxml strdup() implementation
130 *
131 * Returns the copy of the string or NULL in case of error
132 */
Daniel Veillardb82c1662001-12-09 14:00:54 +0000133xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000134#endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */
Daniel Veillardb8478642001-10-12 17:29:10 +0000135
Daniel Veillardd0463562001-10-13 09:15:48 +0000136#include <libxml/threads.h>
137#include <libxml/globals.h>
138#include <libxml/SAX.h>
139
140#undef docbDefaultSAXHandler
141#undef htmlDefaultSAXHandler
142#undef oldXMLWDcompatibility
143#undef xmlBufferAllocScheme
144#undef xmlDefaultBufferSize
145#undef xmlDefaultSAXHandler
146#undef xmlDefaultSAXLocator
147#undef xmlDoValidityCheckingDefaultValue
148#undef xmlGenericError
Daniel Veillard659e71e2003-10-10 14:10:40 +0000149#undef xmlStructuredError
Daniel Veillardd0463562001-10-13 09:15:48 +0000150#undef xmlGenericErrorContext
151#undef xmlGetWarningsDefaultValue
152#undef xmlIndentTreeOutput
Aleksey Sanin23002562002-05-24 07:18:40 +0000153#undef xmlTreeIndentString
Daniel Veillardd0463562001-10-13 09:15:48 +0000154#undef xmlKeepBlanksDefaultValue
155#undef xmlLineNumbersDefaultValue
156#undef xmlLoadExtDtdDefaultValue
157#undef xmlParserDebugEntities
158#undef xmlParserVersion
159#undef xmlPedanticParserDefaultValue
160#undef xmlSaveNoEmptyTags
161#undef xmlSubstituteEntitiesDefaultValue
Daniel Veillard8326e732003-01-07 00:19:07 +0000162#undef xmlRegisterNodeDefaultValue
163#undef xmlDeregisterNodeDefaultValue
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000164#undef xmlLastError
Daniel Veillardd0463562001-10-13 09:15:48 +0000165
Daniel Veillard0335a842004-06-02 16:18:40 +0000166#undef xmlParserInputBufferCreateFilenameValue
167#undef xmlOutputBufferCreateFilenameValue
Daniel Veillard9d06d302002-01-22 18:15:52 +0000168/**
169 * xmlParserVersion:
170 *
171 * Constant string describing the internal version of the library
172 */
William M. Brackf4025492004-08-18 21:08:46 +0000173const char *xmlParserVersion = LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA;
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000174
Daniel Veillard9d06d302002-01-22 18:15:52 +0000175/**
176 * xmlBufferAllocScheme:
177 *
178 * Global setting, default allocation policy for buffers, default is
179 * XML_BUFFER_ALLOC_EXACT
Daniel Veillardb8478642001-10-12 17:29:10 +0000180 */
181xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000182static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_EXACT;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000183/**
184 * xmlDefaultBufferSize:
185 *
186 * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
187 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000188int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000189static int xmlDefaultBufferSizeThrDef = BASE_BUFFER_SIZE;
Daniel Veillardb8478642001-10-12 17:29:10 +0000190
191/*
192 * Parser defaults
193 */
Daniel Veillardd0463562001-10-13 09:15:48 +0000194
Daniel Veillard9d06d302002-01-22 18:15:52 +0000195/**
196 * oldXMLWDcompatibility:
197 *
198 * Global setting, DEPRECATED.
199 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000200int oldXMLWDcompatibility = 0; /* DEPRECATED */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000201/**
202 * xmlParserDebugEntities:
203 *
204 * Global setting, asking the parser to print out debugging informations.
205 * while handling entities.
206 * Disabled by default
207 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000208int xmlParserDebugEntities = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000209static int xmlParserDebugEntitiesThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000210/**
211 * xmlDoValidityCheckingDefaultValue:
212 *
213 * Global setting, indicate that the parser should work in validating mode.
214 * Disabled by default.
215 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000216int xmlDoValidityCheckingDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000217static int xmlDoValidityCheckingDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000218/**
219 * xmlGetWarningsDefaultValue:
220 *
221 * Global setting, indicate that the parser should provide warnings.
222 * Activated by default.
223 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000224int xmlGetWarningsDefaultValue = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000225static int xmlGetWarningsDefaultValueThrDef = 1;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000226/**
227 * xmlLoadExtDtdDefaultValue:
228 *
229 * Global setting, indicate that the parser should load DTD while not
230 * validating.
231 * Disabled by default.
232 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000233int xmlLoadExtDtdDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000234static int xmlLoadExtDtdDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000235/**
236 * xmlPedanticParserDefaultValue:
237 *
238 * Global setting, indicate that the parser be pedantic
239 * Disabled by default.
240 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000241int xmlPedanticParserDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000242static int xmlPedanticParserDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000243/**
244 * xmlLineNumbersDefaultValue:
245 *
246 * Global setting, indicate that the parser should store the line number
247 * in the content field of elements in the DOM tree.
248 * Disabled by default since this may not be safe for old classes of
249 * applicaton.
250 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000251int xmlLineNumbersDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000252static int xmlLineNumbersDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000253/**
254 * xmlKeepBlanksDefaultValue:
255 *
256 * Global setting, indicate that the parser should keep all blanks
257 * nodes found in the content
258 * Activated by default, this is actually needed to have the parser
259 * conformant to the XML Recommendation, however the option is kept
260 * for some applications since this was libxml1 default behaviour.
261 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000262int xmlKeepBlanksDefaultValue = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000263static int xmlKeepBlanksDefaultValueThrDef = 1;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000264/**
265 * xmlSubstituteEntitiesDefaultValue:
266 *
267 * Global setting, indicate that the parser should not generate entity
268 * references but replace them with the actual content of the entity
269 * Disabled by default, this should be activated when using XPath since
270 * the XPath data model requires entities replacement and the XPath
271 * engine does not handle entities references transparently.
272 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000273int xmlSubstituteEntitiesDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000274static int xmlSubstituteEntitiesDefaultValueThrDef = 0;
Daniel Veillardb8478642001-10-12 17:29:10 +0000275
Daniel Veillard5335dc52003-01-01 20:59:38 +0000276xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000277static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000278xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000279static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000280
Daniel Veillard0335a842004-06-02 16:18:40 +0000281xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue = NULL;
282static xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValueThrDef = NULL;
283
284xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue = NULL;
285static xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValueThrDef = NULL;
286
Daniel Veillardb8478642001-10-12 17:29:10 +0000287/*
288 * Error handling
289 */
290
291/* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
292/* Must initialize xmlGenericError in xmlInitParser */
Daniel Veillardffa3c742005-07-21 13:24:09 +0000293void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
Daniel Veillard635ef722001-10-29 11:48:19 +0000294 const char *msg,
295 ...);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000296/**
297 * xmlGenericError:
298 *
299 * Global setting: function used for generic error callbacks
300 */
Daniel Veillard635ef722001-10-29 11:48:19 +0000301xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000302static xmlGenericErrorFunc xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000303/**
Daniel Veillard659e71e2003-10-10 14:10:40 +0000304 * xmlStructuredError:
305 *
306 * Global setting: function used for structured error callbacks
307 */
308xmlStructuredErrorFunc xmlStructuredError = NULL;
309static xmlStructuredErrorFunc xmlStructuredErrorThrDef = NULL;
310/**
Daniel Veillard9d06d302002-01-22 18:15:52 +0000311 * xmlGenericErrorContext:
312 *
313 * Global setting passed to generic error callbacks
314 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000315void *xmlGenericErrorContext = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000316static void *xmlGenericErrorContextThrDef = NULL;
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000317xmlError xmlLastError;
Daniel Veillardb8478642001-10-12 17:29:10 +0000318
319/*
320 * output defaults
321 */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000322/**
323 * xmlIndentTreeOutput:
324 *
325 * Global setting, asking the serializer to indent the output tree by default
Aleksey Sanin23002562002-05-24 07:18:40 +0000326 * Enabled by default
Daniel Veillard9d06d302002-01-22 18:15:52 +0000327 */
Aleksey Sanin23002562002-05-24 07:18:40 +0000328int xmlIndentTreeOutput = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000329static int xmlIndentTreeOutputThrDef = 1;
Aleksey Sanin23002562002-05-24 07:18:40 +0000330
331/**
332 * xmlTreeIndentString:
333 *
334 * The string used to do one-level indent. By default is equal to " " (two spaces)
335 */
336const char *xmlTreeIndentString = " ";
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000337static const char *xmlTreeIndentStringThrDef = " ";
Aleksey Sanin23002562002-05-24 07:18:40 +0000338
Daniel Veillard9d06d302002-01-22 18:15:52 +0000339/**
340 * xmlSaveNoEmptyTags:
341 *
342 * Global setting, asking the serializer to not output empty tags
343 * as <empty/> but <empty></empty>. those two forms are undistinguishable
344 * once parsed.
345 * Disabled by default
346 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000347int xmlSaveNoEmptyTags = 0;
Daniel Veillard24505b02005-07-28 23:49:35 +0000348static int xmlSaveNoEmptyTagsThrDef = 0;
Daniel Veillardb8478642001-10-12 17:29:10 +0000349
Daniel Veillard81273902003-09-30 00:43:48 +0000350#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000351/**
352 * xmlDefaultSAXHandler:
353 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000354 * Default SAX version1 handler for XML, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000355 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000356xmlSAXHandlerV1 xmlDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000357 xmlSAX2InternalSubset,
358 xmlSAX2IsStandalone,
359 xmlSAX2HasInternalSubset,
360 xmlSAX2HasExternalSubset,
361 xmlSAX2ResolveEntity,
362 xmlSAX2GetEntity,
363 xmlSAX2EntityDecl,
364 xmlSAX2NotationDecl,
365 xmlSAX2AttributeDecl,
366 xmlSAX2ElementDecl,
367 xmlSAX2UnparsedEntityDecl,
368 xmlSAX2SetDocumentLocator,
369 xmlSAX2StartDocument,
370 xmlSAX2EndDocument,
371 xmlSAX2StartElement,
372 xmlSAX2EndElement,
373 xmlSAX2Reference,
374 xmlSAX2Characters,
375 xmlSAX2Characters,
376 xmlSAX2ProcessingInstruction,
377 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000378 xmlParserWarning,
379 xmlParserError,
380 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000381 xmlSAX2GetParameterEntity,
382 xmlSAX2CDataBlock,
383 xmlSAX2ExternalSubset,
384 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000385};
Daniel Veillard81273902003-09-30 00:43:48 +0000386#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillardb8478642001-10-12 17:29:10 +0000387
Daniel Veillard9d06d302002-01-22 18:15:52 +0000388/**
389 * xmlDefaultSAXLocator:
390 *
391 * The default SAX Locator
392 * { getPublicId, getSystemId, getLineNumber, getColumnNumber}
Daniel Veillardb8478642001-10-12 17:29:10 +0000393 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000394xmlSAXLocator xmlDefaultSAXLocator = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000395 xmlSAX2GetPublicId,
396 xmlSAX2GetSystemId,
397 xmlSAX2GetLineNumber,
398 xmlSAX2GetColumnNumber
Daniel Veillardb8478642001-10-12 17:29:10 +0000399};
400
401#ifdef LIBXML_HTML_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000402/**
403 * htmlDefaultSAXHandler:
404 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000405 * Default old SAX v1 handler for HTML, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000406 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000407xmlSAXHandlerV1 htmlDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000408 xmlSAX2InternalSubset,
Daniel Veillardb8478642001-10-12 17:29:10 +0000409 NULL,
410 NULL,
411 NULL,
412 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000413 xmlSAX2GetEntity,
Daniel Veillardb8478642001-10-12 17:29:10 +0000414 NULL,
415 NULL,
416 NULL,
417 NULL,
418 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000419 xmlSAX2SetDocumentLocator,
420 xmlSAX2StartDocument,
421 xmlSAX2EndDocument,
422 xmlSAX2StartElement,
423 xmlSAX2EndElement,
Daniel Veillardb8478642001-10-12 17:29:10 +0000424 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000425 xmlSAX2Characters,
426 xmlSAX2IgnorableWhitespace,
Daniel Veillardfc484dd2004-10-22 14:34:23 +0000427 xmlSAX2ProcessingInstruction,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000428 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000429 xmlParserWarning,
430 xmlParserError,
431 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000432 xmlSAX2GetParameterEntity,
433 xmlSAX2CDataBlock,
Daniel Veillardb8478642001-10-12 17:29:10 +0000434 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000435 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000436};
437#endif /* LIBXML_HTML_ENABLED */
438
439#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000440/**
441 * docbDefaultSAXHandler:
442 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000443 * Default old SAX v1 handler for SGML DocBook, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000444 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000445xmlSAXHandlerV1 docbDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000446 xmlSAX2InternalSubset,
447 xmlSAX2IsStandalone,
448 xmlSAX2HasInternalSubset,
449 xmlSAX2HasExternalSubset,
450 xmlSAX2ResolveEntity,
451 xmlSAX2GetEntity,
452 xmlSAX2EntityDecl,
Daniel Veillardb8478642001-10-12 17:29:10 +0000453 NULL,
454 NULL,
455 NULL,
456 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000457 xmlSAX2SetDocumentLocator,
458 xmlSAX2StartDocument,
459 xmlSAX2EndDocument,
460 xmlSAX2StartElement,
461 xmlSAX2EndElement,
462 xmlSAX2Reference,
463 xmlSAX2Characters,
464 xmlSAX2IgnorableWhitespace,
Daniel Veillardb8478642001-10-12 17:29:10 +0000465 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000466 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000467 xmlParserWarning,
468 xmlParserError,
469 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000470 xmlSAX2GetParameterEntity,
Daniel Veillardb8478642001-10-12 17:29:10 +0000471 NULL,
472 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000473 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000474};
475#endif /* LIBXML_DOCB_ENABLED */
476
477/**
478 * xmlInitializeGlobalState:
479 * @gs: a pointer to a newly allocated global state
480 *
481 * xmlInitializeGlobalState() initialize a global state with all the
482 * default values of the library.
483 */
484void
485xmlInitializeGlobalState(xmlGlobalStatePtr gs)
486{
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000487#ifdef DEBUG_GLOBALS
488 fprintf(stderr, "Initializing globals at %lu for thread %d\n",
489 (unsigned long) gs, xmlGetThreadId());
490#endif
491
Daniel Veillardb8478642001-10-12 17:29:10 +0000492 /*
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000493 * Perform initialization as required by libxml
Daniel Veillardb8478642001-10-12 17:29:10 +0000494 */
Daniel Veillard5805be22003-08-28 08:03:23 +0000495 if (xmlThrDefMutex == NULL)
496 xmlInitGlobals();
497
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000498 xmlMutexLock(xmlThrDefMutex);
William M. Brack8b2c7f12002-11-22 05:07:29 +0000499
Daniel Veillardbca3ad22005-08-23 22:14:02 +0000500#if defined(LIBXML_DOCB_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
Daniel Veillard092643b2003-09-25 14:29:29 +0000501 initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000502#endif
Daniel Veillardd8467682005-06-08 17:42:42 +0000503#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED)
Daniel Veillard092643b2003-09-25 14:29:29 +0000504 inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000505#endif
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000506
Daniel Veillardb8478642001-10-12 17:29:10 +0000507 gs->oldXMLWDcompatibility = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000508 gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
509 gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;
William M. Brack21e4ef22005-01-02 09:53:13 +0000510#if defined(LIBXML_SAX1_ENABLED) && defined(LIBXML_LEGACY_ENABLED)
Daniel Veillard092643b2003-09-25 14:29:29 +0000511 initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
Daniel Veillard81273902003-09-30 00:43:48 +0000512#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillard4432df22003-09-28 18:58:27 +0000513 gs->xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId;
514 gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
515 gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
516 gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000517 gs->xmlDoValidityCheckingDefaultValue =
518 xmlDoValidityCheckingDefaultValueThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000519#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
520 gs->xmlFree = (xmlFreeFunc) xmlMemFree;
521 gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000522 gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000523 gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
524 gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
525#else
526 gs->xmlFree = (xmlFreeFunc) free;
527 gs->xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000528 gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000529 gs->xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard572577e2002-01-18 16:23:55 +0000530 gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillardb8478642001-10-12 17:29:10 +0000531#endif
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000532 gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
533 gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
534 gs->xmlTreeIndentString = xmlTreeIndentStringThrDef;
535 gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
536 gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
537 gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
538 gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000539 gs->xmlParserVersion = LIBXML_VERSION_STRING;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000540 gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
541 gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
542 gs->xmlSubstituteEntitiesDefaultValue =
543 xmlSubstituteEntitiesDefaultValueThrDef;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000544
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000545 gs->xmlGenericError = xmlGenericErrorThrDef;
Daniel Veillard659e71e2003-10-10 14:10:40 +0000546 gs->xmlStructuredError = xmlStructuredErrorThrDef;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000547 gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
548 gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
549 gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
Daniel Veillard0335a842004-06-02 16:18:40 +0000550
551 gs->xmlParserInputBufferCreateFilenameValue = xmlParserInputBufferCreateFilenameValueThrDef;
552 gs->xmlOutputBufferCreateFilenameValue = xmlOutputBufferCreateFilenameValueThrDef;
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000553 memset(&gs->xmlLastError, 0, sizeof(xmlError));
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000554
555 xmlMutexUnlock(xmlThrDefMutex);
556}
557
Daniel Veillard1e906612003-12-05 14:57:46 +0000558/**
559 * DOC_DISABLE : we ignore missing doc for the xmlThrDef functions,
560 * those are really internal work
561 */
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000562void
563xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
564 xmlMutexLock(xmlThrDefMutex);
565 xmlGenericErrorContextThrDef = ctx;
566 if (handler != NULL)
567 xmlGenericErrorThrDef = handler;
568 else
569 xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
570 xmlMutexUnlock(xmlThrDefMutex);
Daniel Veillardb8478642001-10-12 17:29:10 +0000571}
572
Daniel Veillard659e71e2003-10-10 14:10:40 +0000573void
574xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
575 xmlMutexLock(xmlThrDefMutex);
576 xmlGenericErrorContextThrDef = ctx;
577 xmlStructuredErrorThrDef = handler;
578 xmlMutexUnlock(xmlThrDefMutex);
579}
580
Daniel Veillard5335dc52003-01-01 20:59:38 +0000581/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000582 * xmlRegisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000583 * @func: function pointer to the new RegisterNodeFunc
584 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000585 * Registers a callback for node creation
586 *
587 * Returns the old value of the registration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000588 */
589xmlRegisterNodeFunc
590xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
591{
592 xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue;
593
Daniel Veillarda880b122003-04-21 21:36:41 +0000594 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000595 xmlRegisterNodeDefaultValue = func;
596 return(old);
597}
598
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000599xmlRegisterNodeFunc
600xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
601{
602 xmlRegisterNodeFunc old;
603
604 xmlMutexLock(xmlThrDefMutex);
605 old = xmlRegisterNodeDefaultValueThrDef;
606
607 __xmlRegisterCallbacks = 1;
608 xmlRegisterNodeDefaultValueThrDef = func;
609 xmlMutexUnlock(xmlThrDefMutex);
610
611 return(old);
612}
613
Daniel Veillard5335dc52003-01-01 20:59:38 +0000614/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000615 * xmlDeregisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000616 * @func: function pointer to the new DeregisterNodeFunc
617 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000618 * Registers a callback for node destruction
619 *
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000620 * Returns the previous value of the deregistration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000621 */
622xmlDeregisterNodeFunc
623xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
624{
625 xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue;
626
Daniel Veillarda880b122003-04-21 21:36:41 +0000627 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000628 xmlDeregisterNodeDefaultValue = func;
629 return(old);
630}
631
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000632xmlDeregisterNodeFunc
633xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
634{
635 xmlDeregisterNodeFunc old;
636
637 xmlMutexLock(xmlThrDefMutex);
638 old = xmlDeregisterNodeDefaultValueThrDef;
639
640 __xmlRegisterCallbacks = 1;
641 xmlDeregisterNodeDefaultValueThrDef = func;
642 xmlMutexUnlock(xmlThrDefMutex);
643
644 return(old);
645}
646
Daniel Veillard0335a842004-06-02 16:18:40 +0000647xmlParserInputBufferCreateFilenameFunc
648xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
649{
650 xmlParserInputBufferCreateFilenameFunc old;
651
652 xmlMutexLock(xmlThrDefMutex);
653 old = xmlParserInputBufferCreateFilenameValueThrDef;
Daniel Veillard1b243b42004-06-08 10:16:42 +0000654 if (old == NULL) {
655 old = __xmlParserInputBufferCreateFilename;
656 }
657
Daniel Veillard0335a842004-06-02 16:18:40 +0000658 xmlParserInputBufferCreateFilenameValueThrDef = func;
659 xmlMutexUnlock(xmlThrDefMutex);
660
661 return(old);
662}
663
Daniel Veillard0335a842004-06-02 16:18:40 +0000664xmlOutputBufferCreateFilenameFunc
665xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
666{
667 xmlOutputBufferCreateFilenameFunc old;
668
669 xmlMutexLock(xmlThrDefMutex);
670 old = xmlOutputBufferCreateFilenameValueThrDef;
Daniel Veillard1b243b42004-06-08 10:16:42 +0000671#ifdef LIBXML_OUTPUT_ENABLED
672 if (old == NULL) {
673 old = __xmlOutputBufferCreateFilename;
674 }
675#endif
Daniel Veillard0335a842004-06-02 16:18:40 +0000676 xmlOutputBufferCreateFilenameValueThrDef = func;
677 xmlMutexUnlock(xmlThrDefMutex);
678
679 return(old);
680}
Daniel Veillard5335dc52003-01-01 20:59:38 +0000681
Daniel Veillarda4617b82001-11-04 20:19:12 +0000682#ifdef LIBXML_DOCB_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000683#undef docbDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000684xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000685__docbDefaultSAXHandler(void) {
686 if (IS_MAIN_THREAD)
687 return (&docbDefaultSAXHandler);
688 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000689 return (&xmlGetGlobalState()->docbDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000690}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000691#endif
Daniel Veillardb8478642001-10-12 17:29:10 +0000692
Daniel Veillarda4617b82001-11-04 20:19:12 +0000693#ifdef LIBXML_HTML_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000694#undef htmlDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000695xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000696__htmlDefaultSAXHandler(void) {
697 if (IS_MAIN_THREAD)
698 return (&htmlDefaultSAXHandler);
699 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000700 return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000701}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000702#endif
703
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000704#undef xmlLastError
705xmlError *
706__xmlLastError(void) {
707 if (IS_MAIN_THREAD)
708 return (&xmlLastError);
709 else
710 return (&xmlGetGlobalState()->xmlLastError);
711}
712
Daniel Veillarda4617b82001-11-04 20:19:12 +0000713/*
William M. Brack5ab479b2004-06-10 13:00:15 +0000714 * The following memory routines were apparently lost at some point,
715 * and were re-inserted at this point on June 10, 2004. Hope it's
716 * the right place for them :-)
717 */
718#if defined(LIBXML_THREAD_ALLOC_ENABLED) && defined(LIBXML_THREAD_ENABLED)
719#undef xmlMalloc
720xmlMallocFunc *
721__xmlMalloc(void){
722 if (IS_MAIN_THREAD)
723 return (&xmlMalloc);
724 else
725 return (&xmlGetGlobalState()->xmlMalloc);
726}
727
728#undef xmlMallocAtomic
729xmlMallocFunc *
730__xmlMallocAtomic(void){
731 if (IS_MAIN_THREAD)
732 return (&xmlMallocAtomic);
733 else
734 return (&xmlGetGlobalState()->xmlMallocAtomic);
735}
736
737#undef xmlRealloc
738xmlReallocFunc *
739__xmlRealloc(void){
740 if (IS_MAIN_THREAD)
741 return (&xmlRealloc);
742 else
743 return (&xmlGetGlobalState()->xmlRealloc);
744}
745
746#undef xmlFree
747xmlFreeFunc *
748__xmlFree(void){
749 if (IS_MAIN_THREAD)
750 return (&xmlFree);
751 else
752 return (&xmlGetGlobalState()->xmlFree);
753}
754
755xmlStrdupFunc *
756__xmlMemStrdup(void){
757 if (IS_MAIN_THREAD)
758 return (&xmlMemStrdup);
759 else
760 return (&xmlGetGlobalState()->xmlMemStrdup);
761}
762
763#endif
764
765/*
Daniel Veillarda4617b82001-11-04 20:19:12 +0000766 * Everything starting from the line below is
767 * Automatically generated by build_glob.py.
768 * Do not modify the previous line.
769 */
770
Daniel Veillardb8478642001-10-12 17:29:10 +0000771
Daniel Veillardb8478642001-10-12 17:29:10 +0000772#undef oldXMLWDcompatibility
773int *
774__oldXMLWDcompatibility(void) {
775 if (IS_MAIN_THREAD)
776 return (&oldXMLWDcompatibility);
777 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000778 return (&xmlGetGlobalState()->oldXMLWDcompatibility);
Daniel Veillardb8478642001-10-12 17:29:10 +0000779}
780
Daniel Veillardb8478642001-10-12 17:29:10 +0000781#undef xmlBufferAllocScheme
782xmlBufferAllocationScheme *
783__xmlBufferAllocScheme(void) {
784 if (IS_MAIN_THREAD)
785 return (&xmlBufferAllocScheme);
786 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000787 return (&xmlGetGlobalState()->xmlBufferAllocScheme);
Daniel Veillardb8478642001-10-12 17:29:10 +0000788}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000789xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
790 xmlBufferAllocationScheme ret;
791 xmlMutexLock(xmlThrDefMutex);
792 ret = xmlBufferAllocSchemeThrDef;
793 xmlBufferAllocSchemeThrDef = v;
794 xmlMutexUnlock(xmlThrDefMutex);
795 return ret;
796}
Daniel Veillardb8478642001-10-12 17:29:10 +0000797
Daniel Veillardb8478642001-10-12 17:29:10 +0000798#undef xmlDefaultBufferSize
799int *
800__xmlDefaultBufferSize(void) {
801 if (IS_MAIN_THREAD)
802 return (&xmlDefaultBufferSize);
803 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000804 return (&xmlGetGlobalState()->xmlDefaultBufferSize);
Daniel Veillardb8478642001-10-12 17:29:10 +0000805}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000806int xmlThrDefDefaultBufferSize(int v) {
807 int ret;
808 xmlMutexLock(xmlThrDefMutex);
809 ret = xmlDefaultBufferSizeThrDef;
810 xmlDefaultBufferSizeThrDef = v;
811 xmlMutexUnlock(xmlThrDefMutex);
812 return ret;
813}
Daniel Veillardb8478642001-10-12 17:29:10 +0000814
Daniel Veillard81273902003-09-30 00:43:48 +0000815#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000816#undef xmlDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000817xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000818__xmlDefaultSAXHandler(void) {
819 if (IS_MAIN_THREAD)
820 return (&xmlDefaultSAXHandler);
821 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000822 return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000823}
Daniel Veillard81273902003-09-30 00:43:48 +0000824#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillardb8478642001-10-12 17:29:10 +0000825
Daniel Veillardb8478642001-10-12 17:29:10 +0000826#undef xmlDefaultSAXLocator
827xmlSAXLocator *
828__xmlDefaultSAXLocator(void) {
829 if (IS_MAIN_THREAD)
830 return (&xmlDefaultSAXLocator);
831 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000832 return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
Daniel Veillardb8478642001-10-12 17:29:10 +0000833}
834
Daniel Veillardb8478642001-10-12 17:29:10 +0000835#undef xmlDoValidityCheckingDefaultValue
836int *
837__xmlDoValidityCheckingDefaultValue(void) {
838 if (IS_MAIN_THREAD)
839 return (&xmlDoValidityCheckingDefaultValue);
840 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000841 return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000842}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000843int xmlThrDefDoValidityCheckingDefaultValue(int v) {
844 int ret;
845 xmlMutexLock(xmlThrDefMutex);
846 ret = xmlDoValidityCheckingDefaultValueThrDef;
847 xmlDoValidityCheckingDefaultValueThrDef = v;
848 xmlMutexUnlock(xmlThrDefMutex);
849 return ret;
850}
Daniel Veillardb8478642001-10-12 17:29:10 +0000851
Daniel Veillardb8478642001-10-12 17:29:10 +0000852#undef xmlGenericError
853xmlGenericErrorFunc *
854__xmlGenericError(void) {
855 if (IS_MAIN_THREAD)
856 return (&xmlGenericError);
857 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000858 return (&xmlGetGlobalState()->xmlGenericError);
Daniel Veillardb8478642001-10-12 17:29:10 +0000859}
860
Daniel Veillard659e71e2003-10-10 14:10:40 +0000861#undef xmlStructuredError
862xmlStructuredErrorFunc *
863__xmlStructuredError(void) {
864 if (IS_MAIN_THREAD)
865 return (&xmlStructuredError);
866 else
867 return (&xmlGetGlobalState()->xmlStructuredError);
868}
869
Daniel Veillardb8478642001-10-12 17:29:10 +0000870#undef xmlGenericErrorContext
871void * *
872__xmlGenericErrorContext(void) {
873 if (IS_MAIN_THREAD)
874 return (&xmlGenericErrorContext);
875 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000876 return (&xmlGetGlobalState()->xmlGenericErrorContext);
Daniel Veillardb8478642001-10-12 17:29:10 +0000877}
878
Daniel Veillardb8478642001-10-12 17:29:10 +0000879#undef xmlGetWarningsDefaultValue
880int *
881__xmlGetWarningsDefaultValue(void) {
882 if (IS_MAIN_THREAD)
883 return (&xmlGetWarningsDefaultValue);
884 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000885 return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000886}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000887int xmlThrDefGetWarningsDefaultValue(int v) {
888 int ret;
889 xmlMutexLock(xmlThrDefMutex);
890 ret = xmlGetWarningsDefaultValueThrDef;
891 xmlGetWarningsDefaultValueThrDef = v;
892 xmlMutexUnlock(xmlThrDefMutex);
893 return ret;
894}
Daniel Veillardb8478642001-10-12 17:29:10 +0000895
Daniel Veillardb8478642001-10-12 17:29:10 +0000896#undef xmlIndentTreeOutput
897int *
898__xmlIndentTreeOutput(void) {
899 if (IS_MAIN_THREAD)
900 return (&xmlIndentTreeOutput);
901 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000902 return (&xmlGetGlobalState()->xmlIndentTreeOutput);
Daniel Veillardb8478642001-10-12 17:29:10 +0000903}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000904int xmlThrDefIndentTreeOutput(int v) {
905 int ret;
906 xmlMutexLock(xmlThrDefMutex);
907 ret = xmlIndentTreeOutputThrDef;
908 xmlIndentTreeOutputThrDef = v;
909 xmlMutexUnlock(xmlThrDefMutex);
910 return ret;
911}
Daniel Veillardb8478642001-10-12 17:29:10 +0000912
Aleksey Sanin23002562002-05-24 07:18:40 +0000913#undef xmlTreeIndentString
914const char * *
915__xmlTreeIndentString(void) {
916 if (IS_MAIN_THREAD)
917 return (&xmlTreeIndentString);
918 else
919 return (&xmlGetGlobalState()->xmlTreeIndentString);
920}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000921const char * xmlThrDefTreeIndentString(const char * v) {
922 const char * ret;
923 xmlMutexLock(xmlThrDefMutex);
924 ret = xmlTreeIndentStringThrDef;
925 xmlTreeIndentStringThrDef = v;
926 xmlMutexUnlock(xmlThrDefMutex);
927 return ret;
928}
Aleksey Sanin23002562002-05-24 07:18:40 +0000929
Daniel Veillardb8478642001-10-12 17:29:10 +0000930#undef xmlKeepBlanksDefaultValue
931int *
932__xmlKeepBlanksDefaultValue(void) {
933 if (IS_MAIN_THREAD)
934 return (&xmlKeepBlanksDefaultValue);
935 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000936 return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000937}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000938int xmlThrDefKeepBlanksDefaultValue(int v) {
939 int ret;
940 xmlMutexLock(xmlThrDefMutex);
941 ret = xmlKeepBlanksDefaultValueThrDef;
942 xmlKeepBlanksDefaultValueThrDef = v;
943 xmlMutexUnlock(xmlThrDefMutex);
944 return ret;
945}
Daniel Veillardb8478642001-10-12 17:29:10 +0000946
Daniel Veillardb8478642001-10-12 17:29:10 +0000947#undef xmlLineNumbersDefaultValue
948int *
949__xmlLineNumbersDefaultValue(void) {
950 if (IS_MAIN_THREAD)
951 return (&xmlLineNumbersDefaultValue);
952 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000953 return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000954}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000955int xmlThrDefLineNumbersDefaultValue(int v) {
956 int ret;
957 xmlMutexLock(xmlThrDefMutex);
958 ret = xmlLineNumbersDefaultValueThrDef;
959 xmlLineNumbersDefaultValueThrDef = v;
960 xmlMutexUnlock(xmlThrDefMutex);
961 return ret;
962}
Daniel Veillardb8478642001-10-12 17:29:10 +0000963
Daniel Veillardb8478642001-10-12 17:29:10 +0000964#undef xmlLoadExtDtdDefaultValue
965int *
966__xmlLoadExtDtdDefaultValue(void) {
967 if (IS_MAIN_THREAD)
968 return (&xmlLoadExtDtdDefaultValue);
969 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000970 return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000971}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000972int xmlThrDefLoadExtDtdDefaultValue(int v) {
973 int ret;
974 xmlMutexLock(xmlThrDefMutex);
975 ret = xmlLoadExtDtdDefaultValueThrDef;
976 xmlLoadExtDtdDefaultValueThrDef = v;
977 xmlMutexUnlock(xmlThrDefMutex);
978 return ret;
979}
Daniel Veillardb8478642001-10-12 17:29:10 +0000980
Daniel Veillardb8478642001-10-12 17:29:10 +0000981#undef xmlParserDebugEntities
982int *
983__xmlParserDebugEntities(void) {
984 if (IS_MAIN_THREAD)
985 return (&xmlParserDebugEntities);
986 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000987 return (&xmlGetGlobalState()->xmlParserDebugEntities);
Daniel Veillardb8478642001-10-12 17:29:10 +0000988}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000989int xmlThrDefParserDebugEntities(int v) {
990 int ret;
991 xmlMutexLock(xmlThrDefMutex);
992 ret = xmlParserDebugEntitiesThrDef;
993 xmlParserDebugEntitiesThrDef = v;
994 xmlMutexUnlock(xmlThrDefMutex);
995 return ret;
996}
Daniel Veillardb8478642001-10-12 17:29:10 +0000997
Daniel Veillardb8478642001-10-12 17:29:10 +0000998#undef xmlParserVersion
999const char * *
1000__xmlParserVersion(void) {
1001 if (IS_MAIN_THREAD)
1002 return (&xmlParserVersion);
1003 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001004 return (&xmlGetGlobalState()->xmlParserVersion);
Daniel Veillardb8478642001-10-12 17:29:10 +00001005}
1006
Daniel Veillardb8478642001-10-12 17:29:10 +00001007#undef xmlPedanticParserDefaultValue
1008int *
1009__xmlPedanticParserDefaultValue(void) {
1010 if (IS_MAIN_THREAD)
1011 return (&xmlPedanticParserDefaultValue);
1012 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001013 return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +00001014}
Daniel Veillard781ac8b2003-05-15 22:11:36 +00001015int xmlThrDefPedanticParserDefaultValue(int v) {
1016 int ret;
1017 xmlMutexLock(xmlThrDefMutex);
1018 ret = xmlPedanticParserDefaultValueThrDef;
1019 xmlPedanticParserDefaultValueThrDef = v;
1020 xmlMutexUnlock(xmlThrDefMutex);
1021 return ret;
1022}
Daniel Veillardb8478642001-10-12 17:29:10 +00001023
Daniel Veillardb8478642001-10-12 17:29:10 +00001024#undef xmlSaveNoEmptyTags
1025int *
1026__xmlSaveNoEmptyTags(void) {
1027 if (IS_MAIN_THREAD)
1028 return (&xmlSaveNoEmptyTags);
1029 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001030 return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
Daniel Veillardb8478642001-10-12 17:29:10 +00001031}
Daniel Veillard781ac8b2003-05-15 22:11:36 +00001032int xmlThrDefSaveNoEmptyTags(int v) {
1033 int ret;
1034 xmlMutexLock(xmlThrDefMutex);
1035 ret = xmlSaveNoEmptyTagsThrDef;
1036 xmlSaveNoEmptyTagsThrDef = v;
1037 xmlMutexUnlock(xmlThrDefMutex);
1038 return ret;
1039}
Daniel Veillardb8478642001-10-12 17:29:10 +00001040
Daniel Veillardb8478642001-10-12 17:29:10 +00001041#undef xmlSubstituteEntitiesDefaultValue
1042int *
1043__xmlSubstituteEntitiesDefaultValue(void) {
1044 if (IS_MAIN_THREAD)
1045 return (&xmlSubstituteEntitiesDefaultValue);
1046 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001047 return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +00001048}
Daniel Veillard781ac8b2003-05-15 22:11:36 +00001049int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
1050 int ret;
1051 xmlMutexLock(xmlThrDefMutex);
1052 ret = xmlSubstituteEntitiesDefaultValueThrDef;
1053 xmlSubstituteEntitiesDefaultValueThrDef = v;
1054 xmlMutexUnlock(xmlThrDefMutex);
1055 return ret;
1056}
Daniel Veillard5335dc52003-01-01 20:59:38 +00001057
1058#undef xmlRegisterNodeDefaultValue
1059xmlRegisterNodeFunc *
1060__xmlRegisterNodeDefaultValue(void) {
1061 if (IS_MAIN_THREAD)
1062 return (&xmlRegisterNodeDefaultValue);
1063 else
1064 return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue);
1065}
1066
1067#undef xmlDeregisterNodeDefaultValue
1068xmlDeregisterNodeFunc *
1069__xmlDeregisterNodeDefaultValue(void) {
1070 if (IS_MAIN_THREAD)
1071 return (&xmlDeregisterNodeDefaultValue);
1072 else
1073 return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue);
1074}
Daniel Veillard0335a842004-06-02 16:18:40 +00001075
1076#undef xmlParserInputBufferCreateFilenameValue
1077xmlParserInputBufferCreateFilenameFunc *
1078__xmlParserInputBufferCreateFilenameValue(void) {
1079 if (IS_MAIN_THREAD)
1080 return (&xmlParserInputBufferCreateFilenameValue);
1081 else
1082 return (&xmlGetGlobalState()->xmlParserInputBufferCreateFilenameValue);
1083}
1084
1085#undef xmlOutputBufferCreateFilenameValue
1086xmlOutputBufferCreateFilenameFunc *
1087__xmlOutputBufferCreateFilenameValue(void) {
1088 if (IS_MAIN_THREAD)
1089 return (&xmlOutputBufferCreateFilenameValue);
1090 else
1091 return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue);
William M. Brack803812b2004-06-03 02:11:24 +00001092}
Daniel Veillard5d4644e2005-04-01 13:11:58 +00001093
1094#define bottom_globals
1095#include "elfgcchack.h"