blob: f1aa15065e42b5ee2e304153f4eef481ba6fde5b [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
William M. Brack966668a2003-12-20 02:10:28 +000042/**
43 * xmlInitGlobals:
44 *
45 * Additional initialisation for multi-threading
46 */
Daniel Veillard781ac8b2003-05-15 22:11:36 +000047void xmlInitGlobals()
48{
49 xmlThrDefMutex = xmlNewMutex();
50}
51
William M. Brack966668a2003-12-20 02:10:28 +000052/**
53 * xmlCleanupGlobals:
54 *
55 * Additional cleanup for multi-threading
56 */
Daniel Veillard781ac8b2003-05-15 22:11:36 +000057void xmlCleanupGlobals()
58{
Daniel Veillard2009c4e2003-07-15 20:04:34 +000059 if (xmlThrDefMutex != NULL) {
Daniel Veillarddf101d82003-07-08 14:03:36 +000060 xmlFreeMutex(xmlThrDefMutex);
Daniel Veillard2009c4e2003-07-15 20:04:34 +000061 xmlThrDefMutex = NULL;
62 }
Daniel Veillard781ac8b2003-05-15 22:11:36 +000063}
64
Daniel Veillardb8478642001-10-12 17:29:10 +000065/************************************************************************
66 * *
67 * All the user accessible global variables of the library *
68 * *
69 ************************************************************************/
70
Daniel Veillardb8478642001-10-12 17:29:10 +000071/*
72 * Memory allocation routines
73 */
Daniel Veillard7216cfd2002-11-08 15:10:00 +000074#if defined(DEBUG_MEMORY_LOCATION) || defined(DEBUG_MEMORY)
Daniel Veillard092643b2003-09-25 14:29:29 +000075#ifndef __DEBUG_MEMORY_ALLOC__
Daniel Veillardd0463562001-10-13 09:15:48 +000076extern void xmlMemFree(void *ptr);
77extern void * xmlMemMalloc(size_t size);
78extern void * xmlMemRealloc(void *ptr,size_t size);
79extern char * xmlMemoryStrdup(const char *str);
Daniel Veillard98485322003-08-14 15:44:40 +000080#endif
Daniel Veillardd0463562001-10-13 09:15:48 +000081
Daniel Veillardb8478642001-10-12 17:29:10 +000082xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
83xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +000084xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillardb8478642001-10-12 17:29:10 +000085xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
86xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
87#else
Daniel Veillard9d06d302002-01-22 18:15:52 +000088/**
89 * xmlFree:
90 * @mem: an already allocated block of memory
91 *
92 * The variable holding the libxml free() implementation
93 */
Daniel Veillardb8478642001-10-12 17:29:10 +000094xmlFreeFunc xmlFree = (xmlFreeFunc) free;
Daniel Veillard9d06d302002-01-22 18:15:52 +000095/**
96 * xmlMalloc:
97 * @size: the size requested in bytes
98 *
99 * The variable holding the libxml malloc() implementation
100 *
101 * Returns a pointer to the newly allocated block or NULL in case of error
102 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000103xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000104/**
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000105 * xmlMallocAtomic:
106 * @size: the size requested in bytes
107 *
108 * The variable holding the libxml malloc() implementation for atomic
109 * data (i.e. blocks not containings pointers), useful when using a
110 * garbage collecting allocator.
111 *
112 * Returns a pointer to the newly allocated block or NULL in case of error
113 */
114xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) malloc;
115/**
Daniel Veillard9d06d302002-01-22 18:15:52 +0000116 * xmlRealloc:
117 * @mem: an already allocated block of memory
118 * @size: the new size requested in bytes
119 *
120 * The variable holding the libxml realloc() implementation
121 *
122 * Returns a pointer to the newly reallocated block or NULL in case of error
123 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000124xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000125/**
126 * xmlMemStrdup:
127 * @str: a zero terminated string
128 *
129 * The variable holding the libxml strdup() implementation
130 *
131 * Returns the copy of the string or NULL in case of error
132 */
Daniel Veillardb82c1662001-12-09 14:00:54 +0000133xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000134#endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */
Daniel Veillardb8478642001-10-12 17:29:10 +0000135
Daniel Veillardd0463562001-10-13 09:15:48 +0000136#include <libxml/threads.h>
137#include <libxml/globals.h>
138#include <libxml/SAX.h>
139
140#undef docbDefaultSAXHandler
141#undef htmlDefaultSAXHandler
142#undef oldXMLWDcompatibility
143#undef xmlBufferAllocScheme
144#undef xmlDefaultBufferSize
145#undef xmlDefaultSAXHandler
146#undef xmlDefaultSAXLocator
147#undef xmlDoValidityCheckingDefaultValue
148#undef xmlGenericError
Daniel Veillard659e71e2003-10-10 14:10:40 +0000149#undef xmlStructuredError
Daniel Veillardd0463562001-10-13 09:15:48 +0000150#undef xmlGenericErrorContext
151#undef xmlGetWarningsDefaultValue
152#undef xmlIndentTreeOutput
Aleksey Sanin23002562002-05-24 07:18:40 +0000153#undef xmlTreeIndentString
Daniel Veillardd0463562001-10-13 09:15:48 +0000154#undef xmlKeepBlanksDefaultValue
155#undef xmlLineNumbersDefaultValue
156#undef xmlLoadExtDtdDefaultValue
157#undef xmlParserDebugEntities
158#undef xmlParserVersion
159#undef xmlPedanticParserDefaultValue
160#undef xmlSaveNoEmptyTags
161#undef xmlSubstituteEntitiesDefaultValue
Daniel Veillard8326e732003-01-07 00:19:07 +0000162#undef xmlRegisterNodeDefaultValue
163#undef xmlDeregisterNodeDefaultValue
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000164#undef xmlLastError
Daniel Veillardd0463562001-10-13 09:15:48 +0000165
166#undef xmlFree
167#undef xmlMalloc
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000168#undef xmlMallocAtomic
Daniel Veillardd0463562001-10-13 09:15:48 +0000169#undef xmlMemStrdup
170#undef xmlRealloc
171
Daniel Veillard9d06d302002-01-22 18:15:52 +0000172/**
173 * xmlParserVersion:
174 *
175 * Constant string describing the internal version of the library
176 */
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000177const char *xmlParserVersion = LIBXML_VERSION_STRING;
178
Daniel Veillard9d06d302002-01-22 18:15:52 +0000179/**
180 * xmlBufferAllocScheme:
181 *
182 * Global setting, default allocation policy for buffers, default is
183 * XML_BUFFER_ALLOC_EXACT
Daniel Veillardb8478642001-10-12 17:29:10 +0000184 */
185xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000186static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_EXACT;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000187/**
188 * xmlDefaultBufferSize:
189 *
190 * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
191 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000192int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000193static int xmlDefaultBufferSizeThrDef = BASE_BUFFER_SIZE;
Daniel Veillardb8478642001-10-12 17:29:10 +0000194
195/*
196 * Parser defaults
197 */
Daniel Veillardd0463562001-10-13 09:15:48 +0000198
Daniel Veillard9d06d302002-01-22 18:15:52 +0000199/**
200 * oldXMLWDcompatibility:
201 *
202 * Global setting, DEPRECATED.
203 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000204int oldXMLWDcompatibility = 0; /* DEPRECATED */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000205/**
206 * xmlParserDebugEntities:
207 *
208 * Global setting, asking the parser to print out debugging informations.
209 * while handling entities.
210 * Disabled by default
211 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000212int xmlParserDebugEntities = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000213static int xmlParserDebugEntitiesThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000214/**
215 * xmlDoValidityCheckingDefaultValue:
216 *
217 * Global setting, indicate that the parser should work in validating mode.
218 * Disabled by default.
219 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000220int xmlDoValidityCheckingDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000221static int xmlDoValidityCheckingDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000222/**
223 * xmlGetWarningsDefaultValue:
224 *
225 * Global setting, indicate that the parser should provide warnings.
226 * Activated by default.
227 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000228int xmlGetWarningsDefaultValue = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000229static int xmlGetWarningsDefaultValueThrDef = 1;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000230/**
231 * xmlLoadExtDtdDefaultValue:
232 *
233 * Global setting, indicate that the parser should load DTD while not
234 * validating.
235 * Disabled by default.
236 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000237int xmlLoadExtDtdDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000238static int xmlLoadExtDtdDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000239/**
240 * xmlPedanticParserDefaultValue:
241 *
242 * Global setting, indicate that the parser be pedantic
243 * Disabled by default.
244 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000245int xmlPedanticParserDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000246static int xmlPedanticParserDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000247/**
248 * xmlLineNumbersDefaultValue:
249 *
250 * Global setting, indicate that the parser should store the line number
251 * in the content field of elements in the DOM tree.
252 * Disabled by default since this may not be safe for old classes of
253 * applicaton.
254 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000255int xmlLineNumbersDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000256static int xmlLineNumbersDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000257/**
258 * xmlKeepBlanksDefaultValue:
259 *
260 * Global setting, indicate that the parser should keep all blanks
261 * nodes found in the content
262 * Activated by default, this is actually needed to have the parser
263 * conformant to the XML Recommendation, however the option is kept
264 * for some applications since this was libxml1 default behaviour.
265 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000266int xmlKeepBlanksDefaultValue = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000267static int xmlKeepBlanksDefaultValueThrDef = 1;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000268/**
269 * xmlSubstituteEntitiesDefaultValue:
270 *
271 * Global setting, indicate that the parser should not generate entity
272 * references but replace them with the actual content of the entity
273 * Disabled by default, this should be activated when using XPath since
274 * the XPath data model requires entities replacement and the XPath
275 * engine does not handle entities references transparently.
276 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000277int xmlSubstituteEntitiesDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000278static int xmlSubstituteEntitiesDefaultValueThrDef = 0;
Daniel Veillardb8478642001-10-12 17:29:10 +0000279
Daniel Veillard5335dc52003-01-01 20:59:38 +0000280xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000281static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000282xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000283static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000284
Daniel Veillardb8478642001-10-12 17:29:10 +0000285/*
286 * Error handling
287 */
288
289/* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
290/* Must initialize xmlGenericError in xmlInitParser */
Daniel Veillard635ef722001-10-29 11:48:19 +0000291void xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
292 const char *msg,
293 ...);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000294/**
295 * xmlGenericError:
296 *
297 * Global setting: function used for generic error callbacks
298 */
Daniel Veillard635ef722001-10-29 11:48:19 +0000299xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000300static xmlGenericErrorFunc xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000301/**
Daniel Veillard659e71e2003-10-10 14:10:40 +0000302 * xmlStructuredError:
303 *
304 * Global setting: function used for structured error callbacks
305 */
306xmlStructuredErrorFunc xmlStructuredError = NULL;
307static xmlStructuredErrorFunc xmlStructuredErrorThrDef = NULL;
308/**
Daniel Veillard9d06d302002-01-22 18:15:52 +0000309 * xmlGenericErrorContext:
310 *
311 * Global setting passed to generic error callbacks
312 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000313void *xmlGenericErrorContext = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000314static void *xmlGenericErrorContextThrDef = NULL;
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000315xmlError xmlLastError;
Daniel Veillardb8478642001-10-12 17:29:10 +0000316
317/*
318 * output defaults
319 */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000320/**
321 * xmlIndentTreeOutput:
322 *
323 * Global setting, asking the serializer to indent the output tree by default
Aleksey Sanin23002562002-05-24 07:18:40 +0000324 * Enabled by default
Daniel Veillard9d06d302002-01-22 18:15:52 +0000325 */
Aleksey Sanin23002562002-05-24 07:18:40 +0000326int xmlIndentTreeOutput = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000327static int xmlIndentTreeOutputThrDef = 1;
Aleksey Sanin23002562002-05-24 07:18:40 +0000328
329/**
330 * xmlTreeIndentString:
331 *
332 * The string used to do one-level indent. By default is equal to " " (two spaces)
333 */
334const char *xmlTreeIndentString = " ";
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000335static const char *xmlTreeIndentStringThrDef = " ";
Aleksey Sanin23002562002-05-24 07:18:40 +0000336
Daniel Veillard9d06d302002-01-22 18:15:52 +0000337/**
338 * xmlSaveNoEmptyTags:
339 *
340 * Global setting, asking the serializer to not output empty tags
341 * as <empty/> but <empty></empty>. those two forms are undistinguishable
342 * once parsed.
343 * Disabled by default
344 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000345int xmlSaveNoEmptyTags = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000346int xmlSaveNoEmptyTagsThrDef = 0;
Daniel Veillardb8478642001-10-12 17:29:10 +0000347
Daniel Veillard81273902003-09-30 00:43:48 +0000348#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000349/**
350 * xmlDefaultSAXHandler:
351 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000352 * Default SAX version1 handler for XML, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000353 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000354xmlSAXHandlerV1 xmlDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000355 xmlSAX2InternalSubset,
356 xmlSAX2IsStandalone,
357 xmlSAX2HasInternalSubset,
358 xmlSAX2HasExternalSubset,
359 xmlSAX2ResolveEntity,
360 xmlSAX2GetEntity,
361 xmlSAX2EntityDecl,
362 xmlSAX2NotationDecl,
363 xmlSAX2AttributeDecl,
364 xmlSAX2ElementDecl,
365 xmlSAX2UnparsedEntityDecl,
366 xmlSAX2SetDocumentLocator,
367 xmlSAX2StartDocument,
368 xmlSAX2EndDocument,
369 xmlSAX2StartElement,
370 xmlSAX2EndElement,
371 xmlSAX2Reference,
372 xmlSAX2Characters,
373 xmlSAX2Characters,
374 xmlSAX2ProcessingInstruction,
375 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000376 xmlParserWarning,
377 xmlParserError,
378 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000379 xmlSAX2GetParameterEntity,
380 xmlSAX2CDataBlock,
381 xmlSAX2ExternalSubset,
382 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000383};
Daniel Veillard81273902003-09-30 00:43:48 +0000384#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillardb8478642001-10-12 17:29:10 +0000385
Daniel Veillard9d06d302002-01-22 18:15:52 +0000386/**
387 * xmlDefaultSAXLocator:
388 *
389 * The default SAX Locator
390 * { getPublicId, getSystemId, getLineNumber, getColumnNumber}
Daniel Veillardb8478642001-10-12 17:29:10 +0000391 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000392xmlSAXLocator xmlDefaultSAXLocator = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000393 xmlSAX2GetPublicId,
394 xmlSAX2GetSystemId,
395 xmlSAX2GetLineNumber,
396 xmlSAX2GetColumnNumber
Daniel Veillardb8478642001-10-12 17:29:10 +0000397};
398
399#ifdef LIBXML_HTML_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000400/**
401 * htmlDefaultSAXHandler:
402 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000403 * Default old SAX v1 handler for HTML, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000404 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000405xmlSAXHandlerV1 htmlDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000406 xmlSAX2InternalSubset,
Daniel Veillardb8478642001-10-12 17:29:10 +0000407 NULL,
408 NULL,
409 NULL,
410 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000411 xmlSAX2GetEntity,
Daniel Veillardb8478642001-10-12 17:29:10 +0000412 NULL,
413 NULL,
414 NULL,
415 NULL,
416 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000417 xmlSAX2SetDocumentLocator,
418 xmlSAX2StartDocument,
419 xmlSAX2EndDocument,
420 xmlSAX2StartElement,
421 xmlSAX2EndElement,
Daniel Veillardb8478642001-10-12 17:29:10 +0000422 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000423 xmlSAX2Characters,
424 xmlSAX2IgnorableWhitespace,
Daniel Veillardb8478642001-10-12 17:29:10 +0000425 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000426 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000427 xmlParserWarning,
428 xmlParserError,
429 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000430 xmlSAX2GetParameterEntity,
431 xmlSAX2CDataBlock,
Daniel Veillardb8478642001-10-12 17:29:10 +0000432 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000433 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000434};
435#endif /* LIBXML_HTML_ENABLED */
436
437#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000438/**
439 * docbDefaultSAXHandler:
440 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000441 * Default old SAX v1 handler for SGML DocBook, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000442 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000443xmlSAXHandlerV1 docbDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000444 xmlSAX2InternalSubset,
445 xmlSAX2IsStandalone,
446 xmlSAX2HasInternalSubset,
447 xmlSAX2HasExternalSubset,
448 xmlSAX2ResolveEntity,
449 xmlSAX2GetEntity,
450 xmlSAX2EntityDecl,
Daniel Veillardb8478642001-10-12 17:29:10 +0000451 NULL,
452 NULL,
453 NULL,
454 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000455 xmlSAX2SetDocumentLocator,
456 xmlSAX2StartDocument,
457 xmlSAX2EndDocument,
458 xmlSAX2StartElement,
459 xmlSAX2EndElement,
460 xmlSAX2Reference,
461 xmlSAX2Characters,
462 xmlSAX2IgnorableWhitespace,
Daniel Veillardb8478642001-10-12 17:29:10 +0000463 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000464 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000465 xmlParserWarning,
466 xmlParserError,
467 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000468 xmlSAX2GetParameterEntity,
Daniel Veillardb8478642001-10-12 17:29:10 +0000469 NULL,
470 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000471 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000472};
473#endif /* LIBXML_DOCB_ENABLED */
474
475/**
476 * xmlInitializeGlobalState:
477 * @gs: a pointer to a newly allocated global state
478 *
479 * xmlInitializeGlobalState() initialize a global state with all the
480 * default values of the library.
481 */
482void
483xmlInitializeGlobalState(xmlGlobalStatePtr gs)
484{
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000485#ifdef DEBUG_GLOBALS
486 fprintf(stderr, "Initializing globals at %lu for thread %d\n",
487 (unsigned long) gs, xmlGetThreadId());
488#endif
489
Daniel Veillardb8478642001-10-12 17:29:10 +0000490 /*
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000491 * Perform initialization as required by libxml
Daniel Veillardb8478642001-10-12 17:29:10 +0000492 */
Daniel Veillard5805be22003-08-28 08:03:23 +0000493 if (xmlThrDefMutex == NULL)
494 xmlInitGlobals();
495
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000496 xmlMutexLock(xmlThrDefMutex);
William M. Brack8b2c7f12002-11-22 05:07:29 +0000497
Daniel Veillarda4617b82001-11-04 20:19:12 +0000498#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard092643b2003-09-25 14:29:29 +0000499 initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000500#endif
501#ifdef LIBXML_HTML_ENABLED
Daniel Veillard092643b2003-09-25 14:29:29 +0000502 inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000503#endif
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000504
Daniel Veillardb8478642001-10-12 17:29:10 +0000505 gs->oldXMLWDcompatibility = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000506 gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
507 gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;
Daniel Veillard81273902003-09-30 00:43:48 +0000508#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard092643b2003-09-25 14:29:29 +0000509 initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
Daniel Veillard81273902003-09-30 00:43:48 +0000510#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillard4432df22003-09-28 18:58:27 +0000511 gs->xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId;
512 gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
513 gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
514 gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000515 gs->xmlDoValidityCheckingDefaultValue =
516 xmlDoValidityCheckingDefaultValueThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000517#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
518 gs->xmlFree = (xmlFreeFunc) xmlMemFree;
519 gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000520 gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000521 gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
522 gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
523#else
524 gs->xmlFree = (xmlFreeFunc) free;
525 gs->xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000526 gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000527 gs->xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard572577e2002-01-18 16:23:55 +0000528 gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillardb8478642001-10-12 17:29:10 +0000529#endif
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000530 gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
531 gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
532 gs->xmlTreeIndentString = xmlTreeIndentStringThrDef;
533 gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
534 gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
535 gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
536 gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000537 gs->xmlParserVersion = LIBXML_VERSION_STRING;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000538 gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
539 gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
540 gs->xmlSubstituteEntitiesDefaultValue =
541 xmlSubstituteEntitiesDefaultValueThrDef;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000542
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000543 gs->xmlGenericError = xmlGenericErrorThrDef;
Daniel Veillard659e71e2003-10-10 14:10:40 +0000544 gs->xmlStructuredError = xmlStructuredErrorThrDef;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000545 gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
546 gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
547 gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000548 memset(&gs->xmlLastError, 0, sizeof(xmlError));
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000549
550 xmlMutexUnlock(xmlThrDefMutex);
551}
552
Daniel Veillard1e906612003-12-05 14:57:46 +0000553/**
554 * DOC_DISABLE : we ignore missing doc for the xmlThrDef functions,
555 * those are really internal work
556 */
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000557void
558xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
559 xmlMutexLock(xmlThrDefMutex);
560 xmlGenericErrorContextThrDef = ctx;
561 if (handler != NULL)
562 xmlGenericErrorThrDef = handler;
563 else
564 xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
565 xmlMutexUnlock(xmlThrDefMutex);
Daniel Veillardb8478642001-10-12 17:29:10 +0000566}
567
Daniel Veillard659e71e2003-10-10 14:10:40 +0000568void
569xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
570 xmlMutexLock(xmlThrDefMutex);
571 xmlGenericErrorContextThrDef = ctx;
572 xmlStructuredErrorThrDef = handler;
573 xmlMutexUnlock(xmlThrDefMutex);
574}
575
Daniel Veillard5335dc52003-01-01 20:59:38 +0000576/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000577 * xmlRegisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000578 * @func: function pointer to the new RegisterNodeFunc
579 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000580 * Registers a callback for node creation
581 *
582 * Returns the old value of the registration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000583 */
584xmlRegisterNodeFunc
585xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
586{
587 xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue;
588
Daniel Veillarda880b122003-04-21 21:36:41 +0000589 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000590 xmlRegisterNodeDefaultValue = func;
591 return(old);
592}
593
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000594xmlRegisterNodeFunc
595xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
596{
597 xmlRegisterNodeFunc old;
598
599 xmlMutexLock(xmlThrDefMutex);
600 old = xmlRegisterNodeDefaultValueThrDef;
601
602 __xmlRegisterCallbacks = 1;
603 xmlRegisterNodeDefaultValueThrDef = func;
604 xmlMutexUnlock(xmlThrDefMutex);
605
606 return(old);
607}
608
Daniel Veillard5335dc52003-01-01 20:59:38 +0000609/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000610 * xmlDeregisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000611 * @func: function pointer to the new DeregisterNodeFunc
612 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000613 * Registers a callback for node destruction
614 *
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000615 * Returns the previous value of the deregistration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000616 */
617xmlDeregisterNodeFunc
618xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
619{
620 xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue;
621
Daniel Veillarda880b122003-04-21 21:36:41 +0000622 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000623 xmlDeregisterNodeDefaultValue = func;
624 return(old);
625}
626
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000627xmlDeregisterNodeFunc
628xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
629{
630 xmlDeregisterNodeFunc old;
631
632 xmlMutexLock(xmlThrDefMutex);
633 old = xmlDeregisterNodeDefaultValueThrDef;
634
635 __xmlRegisterCallbacks = 1;
636 xmlDeregisterNodeDefaultValueThrDef = func;
637 xmlMutexUnlock(xmlThrDefMutex);
638
639 return(old);
640}
641
Daniel Veillard5335dc52003-01-01 20:59:38 +0000642
Daniel Veillarda4617b82001-11-04 20:19:12 +0000643#ifdef LIBXML_DOCB_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000644#undef docbDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000645xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000646__docbDefaultSAXHandler(void) {
647 if (IS_MAIN_THREAD)
648 return (&docbDefaultSAXHandler);
649 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000650 return (&xmlGetGlobalState()->docbDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000651}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000652#endif
Daniel Veillardb8478642001-10-12 17:29:10 +0000653
Daniel Veillarda4617b82001-11-04 20:19:12 +0000654#ifdef LIBXML_HTML_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000655#undef htmlDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000656xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000657__htmlDefaultSAXHandler(void) {
658 if (IS_MAIN_THREAD)
659 return (&htmlDefaultSAXHandler);
660 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000661 return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000662}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000663#endif
664
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000665#undef xmlLastError
666xmlError *
667__xmlLastError(void) {
668 if (IS_MAIN_THREAD)
669 return (&xmlLastError);
670 else
671 return (&xmlGetGlobalState()->xmlLastError);
672}
673
Daniel Veillarda4617b82001-11-04 20:19:12 +0000674/*
675 * Everything starting from the line below is
676 * Automatically generated by build_glob.py.
677 * Do not modify the previous line.
678 */
679
Daniel Veillardb8478642001-10-12 17:29:10 +0000680
Daniel Veillardb8478642001-10-12 17:29:10 +0000681#undef oldXMLWDcompatibility
682int *
683__oldXMLWDcompatibility(void) {
684 if (IS_MAIN_THREAD)
685 return (&oldXMLWDcompatibility);
686 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000687 return (&xmlGetGlobalState()->oldXMLWDcompatibility);
Daniel Veillardb8478642001-10-12 17:29:10 +0000688}
689
Daniel Veillardb8478642001-10-12 17:29:10 +0000690#undef xmlBufferAllocScheme
691xmlBufferAllocationScheme *
692__xmlBufferAllocScheme(void) {
693 if (IS_MAIN_THREAD)
694 return (&xmlBufferAllocScheme);
695 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000696 return (&xmlGetGlobalState()->xmlBufferAllocScheme);
Daniel Veillardb8478642001-10-12 17:29:10 +0000697}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000698xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
699 xmlBufferAllocationScheme ret;
700 xmlMutexLock(xmlThrDefMutex);
701 ret = xmlBufferAllocSchemeThrDef;
702 xmlBufferAllocSchemeThrDef = v;
703 xmlMutexUnlock(xmlThrDefMutex);
704 return ret;
705}
Daniel Veillardb8478642001-10-12 17:29:10 +0000706
Daniel Veillardb8478642001-10-12 17:29:10 +0000707#undef xmlDefaultBufferSize
708int *
709__xmlDefaultBufferSize(void) {
710 if (IS_MAIN_THREAD)
711 return (&xmlDefaultBufferSize);
712 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000713 return (&xmlGetGlobalState()->xmlDefaultBufferSize);
Daniel Veillardb8478642001-10-12 17:29:10 +0000714}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000715int xmlThrDefDefaultBufferSize(int v) {
716 int ret;
717 xmlMutexLock(xmlThrDefMutex);
718 ret = xmlDefaultBufferSizeThrDef;
719 xmlDefaultBufferSizeThrDef = v;
720 xmlMutexUnlock(xmlThrDefMutex);
721 return ret;
722}
Daniel Veillardb8478642001-10-12 17:29:10 +0000723
Daniel Veillard81273902003-09-30 00:43:48 +0000724#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000725#undef xmlDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000726xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000727__xmlDefaultSAXHandler(void) {
728 if (IS_MAIN_THREAD)
729 return (&xmlDefaultSAXHandler);
730 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000731 return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000732}
Daniel Veillard81273902003-09-30 00:43:48 +0000733#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillardb8478642001-10-12 17:29:10 +0000734
Daniel Veillardb8478642001-10-12 17:29:10 +0000735#undef xmlDefaultSAXLocator
736xmlSAXLocator *
737__xmlDefaultSAXLocator(void) {
738 if (IS_MAIN_THREAD)
739 return (&xmlDefaultSAXLocator);
740 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000741 return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
Daniel Veillardb8478642001-10-12 17:29:10 +0000742}
743
Daniel Veillardb8478642001-10-12 17:29:10 +0000744#undef xmlDoValidityCheckingDefaultValue
745int *
746__xmlDoValidityCheckingDefaultValue(void) {
747 if (IS_MAIN_THREAD)
748 return (&xmlDoValidityCheckingDefaultValue);
749 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000750 return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000751}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000752int xmlThrDefDoValidityCheckingDefaultValue(int v) {
753 int ret;
754 xmlMutexLock(xmlThrDefMutex);
755 ret = xmlDoValidityCheckingDefaultValueThrDef;
756 xmlDoValidityCheckingDefaultValueThrDef = v;
757 xmlMutexUnlock(xmlThrDefMutex);
758 return ret;
759}
Daniel Veillardb8478642001-10-12 17:29:10 +0000760
Daniel Veillardb8478642001-10-12 17:29:10 +0000761#undef xmlGenericError
762xmlGenericErrorFunc *
763__xmlGenericError(void) {
764 if (IS_MAIN_THREAD)
765 return (&xmlGenericError);
766 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000767 return (&xmlGetGlobalState()->xmlGenericError);
Daniel Veillardb8478642001-10-12 17:29:10 +0000768}
769
Daniel Veillard659e71e2003-10-10 14:10:40 +0000770#undef xmlStructuredError
771xmlStructuredErrorFunc *
772__xmlStructuredError(void) {
773 if (IS_MAIN_THREAD)
774 return (&xmlStructuredError);
775 else
776 return (&xmlGetGlobalState()->xmlStructuredError);
777}
778
Daniel Veillardb8478642001-10-12 17:29:10 +0000779#undef xmlGenericErrorContext
780void * *
781__xmlGenericErrorContext(void) {
782 if (IS_MAIN_THREAD)
783 return (&xmlGenericErrorContext);
784 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000785 return (&xmlGetGlobalState()->xmlGenericErrorContext);
Daniel Veillardb8478642001-10-12 17:29:10 +0000786}
787
Daniel Veillardb8478642001-10-12 17:29:10 +0000788#undef xmlGetWarningsDefaultValue
789int *
790__xmlGetWarningsDefaultValue(void) {
791 if (IS_MAIN_THREAD)
792 return (&xmlGetWarningsDefaultValue);
793 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000794 return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000795}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000796int xmlThrDefGetWarningsDefaultValue(int v) {
797 int ret;
798 xmlMutexLock(xmlThrDefMutex);
799 ret = xmlGetWarningsDefaultValueThrDef;
800 xmlGetWarningsDefaultValueThrDef = v;
801 xmlMutexUnlock(xmlThrDefMutex);
802 return ret;
803}
Daniel Veillardb8478642001-10-12 17:29:10 +0000804
Daniel Veillardb8478642001-10-12 17:29:10 +0000805#undef xmlIndentTreeOutput
806int *
807__xmlIndentTreeOutput(void) {
808 if (IS_MAIN_THREAD)
809 return (&xmlIndentTreeOutput);
810 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000811 return (&xmlGetGlobalState()->xmlIndentTreeOutput);
Daniel Veillardb8478642001-10-12 17:29:10 +0000812}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000813int xmlThrDefIndentTreeOutput(int v) {
814 int ret;
815 xmlMutexLock(xmlThrDefMutex);
816 ret = xmlIndentTreeOutputThrDef;
817 xmlIndentTreeOutputThrDef = v;
818 xmlMutexUnlock(xmlThrDefMutex);
819 return ret;
820}
Daniel Veillardb8478642001-10-12 17:29:10 +0000821
Aleksey Sanin23002562002-05-24 07:18:40 +0000822#undef xmlTreeIndentString
823const char * *
824__xmlTreeIndentString(void) {
825 if (IS_MAIN_THREAD)
826 return (&xmlTreeIndentString);
827 else
828 return (&xmlGetGlobalState()->xmlTreeIndentString);
829}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000830const char * xmlThrDefTreeIndentString(const char * v) {
831 const char * ret;
832 xmlMutexLock(xmlThrDefMutex);
833 ret = xmlTreeIndentStringThrDef;
834 xmlTreeIndentStringThrDef = v;
835 xmlMutexUnlock(xmlThrDefMutex);
836 return ret;
837}
Aleksey Sanin23002562002-05-24 07:18:40 +0000838
Daniel Veillardb8478642001-10-12 17:29:10 +0000839#undef xmlKeepBlanksDefaultValue
840int *
841__xmlKeepBlanksDefaultValue(void) {
842 if (IS_MAIN_THREAD)
843 return (&xmlKeepBlanksDefaultValue);
844 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000845 return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000846}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000847int xmlThrDefKeepBlanksDefaultValue(int v) {
848 int ret;
849 xmlMutexLock(xmlThrDefMutex);
850 ret = xmlKeepBlanksDefaultValueThrDef;
851 xmlKeepBlanksDefaultValueThrDef = v;
852 xmlMutexUnlock(xmlThrDefMutex);
853 return ret;
854}
Daniel Veillardb8478642001-10-12 17:29:10 +0000855
Daniel Veillardb8478642001-10-12 17:29:10 +0000856#undef xmlLineNumbersDefaultValue
857int *
858__xmlLineNumbersDefaultValue(void) {
859 if (IS_MAIN_THREAD)
860 return (&xmlLineNumbersDefaultValue);
861 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000862 return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000863}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000864int xmlThrDefLineNumbersDefaultValue(int v) {
865 int ret;
866 xmlMutexLock(xmlThrDefMutex);
867 ret = xmlLineNumbersDefaultValueThrDef;
868 xmlLineNumbersDefaultValueThrDef = v;
869 xmlMutexUnlock(xmlThrDefMutex);
870 return ret;
871}
Daniel Veillardb8478642001-10-12 17:29:10 +0000872
Daniel Veillardb8478642001-10-12 17:29:10 +0000873#undef xmlLoadExtDtdDefaultValue
874int *
875__xmlLoadExtDtdDefaultValue(void) {
876 if (IS_MAIN_THREAD)
877 return (&xmlLoadExtDtdDefaultValue);
878 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000879 return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000880}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000881int xmlThrDefLoadExtDtdDefaultValue(int v) {
882 int ret;
883 xmlMutexLock(xmlThrDefMutex);
884 ret = xmlLoadExtDtdDefaultValueThrDef;
885 xmlLoadExtDtdDefaultValueThrDef = v;
886 xmlMutexUnlock(xmlThrDefMutex);
887 return ret;
888}
Daniel Veillardb8478642001-10-12 17:29:10 +0000889
Daniel Veillardb8478642001-10-12 17:29:10 +0000890#undef xmlParserDebugEntities
891int *
892__xmlParserDebugEntities(void) {
893 if (IS_MAIN_THREAD)
894 return (&xmlParserDebugEntities);
895 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000896 return (&xmlGetGlobalState()->xmlParserDebugEntities);
Daniel Veillardb8478642001-10-12 17:29:10 +0000897}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000898int xmlThrDefParserDebugEntities(int v) {
899 int ret;
900 xmlMutexLock(xmlThrDefMutex);
901 ret = xmlParserDebugEntitiesThrDef;
902 xmlParserDebugEntitiesThrDef = v;
903 xmlMutexUnlock(xmlThrDefMutex);
904 return ret;
905}
Daniel Veillardb8478642001-10-12 17:29:10 +0000906
Daniel Veillardb8478642001-10-12 17:29:10 +0000907#undef xmlParserVersion
908const char * *
909__xmlParserVersion(void) {
910 if (IS_MAIN_THREAD)
911 return (&xmlParserVersion);
912 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000913 return (&xmlGetGlobalState()->xmlParserVersion);
Daniel Veillardb8478642001-10-12 17:29:10 +0000914}
915
Daniel Veillardb8478642001-10-12 17:29:10 +0000916#undef xmlPedanticParserDefaultValue
917int *
918__xmlPedanticParserDefaultValue(void) {
919 if (IS_MAIN_THREAD)
920 return (&xmlPedanticParserDefaultValue);
921 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000922 return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000923}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000924int xmlThrDefPedanticParserDefaultValue(int v) {
925 int ret;
926 xmlMutexLock(xmlThrDefMutex);
927 ret = xmlPedanticParserDefaultValueThrDef;
928 xmlPedanticParserDefaultValueThrDef = v;
929 xmlMutexUnlock(xmlThrDefMutex);
930 return ret;
931}
Daniel Veillardb8478642001-10-12 17:29:10 +0000932
Daniel Veillardb8478642001-10-12 17:29:10 +0000933#undef xmlSaveNoEmptyTags
934int *
935__xmlSaveNoEmptyTags(void) {
936 if (IS_MAIN_THREAD)
937 return (&xmlSaveNoEmptyTags);
938 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000939 return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
Daniel Veillardb8478642001-10-12 17:29:10 +0000940}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000941int xmlThrDefSaveNoEmptyTags(int v) {
942 int ret;
943 xmlMutexLock(xmlThrDefMutex);
944 ret = xmlSaveNoEmptyTagsThrDef;
945 xmlSaveNoEmptyTagsThrDef = v;
946 xmlMutexUnlock(xmlThrDefMutex);
947 return ret;
948}
Daniel Veillardb8478642001-10-12 17:29:10 +0000949
Daniel Veillardb8478642001-10-12 17:29:10 +0000950#undef xmlSubstituteEntitiesDefaultValue
951int *
952__xmlSubstituteEntitiesDefaultValue(void) {
953 if (IS_MAIN_THREAD)
954 return (&xmlSubstituteEntitiesDefaultValue);
955 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000956 return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000957}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000958int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
959 int ret;
960 xmlMutexLock(xmlThrDefMutex);
961 ret = xmlSubstituteEntitiesDefaultValueThrDef;
962 xmlSubstituteEntitiesDefaultValueThrDef = v;
963 xmlMutexUnlock(xmlThrDefMutex);
964 return ret;
965}
Daniel Veillard5335dc52003-01-01 20:59:38 +0000966
967#undef xmlRegisterNodeDefaultValue
968xmlRegisterNodeFunc *
969__xmlRegisterNodeDefaultValue(void) {
970 if (IS_MAIN_THREAD)
971 return (&xmlRegisterNodeDefaultValue);
972 else
973 return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue);
974}
975
976#undef xmlDeregisterNodeDefaultValue
977xmlDeregisterNodeFunc *
978__xmlDeregisterNodeDefaultValue(void) {
979 if (IS_MAIN_THREAD)
980 return (&xmlDeregisterNodeDefaultValue);
981 else
982 return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue);
983}