blob: 5342340c63f441bb29b0b080540f7410f88de0af [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 Veillard781ac8b2003-05-15 22:11:36 +0000483 xmlMutexLock(xmlThrDefMutex);
William M. Brack8b2c7f12002-11-22 05:07:29 +0000484
Daniel Veillarda4617b82001-11-04 20:19:12 +0000485#ifdef LIBXML_DOCB_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000486 initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000487#endif
488#ifdef LIBXML_HTML_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000489 inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000490#endif
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000491
Daniel Veillardb8478642001-10-12 17:29:10 +0000492 gs->oldXMLWDcompatibility = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000493 gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
494 gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000495 initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
496 gs->xmlDefaultSAXLocator.getPublicId = getPublicId;
497 gs->xmlDefaultSAXLocator.getSystemId = getSystemId;
498 gs->xmlDefaultSAXLocator.getLineNumber = getLineNumber;
499 gs->xmlDefaultSAXLocator.getColumnNumber = getColumnNumber;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000500 gs->xmlDoValidityCheckingDefaultValue =
501 xmlDoValidityCheckingDefaultValueThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000502#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
503 gs->xmlFree = (xmlFreeFunc) xmlMemFree;
504 gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000505 gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000506 gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
507 gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
508#else
509 gs->xmlFree = (xmlFreeFunc) free;
510 gs->xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000511 gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000512 gs->xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard572577e2002-01-18 16:23:55 +0000513 gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillardb8478642001-10-12 17:29:10 +0000514#endif
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000515 gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
516 gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
517 gs->xmlTreeIndentString = xmlTreeIndentStringThrDef;
518 gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
519 gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
520 gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
521 gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000522 gs->xmlParserVersion = LIBXML_VERSION_STRING;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000523 gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
524 gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
525 gs->xmlSubstituteEntitiesDefaultValue =
526 xmlSubstituteEntitiesDefaultValueThrDef;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000527
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000528 gs->xmlGenericError = xmlGenericErrorThrDef;
529 gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
530 gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
531 gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
532
533 xmlMutexUnlock(xmlThrDefMutex);
534}
535
536void
537xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
538 xmlMutexLock(xmlThrDefMutex);
539 xmlGenericErrorContextThrDef = ctx;
540 if (handler != NULL)
541 xmlGenericErrorThrDef = handler;
542 else
543 xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
544 xmlMutexUnlock(xmlThrDefMutex);
Daniel Veillardb8478642001-10-12 17:29:10 +0000545}
546
Daniel Veillard5335dc52003-01-01 20:59:38 +0000547/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000548 * xmlRegisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000549 * @func: function pointer to the new RegisterNodeFunc
550 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000551 * Registers a callback for node creation
552 *
553 * Returns the old value of the registration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000554 */
555xmlRegisterNodeFunc
556xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
557{
558 xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue;
559
Daniel Veillarda880b122003-04-21 21:36:41 +0000560 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000561 xmlRegisterNodeDefaultValue = func;
562 return(old);
563}
564
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000565xmlRegisterNodeFunc
566xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
567{
568 xmlRegisterNodeFunc old;
569
570 xmlMutexLock(xmlThrDefMutex);
571 old = xmlRegisterNodeDefaultValueThrDef;
572
573 __xmlRegisterCallbacks = 1;
574 xmlRegisterNodeDefaultValueThrDef = func;
575 xmlMutexUnlock(xmlThrDefMutex);
576
577 return(old);
578}
579
Daniel Veillard5335dc52003-01-01 20:59:38 +0000580/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000581 * xmlDeregisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000582 * @func: function pointer to the new DeregisterNodeFunc
583 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000584 * Registers a callback for node destruction
585 *
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000586 * Returns the previous value of the deregistration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000587 */
588xmlDeregisterNodeFunc
589xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
590{
591 xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue;
592
Daniel Veillarda880b122003-04-21 21:36:41 +0000593 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000594 xmlDeregisterNodeDefaultValue = func;
595 return(old);
596}
597
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000598xmlDeregisterNodeFunc
599xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
600{
601 xmlDeregisterNodeFunc old;
602
603 xmlMutexLock(xmlThrDefMutex);
604 old = xmlDeregisterNodeDefaultValueThrDef;
605
606 __xmlRegisterCallbacks = 1;
607 xmlDeregisterNodeDefaultValueThrDef = func;
608 xmlMutexUnlock(xmlThrDefMutex);
609
610 return(old);
611}
612
Daniel Veillard5335dc52003-01-01 20:59:38 +0000613
Daniel Veillarda4617b82001-11-04 20:19:12 +0000614#ifdef LIBXML_DOCB_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000615#undef docbDefaultSAXHandler
616xmlSAXHandler *
617__docbDefaultSAXHandler(void) {
618 if (IS_MAIN_THREAD)
619 return (&docbDefaultSAXHandler);
620 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000621 return (&xmlGetGlobalState()->docbDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000622}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000623#endif
Daniel Veillardb8478642001-10-12 17:29:10 +0000624
Daniel Veillarda4617b82001-11-04 20:19:12 +0000625#ifdef LIBXML_HTML_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000626#undef htmlDefaultSAXHandler
627xmlSAXHandler *
628__htmlDefaultSAXHandler(void) {
629 if (IS_MAIN_THREAD)
630 return (&htmlDefaultSAXHandler);
631 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000632 return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000633}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000634#endif
635
636/*
637 * Everything starting from the line below is
638 * Automatically generated by build_glob.py.
639 * Do not modify the previous line.
640 */
641
Daniel Veillardb8478642001-10-12 17:29:10 +0000642
Daniel Veillardb8478642001-10-12 17:29:10 +0000643#undef oldXMLWDcompatibility
644int *
645__oldXMLWDcompatibility(void) {
646 if (IS_MAIN_THREAD)
647 return (&oldXMLWDcompatibility);
648 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000649 return (&xmlGetGlobalState()->oldXMLWDcompatibility);
Daniel Veillardb8478642001-10-12 17:29:10 +0000650}
651
Daniel Veillardb8478642001-10-12 17:29:10 +0000652#undef xmlBufferAllocScheme
653xmlBufferAllocationScheme *
654__xmlBufferAllocScheme(void) {
655 if (IS_MAIN_THREAD)
656 return (&xmlBufferAllocScheme);
657 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000658 return (&xmlGetGlobalState()->xmlBufferAllocScheme);
Daniel Veillardb8478642001-10-12 17:29:10 +0000659}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000660xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
661 xmlBufferAllocationScheme ret;
662 xmlMutexLock(xmlThrDefMutex);
663 ret = xmlBufferAllocSchemeThrDef;
664 xmlBufferAllocSchemeThrDef = v;
665 xmlMutexUnlock(xmlThrDefMutex);
666 return ret;
667}
Daniel Veillardb8478642001-10-12 17:29:10 +0000668
Daniel Veillardb8478642001-10-12 17:29:10 +0000669#undef xmlDefaultBufferSize
670int *
671__xmlDefaultBufferSize(void) {
672 if (IS_MAIN_THREAD)
673 return (&xmlDefaultBufferSize);
674 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000675 return (&xmlGetGlobalState()->xmlDefaultBufferSize);
Daniel Veillardb8478642001-10-12 17:29:10 +0000676}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000677int xmlThrDefDefaultBufferSize(int v) {
678 int ret;
679 xmlMutexLock(xmlThrDefMutex);
680 ret = xmlDefaultBufferSizeThrDef;
681 xmlDefaultBufferSizeThrDef = v;
682 xmlMutexUnlock(xmlThrDefMutex);
683 return ret;
684}
Daniel Veillardb8478642001-10-12 17:29:10 +0000685
Daniel Veillardb8478642001-10-12 17:29:10 +0000686#undef xmlDefaultSAXHandler
687xmlSAXHandler *
688__xmlDefaultSAXHandler(void) {
689 if (IS_MAIN_THREAD)
690 return (&xmlDefaultSAXHandler);
691 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000692 return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000693}
694
Daniel Veillardb8478642001-10-12 17:29:10 +0000695#undef xmlDefaultSAXLocator
696xmlSAXLocator *
697__xmlDefaultSAXLocator(void) {
698 if (IS_MAIN_THREAD)
699 return (&xmlDefaultSAXLocator);
700 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000701 return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
Daniel Veillardb8478642001-10-12 17:29:10 +0000702}
703
Daniel Veillardb8478642001-10-12 17:29:10 +0000704#undef xmlDoValidityCheckingDefaultValue
705int *
706__xmlDoValidityCheckingDefaultValue(void) {
707 if (IS_MAIN_THREAD)
708 return (&xmlDoValidityCheckingDefaultValue);
709 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000710 return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000711}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000712int xmlThrDefDoValidityCheckingDefaultValue(int v) {
713 int ret;
714 xmlMutexLock(xmlThrDefMutex);
715 ret = xmlDoValidityCheckingDefaultValueThrDef;
716 xmlDoValidityCheckingDefaultValueThrDef = v;
717 xmlMutexUnlock(xmlThrDefMutex);
718 return ret;
719}
Daniel Veillardb8478642001-10-12 17:29:10 +0000720
Daniel Veillardb8478642001-10-12 17:29:10 +0000721#undef xmlGenericError
722xmlGenericErrorFunc *
723__xmlGenericError(void) {
724 if (IS_MAIN_THREAD)
725 return (&xmlGenericError);
726 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000727 return (&xmlGetGlobalState()->xmlGenericError);
Daniel Veillardb8478642001-10-12 17:29:10 +0000728}
729
Daniel Veillardb8478642001-10-12 17:29:10 +0000730#undef xmlGenericErrorContext
731void * *
732__xmlGenericErrorContext(void) {
733 if (IS_MAIN_THREAD)
734 return (&xmlGenericErrorContext);
735 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000736 return (&xmlGetGlobalState()->xmlGenericErrorContext);
Daniel Veillardb8478642001-10-12 17:29:10 +0000737}
738
Daniel Veillardb8478642001-10-12 17:29:10 +0000739#undef xmlGetWarningsDefaultValue
740int *
741__xmlGetWarningsDefaultValue(void) {
742 if (IS_MAIN_THREAD)
743 return (&xmlGetWarningsDefaultValue);
744 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000745 return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000746}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000747int xmlThrDefGetWarningsDefaultValue(int v) {
748 int ret;
749 xmlMutexLock(xmlThrDefMutex);
750 ret = xmlGetWarningsDefaultValueThrDef;
751 xmlGetWarningsDefaultValueThrDef = v;
752 xmlMutexUnlock(xmlThrDefMutex);
753 return ret;
754}
Daniel Veillardb8478642001-10-12 17:29:10 +0000755
Daniel Veillardb8478642001-10-12 17:29:10 +0000756#undef xmlIndentTreeOutput
757int *
758__xmlIndentTreeOutput(void) {
759 if (IS_MAIN_THREAD)
760 return (&xmlIndentTreeOutput);
761 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000762 return (&xmlGetGlobalState()->xmlIndentTreeOutput);
Daniel Veillardb8478642001-10-12 17:29:10 +0000763}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000764int xmlThrDefIndentTreeOutput(int v) {
765 int ret;
766 xmlMutexLock(xmlThrDefMutex);
767 ret = xmlIndentTreeOutputThrDef;
768 xmlIndentTreeOutputThrDef = v;
769 xmlMutexUnlock(xmlThrDefMutex);
770 return ret;
771}
Daniel Veillardb8478642001-10-12 17:29:10 +0000772
Aleksey Sanin23002562002-05-24 07:18:40 +0000773#undef xmlTreeIndentString
774const char * *
775__xmlTreeIndentString(void) {
776 if (IS_MAIN_THREAD)
777 return (&xmlTreeIndentString);
778 else
779 return (&xmlGetGlobalState()->xmlTreeIndentString);
780}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000781const char * xmlThrDefTreeIndentString(const char * v) {
782 const char * ret;
783 xmlMutexLock(xmlThrDefMutex);
784 ret = xmlTreeIndentStringThrDef;
785 xmlTreeIndentStringThrDef = v;
786 xmlMutexUnlock(xmlThrDefMutex);
787 return ret;
788}
Aleksey Sanin23002562002-05-24 07:18:40 +0000789
Daniel Veillardb8478642001-10-12 17:29:10 +0000790#undef xmlKeepBlanksDefaultValue
791int *
792__xmlKeepBlanksDefaultValue(void) {
793 if (IS_MAIN_THREAD)
794 return (&xmlKeepBlanksDefaultValue);
795 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000796 return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000797}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000798int xmlThrDefKeepBlanksDefaultValue(int v) {
799 int ret;
800 xmlMutexLock(xmlThrDefMutex);
801 ret = xmlKeepBlanksDefaultValueThrDef;
802 xmlKeepBlanksDefaultValueThrDef = v;
803 xmlMutexUnlock(xmlThrDefMutex);
804 return ret;
805}
Daniel Veillardb8478642001-10-12 17:29:10 +0000806
Daniel Veillardb8478642001-10-12 17:29:10 +0000807#undef xmlLineNumbersDefaultValue
808int *
809__xmlLineNumbersDefaultValue(void) {
810 if (IS_MAIN_THREAD)
811 return (&xmlLineNumbersDefaultValue);
812 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000813 return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000814}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000815int xmlThrDefLineNumbersDefaultValue(int v) {
816 int ret;
817 xmlMutexLock(xmlThrDefMutex);
818 ret = xmlLineNumbersDefaultValueThrDef;
819 xmlLineNumbersDefaultValueThrDef = v;
820 xmlMutexUnlock(xmlThrDefMutex);
821 return ret;
822}
Daniel Veillardb8478642001-10-12 17:29:10 +0000823
Daniel Veillardb8478642001-10-12 17:29:10 +0000824#undef xmlLoadExtDtdDefaultValue
825int *
826__xmlLoadExtDtdDefaultValue(void) {
827 if (IS_MAIN_THREAD)
828 return (&xmlLoadExtDtdDefaultValue);
829 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000830 return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000831}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000832int xmlThrDefLoadExtDtdDefaultValue(int v) {
833 int ret;
834 xmlMutexLock(xmlThrDefMutex);
835 ret = xmlLoadExtDtdDefaultValueThrDef;
836 xmlLoadExtDtdDefaultValueThrDef = v;
837 xmlMutexUnlock(xmlThrDefMutex);
838 return ret;
839}
Daniel Veillardb8478642001-10-12 17:29:10 +0000840
Daniel Veillardb8478642001-10-12 17:29:10 +0000841#undef xmlParserDebugEntities
842int *
843__xmlParserDebugEntities(void) {
844 if (IS_MAIN_THREAD)
845 return (&xmlParserDebugEntities);
846 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000847 return (&xmlGetGlobalState()->xmlParserDebugEntities);
Daniel Veillardb8478642001-10-12 17:29:10 +0000848}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000849int xmlThrDefParserDebugEntities(int v) {
850 int ret;
851 xmlMutexLock(xmlThrDefMutex);
852 ret = xmlParserDebugEntitiesThrDef;
853 xmlParserDebugEntitiesThrDef = v;
854 xmlMutexUnlock(xmlThrDefMutex);
855 return ret;
856}
Daniel Veillardb8478642001-10-12 17:29:10 +0000857
Daniel Veillardb8478642001-10-12 17:29:10 +0000858#undef xmlParserVersion
859const char * *
860__xmlParserVersion(void) {
861 if (IS_MAIN_THREAD)
862 return (&xmlParserVersion);
863 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000864 return (&xmlGetGlobalState()->xmlParserVersion);
Daniel Veillardb8478642001-10-12 17:29:10 +0000865}
866
Daniel Veillardb8478642001-10-12 17:29:10 +0000867#undef xmlPedanticParserDefaultValue
868int *
869__xmlPedanticParserDefaultValue(void) {
870 if (IS_MAIN_THREAD)
871 return (&xmlPedanticParserDefaultValue);
872 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000873 return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000874}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000875int xmlThrDefPedanticParserDefaultValue(int v) {
876 int ret;
877 xmlMutexLock(xmlThrDefMutex);
878 ret = xmlPedanticParserDefaultValueThrDef;
879 xmlPedanticParserDefaultValueThrDef = v;
880 xmlMutexUnlock(xmlThrDefMutex);
881 return ret;
882}
Daniel Veillardb8478642001-10-12 17:29:10 +0000883
Daniel Veillardb8478642001-10-12 17:29:10 +0000884#undef xmlSaveNoEmptyTags
885int *
886__xmlSaveNoEmptyTags(void) {
887 if (IS_MAIN_THREAD)
888 return (&xmlSaveNoEmptyTags);
889 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000890 return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
Daniel Veillardb8478642001-10-12 17:29:10 +0000891}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000892int xmlThrDefSaveNoEmptyTags(int v) {
893 int ret;
894 xmlMutexLock(xmlThrDefMutex);
895 ret = xmlSaveNoEmptyTagsThrDef;
896 xmlSaveNoEmptyTagsThrDef = v;
897 xmlMutexUnlock(xmlThrDefMutex);
898 return ret;
899}
Daniel Veillardb8478642001-10-12 17:29:10 +0000900
Daniel Veillardb8478642001-10-12 17:29:10 +0000901#undef xmlSubstituteEntitiesDefaultValue
902int *
903__xmlSubstituteEntitiesDefaultValue(void) {
904 if (IS_MAIN_THREAD)
905 return (&xmlSubstituteEntitiesDefaultValue);
906 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000907 return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000908}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000909int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
910 int ret;
911 xmlMutexLock(xmlThrDefMutex);
912 ret = xmlSubstituteEntitiesDefaultValueThrDef;
913 xmlSubstituteEntitiesDefaultValueThrDef = v;
914 xmlMutexUnlock(xmlThrDefMutex);
915 return ret;
916}
Daniel Veillard5335dc52003-01-01 20:59:38 +0000917
918#undef xmlRegisterNodeDefaultValue
919xmlRegisterNodeFunc *
920__xmlRegisterNodeDefaultValue(void) {
921 if (IS_MAIN_THREAD)
922 return (&xmlRegisterNodeDefaultValue);
923 else
924 return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue);
925}
926
927#undef xmlDeregisterNodeDefaultValue
928xmlDeregisterNodeFunc *
929__xmlDeregisterNodeDefaultValue(void) {
930 if (IS_MAIN_THREAD)
931 return (&xmlDeregisterNodeDefaultValue);
932 else
933 return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue);
934}