blob: 69b4dc20e7acb7b0afdefaa67d4a2e45951d02d0 [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 Veillard2b8c4a12003-10-02 22:28:19 +0000124#endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */
Daniel Veillardb8478642001-10-12 17:29:10 +0000125
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
Daniel Veillard659e71e2003-10-10 14:10:40 +0000139#undef xmlStructuredError
Daniel Veillardd0463562001-10-13 09:15:48 +0000140#undef xmlGenericErrorContext
141#undef xmlGetWarningsDefaultValue
142#undef xmlIndentTreeOutput
Aleksey Sanin23002562002-05-24 07:18:40 +0000143#undef xmlTreeIndentString
Daniel Veillardd0463562001-10-13 09:15:48 +0000144#undef xmlKeepBlanksDefaultValue
145#undef xmlLineNumbersDefaultValue
146#undef xmlLoadExtDtdDefaultValue
147#undef xmlParserDebugEntities
148#undef xmlParserVersion
149#undef xmlPedanticParserDefaultValue
150#undef xmlSaveNoEmptyTags
151#undef xmlSubstituteEntitiesDefaultValue
Daniel Veillard8326e732003-01-07 00:19:07 +0000152#undef xmlRegisterNodeDefaultValue
153#undef xmlDeregisterNodeDefaultValue
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000154#undef xmlLastError
Daniel Veillardd0463562001-10-13 09:15:48 +0000155
156#undef xmlFree
157#undef xmlMalloc
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000158#undef xmlMallocAtomic
Daniel Veillardd0463562001-10-13 09:15:48 +0000159#undef xmlMemStrdup
160#undef xmlRealloc
161
Daniel Veillard9d06d302002-01-22 18:15:52 +0000162/**
163 * xmlParserVersion:
164 *
165 * Constant string describing the internal version of the library
166 */
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000167const char *xmlParserVersion = LIBXML_VERSION_STRING;
168
Daniel Veillard9d06d302002-01-22 18:15:52 +0000169/**
170 * xmlBufferAllocScheme:
171 *
172 * Global setting, default allocation policy for buffers, default is
173 * XML_BUFFER_ALLOC_EXACT
Daniel Veillardb8478642001-10-12 17:29:10 +0000174 */
175xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000176static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_EXACT;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000177/**
178 * xmlDefaultBufferSize:
179 *
180 * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
181 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000182int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000183static int xmlDefaultBufferSizeThrDef = BASE_BUFFER_SIZE;
Daniel Veillardb8478642001-10-12 17:29:10 +0000184
185/*
186 * Parser defaults
187 */
Daniel Veillardd0463562001-10-13 09:15:48 +0000188
Daniel Veillard9d06d302002-01-22 18:15:52 +0000189/**
190 * oldXMLWDcompatibility:
191 *
192 * Global setting, DEPRECATED.
193 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000194int oldXMLWDcompatibility = 0; /* DEPRECATED */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000195/**
196 * xmlParserDebugEntities:
197 *
198 * Global setting, asking the parser to print out debugging informations.
199 * while handling entities.
200 * Disabled by default
201 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000202int xmlParserDebugEntities = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000203static int xmlParserDebugEntitiesThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000204/**
205 * xmlDoValidityCheckingDefaultValue:
206 *
207 * Global setting, indicate that the parser should work in validating mode.
208 * Disabled by default.
209 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000210int xmlDoValidityCheckingDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000211static int xmlDoValidityCheckingDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000212/**
213 * xmlGetWarningsDefaultValue:
214 *
215 * Global setting, indicate that the parser should provide warnings.
216 * Activated by default.
217 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000218int xmlGetWarningsDefaultValue = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000219static int xmlGetWarningsDefaultValueThrDef = 1;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000220/**
221 * xmlLoadExtDtdDefaultValue:
222 *
223 * Global setting, indicate that the parser should load DTD while not
224 * validating.
225 * Disabled by default.
226 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000227int xmlLoadExtDtdDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000228static int xmlLoadExtDtdDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000229/**
230 * xmlPedanticParserDefaultValue:
231 *
232 * Global setting, indicate that the parser be pedantic
233 * Disabled by default.
234 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000235int xmlPedanticParserDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000236static int xmlPedanticParserDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000237/**
238 * xmlLineNumbersDefaultValue:
239 *
240 * Global setting, indicate that the parser should store the line number
241 * in the content field of elements in the DOM tree.
242 * Disabled by default since this may not be safe for old classes of
243 * applicaton.
244 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000245int xmlLineNumbersDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000246static int xmlLineNumbersDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000247/**
248 * xmlKeepBlanksDefaultValue:
249 *
250 * Global setting, indicate that the parser should keep all blanks
251 * nodes found in the content
252 * Activated by default, this is actually needed to have the parser
253 * conformant to the XML Recommendation, however the option is kept
254 * for some applications since this was libxml1 default behaviour.
255 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000256int xmlKeepBlanksDefaultValue = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000257static int xmlKeepBlanksDefaultValueThrDef = 1;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000258/**
259 * xmlSubstituteEntitiesDefaultValue:
260 *
261 * Global setting, indicate that the parser should not generate entity
262 * references but replace them with the actual content of the entity
263 * Disabled by default, this should be activated when using XPath since
264 * the XPath data model requires entities replacement and the XPath
265 * engine does not handle entities references transparently.
266 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000267int xmlSubstituteEntitiesDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000268static int xmlSubstituteEntitiesDefaultValueThrDef = 0;
Daniel Veillardb8478642001-10-12 17:29:10 +0000269
Daniel Veillard5335dc52003-01-01 20:59:38 +0000270xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000271static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000272xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000273static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000274
Daniel Veillardb8478642001-10-12 17:29:10 +0000275/*
276 * Error handling
277 */
278
279/* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
280/* Must initialize xmlGenericError in xmlInitParser */
Daniel Veillard635ef722001-10-29 11:48:19 +0000281void xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
282 const char *msg,
283 ...);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000284/**
285 * xmlGenericError:
286 *
287 * Global setting: function used for generic error callbacks
288 */
Daniel Veillard635ef722001-10-29 11:48:19 +0000289xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000290static xmlGenericErrorFunc xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000291/**
Daniel Veillard659e71e2003-10-10 14:10:40 +0000292 * xmlStructuredError:
293 *
294 * Global setting: function used for structured error callbacks
295 */
296xmlStructuredErrorFunc xmlStructuredError = NULL;
297static xmlStructuredErrorFunc xmlStructuredErrorThrDef = NULL;
298/**
Daniel Veillard9d06d302002-01-22 18:15:52 +0000299 * xmlGenericErrorContext:
300 *
301 * Global setting passed to generic error callbacks
302 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000303void *xmlGenericErrorContext = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000304static void *xmlGenericErrorContextThrDef = NULL;
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000305xmlError xmlLastError;
Daniel Veillardb8478642001-10-12 17:29:10 +0000306
307/*
308 * output defaults
309 */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000310/**
311 * xmlIndentTreeOutput:
312 *
313 * Global setting, asking the serializer to indent the output tree by default
Aleksey Sanin23002562002-05-24 07:18:40 +0000314 * Enabled by default
Daniel Veillard9d06d302002-01-22 18:15:52 +0000315 */
Aleksey Sanin23002562002-05-24 07:18:40 +0000316int xmlIndentTreeOutput = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000317static int xmlIndentTreeOutputThrDef = 1;
Aleksey Sanin23002562002-05-24 07:18:40 +0000318
319/**
320 * xmlTreeIndentString:
321 *
322 * The string used to do one-level indent. By default is equal to " " (two spaces)
323 */
324const char *xmlTreeIndentString = " ";
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000325static const char *xmlTreeIndentStringThrDef = " ";
Aleksey Sanin23002562002-05-24 07:18:40 +0000326
Daniel Veillard9d06d302002-01-22 18:15:52 +0000327/**
328 * xmlSaveNoEmptyTags:
329 *
330 * Global setting, asking the serializer to not output empty tags
331 * as <empty/> but <empty></empty>. those two forms are undistinguishable
332 * once parsed.
333 * Disabled by default
334 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000335int xmlSaveNoEmptyTags = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000336int xmlSaveNoEmptyTagsThrDef = 0;
Daniel Veillardb8478642001-10-12 17:29:10 +0000337
Daniel Veillard81273902003-09-30 00:43:48 +0000338#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000339/**
340 * xmlDefaultSAXHandler:
341 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000342 * Default SAX version1 handler for XML, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000343 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000344xmlSAXHandlerV1 xmlDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000345 xmlSAX2InternalSubset,
346 xmlSAX2IsStandalone,
347 xmlSAX2HasInternalSubset,
348 xmlSAX2HasExternalSubset,
349 xmlSAX2ResolveEntity,
350 xmlSAX2GetEntity,
351 xmlSAX2EntityDecl,
352 xmlSAX2NotationDecl,
353 xmlSAX2AttributeDecl,
354 xmlSAX2ElementDecl,
355 xmlSAX2UnparsedEntityDecl,
356 xmlSAX2SetDocumentLocator,
357 xmlSAX2StartDocument,
358 xmlSAX2EndDocument,
359 xmlSAX2StartElement,
360 xmlSAX2EndElement,
361 xmlSAX2Reference,
362 xmlSAX2Characters,
363 xmlSAX2Characters,
364 xmlSAX2ProcessingInstruction,
365 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000366 xmlParserWarning,
367 xmlParserError,
368 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000369 xmlSAX2GetParameterEntity,
370 xmlSAX2CDataBlock,
371 xmlSAX2ExternalSubset,
372 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000373};
Daniel Veillard81273902003-09-30 00:43:48 +0000374#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillardb8478642001-10-12 17:29:10 +0000375
Daniel Veillard9d06d302002-01-22 18:15:52 +0000376/**
377 * xmlDefaultSAXLocator:
378 *
379 * The default SAX Locator
380 * { getPublicId, getSystemId, getLineNumber, getColumnNumber}
Daniel Veillardb8478642001-10-12 17:29:10 +0000381 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000382xmlSAXLocator xmlDefaultSAXLocator = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000383 xmlSAX2GetPublicId,
384 xmlSAX2GetSystemId,
385 xmlSAX2GetLineNumber,
386 xmlSAX2GetColumnNumber
Daniel Veillardb8478642001-10-12 17:29:10 +0000387};
388
389#ifdef LIBXML_HTML_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000390/**
391 * htmlDefaultSAXHandler:
392 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000393 * Default old SAX v1 handler for HTML, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000394 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000395xmlSAXHandlerV1 htmlDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000396 xmlSAX2InternalSubset,
Daniel Veillardb8478642001-10-12 17:29:10 +0000397 NULL,
398 NULL,
399 NULL,
400 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000401 xmlSAX2GetEntity,
Daniel Veillardb8478642001-10-12 17:29:10 +0000402 NULL,
403 NULL,
404 NULL,
405 NULL,
406 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000407 xmlSAX2SetDocumentLocator,
408 xmlSAX2StartDocument,
409 xmlSAX2EndDocument,
410 xmlSAX2StartElement,
411 xmlSAX2EndElement,
Daniel Veillardb8478642001-10-12 17:29:10 +0000412 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000413 xmlSAX2Characters,
414 xmlSAX2IgnorableWhitespace,
Daniel Veillardb8478642001-10-12 17:29:10 +0000415 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000416 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000417 xmlParserWarning,
418 xmlParserError,
419 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000420 xmlSAX2GetParameterEntity,
421 xmlSAX2CDataBlock,
Daniel Veillardb8478642001-10-12 17:29:10 +0000422 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000423 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000424};
425#endif /* LIBXML_HTML_ENABLED */
426
427#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000428/**
429 * docbDefaultSAXHandler:
430 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000431 * Default old SAX v1 handler for SGML DocBook, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000432 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000433xmlSAXHandlerV1 docbDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000434 xmlSAX2InternalSubset,
435 xmlSAX2IsStandalone,
436 xmlSAX2HasInternalSubset,
437 xmlSAX2HasExternalSubset,
438 xmlSAX2ResolveEntity,
439 xmlSAX2GetEntity,
440 xmlSAX2EntityDecl,
Daniel Veillardb8478642001-10-12 17:29:10 +0000441 NULL,
442 NULL,
443 NULL,
444 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000445 xmlSAX2SetDocumentLocator,
446 xmlSAX2StartDocument,
447 xmlSAX2EndDocument,
448 xmlSAX2StartElement,
449 xmlSAX2EndElement,
450 xmlSAX2Reference,
451 xmlSAX2Characters,
452 xmlSAX2IgnorableWhitespace,
Daniel Veillardb8478642001-10-12 17:29:10 +0000453 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000454 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000455 xmlParserWarning,
456 xmlParserError,
457 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000458 xmlSAX2GetParameterEntity,
Daniel Veillardb8478642001-10-12 17:29:10 +0000459 NULL,
460 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000461 0,
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 Veillard092643b2003-09-25 14:29:29 +0000489 initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000490#endif
491#ifdef LIBXML_HTML_ENABLED
Daniel Veillard092643b2003-09-25 14:29:29 +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 Veillard81273902003-09-30 00:43:48 +0000498#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard092643b2003-09-25 14:29:29 +0000499 initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
Daniel Veillard81273902003-09-30 00:43:48 +0000500#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillard4432df22003-09-28 18:58:27 +0000501 gs->xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId;
502 gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
503 gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
504 gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000505 gs->xmlDoValidityCheckingDefaultValue =
506 xmlDoValidityCheckingDefaultValueThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000507#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
508 gs->xmlFree = (xmlFreeFunc) xmlMemFree;
509 gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000510 gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000511 gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
512 gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
513#else
514 gs->xmlFree = (xmlFreeFunc) free;
515 gs->xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000516 gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000517 gs->xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard572577e2002-01-18 16:23:55 +0000518 gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillardb8478642001-10-12 17:29:10 +0000519#endif
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000520 gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
521 gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
522 gs->xmlTreeIndentString = xmlTreeIndentStringThrDef;
523 gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
524 gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
525 gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
526 gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000527 gs->xmlParserVersion = LIBXML_VERSION_STRING;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000528 gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
529 gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
530 gs->xmlSubstituteEntitiesDefaultValue =
531 xmlSubstituteEntitiesDefaultValueThrDef;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000532
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000533 gs->xmlGenericError = xmlGenericErrorThrDef;
Daniel Veillard659e71e2003-10-10 14:10:40 +0000534 gs->xmlStructuredError = xmlStructuredErrorThrDef;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000535 gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
536 gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
537 gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000538 memset(&gs->xmlLastError, 0, sizeof(xmlError));
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000539
540 xmlMutexUnlock(xmlThrDefMutex);
541}
542
Daniel Veillard1e906612003-12-05 14:57:46 +0000543/**
544 * DOC_DISABLE : we ignore missing doc for the xmlThrDef functions,
545 * those are really internal work
546 */
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000547void
548xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
549 xmlMutexLock(xmlThrDefMutex);
550 xmlGenericErrorContextThrDef = ctx;
551 if (handler != NULL)
552 xmlGenericErrorThrDef = handler;
553 else
554 xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
555 xmlMutexUnlock(xmlThrDefMutex);
Daniel Veillardb8478642001-10-12 17:29:10 +0000556}
557
Daniel Veillard659e71e2003-10-10 14:10:40 +0000558void
559xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
560 xmlMutexLock(xmlThrDefMutex);
561 xmlGenericErrorContextThrDef = ctx;
562 xmlStructuredErrorThrDef = handler;
563 xmlMutexUnlock(xmlThrDefMutex);
564}
565
Daniel Veillard5335dc52003-01-01 20:59:38 +0000566/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000567 * xmlRegisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000568 * @func: function pointer to the new RegisterNodeFunc
569 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000570 * Registers a callback for node creation
571 *
572 * Returns the old value of the registration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000573 */
574xmlRegisterNodeFunc
575xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
576{
577 xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue;
578
Daniel Veillarda880b122003-04-21 21:36:41 +0000579 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000580 xmlRegisterNodeDefaultValue = func;
581 return(old);
582}
583
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000584xmlRegisterNodeFunc
585xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
586{
587 xmlRegisterNodeFunc old;
588
589 xmlMutexLock(xmlThrDefMutex);
590 old = xmlRegisterNodeDefaultValueThrDef;
591
592 __xmlRegisterCallbacks = 1;
593 xmlRegisterNodeDefaultValueThrDef = func;
594 xmlMutexUnlock(xmlThrDefMutex);
595
596 return(old);
597}
598
Daniel Veillard5335dc52003-01-01 20:59:38 +0000599/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000600 * xmlDeregisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000601 * @func: function pointer to the new DeregisterNodeFunc
602 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000603 * Registers a callback for node destruction
604 *
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000605 * Returns the previous value of the deregistration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000606 */
607xmlDeregisterNodeFunc
608xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
609{
610 xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue;
611
Daniel Veillarda880b122003-04-21 21:36:41 +0000612 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000613 xmlDeregisterNodeDefaultValue = func;
614 return(old);
615}
616
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000617xmlDeregisterNodeFunc
618xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
619{
620 xmlDeregisterNodeFunc old;
621
622 xmlMutexLock(xmlThrDefMutex);
623 old = xmlDeregisterNodeDefaultValueThrDef;
624
625 __xmlRegisterCallbacks = 1;
626 xmlDeregisterNodeDefaultValueThrDef = func;
627 xmlMutexUnlock(xmlThrDefMutex);
628
629 return(old);
630}
631
Daniel Veillard5335dc52003-01-01 20:59:38 +0000632
Daniel Veillarda4617b82001-11-04 20:19:12 +0000633#ifdef LIBXML_DOCB_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000634#undef docbDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000635xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000636__docbDefaultSAXHandler(void) {
637 if (IS_MAIN_THREAD)
638 return (&docbDefaultSAXHandler);
639 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000640 return (&xmlGetGlobalState()->docbDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000641}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000642#endif
Daniel Veillardb8478642001-10-12 17:29:10 +0000643
Daniel Veillarda4617b82001-11-04 20:19:12 +0000644#ifdef LIBXML_HTML_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000645#undef htmlDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000646xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000647__htmlDefaultSAXHandler(void) {
648 if (IS_MAIN_THREAD)
649 return (&htmlDefaultSAXHandler);
650 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000651 return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000652}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000653#endif
654
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000655#undef xmlLastError
656xmlError *
657__xmlLastError(void) {
658 if (IS_MAIN_THREAD)
659 return (&xmlLastError);
660 else
661 return (&xmlGetGlobalState()->xmlLastError);
662}
663
Daniel Veillarda4617b82001-11-04 20:19:12 +0000664/*
665 * Everything starting from the line below is
666 * Automatically generated by build_glob.py.
667 * Do not modify the previous line.
668 */
669
Daniel Veillardb8478642001-10-12 17:29:10 +0000670
Daniel Veillardb8478642001-10-12 17:29:10 +0000671#undef oldXMLWDcompatibility
672int *
673__oldXMLWDcompatibility(void) {
674 if (IS_MAIN_THREAD)
675 return (&oldXMLWDcompatibility);
676 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000677 return (&xmlGetGlobalState()->oldXMLWDcompatibility);
Daniel Veillardb8478642001-10-12 17:29:10 +0000678}
679
Daniel Veillardb8478642001-10-12 17:29:10 +0000680#undef xmlBufferAllocScheme
681xmlBufferAllocationScheme *
682__xmlBufferAllocScheme(void) {
683 if (IS_MAIN_THREAD)
684 return (&xmlBufferAllocScheme);
685 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000686 return (&xmlGetGlobalState()->xmlBufferAllocScheme);
Daniel Veillardb8478642001-10-12 17:29:10 +0000687}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000688xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
689 xmlBufferAllocationScheme ret;
690 xmlMutexLock(xmlThrDefMutex);
691 ret = xmlBufferAllocSchemeThrDef;
692 xmlBufferAllocSchemeThrDef = v;
693 xmlMutexUnlock(xmlThrDefMutex);
694 return ret;
695}
Daniel Veillardb8478642001-10-12 17:29:10 +0000696
Daniel Veillardb8478642001-10-12 17:29:10 +0000697#undef xmlDefaultBufferSize
698int *
699__xmlDefaultBufferSize(void) {
700 if (IS_MAIN_THREAD)
701 return (&xmlDefaultBufferSize);
702 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000703 return (&xmlGetGlobalState()->xmlDefaultBufferSize);
Daniel Veillardb8478642001-10-12 17:29:10 +0000704}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000705int xmlThrDefDefaultBufferSize(int v) {
706 int ret;
707 xmlMutexLock(xmlThrDefMutex);
708 ret = xmlDefaultBufferSizeThrDef;
709 xmlDefaultBufferSizeThrDef = v;
710 xmlMutexUnlock(xmlThrDefMutex);
711 return ret;
712}
Daniel Veillardb8478642001-10-12 17:29:10 +0000713
Daniel Veillard81273902003-09-30 00:43:48 +0000714#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000715#undef xmlDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000716xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000717__xmlDefaultSAXHandler(void) {
718 if (IS_MAIN_THREAD)
719 return (&xmlDefaultSAXHandler);
720 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000721 return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000722}
Daniel Veillard81273902003-09-30 00:43:48 +0000723#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillardb8478642001-10-12 17:29:10 +0000724
Daniel Veillardb8478642001-10-12 17:29:10 +0000725#undef xmlDefaultSAXLocator
726xmlSAXLocator *
727__xmlDefaultSAXLocator(void) {
728 if (IS_MAIN_THREAD)
729 return (&xmlDefaultSAXLocator);
730 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000731 return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
Daniel Veillardb8478642001-10-12 17:29:10 +0000732}
733
Daniel Veillardb8478642001-10-12 17:29:10 +0000734#undef xmlDoValidityCheckingDefaultValue
735int *
736__xmlDoValidityCheckingDefaultValue(void) {
737 if (IS_MAIN_THREAD)
738 return (&xmlDoValidityCheckingDefaultValue);
739 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000740 return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000741}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000742int xmlThrDefDoValidityCheckingDefaultValue(int v) {
743 int ret;
744 xmlMutexLock(xmlThrDefMutex);
745 ret = xmlDoValidityCheckingDefaultValueThrDef;
746 xmlDoValidityCheckingDefaultValueThrDef = v;
747 xmlMutexUnlock(xmlThrDefMutex);
748 return ret;
749}
Daniel Veillardb8478642001-10-12 17:29:10 +0000750
Daniel Veillardb8478642001-10-12 17:29:10 +0000751#undef xmlGenericError
752xmlGenericErrorFunc *
753__xmlGenericError(void) {
754 if (IS_MAIN_THREAD)
755 return (&xmlGenericError);
756 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000757 return (&xmlGetGlobalState()->xmlGenericError);
Daniel Veillardb8478642001-10-12 17:29:10 +0000758}
759
Daniel Veillard659e71e2003-10-10 14:10:40 +0000760#undef xmlStructuredError
761xmlStructuredErrorFunc *
762__xmlStructuredError(void) {
763 if (IS_MAIN_THREAD)
764 return (&xmlStructuredError);
765 else
766 return (&xmlGetGlobalState()->xmlStructuredError);
767}
768
Daniel Veillardb8478642001-10-12 17:29:10 +0000769#undef xmlGenericErrorContext
770void * *
771__xmlGenericErrorContext(void) {
772 if (IS_MAIN_THREAD)
773 return (&xmlGenericErrorContext);
774 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000775 return (&xmlGetGlobalState()->xmlGenericErrorContext);
Daniel Veillardb8478642001-10-12 17:29:10 +0000776}
777
Daniel Veillardb8478642001-10-12 17:29:10 +0000778#undef xmlGetWarningsDefaultValue
779int *
780__xmlGetWarningsDefaultValue(void) {
781 if (IS_MAIN_THREAD)
782 return (&xmlGetWarningsDefaultValue);
783 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000784 return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000785}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000786int xmlThrDefGetWarningsDefaultValue(int v) {
787 int ret;
788 xmlMutexLock(xmlThrDefMutex);
789 ret = xmlGetWarningsDefaultValueThrDef;
790 xmlGetWarningsDefaultValueThrDef = v;
791 xmlMutexUnlock(xmlThrDefMutex);
792 return ret;
793}
Daniel Veillardb8478642001-10-12 17:29:10 +0000794
Daniel Veillardb8478642001-10-12 17:29:10 +0000795#undef xmlIndentTreeOutput
796int *
797__xmlIndentTreeOutput(void) {
798 if (IS_MAIN_THREAD)
799 return (&xmlIndentTreeOutput);
800 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000801 return (&xmlGetGlobalState()->xmlIndentTreeOutput);
Daniel Veillardb8478642001-10-12 17:29:10 +0000802}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000803int xmlThrDefIndentTreeOutput(int v) {
804 int ret;
805 xmlMutexLock(xmlThrDefMutex);
806 ret = xmlIndentTreeOutputThrDef;
807 xmlIndentTreeOutputThrDef = v;
808 xmlMutexUnlock(xmlThrDefMutex);
809 return ret;
810}
Daniel Veillardb8478642001-10-12 17:29:10 +0000811
Aleksey Sanin23002562002-05-24 07:18:40 +0000812#undef xmlTreeIndentString
813const char * *
814__xmlTreeIndentString(void) {
815 if (IS_MAIN_THREAD)
816 return (&xmlTreeIndentString);
817 else
818 return (&xmlGetGlobalState()->xmlTreeIndentString);
819}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000820const char * xmlThrDefTreeIndentString(const char * v) {
821 const char * ret;
822 xmlMutexLock(xmlThrDefMutex);
823 ret = xmlTreeIndentStringThrDef;
824 xmlTreeIndentStringThrDef = v;
825 xmlMutexUnlock(xmlThrDefMutex);
826 return ret;
827}
Aleksey Sanin23002562002-05-24 07:18:40 +0000828
Daniel Veillardb8478642001-10-12 17:29:10 +0000829#undef xmlKeepBlanksDefaultValue
830int *
831__xmlKeepBlanksDefaultValue(void) {
832 if (IS_MAIN_THREAD)
833 return (&xmlKeepBlanksDefaultValue);
834 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000835 return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000836}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000837int xmlThrDefKeepBlanksDefaultValue(int v) {
838 int ret;
839 xmlMutexLock(xmlThrDefMutex);
840 ret = xmlKeepBlanksDefaultValueThrDef;
841 xmlKeepBlanksDefaultValueThrDef = v;
842 xmlMutexUnlock(xmlThrDefMutex);
843 return ret;
844}
Daniel Veillardb8478642001-10-12 17:29:10 +0000845
Daniel Veillardb8478642001-10-12 17:29:10 +0000846#undef xmlLineNumbersDefaultValue
847int *
848__xmlLineNumbersDefaultValue(void) {
849 if (IS_MAIN_THREAD)
850 return (&xmlLineNumbersDefaultValue);
851 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000852 return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000853}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000854int xmlThrDefLineNumbersDefaultValue(int v) {
855 int ret;
856 xmlMutexLock(xmlThrDefMutex);
857 ret = xmlLineNumbersDefaultValueThrDef;
858 xmlLineNumbersDefaultValueThrDef = v;
859 xmlMutexUnlock(xmlThrDefMutex);
860 return ret;
861}
Daniel Veillardb8478642001-10-12 17:29:10 +0000862
Daniel Veillardb8478642001-10-12 17:29:10 +0000863#undef xmlLoadExtDtdDefaultValue
864int *
865__xmlLoadExtDtdDefaultValue(void) {
866 if (IS_MAIN_THREAD)
867 return (&xmlLoadExtDtdDefaultValue);
868 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000869 return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000870}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000871int xmlThrDefLoadExtDtdDefaultValue(int v) {
872 int ret;
873 xmlMutexLock(xmlThrDefMutex);
874 ret = xmlLoadExtDtdDefaultValueThrDef;
875 xmlLoadExtDtdDefaultValueThrDef = v;
876 xmlMutexUnlock(xmlThrDefMutex);
877 return ret;
878}
Daniel Veillardb8478642001-10-12 17:29:10 +0000879
Daniel Veillardb8478642001-10-12 17:29:10 +0000880#undef xmlParserDebugEntities
881int *
882__xmlParserDebugEntities(void) {
883 if (IS_MAIN_THREAD)
884 return (&xmlParserDebugEntities);
885 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000886 return (&xmlGetGlobalState()->xmlParserDebugEntities);
Daniel Veillardb8478642001-10-12 17:29:10 +0000887}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000888int xmlThrDefParserDebugEntities(int v) {
889 int ret;
890 xmlMutexLock(xmlThrDefMutex);
891 ret = xmlParserDebugEntitiesThrDef;
892 xmlParserDebugEntitiesThrDef = v;
893 xmlMutexUnlock(xmlThrDefMutex);
894 return ret;
895}
Daniel Veillardb8478642001-10-12 17:29:10 +0000896
Daniel Veillardb8478642001-10-12 17:29:10 +0000897#undef xmlParserVersion
898const char * *
899__xmlParserVersion(void) {
900 if (IS_MAIN_THREAD)
901 return (&xmlParserVersion);
902 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000903 return (&xmlGetGlobalState()->xmlParserVersion);
Daniel Veillardb8478642001-10-12 17:29:10 +0000904}
905
Daniel Veillardb8478642001-10-12 17:29:10 +0000906#undef xmlPedanticParserDefaultValue
907int *
908__xmlPedanticParserDefaultValue(void) {
909 if (IS_MAIN_THREAD)
910 return (&xmlPedanticParserDefaultValue);
911 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000912 return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000913}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000914int xmlThrDefPedanticParserDefaultValue(int v) {
915 int ret;
916 xmlMutexLock(xmlThrDefMutex);
917 ret = xmlPedanticParserDefaultValueThrDef;
918 xmlPedanticParserDefaultValueThrDef = v;
919 xmlMutexUnlock(xmlThrDefMutex);
920 return ret;
921}
Daniel Veillardb8478642001-10-12 17:29:10 +0000922
Daniel Veillardb8478642001-10-12 17:29:10 +0000923#undef xmlSaveNoEmptyTags
924int *
925__xmlSaveNoEmptyTags(void) {
926 if (IS_MAIN_THREAD)
927 return (&xmlSaveNoEmptyTags);
928 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000929 return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
Daniel Veillardb8478642001-10-12 17:29:10 +0000930}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000931int xmlThrDefSaveNoEmptyTags(int v) {
932 int ret;
933 xmlMutexLock(xmlThrDefMutex);
934 ret = xmlSaveNoEmptyTagsThrDef;
935 xmlSaveNoEmptyTagsThrDef = v;
936 xmlMutexUnlock(xmlThrDefMutex);
937 return ret;
938}
Daniel Veillardb8478642001-10-12 17:29:10 +0000939
Daniel Veillardb8478642001-10-12 17:29:10 +0000940#undef xmlSubstituteEntitiesDefaultValue
941int *
942__xmlSubstituteEntitiesDefaultValue(void) {
943 if (IS_MAIN_THREAD)
944 return (&xmlSubstituteEntitiesDefaultValue);
945 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000946 return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000947}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000948int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
949 int ret;
950 xmlMutexLock(xmlThrDefMutex);
951 ret = xmlSubstituteEntitiesDefaultValueThrDef;
952 xmlSubstituteEntitiesDefaultValueThrDef = v;
953 xmlMutexUnlock(xmlThrDefMutex);
954 return ret;
955}
Daniel Veillard5335dc52003-01-01 20:59:38 +0000956
957#undef xmlRegisterNodeDefaultValue
958xmlRegisterNodeFunc *
959__xmlRegisterNodeDefaultValue(void) {
960 if (IS_MAIN_THREAD)
961 return (&xmlRegisterNodeDefaultValue);
962 else
963 return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue);
964}
965
966#undef xmlDeregisterNodeDefaultValue
967xmlDeregisterNodeFunc *
968__xmlDeregisterNodeDefaultValue(void) {
969 if (IS_MAIN_THREAD)
970 return (&xmlDeregisterNodeDefaultValue);
971 else
972 return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue);
973}