blob: bdbbc37677b02b269d5e6997dc2904676f065ea5 [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 Veillard9d06d302002-01-22 18:15:52 +0000328/**
329 * xmlDefaultSAXHandler:
330 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000331 * Default SAX version1 handler for XML, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000332 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000333xmlSAXHandlerV1 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,
Daniel Veillardb8478642001-10-12 17:29:10 +0000362};
363
Daniel Veillard9d06d302002-01-22 18:15:52 +0000364/**
365 * xmlDefaultSAXLocator:
366 *
367 * The default SAX Locator
368 * { getPublicId, getSystemId, getLineNumber, getColumnNumber}
Daniel Veillardb8478642001-10-12 17:29:10 +0000369 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000370xmlSAXLocator xmlDefaultSAXLocator = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000371 xmlSAX2GetPublicId,
372 xmlSAX2GetSystemId,
373 xmlSAX2GetLineNumber,
374 xmlSAX2GetColumnNumber
Daniel Veillardb8478642001-10-12 17:29:10 +0000375};
376
377#ifdef LIBXML_HTML_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000378/**
379 * htmlDefaultSAXHandler:
380 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000381 * Default old SAX v1 handler for HTML, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000382 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000383xmlSAXHandlerV1 htmlDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000384 xmlSAX2InternalSubset,
Daniel Veillardb8478642001-10-12 17:29:10 +0000385 NULL,
386 NULL,
387 NULL,
388 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000389 xmlSAX2GetEntity,
Daniel Veillardb8478642001-10-12 17:29:10 +0000390 NULL,
391 NULL,
392 NULL,
393 NULL,
394 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000395 xmlSAX2SetDocumentLocator,
396 xmlSAX2StartDocument,
397 xmlSAX2EndDocument,
398 xmlSAX2StartElement,
399 xmlSAX2EndElement,
Daniel Veillardb8478642001-10-12 17:29:10 +0000400 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000401 xmlSAX2Characters,
402 xmlSAX2IgnorableWhitespace,
Daniel Veillardb8478642001-10-12 17:29:10 +0000403 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000404 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000405 xmlParserWarning,
406 xmlParserError,
407 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000408 xmlSAX2GetParameterEntity,
409 xmlSAX2CDataBlock,
Daniel Veillardb8478642001-10-12 17:29:10 +0000410 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000411 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000412};
413#endif /* LIBXML_HTML_ENABLED */
414
415#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000416/**
417 * docbDefaultSAXHandler:
418 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000419 * Default old SAX v1 handler for SGML DocBook, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000420 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000421xmlSAXHandlerV1 docbDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000422 xmlSAX2InternalSubset,
423 xmlSAX2IsStandalone,
424 xmlSAX2HasInternalSubset,
425 xmlSAX2HasExternalSubset,
426 xmlSAX2ResolveEntity,
427 xmlSAX2GetEntity,
428 xmlSAX2EntityDecl,
Daniel Veillardb8478642001-10-12 17:29:10 +0000429 NULL,
430 NULL,
431 NULL,
432 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000433 xmlSAX2SetDocumentLocator,
434 xmlSAX2StartDocument,
435 xmlSAX2EndDocument,
436 xmlSAX2StartElement,
437 xmlSAX2EndElement,
438 xmlSAX2Reference,
439 xmlSAX2Characters,
440 xmlSAX2IgnorableWhitespace,
Daniel Veillardb8478642001-10-12 17:29:10 +0000441 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000442 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000443 xmlParserWarning,
444 xmlParserError,
445 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000446 xmlSAX2GetParameterEntity,
Daniel Veillardb8478642001-10-12 17:29:10 +0000447 NULL,
448 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000449 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000450};
451#endif /* LIBXML_DOCB_ENABLED */
452
453/**
454 * xmlInitializeGlobalState:
455 * @gs: a pointer to a newly allocated global state
456 *
457 * xmlInitializeGlobalState() initialize a global state with all the
458 * default values of the library.
459 */
460void
461xmlInitializeGlobalState(xmlGlobalStatePtr gs)
462{
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000463#ifdef DEBUG_GLOBALS
464 fprintf(stderr, "Initializing globals at %lu for thread %d\n",
465 (unsigned long) gs, xmlGetThreadId());
466#endif
467
Daniel Veillardb8478642001-10-12 17:29:10 +0000468 /*
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000469 * Perform initialization as required by libxml
Daniel Veillardb8478642001-10-12 17:29:10 +0000470 */
Daniel Veillard5805be22003-08-28 08:03:23 +0000471 if (xmlThrDefMutex == NULL)
472 xmlInitGlobals();
473
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000474 xmlMutexLock(xmlThrDefMutex);
William M. Brack8b2c7f12002-11-22 05:07:29 +0000475
Daniel Veillarda4617b82001-11-04 20:19:12 +0000476#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard092643b2003-09-25 14:29:29 +0000477 initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000478#endif
479#ifdef LIBXML_HTML_ENABLED
Daniel Veillard092643b2003-09-25 14:29:29 +0000480 inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000481#endif
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000482
Daniel Veillardb8478642001-10-12 17:29:10 +0000483 gs->oldXMLWDcompatibility = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000484 gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
485 gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;
Daniel Veillard092643b2003-09-25 14:29:29 +0000486 initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
Daniel Veillardb8478642001-10-12 17:29:10 +0000487 gs->xmlDefaultSAXLocator.getPublicId = getPublicId;
488 gs->xmlDefaultSAXLocator.getSystemId = getSystemId;
489 gs->xmlDefaultSAXLocator.getLineNumber = getLineNumber;
490 gs->xmlDefaultSAXLocator.getColumnNumber = getColumnNumber;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000491 gs->xmlDoValidityCheckingDefaultValue =
492 xmlDoValidityCheckingDefaultValueThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000493#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
494 gs->xmlFree = (xmlFreeFunc) xmlMemFree;
495 gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000496 gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000497 gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
498 gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
499#else
500 gs->xmlFree = (xmlFreeFunc) free;
501 gs->xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000502 gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000503 gs->xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard572577e2002-01-18 16:23:55 +0000504 gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillardb8478642001-10-12 17:29:10 +0000505#endif
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000506 gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
507 gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
508 gs->xmlTreeIndentString = xmlTreeIndentStringThrDef;
509 gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
510 gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
511 gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
512 gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000513 gs->xmlParserVersion = LIBXML_VERSION_STRING;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000514 gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
515 gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
516 gs->xmlSubstituteEntitiesDefaultValue =
517 xmlSubstituteEntitiesDefaultValueThrDef;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000518
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000519 gs->xmlGenericError = xmlGenericErrorThrDef;
520 gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
521 gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
522 gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
523
524 xmlMutexUnlock(xmlThrDefMutex);
525}
526
527void
528xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
529 xmlMutexLock(xmlThrDefMutex);
530 xmlGenericErrorContextThrDef = ctx;
531 if (handler != NULL)
532 xmlGenericErrorThrDef = handler;
533 else
534 xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
535 xmlMutexUnlock(xmlThrDefMutex);
Daniel Veillardb8478642001-10-12 17:29:10 +0000536}
537
Daniel Veillard5335dc52003-01-01 20:59:38 +0000538/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000539 * xmlRegisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000540 * @func: function pointer to the new RegisterNodeFunc
541 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000542 * Registers a callback for node creation
543 *
544 * Returns the old value of the registration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000545 */
546xmlRegisterNodeFunc
547xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
548{
549 xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue;
550
Daniel Veillarda880b122003-04-21 21:36:41 +0000551 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000552 xmlRegisterNodeDefaultValue = func;
553 return(old);
554}
555
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000556xmlRegisterNodeFunc
557xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
558{
559 xmlRegisterNodeFunc old;
560
561 xmlMutexLock(xmlThrDefMutex);
562 old = xmlRegisterNodeDefaultValueThrDef;
563
564 __xmlRegisterCallbacks = 1;
565 xmlRegisterNodeDefaultValueThrDef = func;
566 xmlMutexUnlock(xmlThrDefMutex);
567
568 return(old);
569}
570
Daniel Veillard5335dc52003-01-01 20:59:38 +0000571/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000572 * xmlDeregisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000573 * @func: function pointer to the new DeregisterNodeFunc
574 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000575 * Registers a callback for node destruction
576 *
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000577 * Returns the previous value of the deregistration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000578 */
579xmlDeregisterNodeFunc
580xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
581{
582 xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue;
583
Daniel Veillarda880b122003-04-21 21:36:41 +0000584 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000585 xmlDeregisterNodeDefaultValue = func;
586 return(old);
587}
588
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000589xmlDeregisterNodeFunc
590xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
591{
592 xmlDeregisterNodeFunc old;
593
594 xmlMutexLock(xmlThrDefMutex);
595 old = xmlDeregisterNodeDefaultValueThrDef;
596
597 __xmlRegisterCallbacks = 1;
598 xmlDeregisterNodeDefaultValueThrDef = func;
599 xmlMutexUnlock(xmlThrDefMutex);
600
601 return(old);
602}
603
Daniel Veillard5335dc52003-01-01 20:59:38 +0000604
Daniel Veillarda4617b82001-11-04 20:19:12 +0000605#ifdef LIBXML_DOCB_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000606#undef docbDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000607xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000608__docbDefaultSAXHandler(void) {
609 if (IS_MAIN_THREAD)
610 return (&docbDefaultSAXHandler);
611 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000612 return (&xmlGetGlobalState()->docbDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000613}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000614#endif
Daniel Veillardb8478642001-10-12 17:29:10 +0000615
Daniel Veillarda4617b82001-11-04 20:19:12 +0000616#ifdef LIBXML_HTML_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000617#undef htmlDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000618xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000619__htmlDefaultSAXHandler(void) {
620 if (IS_MAIN_THREAD)
621 return (&htmlDefaultSAXHandler);
622 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000623 return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000624}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000625#endif
626
627/*
628 * Everything starting from the line below is
629 * Automatically generated by build_glob.py.
630 * Do not modify the previous line.
631 */
632
Daniel Veillardb8478642001-10-12 17:29:10 +0000633
Daniel Veillardb8478642001-10-12 17:29:10 +0000634#undef oldXMLWDcompatibility
635int *
636__oldXMLWDcompatibility(void) {
637 if (IS_MAIN_THREAD)
638 return (&oldXMLWDcompatibility);
639 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000640 return (&xmlGetGlobalState()->oldXMLWDcompatibility);
Daniel Veillardb8478642001-10-12 17:29:10 +0000641}
642
Daniel Veillardb8478642001-10-12 17:29:10 +0000643#undef xmlBufferAllocScheme
644xmlBufferAllocationScheme *
645__xmlBufferAllocScheme(void) {
646 if (IS_MAIN_THREAD)
647 return (&xmlBufferAllocScheme);
648 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000649 return (&xmlGetGlobalState()->xmlBufferAllocScheme);
Daniel Veillardb8478642001-10-12 17:29:10 +0000650}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000651xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
652 xmlBufferAllocationScheme ret;
653 xmlMutexLock(xmlThrDefMutex);
654 ret = xmlBufferAllocSchemeThrDef;
655 xmlBufferAllocSchemeThrDef = v;
656 xmlMutexUnlock(xmlThrDefMutex);
657 return ret;
658}
Daniel Veillardb8478642001-10-12 17:29:10 +0000659
Daniel Veillardb8478642001-10-12 17:29:10 +0000660#undef xmlDefaultBufferSize
661int *
662__xmlDefaultBufferSize(void) {
663 if (IS_MAIN_THREAD)
664 return (&xmlDefaultBufferSize);
665 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000666 return (&xmlGetGlobalState()->xmlDefaultBufferSize);
Daniel Veillardb8478642001-10-12 17:29:10 +0000667}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000668int xmlThrDefDefaultBufferSize(int v) {
669 int ret;
670 xmlMutexLock(xmlThrDefMutex);
671 ret = xmlDefaultBufferSizeThrDef;
672 xmlDefaultBufferSizeThrDef = v;
673 xmlMutexUnlock(xmlThrDefMutex);
674 return ret;
675}
Daniel Veillardb8478642001-10-12 17:29:10 +0000676
Daniel Veillardb8478642001-10-12 17:29:10 +0000677#undef xmlDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000678xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000679__xmlDefaultSAXHandler(void) {
680 if (IS_MAIN_THREAD)
681 return (&xmlDefaultSAXHandler);
682 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000683 return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000684}
685
Daniel Veillardb8478642001-10-12 17:29:10 +0000686#undef xmlDefaultSAXLocator
687xmlSAXLocator *
688__xmlDefaultSAXLocator(void) {
689 if (IS_MAIN_THREAD)
690 return (&xmlDefaultSAXLocator);
691 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000692 return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
Daniel Veillardb8478642001-10-12 17:29:10 +0000693}
694
Daniel Veillardb8478642001-10-12 17:29:10 +0000695#undef xmlDoValidityCheckingDefaultValue
696int *
697__xmlDoValidityCheckingDefaultValue(void) {
698 if (IS_MAIN_THREAD)
699 return (&xmlDoValidityCheckingDefaultValue);
700 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000701 return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000702}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000703int xmlThrDefDoValidityCheckingDefaultValue(int v) {
704 int ret;
705 xmlMutexLock(xmlThrDefMutex);
706 ret = xmlDoValidityCheckingDefaultValueThrDef;
707 xmlDoValidityCheckingDefaultValueThrDef = v;
708 xmlMutexUnlock(xmlThrDefMutex);
709 return ret;
710}
Daniel Veillardb8478642001-10-12 17:29:10 +0000711
Daniel Veillardb8478642001-10-12 17:29:10 +0000712#undef xmlGenericError
713xmlGenericErrorFunc *
714__xmlGenericError(void) {
715 if (IS_MAIN_THREAD)
716 return (&xmlGenericError);
717 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000718 return (&xmlGetGlobalState()->xmlGenericError);
Daniel Veillardb8478642001-10-12 17:29:10 +0000719}
720
Daniel Veillardb8478642001-10-12 17:29:10 +0000721#undef xmlGenericErrorContext
722void * *
723__xmlGenericErrorContext(void) {
724 if (IS_MAIN_THREAD)
725 return (&xmlGenericErrorContext);
726 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000727 return (&xmlGetGlobalState()->xmlGenericErrorContext);
Daniel Veillardb8478642001-10-12 17:29:10 +0000728}
729
Daniel Veillardb8478642001-10-12 17:29:10 +0000730#undef xmlGetWarningsDefaultValue
731int *
732__xmlGetWarningsDefaultValue(void) {
733 if (IS_MAIN_THREAD)
734 return (&xmlGetWarningsDefaultValue);
735 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000736 return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000737}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000738int xmlThrDefGetWarningsDefaultValue(int v) {
739 int ret;
740 xmlMutexLock(xmlThrDefMutex);
741 ret = xmlGetWarningsDefaultValueThrDef;
742 xmlGetWarningsDefaultValueThrDef = v;
743 xmlMutexUnlock(xmlThrDefMutex);
744 return ret;
745}
Daniel Veillardb8478642001-10-12 17:29:10 +0000746
Daniel Veillardb8478642001-10-12 17:29:10 +0000747#undef xmlIndentTreeOutput
748int *
749__xmlIndentTreeOutput(void) {
750 if (IS_MAIN_THREAD)
751 return (&xmlIndentTreeOutput);
752 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000753 return (&xmlGetGlobalState()->xmlIndentTreeOutput);
Daniel Veillardb8478642001-10-12 17:29:10 +0000754}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000755int xmlThrDefIndentTreeOutput(int v) {
756 int ret;
757 xmlMutexLock(xmlThrDefMutex);
758 ret = xmlIndentTreeOutputThrDef;
759 xmlIndentTreeOutputThrDef = v;
760 xmlMutexUnlock(xmlThrDefMutex);
761 return ret;
762}
Daniel Veillardb8478642001-10-12 17:29:10 +0000763
Aleksey Sanin23002562002-05-24 07:18:40 +0000764#undef xmlTreeIndentString
765const char * *
766__xmlTreeIndentString(void) {
767 if (IS_MAIN_THREAD)
768 return (&xmlTreeIndentString);
769 else
770 return (&xmlGetGlobalState()->xmlTreeIndentString);
771}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000772const char * xmlThrDefTreeIndentString(const char * v) {
773 const char * ret;
774 xmlMutexLock(xmlThrDefMutex);
775 ret = xmlTreeIndentStringThrDef;
776 xmlTreeIndentStringThrDef = v;
777 xmlMutexUnlock(xmlThrDefMutex);
778 return ret;
779}
Aleksey Sanin23002562002-05-24 07:18:40 +0000780
Daniel Veillardb8478642001-10-12 17:29:10 +0000781#undef xmlKeepBlanksDefaultValue
782int *
783__xmlKeepBlanksDefaultValue(void) {
784 if (IS_MAIN_THREAD)
785 return (&xmlKeepBlanksDefaultValue);
786 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000787 return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000788}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000789int xmlThrDefKeepBlanksDefaultValue(int v) {
790 int ret;
791 xmlMutexLock(xmlThrDefMutex);
792 ret = xmlKeepBlanksDefaultValueThrDef;
793 xmlKeepBlanksDefaultValueThrDef = v;
794 xmlMutexUnlock(xmlThrDefMutex);
795 return ret;
796}
Daniel Veillardb8478642001-10-12 17:29:10 +0000797
Daniel Veillardb8478642001-10-12 17:29:10 +0000798#undef xmlLineNumbersDefaultValue
799int *
800__xmlLineNumbersDefaultValue(void) {
801 if (IS_MAIN_THREAD)
802 return (&xmlLineNumbersDefaultValue);
803 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000804 return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000805}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000806int xmlThrDefLineNumbersDefaultValue(int v) {
807 int ret;
808 xmlMutexLock(xmlThrDefMutex);
809 ret = xmlLineNumbersDefaultValueThrDef;
810 xmlLineNumbersDefaultValueThrDef = v;
811 xmlMutexUnlock(xmlThrDefMutex);
812 return ret;
813}
Daniel Veillardb8478642001-10-12 17:29:10 +0000814
Daniel Veillardb8478642001-10-12 17:29:10 +0000815#undef xmlLoadExtDtdDefaultValue
816int *
817__xmlLoadExtDtdDefaultValue(void) {
818 if (IS_MAIN_THREAD)
819 return (&xmlLoadExtDtdDefaultValue);
820 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000821 return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000822}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000823int xmlThrDefLoadExtDtdDefaultValue(int v) {
824 int ret;
825 xmlMutexLock(xmlThrDefMutex);
826 ret = xmlLoadExtDtdDefaultValueThrDef;
827 xmlLoadExtDtdDefaultValueThrDef = v;
828 xmlMutexUnlock(xmlThrDefMutex);
829 return ret;
830}
Daniel Veillardb8478642001-10-12 17:29:10 +0000831
Daniel Veillardb8478642001-10-12 17:29:10 +0000832#undef xmlParserDebugEntities
833int *
834__xmlParserDebugEntities(void) {
835 if (IS_MAIN_THREAD)
836 return (&xmlParserDebugEntities);
837 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000838 return (&xmlGetGlobalState()->xmlParserDebugEntities);
Daniel Veillardb8478642001-10-12 17:29:10 +0000839}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000840int xmlThrDefParserDebugEntities(int v) {
841 int ret;
842 xmlMutexLock(xmlThrDefMutex);
843 ret = xmlParserDebugEntitiesThrDef;
844 xmlParserDebugEntitiesThrDef = v;
845 xmlMutexUnlock(xmlThrDefMutex);
846 return ret;
847}
Daniel Veillardb8478642001-10-12 17:29:10 +0000848
Daniel Veillardb8478642001-10-12 17:29:10 +0000849#undef xmlParserVersion
850const char * *
851__xmlParserVersion(void) {
852 if (IS_MAIN_THREAD)
853 return (&xmlParserVersion);
854 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000855 return (&xmlGetGlobalState()->xmlParserVersion);
Daniel Veillardb8478642001-10-12 17:29:10 +0000856}
857
Daniel Veillardb8478642001-10-12 17:29:10 +0000858#undef xmlPedanticParserDefaultValue
859int *
860__xmlPedanticParserDefaultValue(void) {
861 if (IS_MAIN_THREAD)
862 return (&xmlPedanticParserDefaultValue);
863 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000864 return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000865}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000866int xmlThrDefPedanticParserDefaultValue(int v) {
867 int ret;
868 xmlMutexLock(xmlThrDefMutex);
869 ret = xmlPedanticParserDefaultValueThrDef;
870 xmlPedanticParserDefaultValueThrDef = v;
871 xmlMutexUnlock(xmlThrDefMutex);
872 return ret;
873}
Daniel Veillardb8478642001-10-12 17:29:10 +0000874
Daniel Veillardb8478642001-10-12 17:29:10 +0000875#undef xmlSaveNoEmptyTags
876int *
877__xmlSaveNoEmptyTags(void) {
878 if (IS_MAIN_THREAD)
879 return (&xmlSaveNoEmptyTags);
880 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000881 return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
Daniel Veillardb8478642001-10-12 17:29:10 +0000882}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000883int xmlThrDefSaveNoEmptyTags(int v) {
884 int ret;
885 xmlMutexLock(xmlThrDefMutex);
886 ret = xmlSaveNoEmptyTagsThrDef;
887 xmlSaveNoEmptyTagsThrDef = v;
888 xmlMutexUnlock(xmlThrDefMutex);
889 return ret;
890}
Daniel Veillardb8478642001-10-12 17:29:10 +0000891
Daniel Veillardb8478642001-10-12 17:29:10 +0000892#undef xmlSubstituteEntitiesDefaultValue
893int *
894__xmlSubstituteEntitiesDefaultValue(void) {
895 if (IS_MAIN_THREAD)
896 return (&xmlSubstituteEntitiesDefaultValue);
897 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000898 return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000899}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000900int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
901 int ret;
902 xmlMutexLock(xmlThrDefMutex);
903 ret = xmlSubstituteEntitiesDefaultValueThrDef;
904 xmlSubstituteEntitiesDefaultValueThrDef = v;
905 xmlMutexUnlock(xmlThrDefMutex);
906 return ret;
907}
Daniel Veillard5335dc52003-01-01 20:59:38 +0000908
909#undef xmlRegisterNodeDefaultValue
910xmlRegisterNodeFunc *
911__xmlRegisterNodeDefaultValue(void) {
912 if (IS_MAIN_THREAD)
913 return (&xmlRegisterNodeDefaultValue);
914 else
915 return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue);
916}
917
918#undef xmlDeregisterNodeDefaultValue
919xmlDeregisterNodeFunc *
920__xmlDeregisterNodeDefaultValue(void) {
921 if (IS_MAIN_THREAD)
922 return (&xmlDeregisterNodeDefaultValue);
923 else
924 return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue);
925}