blob: 2cddaa85dfab3514e205c49efb36f2d59328c59f [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 Veillard98485322003-08-14 15:44:40 +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 Veillard9d06d302002-01-22 18:15:52 +0000328/**
329 * xmlDefaultSAXHandler:
330 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000331 * Default handler for XML, builds the DOM tree
332 */
333xmlSAXHandler xmlDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000334 xmlSAX2InternalSubset,
335 xmlSAX2IsStandalone,
336 xmlSAX2HasInternalSubset,
337 xmlSAX2HasExternalSubset,
338 xmlSAX2ResolveEntity,
339 xmlSAX2GetEntity,
340 xmlSAX2EntityDecl,
341 xmlSAX2NotationDecl,
342 xmlSAX2AttributeDecl,
343 xmlSAX2ElementDecl,
344 xmlSAX2UnparsedEntityDecl,
345 xmlSAX2SetDocumentLocator,
346 xmlSAX2StartDocument,
347 xmlSAX2EndDocument,
348 xmlSAX2StartElement,
349 xmlSAX2EndElement,
350 xmlSAX2Reference,
351 xmlSAX2Characters,
352 xmlSAX2Characters,
353 xmlSAX2ProcessingInstruction,
354 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000355 xmlParserWarning,
356 xmlParserError,
357 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000358 xmlSAX2GetParameterEntity,
359 xmlSAX2CDataBlock,
360 xmlSAX2ExternalSubset,
361 0,
362 NULL,
363 NULL,
364 NULL,
365 NULL
Daniel Veillardb8478642001-10-12 17:29:10 +0000366};
367
Daniel Veillard9d06d302002-01-22 18:15:52 +0000368/**
369 * xmlDefaultSAXLocator:
370 *
371 * The default SAX Locator
372 * { getPublicId, getSystemId, getLineNumber, getColumnNumber}
Daniel Veillardb8478642001-10-12 17:29:10 +0000373 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000374xmlSAXLocator xmlDefaultSAXLocator = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000375 xmlSAX2GetPublicId,
376 xmlSAX2GetSystemId,
377 xmlSAX2GetLineNumber,
378 xmlSAX2GetColumnNumber
Daniel Veillardb8478642001-10-12 17:29:10 +0000379};
380
381#ifdef LIBXML_HTML_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000382/**
383 * htmlDefaultSAXHandler:
384 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000385 * Default handler for HTML, builds the DOM tree
386 */
387xmlSAXHandler htmlDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000388 xmlSAX2InternalSubset,
Daniel Veillardb8478642001-10-12 17:29:10 +0000389 NULL,
390 NULL,
391 NULL,
392 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000393 xmlSAX2GetEntity,
Daniel Veillardb8478642001-10-12 17:29:10 +0000394 NULL,
395 NULL,
396 NULL,
397 NULL,
398 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000399 xmlSAX2SetDocumentLocator,
400 xmlSAX2StartDocument,
401 xmlSAX2EndDocument,
402 xmlSAX2StartElement,
403 xmlSAX2EndElement,
Daniel Veillardb8478642001-10-12 17:29:10 +0000404 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000405 xmlSAX2Characters,
406 xmlSAX2IgnorableWhitespace,
Daniel Veillardb8478642001-10-12 17:29:10 +0000407 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000408 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000409 xmlParserWarning,
410 xmlParserError,
411 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000412 xmlSAX2GetParameterEntity,
413 xmlSAX2CDataBlock,
Daniel Veillardb8478642001-10-12 17:29:10 +0000414 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000415 0,
416 NULL,
417 NULL,
418 NULL,
419 NULL
Daniel Veillardb8478642001-10-12 17:29:10 +0000420};
421#endif /* LIBXML_HTML_ENABLED */
422
423#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000424/**
425 * docbDefaultSAXHandler:
426 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000427 * Default handler for SGML DocBook, builds the DOM tree
428 */
429xmlSAXHandler docbDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000430 xmlSAX2InternalSubset,
431 xmlSAX2IsStandalone,
432 xmlSAX2HasInternalSubset,
433 xmlSAX2HasExternalSubset,
434 xmlSAX2ResolveEntity,
435 xmlSAX2GetEntity,
436 xmlSAX2EntityDecl,
Daniel Veillardb8478642001-10-12 17:29:10 +0000437 NULL,
438 NULL,
439 NULL,
440 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000441 xmlSAX2SetDocumentLocator,
442 xmlSAX2StartDocument,
443 xmlSAX2EndDocument,
444 xmlSAX2StartElement,
445 xmlSAX2EndElement,
446 xmlSAX2Reference,
447 xmlSAX2Characters,
448 xmlSAX2IgnorableWhitespace,
Daniel Veillardb8478642001-10-12 17:29:10 +0000449 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000450 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000451 xmlParserWarning,
452 xmlParserError,
453 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000454 xmlSAX2GetParameterEntity,
Daniel Veillardb8478642001-10-12 17:29:10 +0000455 NULL,
456 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000457 0,
458 NULL,
459 NULL,
460 NULL,
461 NULL
Daniel Veillardb8478642001-10-12 17:29:10 +0000462};
463#endif /* LIBXML_DOCB_ENABLED */
464
465/**
466 * xmlInitializeGlobalState:
467 * @gs: a pointer to a newly allocated global state
468 *
469 * xmlInitializeGlobalState() initialize a global state with all the
470 * default values of the library.
471 */
472void
473xmlInitializeGlobalState(xmlGlobalStatePtr gs)
474{
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000475#ifdef DEBUG_GLOBALS
476 fprintf(stderr, "Initializing globals at %lu for thread %d\n",
477 (unsigned long) gs, xmlGetThreadId());
478#endif
479
Daniel Veillardb8478642001-10-12 17:29:10 +0000480 /*
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000481 * Perform initialization as required by libxml
Daniel Veillardb8478642001-10-12 17:29:10 +0000482 */
Daniel Veillard5805be22003-08-28 08:03:23 +0000483 if (xmlThrDefMutex == NULL)
484 xmlInitGlobals();
485
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000486 xmlMutexLock(xmlThrDefMutex);
William M. Brack8b2c7f12002-11-22 05:07:29 +0000487
Daniel Veillarda4617b82001-11-04 20:19:12 +0000488#ifdef LIBXML_DOCB_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000489 initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000490#endif
491#ifdef LIBXML_HTML_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000492 inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000493#endif
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000494
Daniel Veillardb8478642001-10-12 17:29:10 +0000495 gs->oldXMLWDcompatibility = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000496 gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
497 gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000498 initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
499 gs->xmlDefaultSAXLocator.getPublicId = getPublicId;
500 gs->xmlDefaultSAXLocator.getSystemId = getSystemId;
501 gs->xmlDefaultSAXLocator.getLineNumber = getLineNumber;
502 gs->xmlDefaultSAXLocator.getColumnNumber = getColumnNumber;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000503 gs->xmlDoValidityCheckingDefaultValue =
504 xmlDoValidityCheckingDefaultValueThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000505#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
506 gs->xmlFree = (xmlFreeFunc) xmlMemFree;
507 gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000508 gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000509 gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
510 gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
511#else
512 gs->xmlFree = (xmlFreeFunc) free;
513 gs->xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000514 gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000515 gs->xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard572577e2002-01-18 16:23:55 +0000516 gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillardb8478642001-10-12 17:29:10 +0000517#endif
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000518 gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
519 gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
520 gs->xmlTreeIndentString = xmlTreeIndentStringThrDef;
521 gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
522 gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
523 gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
524 gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000525 gs->xmlParserVersion = LIBXML_VERSION_STRING;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000526 gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
527 gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
528 gs->xmlSubstituteEntitiesDefaultValue =
529 xmlSubstituteEntitiesDefaultValueThrDef;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000530
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000531 gs->xmlGenericError = xmlGenericErrorThrDef;
532 gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
533 gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
534 gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
535
536 xmlMutexUnlock(xmlThrDefMutex);
537}
538
539void
540xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
541 xmlMutexLock(xmlThrDefMutex);
542 xmlGenericErrorContextThrDef = ctx;
543 if (handler != NULL)
544 xmlGenericErrorThrDef = handler;
545 else
546 xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
547 xmlMutexUnlock(xmlThrDefMutex);
Daniel Veillardb8478642001-10-12 17:29:10 +0000548}
549
Daniel Veillard5335dc52003-01-01 20:59:38 +0000550/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000551 * xmlRegisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000552 * @func: function pointer to the new RegisterNodeFunc
553 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000554 * Registers a callback for node creation
555 *
556 * Returns the old value of the registration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000557 */
558xmlRegisterNodeFunc
559xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
560{
561 xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue;
562
Daniel Veillarda880b122003-04-21 21:36:41 +0000563 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000564 xmlRegisterNodeDefaultValue = func;
565 return(old);
566}
567
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000568xmlRegisterNodeFunc
569xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
570{
571 xmlRegisterNodeFunc old;
572
573 xmlMutexLock(xmlThrDefMutex);
574 old = xmlRegisterNodeDefaultValueThrDef;
575
576 __xmlRegisterCallbacks = 1;
577 xmlRegisterNodeDefaultValueThrDef = func;
578 xmlMutexUnlock(xmlThrDefMutex);
579
580 return(old);
581}
582
Daniel Veillard5335dc52003-01-01 20:59:38 +0000583/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000584 * xmlDeregisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000585 * @func: function pointer to the new DeregisterNodeFunc
586 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000587 * Registers a callback for node destruction
588 *
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000589 * Returns the previous value of the deregistration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000590 */
591xmlDeregisterNodeFunc
592xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
593{
594 xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue;
595
Daniel Veillarda880b122003-04-21 21:36:41 +0000596 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000597 xmlDeregisterNodeDefaultValue = func;
598 return(old);
599}
600
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000601xmlDeregisterNodeFunc
602xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
603{
604 xmlDeregisterNodeFunc old;
605
606 xmlMutexLock(xmlThrDefMutex);
607 old = xmlDeregisterNodeDefaultValueThrDef;
608
609 __xmlRegisterCallbacks = 1;
610 xmlDeregisterNodeDefaultValueThrDef = func;
611 xmlMutexUnlock(xmlThrDefMutex);
612
613 return(old);
614}
615
Daniel Veillard5335dc52003-01-01 20:59:38 +0000616
Daniel Veillarda4617b82001-11-04 20:19:12 +0000617#ifdef LIBXML_DOCB_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000618#undef docbDefaultSAXHandler
619xmlSAXHandler *
620__docbDefaultSAXHandler(void) {
621 if (IS_MAIN_THREAD)
622 return (&docbDefaultSAXHandler);
623 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000624 return (&xmlGetGlobalState()->docbDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000625}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000626#endif
Daniel Veillardb8478642001-10-12 17:29:10 +0000627
Daniel Veillarda4617b82001-11-04 20:19:12 +0000628#ifdef LIBXML_HTML_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000629#undef htmlDefaultSAXHandler
630xmlSAXHandler *
631__htmlDefaultSAXHandler(void) {
632 if (IS_MAIN_THREAD)
633 return (&htmlDefaultSAXHandler);
634 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000635 return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000636}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000637#endif
638
639/*
640 * Everything starting from the line below is
641 * Automatically generated by build_glob.py.
642 * Do not modify the previous line.
643 */
644
Daniel Veillardb8478642001-10-12 17:29:10 +0000645
Daniel Veillardb8478642001-10-12 17:29:10 +0000646#undef oldXMLWDcompatibility
647int *
648__oldXMLWDcompatibility(void) {
649 if (IS_MAIN_THREAD)
650 return (&oldXMLWDcompatibility);
651 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000652 return (&xmlGetGlobalState()->oldXMLWDcompatibility);
Daniel Veillardb8478642001-10-12 17:29:10 +0000653}
654
Daniel Veillardb8478642001-10-12 17:29:10 +0000655#undef xmlBufferAllocScheme
656xmlBufferAllocationScheme *
657__xmlBufferAllocScheme(void) {
658 if (IS_MAIN_THREAD)
659 return (&xmlBufferAllocScheme);
660 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000661 return (&xmlGetGlobalState()->xmlBufferAllocScheme);
Daniel Veillardb8478642001-10-12 17:29:10 +0000662}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000663xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
664 xmlBufferAllocationScheme ret;
665 xmlMutexLock(xmlThrDefMutex);
666 ret = xmlBufferAllocSchemeThrDef;
667 xmlBufferAllocSchemeThrDef = v;
668 xmlMutexUnlock(xmlThrDefMutex);
669 return ret;
670}
Daniel Veillardb8478642001-10-12 17:29:10 +0000671
Daniel Veillardb8478642001-10-12 17:29:10 +0000672#undef xmlDefaultBufferSize
673int *
674__xmlDefaultBufferSize(void) {
675 if (IS_MAIN_THREAD)
676 return (&xmlDefaultBufferSize);
677 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000678 return (&xmlGetGlobalState()->xmlDefaultBufferSize);
Daniel Veillardb8478642001-10-12 17:29:10 +0000679}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000680int xmlThrDefDefaultBufferSize(int v) {
681 int ret;
682 xmlMutexLock(xmlThrDefMutex);
683 ret = xmlDefaultBufferSizeThrDef;
684 xmlDefaultBufferSizeThrDef = v;
685 xmlMutexUnlock(xmlThrDefMutex);
686 return ret;
687}
Daniel Veillardb8478642001-10-12 17:29:10 +0000688
Daniel Veillardb8478642001-10-12 17:29:10 +0000689#undef xmlDefaultSAXHandler
690xmlSAXHandler *
691__xmlDefaultSAXHandler(void) {
692 if (IS_MAIN_THREAD)
693 return (&xmlDefaultSAXHandler);
694 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000695 return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000696}
697
Daniel Veillardb8478642001-10-12 17:29:10 +0000698#undef xmlDefaultSAXLocator
699xmlSAXLocator *
700__xmlDefaultSAXLocator(void) {
701 if (IS_MAIN_THREAD)
702 return (&xmlDefaultSAXLocator);
703 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000704 return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
Daniel Veillardb8478642001-10-12 17:29:10 +0000705}
706
Daniel Veillardb8478642001-10-12 17:29:10 +0000707#undef xmlDoValidityCheckingDefaultValue
708int *
709__xmlDoValidityCheckingDefaultValue(void) {
710 if (IS_MAIN_THREAD)
711 return (&xmlDoValidityCheckingDefaultValue);
712 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000713 return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000714}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000715int xmlThrDefDoValidityCheckingDefaultValue(int v) {
716 int ret;
717 xmlMutexLock(xmlThrDefMutex);
718 ret = xmlDoValidityCheckingDefaultValueThrDef;
719 xmlDoValidityCheckingDefaultValueThrDef = v;
720 xmlMutexUnlock(xmlThrDefMutex);
721 return ret;
722}
Daniel Veillardb8478642001-10-12 17:29:10 +0000723
Daniel Veillardb8478642001-10-12 17:29:10 +0000724#undef xmlGenericError
725xmlGenericErrorFunc *
726__xmlGenericError(void) {
727 if (IS_MAIN_THREAD)
728 return (&xmlGenericError);
729 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000730 return (&xmlGetGlobalState()->xmlGenericError);
Daniel Veillardb8478642001-10-12 17:29:10 +0000731}
732
Daniel Veillardb8478642001-10-12 17:29:10 +0000733#undef xmlGenericErrorContext
734void * *
735__xmlGenericErrorContext(void) {
736 if (IS_MAIN_THREAD)
737 return (&xmlGenericErrorContext);
738 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000739 return (&xmlGetGlobalState()->xmlGenericErrorContext);
Daniel Veillardb8478642001-10-12 17:29:10 +0000740}
741
Daniel Veillardb8478642001-10-12 17:29:10 +0000742#undef xmlGetWarningsDefaultValue
743int *
744__xmlGetWarningsDefaultValue(void) {
745 if (IS_MAIN_THREAD)
746 return (&xmlGetWarningsDefaultValue);
747 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000748 return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000749}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000750int xmlThrDefGetWarningsDefaultValue(int v) {
751 int ret;
752 xmlMutexLock(xmlThrDefMutex);
753 ret = xmlGetWarningsDefaultValueThrDef;
754 xmlGetWarningsDefaultValueThrDef = v;
755 xmlMutexUnlock(xmlThrDefMutex);
756 return ret;
757}
Daniel Veillardb8478642001-10-12 17:29:10 +0000758
Daniel Veillardb8478642001-10-12 17:29:10 +0000759#undef xmlIndentTreeOutput
760int *
761__xmlIndentTreeOutput(void) {
762 if (IS_MAIN_THREAD)
763 return (&xmlIndentTreeOutput);
764 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000765 return (&xmlGetGlobalState()->xmlIndentTreeOutput);
Daniel Veillardb8478642001-10-12 17:29:10 +0000766}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000767int xmlThrDefIndentTreeOutput(int v) {
768 int ret;
769 xmlMutexLock(xmlThrDefMutex);
770 ret = xmlIndentTreeOutputThrDef;
771 xmlIndentTreeOutputThrDef = v;
772 xmlMutexUnlock(xmlThrDefMutex);
773 return ret;
774}
Daniel Veillardb8478642001-10-12 17:29:10 +0000775
Aleksey Sanin23002562002-05-24 07:18:40 +0000776#undef xmlTreeIndentString
777const char * *
778__xmlTreeIndentString(void) {
779 if (IS_MAIN_THREAD)
780 return (&xmlTreeIndentString);
781 else
782 return (&xmlGetGlobalState()->xmlTreeIndentString);
783}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000784const char * xmlThrDefTreeIndentString(const char * v) {
785 const char * ret;
786 xmlMutexLock(xmlThrDefMutex);
787 ret = xmlTreeIndentStringThrDef;
788 xmlTreeIndentStringThrDef = v;
789 xmlMutexUnlock(xmlThrDefMutex);
790 return ret;
791}
Aleksey Sanin23002562002-05-24 07:18:40 +0000792
Daniel Veillardb8478642001-10-12 17:29:10 +0000793#undef xmlKeepBlanksDefaultValue
794int *
795__xmlKeepBlanksDefaultValue(void) {
796 if (IS_MAIN_THREAD)
797 return (&xmlKeepBlanksDefaultValue);
798 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000799 return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000800}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000801int xmlThrDefKeepBlanksDefaultValue(int v) {
802 int ret;
803 xmlMutexLock(xmlThrDefMutex);
804 ret = xmlKeepBlanksDefaultValueThrDef;
805 xmlKeepBlanksDefaultValueThrDef = v;
806 xmlMutexUnlock(xmlThrDefMutex);
807 return ret;
808}
Daniel Veillardb8478642001-10-12 17:29:10 +0000809
Daniel Veillardb8478642001-10-12 17:29:10 +0000810#undef xmlLineNumbersDefaultValue
811int *
812__xmlLineNumbersDefaultValue(void) {
813 if (IS_MAIN_THREAD)
814 return (&xmlLineNumbersDefaultValue);
815 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000816 return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000817}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000818int xmlThrDefLineNumbersDefaultValue(int v) {
819 int ret;
820 xmlMutexLock(xmlThrDefMutex);
821 ret = xmlLineNumbersDefaultValueThrDef;
822 xmlLineNumbersDefaultValueThrDef = v;
823 xmlMutexUnlock(xmlThrDefMutex);
824 return ret;
825}
Daniel Veillardb8478642001-10-12 17:29:10 +0000826
Daniel Veillardb8478642001-10-12 17:29:10 +0000827#undef xmlLoadExtDtdDefaultValue
828int *
829__xmlLoadExtDtdDefaultValue(void) {
830 if (IS_MAIN_THREAD)
831 return (&xmlLoadExtDtdDefaultValue);
832 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000833 return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000834}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000835int xmlThrDefLoadExtDtdDefaultValue(int v) {
836 int ret;
837 xmlMutexLock(xmlThrDefMutex);
838 ret = xmlLoadExtDtdDefaultValueThrDef;
839 xmlLoadExtDtdDefaultValueThrDef = v;
840 xmlMutexUnlock(xmlThrDefMutex);
841 return ret;
842}
Daniel Veillardb8478642001-10-12 17:29:10 +0000843
Daniel Veillardb8478642001-10-12 17:29:10 +0000844#undef xmlParserDebugEntities
845int *
846__xmlParserDebugEntities(void) {
847 if (IS_MAIN_THREAD)
848 return (&xmlParserDebugEntities);
849 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000850 return (&xmlGetGlobalState()->xmlParserDebugEntities);
Daniel Veillardb8478642001-10-12 17:29:10 +0000851}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000852int xmlThrDefParserDebugEntities(int v) {
853 int ret;
854 xmlMutexLock(xmlThrDefMutex);
855 ret = xmlParserDebugEntitiesThrDef;
856 xmlParserDebugEntitiesThrDef = v;
857 xmlMutexUnlock(xmlThrDefMutex);
858 return ret;
859}
Daniel Veillardb8478642001-10-12 17:29:10 +0000860
Daniel Veillardb8478642001-10-12 17:29:10 +0000861#undef xmlParserVersion
862const char * *
863__xmlParserVersion(void) {
864 if (IS_MAIN_THREAD)
865 return (&xmlParserVersion);
866 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000867 return (&xmlGetGlobalState()->xmlParserVersion);
Daniel Veillardb8478642001-10-12 17:29:10 +0000868}
869
Daniel Veillardb8478642001-10-12 17:29:10 +0000870#undef xmlPedanticParserDefaultValue
871int *
872__xmlPedanticParserDefaultValue(void) {
873 if (IS_MAIN_THREAD)
874 return (&xmlPedanticParserDefaultValue);
875 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000876 return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000877}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000878int xmlThrDefPedanticParserDefaultValue(int v) {
879 int ret;
880 xmlMutexLock(xmlThrDefMutex);
881 ret = xmlPedanticParserDefaultValueThrDef;
882 xmlPedanticParserDefaultValueThrDef = v;
883 xmlMutexUnlock(xmlThrDefMutex);
884 return ret;
885}
Daniel Veillardb8478642001-10-12 17:29:10 +0000886
Daniel Veillardb8478642001-10-12 17:29:10 +0000887#undef xmlSaveNoEmptyTags
888int *
889__xmlSaveNoEmptyTags(void) {
890 if (IS_MAIN_THREAD)
891 return (&xmlSaveNoEmptyTags);
892 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000893 return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
Daniel Veillardb8478642001-10-12 17:29:10 +0000894}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000895int xmlThrDefSaveNoEmptyTags(int v) {
896 int ret;
897 xmlMutexLock(xmlThrDefMutex);
898 ret = xmlSaveNoEmptyTagsThrDef;
899 xmlSaveNoEmptyTagsThrDef = v;
900 xmlMutexUnlock(xmlThrDefMutex);
901 return ret;
902}
Daniel Veillardb8478642001-10-12 17:29:10 +0000903
Daniel Veillardb8478642001-10-12 17:29:10 +0000904#undef xmlSubstituteEntitiesDefaultValue
905int *
906__xmlSubstituteEntitiesDefaultValue(void) {
907 if (IS_MAIN_THREAD)
908 return (&xmlSubstituteEntitiesDefaultValue);
909 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000910 return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000911}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000912int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
913 int ret;
914 xmlMutexLock(xmlThrDefMutex);
915 ret = xmlSubstituteEntitiesDefaultValueThrDef;
916 xmlSubstituteEntitiesDefaultValueThrDef = v;
917 xmlMutexUnlock(xmlThrDefMutex);
918 return ret;
919}
Daniel Veillard5335dc52003-01-01 20:59:38 +0000920
921#undef xmlRegisterNodeDefaultValue
922xmlRegisterNodeFunc *
923__xmlRegisterNodeDefaultValue(void) {
924 if (IS_MAIN_THREAD)
925 return (&xmlRegisterNodeDefaultValue);
926 else
927 return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue);
928}
929
930#undef xmlDeregisterNodeDefaultValue
931xmlDeregisterNodeFunc *
932__xmlDeregisterNodeDefaultValue(void) {
933 if (IS_MAIN_THREAD)
934 return (&xmlDeregisterNodeDefaultValue);
935 else
936 return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue);
937}