blob: 140bc899dd5b1b2ca42bcfb0f34d9c28544b840a [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
42void xmlInitGlobals()
43{
44 xmlThrDefMutex = xmlNewMutex();
45}
46
47void xmlCleanupGlobals()
48{
Daniel Veillard2009c4e2003-07-15 20:04:34 +000049 if (xmlThrDefMutex != NULL) {
Daniel Veillarddf101d82003-07-08 14:03:36 +000050 xmlFreeMutex(xmlThrDefMutex);
Daniel Veillard2009c4e2003-07-15 20:04:34 +000051 xmlThrDefMutex = NULL;
52 }
Daniel Veillard781ac8b2003-05-15 22:11:36 +000053}
54
Daniel Veillardb8478642001-10-12 17:29:10 +000055/************************************************************************
56 * *
57 * All the user accessible global variables of the library *
58 * *
59 ************************************************************************/
60
Daniel Veillardb8478642001-10-12 17:29:10 +000061/*
62 * Memory allocation routines
63 */
Daniel Veillard7216cfd2002-11-08 15:10:00 +000064#if defined(DEBUG_MEMORY_LOCATION) || defined(DEBUG_MEMORY)
Daniel Veillard092643b2003-09-25 14:29:29 +000065#ifndef __DEBUG_MEMORY_ALLOC__
Daniel Veillardd0463562001-10-13 09:15:48 +000066extern void xmlMemFree(void *ptr);
67extern void * xmlMemMalloc(size_t size);
68extern void * xmlMemRealloc(void *ptr,size_t size);
69extern char * xmlMemoryStrdup(const char *str);
Daniel Veillard98485322003-08-14 15:44:40 +000070#endif
Daniel Veillardd0463562001-10-13 09:15:48 +000071
Daniel Veillardb8478642001-10-12 17:29:10 +000072xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
73xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +000074xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillardb8478642001-10-12 17:29:10 +000075xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
76xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
77#else
Daniel Veillard9d06d302002-01-22 18:15:52 +000078/**
79 * xmlFree:
80 * @mem: an already allocated block of memory
81 *
82 * The variable holding the libxml free() implementation
83 */
Daniel Veillardb8478642001-10-12 17:29:10 +000084xmlFreeFunc xmlFree = (xmlFreeFunc) free;
Daniel Veillard9d06d302002-01-22 18:15:52 +000085/**
86 * xmlMalloc:
87 * @size: the size requested in bytes
88 *
89 * The variable holding the libxml malloc() implementation
90 *
91 * Returns a pointer to the newly allocated block or NULL in case of error
92 */
Daniel Veillardb8478642001-10-12 17:29:10 +000093xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard9d06d302002-01-22 18:15:52 +000094/**
Daniel Veillard3c908dc2003-04-19 00:07:51 +000095 * xmlMallocAtomic:
96 * @size: the size requested in bytes
97 *
98 * The variable holding the libxml malloc() implementation for atomic
99 * data (i.e. blocks not containings pointers), useful when using a
100 * garbage collecting allocator.
101 *
102 * Returns a pointer to the newly allocated block or NULL in case of error
103 */
104xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) malloc;
105/**
Daniel Veillard9d06d302002-01-22 18:15:52 +0000106 * xmlRealloc:
107 * @mem: an already allocated block of memory
108 * @size: the new size requested in bytes
109 *
110 * The variable holding the libxml realloc() implementation
111 *
112 * Returns a pointer to the newly reallocated block or NULL in case of error
113 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000114xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000115/**
116 * xmlMemStrdup:
117 * @str: a zero terminated string
118 *
119 * The variable holding the libxml strdup() implementation
120 *
121 * Returns the copy of the string or NULL in case of error
122 */
Daniel Veillardb82c1662001-12-09 14:00:54 +0000123xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillardb8478642001-10-12 17:29:10 +0000124#endif
125
Daniel Veillardd0463562001-10-13 09:15:48 +0000126#include <libxml/threads.h>
127#include <libxml/globals.h>
128#include <libxml/SAX.h>
129
130#undef docbDefaultSAXHandler
131#undef htmlDefaultSAXHandler
132#undef oldXMLWDcompatibility
133#undef xmlBufferAllocScheme
134#undef xmlDefaultBufferSize
135#undef xmlDefaultSAXHandler
136#undef xmlDefaultSAXLocator
137#undef xmlDoValidityCheckingDefaultValue
138#undef xmlGenericError
139#undef xmlGenericErrorContext
140#undef xmlGetWarningsDefaultValue
141#undef xmlIndentTreeOutput
Aleksey Sanin23002562002-05-24 07:18:40 +0000142#undef xmlTreeIndentString
Daniel Veillardd0463562001-10-13 09:15:48 +0000143#undef xmlKeepBlanksDefaultValue
144#undef xmlLineNumbersDefaultValue
145#undef xmlLoadExtDtdDefaultValue
146#undef xmlParserDebugEntities
147#undef xmlParserVersion
148#undef xmlPedanticParserDefaultValue
149#undef xmlSaveNoEmptyTags
150#undef xmlSubstituteEntitiesDefaultValue
Daniel Veillard8326e732003-01-07 00:19:07 +0000151#undef xmlRegisterNodeDefaultValue
152#undef xmlDeregisterNodeDefaultValue
Daniel Veillardd0463562001-10-13 09:15:48 +0000153
154#undef xmlFree
155#undef xmlMalloc
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000156#undef xmlMallocAtomic
Daniel Veillardd0463562001-10-13 09:15:48 +0000157#undef xmlMemStrdup
158#undef xmlRealloc
159
Daniel Veillard9d06d302002-01-22 18:15:52 +0000160/**
161 * xmlParserVersion:
162 *
163 * Constant string describing the internal version of the library
164 */
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000165const char *xmlParserVersion = LIBXML_VERSION_STRING;
166
Daniel Veillard9d06d302002-01-22 18:15:52 +0000167/**
168 * xmlBufferAllocScheme:
169 *
170 * Global setting, default allocation policy for buffers, default is
171 * XML_BUFFER_ALLOC_EXACT
Daniel Veillardb8478642001-10-12 17:29:10 +0000172 */
173xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000174static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_EXACT;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000175/**
176 * xmlDefaultBufferSize:
177 *
178 * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
179 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000180int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000181static int xmlDefaultBufferSizeThrDef = BASE_BUFFER_SIZE;
Daniel Veillardb8478642001-10-12 17:29:10 +0000182
183/*
184 * Parser defaults
185 */
Daniel Veillardd0463562001-10-13 09:15:48 +0000186
Daniel Veillard9d06d302002-01-22 18:15:52 +0000187/**
188 * oldXMLWDcompatibility:
189 *
190 * Global setting, DEPRECATED.
191 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000192int oldXMLWDcompatibility = 0; /* DEPRECATED */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000193/**
194 * xmlParserDebugEntities:
195 *
196 * Global setting, asking the parser to print out debugging informations.
197 * while handling entities.
198 * Disabled by default
199 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000200int xmlParserDebugEntities = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000201static int xmlParserDebugEntitiesThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000202/**
203 * xmlDoValidityCheckingDefaultValue:
204 *
205 * Global setting, indicate that the parser should work in validating mode.
206 * Disabled by default.
207 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000208int xmlDoValidityCheckingDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000209static int xmlDoValidityCheckingDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000210/**
211 * xmlGetWarningsDefaultValue:
212 *
213 * Global setting, indicate that the parser should provide warnings.
214 * Activated by default.
215 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000216int xmlGetWarningsDefaultValue = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000217static int xmlGetWarningsDefaultValueThrDef = 1;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000218/**
219 * xmlLoadExtDtdDefaultValue:
220 *
221 * Global setting, indicate that the parser should load DTD while not
222 * validating.
223 * Disabled by default.
224 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000225int xmlLoadExtDtdDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000226static int xmlLoadExtDtdDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000227/**
228 * xmlPedanticParserDefaultValue:
229 *
230 * Global setting, indicate that the parser be pedantic
231 * Disabled by default.
232 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000233int xmlPedanticParserDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000234static int xmlPedanticParserDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000235/**
236 * xmlLineNumbersDefaultValue:
237 *
238 * Global setting, indicate that the parser should store the line number
239 * in the content field of elements in the DOM tree.
240 * Disabled by default since this may not be safe for old classes of
241 * applicaton.
242 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000243int xmlLineNumbersDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000244static int xmlLineNumbersDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000245/**
246 * xmlKeepBlanksDefaultValue:
247 *
248 * Global setting, indicate that the parser should keep all blanks
249 * nodes found in the content
250 * Activated by default, this is actually needed to have the parser
251 * conformant to the XML Recommendation, however the option is kept
252 * for some applications since this was libxml1 default behaviour.
253 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000254int xmlKeepBlanksDefaultValue = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000255static int xmlKeepBlanksDefaultValueThrDef = 1;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000256/**
257 * xmlSubstituteEntitiesDefaultValue:
258 *
259 * Global setting, indicate that the parser should not generate entity
260 * references but replace them with the actual content of the entity
261 * Disabled by default, this should be activated when using XPath since
262 * the XPath data model requires entities replacement and the XPath
263 * engine does not handle entities references transparently.
264 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000265int xmlSubstituteEntitiesDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000266static int xmlSubstituteEntitiesDefaultValueThrDef = 0;
Daniel Veillardb8478642001-10-12 17:29:10 +0000267
Daniel Veillard5335dc52003-01-01 20:59:38 +0000268xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000269static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000270xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000271static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000272
Daniel Veillardb8478642001-10-12 17:29:10 +0000273/*
274 * Error handling
275 */
276
277/* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
278/* Must initialize xmlGenericError in xmlInitParser */
Daniel Veillard635ef722001-10-29 11:48:19 +0000279void xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
280 const char *msg,
281 ...);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000282/**
283 * xmlGenericError:
284 *
285 * Global setting: function used for generic error callbacks
286 */
Daniel Veillard635ef722001-10-29 11:48:19 +0000287xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000288static xmlGenericErrorFunc xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000289/**
290 * xmlGenericErrorContext:
291 *
292 * Global setting passed to generic error callbacks
293 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000294void *xmlGenericErrorContext = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000295static void *xmlGenericErrorContextThrDef = NULL;
Daniel Veillardb8478642001-10-12 17:29:10 +0000296
297/*
298 * output defaults
299 */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000300/**
301 * xmlIndentTreeOutput:
302 *
303 * Global setting, asking the serializer to indent the output tree by default
Aleksey Sanin23002562002-05-24 07:18:40 +0000304 * Enabled by default
Daniel Veillard9d06d302002-01-22 18:15:52 +0000305 */
Aleksey Sanin23002562002-05-24 07:18:40 +0000306int xmlIndentTreeOutput = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000307static int xmlIndentTreeOutputThrDef = 1;
Aleksey Sanin23002562002-05-24 07:18:40 +0000308
309/**
310 * xmlTreeIndentString:
311 *
312 * The string used to do one-level indent. By default is equal to " " (two spaces)
313 */
314const char *xmlTreeIndentString = " ";
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000315static const char *xmlTreeIndentStringThrDef = " ";
Aleksey Sanin23002562002-05-24 07:18:40 +0000316
Daniel Veillard9d06d302002-01-22 18:15:52 +0000317/**
318 * xmlSaveNoEmptyTags:
319 *
320 * Global setting, asking the serializer to not output empty tags
321 * as <empty/> but <empty></empty>. those two forms are undistinguishable
322 * once parsed.
323 * Disabled by default
324 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000325int xmlSaveNoEmptyTags = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000326int xmlSaveNoEmptyTagsThrDef = 0;
Daniel Veillardb8478642001-10-12 17:29:10 +0000327
Daniel Veillard81273902003-09-30 00:43:48 +0000328#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000329/**
330 * xmlDefaultSAXHandler:
331 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000332 * Default SAX version1 handler for XML, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000333 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000334xmlSAXHandlerV1 xmlDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000335 xmlSAX2InternalSubset,
336 xmlSAX2IsStandalone,
337 xmlSAX2HasInternalSubset,
338 xmlSAX2HasExternalSubset,
339 xmlSAX2ResolveEntity,
340 xmlSAX2GetEntity,
341 xmlSAX2EntityDecl,
342 xmlSAX2NotationDecl,
343 xmlSAX2AttributeDecl,
344 xmlSAX2ElementDecl,
345 xmlSAX2UnparsedEntityDecl,
346 xmlSAX2SetDocumentLocator,
347 xmlSAX2StartDocument,
348 xmlSAX2EndDocument,
349 xmlSAX2StartElement,
350 xmlSAX2EndElement,
351 xmlSAX2Reference,
352 xmlSAX2Characters,
353 xmlSAX2Characters,
354 xmlSAX2ProcessingInstruction,
355 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000356 xmlParserWarning,
357 xmlParserError,
358 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000359 xmlSAX2GetParameterEntity,
360 xmlSAX2CDataBlock,
361 xmlSAX2ExternalSubset,
362 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000363};
Daniel Veillard81273902003-09-30 00:43:48 +0000364#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillardb8478642001-10-12 17:29:10 +0000365
Daniel Veillard9d06d302002-01-22 18:15:52 +0000366/**
367 * xmlDefaultSAXLocator:
368 *
369 * The default SAX Locator
370 * { getPublicId, getSystemId, getLineNumber, getColumnNumber}
Daniel Veillardb8478642001-10-12 17:29:10 +0000371 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000372xmlSAXLocator xmlDefaultSAXLocator = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000373 xmlSAX2GetPublicId,
374 xmlSAX2GetSystemId,
375 xmlSAX2GetLineNumber,
376 xmlSAX2GetColumnNumber
Daniel Veillardb8478642001-10-12 17:29:10 +0000377};
378
379#ifdef LIBXML_HTML_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000380/**
381 * htmlDefaultSAXHandler:
382 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000383 * Default old SAX v1 handler for HTML, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000384 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000385xmlSAXHandlerV1 htmlDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000386 xmlSAX2InternalSubset,
Daniel Veillardb8478642001-10-12 17:29:10 +0000387 NULL,
388 NULL,
389 NULL,
390 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000391 xmlSAX2GetEntity,
Daniel Veillardb8478642001-10-12 17:29:10 +0000392 NULL,
393 NULL,
394 NULL,
395 NULL,
396 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000397 xmlSAX2SetDocumentLocator,
398 xmlSAX2StartDocument,
399 xmlSAX2EndDocument,
400 xmlSAX2StartElement,
401 xmlSAX2EndElement,
Daniel Veillardb8478642001-10-12 17:29:10 +0000402 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000403 xmlSAX2Characters,
404 xmlSAX2IgnorableWhitespace,
Daniel Veillardb8478642001-10-12 17:29:10 +0000405 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000406 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000407 xmlParserWarning,
408 xmlParserError,
409 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000410 xmlSAX2GetParameterEntity,
411 xmlSAX2CDataBlock,
Daniel Veillardb8478642001-10-12 17:29:10 +0000412 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000413 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000414};
415#endif /* LIBXML_HTML_ENABLED */
416
417#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000418/**
419 * docbDefaultSAXHandler:
420 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000421 * Default old SAX v1 handler for SGML DocBook, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000422 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000423xmlSAXHandlerV1 docbDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000424 xmlSAX2InternalSubset,
425 xmlSAX2IsStandalone,
426 xmlSAX2HasInternalSubset,
427 xmlSAX2HasExternalSubset,
428 xmlSAX2ResolveEntity,
429 xmlSAX2GetEntity,
430 xmlSAX2EntityDecl,
Daniel Veillardb8478642001-10-12 17:29:10 +0000431 NULL,
432 NULL,
433 NULL,
434 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000435 xmlSAX2SetDocumentLocator,
436 xmlSAX2StartDocument,
437 xmlSAX2EndDocument,
438 xmlSAX2StartElement,
439 xmlSAX2EndElement,
440 xmlSAX2Reference,
441 xmlSAX2Characters,
442 xmlSAX2IgnorableWhitespace,
Daniel Veillardb8478642001-10-12 17:29:10 +0000443 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000444 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000445 xmlParserWarning,
446 xmlParserError,
447 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000448 xmlSAX2GetParameterEntity,
Daniel Veillardb8478642001-10-12 17:29:10 +0000449 NULL,
450 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000451 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000452};
453#endif /* LIBXML_DOCB_ENABLED */
454
455/**
456 * xmlInitializeGlobalState:
457 * @gs: a pointer to a newly allocated global state
458 *
459 * xmlInitializeGlobalState() initialize a global state with all the
460 * default values of the library.
461 */
462void
463xmlInitializeGlobalState(xmlGlobalStatePtr gs)
464{
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000465#ifdef DEBUG_GLOBALS
466 fprintf(stderr, "Initializing globals at %lu for thread %d\n",
467 (unsigned long) gs, xmlGetThreadId());
468#endif
469
Daniel Veillardb8478642001-10-12 17:29:10 +0000470 /*
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000471 * Perform initialization as required by libxml
Daniel Veillardb8478642001-10-12 17:29:10 +0000472 */
Daniel Veillard5805be22003-08-28 08:03:23 +0000473 if (xmlThrDefMutex == NULL)
474 xmlInitGlobals();
475
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000476 xmlMutexLock(xmlThrDefMutex);
William M. Brack8b2c7f12002-11-22 05:07:29 +0000477
Daniel Veillarda4617b82001-11-04 20:19:12 +0000478#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard092643b2003-09-25 14:29:29 +0000479 initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000480#endif
481#ifdef LIBXML_HTML_ENABLED
Daniel Veillard092643b2003-09-25 14:29:29 +0000482 inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000483#endif
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000484
Daniel Veillardb8478642001-10-12 17:29:10 +0000485 gs->oldXMLWDcompatibility = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000486 gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
487 gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;
Daniel Veillard81273902003-09-30 00:43:48 +0000488#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard092643b2003-09-25 14:29:29 +0000489 initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
Daniel Veillard81273902003-09-30 00:43:48 +0000490#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillard4432df22003-09-28 18:58:27 +0000491 gs->xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId;
492 gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
493 gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
494 gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000495 gs->xmlDoValidityCheckingDefaultValue =
496 xmlDoValidityCheckingDefaultValueThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000497#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
498 gs->xmlFree = (xmlFreeFunc) xmlMemFree;
499 gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000500 gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000501 gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
502 gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
503#else
504 gs->xmlFree = (xmlFreeFunc) free;
505 gs->xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000506 gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000507 gs->xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard572577e2002-01-18 16:23:55 +0000508 gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillardb8478642001-10-12 17:29:10 +0000509#endif
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000510 gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
511 gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
512 gs->xmlTreeIndentString = xmlTreeIndentStringThrDef;
513 gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
514 gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
515 gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
516 gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000517 gs->xmlParserVersion = LIBXML_VERSION_STRING;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000518 gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
519 gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
520 gs->xmlSubstituteEntitiesDefaultValue =
521 xmlSubstituteEntitiesDefaultValueThrDef;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000522
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000523 gs->xmlGenericError = xmlGenericErrorThrDef;
524 gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
525 gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
526 gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
527
528 xmlMutexUnlock(xmlThrDefMutex);
529}
530
531void
532xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
533 xmlMutexLock(xmlThrDefMutex);
534 xmlGenericErrorContextThrDef = ctx;
535 if (handler != NULL)
536 xmlGenericErrorThrDef = handler;
537 else
538 xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
539 xmlMutexUnlock(xmlThrDefMutex);
Daniel Veillardb8478642001-10-12 17:29:10 +0000540}
541
Daniel Veillard5335dc52003-01-01 20:59:38 +0000542/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000543 * xmlRegisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000544 * @func: function pointer to the new RegisterNodeFunc
545 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000546 * Registers a callback for node creation
547 *
548 * Returns the old value of the registration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000549 */
550xmlRegisterNodeFunc
551xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
552{
553 xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue;
554
Daniel Veillarda880b122003-04-21 21:36:41 +0000555 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000556 xmlRegisterNodeDefaultValue = func;
557 return(old);
558}
559
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000560xmlRegisterNodeFunc
561xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
562{
563 xmlRegisterNodeFunc old;
564
565 xmlMutexLock(xmlThrDefMutex);
566 old = xmlRegisterNodeDefaultValueThrDef;
567
568 __xmlRegisterCallbacks = 1;
569 xmlRegisterNodeDefaultValueThrDef = func;
570 xmlMutexUnlock(xmlThrDefMutex);
571
572 return(old);
573}
574
Daniel Veillard5335dc52003-01-01 20:59:38 +0000575/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000576 * xmlDeregisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000577 * @func: function pointer to the new DeregisterNodeFunc
578 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000579 * Registers a callback for node destruction
580 *
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000581 * Returns the previous value of the deregistration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000582 */
583xmlDeregisterNodeFunc
584xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
585{
586 xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue;
587
Daniel Veillarda880b122003-04-21 21:36:41 +0000588 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000589 xmlDeregisterNodeDefaultValue = func;
590 return(old);
591}
592
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000593xmlDeregisterNodeFunc
594xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
595{
596 xmlDeregisterNodeFunc old;
597
598 xmlMutexLock(xmlThrDefMutex);
599 old = xmlDeregisterNodeDefaultValueThrDef;
600
601 __xmlRegisterCallbacks = 1;
602 xmlDeregisterNodeDefaultValueThrDef = func;
603 xmlMutexUnlock(xmlThrDefMutex);
604
605 return(old);
606}
607
Daniel Veillard5335dc52003-01-01 20:59:38 +0000608
Daniel Veillarda4617b82001-11-04 20:19:12 +0000609#ifdef LIBXML_DOCB_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000610#undef docbDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000611xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000612__docbDefaultSAXHandler(void) {
613 if (IS_MAIN_THREAD)
614 return (&docbDefaultSAXHandler);
615 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000616 return (&xmlGetGlobalState()->docbDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000617}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000618#endif
Daniel Veillardb8478642001-10-12 17:29:10 +0000619
Daniel Veillarda4617b82001-11-04 20:19:12 +0000620#ifdef LIBXML_HTML_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000621#undef htmlDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000622xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000623__htmlDefaultSAXHandler(void) {
624 if (IS_MAIN_THREAD)
625 return (&htmlDefaultSAXHandler);
626 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000627 return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000628}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000629#endif
630
631/*
632 * Everything starting from the line below is
633 * Automatically generated by build_glob.py.
634 * Do not modify the previous line.
635 */
636
Daniel Veillardb8478642001-10-12 17:29:10 +0000637
Daniel Veillardb8478642001-10-12 17:29:10 +0000638#undef oldXMLWDcompatibility
639int *
640__oldXMLWDcompatibility(void) {
641 if (IS_MAIN_THREAD)
642 return (&oldXMLWDcompatibility);
643 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000644 return (&xmlGetGlobalState()->oldXMLWDcompatibility);
Daniel Veillardb8478642001-10-12 17:29:10 +0000645}
646
Daniel Veillardb8478642001-10-12 17:29:10 +0000647#undef xmlBufferAllocScheme
648xmlBufferAllocationScheme *
649__xmlBufferAllocScheme(void) {
650 if (IS_MAIN_THREAD)
651 return (&xmlBufferAllocScheme);
652 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000653 return (&xmlGetGlobalState()->xmlBufferAllocScheme);
Daniel Veillardb8478642001-10-12 17:29:10 +0000654}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000655xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
656 xmlBufferAllocationScheme ret;
657 xmlMutexLock(xmlThrDefMutex);
658 ret = xmlBufferAllocSchemeThrDef;
659 xmlBufferAllocSchemeThrDef = v;
660 xmlMutexUnlock(xmlThrDefMutex);
661 return ret;
662}
Daniel Veillardb8478642001-10-12 17:29:10 +0000663
Daniel Veillardb8478642001-10-12 17:29:10 +0000664#undef xmlDefaultBufferSize
665int *
666__xmlDefaultBufferSize(void) {
667 if (IS_MAIN_THREAD)
668 return (&xmlDefaultBufferSize);
669 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000670 return (&xmlGetGlobalState()->xmlDefaultBufferSize);
Daniel Veillardb8478642001-10-12 17:29:10 +0000671}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000672int xmlThrDefDefaultBufferSize(int v) {
673 int ret;
674 xmlMutexLock(xmlThrDefMutex);
675 ret = xmlDefaultBufferSizeThrDef;
676 xmlDefaultBufferSizeThrDef = v;
677 xmlMutexUnlock(xmlThrDefMutex);
678 return ret;
679}
Daniel Veillardb8478642001-10-12 17:29:10 +0000680
Daniel Veillard81273902003-09-30 00:43:48 +0000681#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000682#undef xmlDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000683xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000684__xmlDefaultSAXHandler(void) {
685 if (IS_MAIN_THREAD)
686 return (&xmlDefaultSAXHandler);
687 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000688 return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000689}
Daniel Veillard81273902003-09-30 00:43:48 +0000690#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillardb8478642001-10-12 17:29:10 +0000691
Daniel Veillardb8478642001-10-12 17:29:10 +0000692#undef xmlDefaultSAXLocator
693xmlSAXLocator *
694__xmlDefaultSAXLocator(void) {
695 if (IS_MAIN_THREAD)
696 return (&xmlDefaultSAXLocator);
697 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000698 return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
Daniel Veillardb8478642001-10-12 17:29:10 +0000699}
700
Daniel Veillardb8478642001-10-12 17:29:10 +0000701#undef xmlDoValidityCheckingDefaultValue
702int *
703__xmlDoValidityCheckingDefaultValue(void) {
704 if (IS_MAIN_THREAD)
705 return (&xmlDoValidityCheckingDefaultValue);
706 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000707 return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000708}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000709int xmlThrDefDoValidityCheckingDefaultValue(int v) {
710 int ret;
711 xmlMutexLock(xmlThrDefMutex);
712 ret = xmlDoValidityCheckingDefaultValueThrDef;
713 xmlDoValidityCheckingDefaultValueThrDef = v;
714 xmlMutexUnlock(xmlThrDefMutex);
715 return ret;
716}
Daniel Veillardb8478642001-10-12 17:29:10 +0000717
Daniel Veillardb8478642001-10-12 17:29:10 +0000718#undef xmlGenericError
719xmlGenericErrorFunc *
720__xmlGenericError(void) {
721 if (IS_MAIN_THREAD)
722 return (&xmlGenericError);
723 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000724 return (&xmlGetGlobalState()->xmlGenericError);
Daniel Veillardb8478642001-10-12 17:29:10 +0000725}
726
Daniel Veillardb8478642001-10-12 17:29:10 +0000727#undef xmlGenericErrorContext
728void * *
729__xmlGenericErrorContext(void) {
730 if (IS_MAIN_THREAD)
731 return (&xmlGenericErrorContext);
732 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000733 return (&xmlGetGlobalState()->xmlGenericErrorContext);
Daniel Veillardb8478642001-10-12 17:29:10 +0000734}
735
Daniel Veillardb8478642001-10-12 17:29:10 +0000736#undef xmlGetWarningsDefaultValue
737int *
738__xmlGetWarningsDefaultValue(void) {
739 if (IS_MAIN_THREAD)
740 return (&xmlGetWarningsDefaultValue);
741 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000742 return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000743}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000744int xmlThrDefGetWarningsDefaultValue(int v) {
745 int ret;
746 xmlMutexLock(xmlThrDefMutex);
747 ret = xmlGetWarningsDefaultValueThrDef;
748 xmlGetWarningsDefaultValueThrDef = v;
749 xmlMutexUnlock(xmlThrDefMutex);
750 return ret;
751}
Daniel Veillardb8478642001-10-12 17:29:10 +0000752
Daniel Veillardb8478642001-10-12 17:29:10 +0000753#undef xmlIndentTreeOutput
754int *
755__xmlIndentTreeOutput(void) {
756 if (IS_MAIN_THREAD)
757 return (&xmlIndentTreeOutput);
758 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000759 return (&xmlGetGlobalState()->xmlIndentTreeOutput);
Daniel Veillardb8478642001-10-12 17:29:10 +0000760}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000761int xmlThrDefIndentTreeOutput(int v) {
762 int ret;
763 xmlMutexLock(xmlThrDefMutex);
764 ret = xmlIndentTreeOutputThrDef;
765 xmlIndentTreeOutputThrDef = v;
766 xmlMutexUnlock(xmlThrDefMutex);
767 return ret;
768}
Daniel Veillardb8478642001-10-12 17:29:10 +0000769
Aleksey Sanin23002562002-05-24 07:18:40 +0000770#undef xmlTreeIndentString
771const char * *
772__xmlTreeIndentString(void) {
773 if (IS_MAIN_THREAD)
774 return (&xmlTreeIndentString);
775 else
776 return (&xmlGetGlobalState()->xmlTreeIndentString);
777}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000778const char * xmlThrDefTreeIndentString(const char * v) {
779 const char * ret;
780 xmlMutexLock(xmlThrDefMutex);
781 ret = xmlTreeIndentStringThrDef;
782 xmlTreeIndentStringThrDef = v;
783 xmlMutexUnlock(xmlThrDefMutex);
784 return ret;
785}
Aleksey Sanin23002562002-05-24 07:18:40 +0000786
Daniel Veillardb8478642001-10-12 17:29:10 +0000787#undef xmlKeepBlanksDefaultValue
788int *
789__xmlKeepBlanksDefaultValue(void) {
790 if (IS_MAIN_THREAD)
791 return (&xmlKeepBlanksDefaultValue);
792 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000793 return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000794}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000795int xmlThrDefKeepBlanksDefaultValue(int v) {
796 int ret;
797 xmlMutexLock(xmlThrDefMutex);
798 ret = xmlKeepBlanksDefaultValueThrDef;
799 xmlKeepBlanksDefaultValueThrDef = v;
800 xmlMutexUnlock(xmlThrDefMutex);
801 return ret;
802}
Daniel Veillardb8478642001-10-12 17:29:10 +0000803
Daniel Veillardb8478642001-10-12 17:29:10 +0000804#undef xmlLineNumbersDefaultValue
805int *
806__xmlLineNumbersDefaultValue(void) {
807 if (IS_MAIN_THREAD)
808 return (&xmlLineNumbersDefaultValue);
809 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000810 return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000811}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000812int xmlThrDefLineNumbersDefaultValue(int v) {
813 int ret;
814 xmlMutexLock(xmlThrDefMutex);
815 ret = xmlLineNumbersDefaultValueThrDef;
816 xmlLineNumbersDefaultValueThrDef = v;
817 xmlMutexUnlock(xmlThrDefMutex);
818 return ret;
819}
Daniel Veillardb8478642001-10-12 17:29:10 +0000820
Daniel Veillardb8478642001-10-12 17:29:10 +0000821#undef xmlLoadExtDtdDefaultValue
822int *
823__xmlLoadExtDtdDefaultValue(void) {
824 if (IS_MAIN_THREAD)
825 return (&xmlLoadExtDtdDefaultValue);
826 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000827 return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000828}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000829int xmlThrDefLoadExtDtdDefaultValue(int v) {
830 int ret;
831 xmlMutexLock(xmlThrDefMutex);
832 ret = xmlLoadExtDtdDefaultValueThrDef;
833 xmlLoadExtDtdDefaultValueThrDef = v;
834 xmlMutexUnlock(xmlThrDefMutex);
835 return ret;
836}
Daniel Veillardb8478642001-10-12 17:29:10 +0000837
Daniel Veillardb8478642001-10-12 17:29:10 +0000838#undef xmlParserDebugEntities
839int *
840__xmlParserDebugEntities(void) {
841 if (IS_MAIN_THREAD)
842 return (&xmlParserDebugEntities);
843 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000844 return (&xmlGetGlobalState()->xmlParserDebugEntities);
Daniel Veillardb8478642001-10-12 17:29:10 +0000845}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000846int xmlThrDefParserDebugEntities(int v) {
847 int ret;
848 xmlMutexLock(xmlThrDefMutex);
849 ret = xmlParserDebugEntitiesThrDef;
850 xmlParserDebugEntitiesThrDef = v;
851 xmlMutexUnlock(xmlThrDefMutex);
852 return ret;
853}
Daniel Veillardb8478642001-10-12 17:29:10 +0000854
Daniel Veillardb8478642001-10-12 17:29:10 +0000855#undef xmlParserVersion
856const char * *
857__xmlParserVersion(void) {
858 if (IS_MAIN_THREAD)
859 return (&xmlParserVersion);
860 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000861 return (&xmlGetGlobalState()->xmlParserVersion);
Daniel Veillardb8478642001-10-12 17:29:10 +0000862}
863
Daniel Veillardb8478642001-10-12 17:29:10 +0000864#undef xmlPedanticParserDefaultValue
865int *
866__xmlPedanticParserDefaultValue(void) {
867 if (IS_MAIN_THREAD)
868 return (&xmlPedanticParserDefaultValue);
869 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000870 return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000871}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000872int xmlThrDefPedanticParserDefaultValue(int v) {
873 int ret;
874 xmlMutexLock(xmlThrDefMutex);
875 ret = xmlPedanticParserDefaultValueThrDef;
876 xmlPedanticParserDefaultValueThrDef = v;
877 xmlMutexUnlock(xmlThrDefMutex);
878 return ret;
879}
Daniel Veillardb8478642001-10-12 17:29:10 +0000880
Daniel Veillardb8478642001-10-12 17:29:10 +0000881#undef xmlSaveNoEmptyTags
882int *
883__xmlSaveNoEmptyTags(void) {
884 if (IS_MAIN_THREAD)
885 return (&xmlSaveNoEmptyTags);
886 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000887 return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
Daniel Veillardb8478642001-10-12 17:29:10 +0000888}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000889int xmlThrDefSaveNoEmptyTags(int v) {
890 int ret;
891 xmlMutexLock(xmlThrDefMutex);
892 ret = xmlSaveNoEmptyTagsThrDef;
893 xmlSaveNoEmptyTagsThrDef = v;
894 xmlMutexUnlock(xmlThrDefMutex);
895 return ret;
896}
Daniel Veillardb8478642001-10-12 17:29:10 +0000897
Daniel Veillardb8478642001-10-12 17:29:10 +0000898#undef xmlSubstituteEntitiesDefaultValue
899int *
900__xmlSubstituteEntitiesDefaultValue(void) {
901 if (IS_MAIN_THREAD)
902 return (&xmlSubstituteEntitiesDefaultValue);
903 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000904 return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000905}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000906int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
907 int ret;
908 xmlMutexLock(xmlThrDefMutex);
909 ret = xmlSubstituteEntitiesDefaultValueThrDef;
910 xmlSubstituteEntitiesDefaultValueThrDef = v;
911 xmlMutexUnlock(xmlThrDefMutex);
912 return ret;
913}
Daniel Veillard5335dc52003-01-01 20:59:38 +0000914
915#undef xmlRegisterNodeDefaultValue
916xmlRegisterNodeFunc *
917__xmlRegisterNodeDefaultValue(void) {
918 if (IS_MAIN_THREAD)
919 return (&xmlRegisterNodeDefaultValue);
920 else
921 return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue);
922}
923
924#undef xmlDeregisterNodeDefaultValue
925xmlDeregisterNodeFunc *
926__xmlDeregisterNodeDefaultValue(void) {
927 if (IS_MAIN_THREAD)
928 return (&xmlDeregisterNodeDefaultValue);
929 else
930 return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue);
931}