blob: 6297aa29f013ace6393c2e2ebdfd3d46b8a89b8d [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 Veillard0335a842004-06-02 16:18:40 +0000172#undef xmlParserInputBufferCreateFilenameValue
173#undef xmlOutputBufferCreateFilenameValue
Daniel Veillard9d06d302002-01-22 18:15:52 +0000174/**
175 * xmlParserVersion:
176 *
177 * Constant string describing the internal version of the library
178 */
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000179const char *xmlParserVersion = LIBXML_VERSION_STRING;
180
Daniel Veillard9d06d302002-01-22 18:15:52 +0000181/**
182 * xmlBufferAllocScheme:
183 *
184 * Global setting, default allocation policy for buffers, default is
185 * XML_BUFFER_ALLOC_EXACT
Daniel Veillardb8478642001-10-12 17:29:10 +0000186 */
187xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000188static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_EXACT;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000189/**
190 * xmlDefaultBufferSize:
191 *
192 * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
193 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000194int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000195static int xmlDefaultBufferSizeThrDef = BASE_BUFFER_SIZE;
Daniel Veillardb8478642001-10-12 17:29:10 +0000196
197/*
198 * Parser defaults
199 */
Daniel Veillardd0463562001-10-13 09:15:48 +0000200
Daniel Veillard9d06d302002-01-22 18:15:52 +0000201/**
202 * oldXMLWDcompatibility:
203 *
204 * Global setting, DEPRECATED.
205 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000206int oldXMLWDcompatibility = 0; /* DEPRECATED */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000207/**
208 * xmlParserDebugEntities:
209 *
210 * Global setting, asking the parser to print out debugging informations.
211 * while handling entities.
212 * Disabled by default
213 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000214int xmlParserDebugEntities = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000215static int xmlParserDebugEntitiesThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000216/**
217 * xmlDoValidityCheckingDefaultValue:
218 *
219 * Global setting, indicate that the parser should work in validating mode.
220 * Disabled by default.
221 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000222int xmlDoValidityCheckingDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000223static int xmlDoValidityCheckingDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000224/**
225 * xmlGetWarningsDefaultValue:
226 *
227 * Global setting, indicate that the parser should provide warnings.
228 * Activated by default.
229 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000230int xmlGetWarningsDefaultValue = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000231static int xmlGetWarningsDefaultValueThrDef = 1;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000232/**
233 * xmlLoadExtDtdDefaultValue:
234 *
235 * Global setting, indicate that the parser should load DTD while not
236 * validating.
237 * Disabled by default.
238 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000239int xmlLoadExtDtdDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000240static int xmlLoadExtDtdDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000241/**
242 * xmlPedanticParserDefaultValue:
243 *
244 * Global setting, indicate that the parser be pedantic
245 * Disabled by default.
246 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000247int xmlPedanticParserDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000248static int xmlPedanticParserDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000249/**
250 * xmlLineNumbersDefaultValue:
251 *
252 * Global setting, indicate that the parser should store the line number
253 * in the content field of elements in the DOM tree.
254 * Disabled by default since this may not be safe for old classes of
255 * applicaton.
256 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000257int xmlLineNumbersDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000258static int xmlLineNumbersDefaultValueThrDef = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000259/**
260 * xmlKeepBlanksDefaultValue:
261 *
262 * Global setting, indicate that the parser should keep all blanks
263 * nodes found in the content
264 * Activated by default, this is actually needed to have the parser
265 * conformant to the XML Recommendation, however the option is kept
266 * for some applications since this was libxml1 default behaviour.
267 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000268int xmlKeepBlanksDefaultValue = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000269static int xmlKeepBlanksDefaultValueThrDef = 1;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000270/**
271 * xmlSubstituteEntitiesDefaultValue:
272 *
273 * Global setting, indicate that the parser should not generate entity
274 * references but replace them with the actual content of the entity
275 * Disabled by default, this should be activated when using XPath since
276 * the XPath data model requires entities replacement and the XPath
277 * engine does not handle entities references transparently.
278 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000279int xmlSubstituteEntitiesDefaultValue = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000280static int xmlSubstituteEntitiesDefaultValueThrDef = 0;
Daniel Veillardb8478642001-10-12 17:29:10 +0000281
Daniel Veillard5335dc52003-01-01 20:59:38 +0000282xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000283static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000284xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000285static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000286
Daniel Veillard0335a842004-06-02 16:18:40 +0000287xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue = NULL;
288static xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValueThrDef = NULL;
289
290xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue = NULL;
291static xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValueThrDef = NULL;
292
Daniel Veillardb8478642001-10-12 17:29:10 +0000293/*
294 * Error handling
295 */
296
297/* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
298/* Must initialize xmlGenericError in xmlInitParser */
Daniel Veillard635ef722001-10-29 11:48:19 +0000299void xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
300 const char *msg,
301 ...);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000302/**
303 * xmlGenericError:
304 *
305 * Global setting: function used for generic error callbacks
306 */
Daniel Veillard635ef722001-10-29 11:48:19 +0000307xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000308static xmlGenericErrorFunc xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000309/**
Daniel Veillard659e71e2003-10-10 14:10:40 +0000310 * xmlStructuredError:
311 *
312 * Global setting: function used for structured error callbacks
313 */
314xmlStructuredErrorFunc xmlStructuredError = NULL;
315static xmlStructuredErrorFunc xmlStructuredErrorThrDef = NULL;
316/**
Daniel Veillard9d06d302002-01-22 18:15:52 +0000317 * xmlGenericErrorContext:
318 *
319 * Global setting passed to generic error callbacks
320 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000321void *xmlGenericErrorContext = NULL;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000322static void *xmlGenericErrorContextThrDef = NULL;
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000323xmlError xmlLastError;
Daniel Veillardb8478642001-10-12 17:29:10 +0000324
325/*
326 * output defaults
327 */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000328/**
329 * xmlIndentTreeOutput:
330 *
331 * Global setting, asking the serializer to indent the output tree by default
Aleksey Sanin23002562002-05-24 07:18:40 +0000332 * Enabled by default
Daniel Veillard9d06d302002-01-22 18:15:52 +0000333 */
Aleksey Sanin23002562002-05-24 07:18:40 +0000334int xmlIndentTreeOutput = 1;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000335static int xmlIndentTreeOutputThrDef = 1;
Aleksey Sanin23002562002-05-24 07:18:40 +0000336
337/**
338 * xmlTreeIndentString:
339 *
340 * The string used to do one-level indent. By default is equal to " " (two spaces)
341 */
342const char *xmlTreeIndentString = " ";
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000343static const char *xmlTreeIndentStringThrDef = " ";
Aleksey Sanin23002562002-05-24 07:18:40 +0000344
Daniel Veillard9d06d302002-01-22 18:15:52 +0000345/**
346 * xmlSaveNoEmptyTags:
347 *
348 * Global setting, asking the serializer to not output empty tags
349 * as <empty/> but <empty></empty>. those two forms are undistinguishable
350 * once parsed.
351 * Disabled by default
352 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000353int xmlSaveNoEmptyTags = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000354int xmlSaveNoEmptyTagsThrDef = 0;
Daniel Veillardb8478642001-10-12 17:29:10 +0000355
Daniel Veillard81273902003-09-30 00:43:48 +0000356#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000357/**
358 * xmlDefaultSAXHandler:
359 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000360 * Default SAX version1 handler for XML, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000361 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000362xmlSAXHandlerV1 xmlDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000363 xmlSAX2InternalSubset,
364 xmlSAX2IsStandalone,
365 xmlSAX2HasInternalSubset,
366 xmlSAX2HasExternalSubset,
367 xmlSAX2ResolveEntity,
368 xmlSAX2GetEntity,
369 xmlSAX2EntityDecl,
370 xmlSAX2NotationDecl,
371 xmlSAX2AttributeDecl,
372 xmlSAX2ElementDecl,
373 xmlSAX2UnparsedEntityDecl,
374 xmlSAX2SetDocumentLocator,
375 xmlSAX2StartDocument,
376 xmlSAX2EndDocument,
377 xmlSAX2StartElement,
378 xmlSAX2EndElement,
379 xmlSAX2Reference,
380 xmlSAX2Characters,
381 xmlSAX2Characters,
382 xmlSAX2ProcessingInstruction,
383 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000384 xmlParserWarning,
385 xmlParserError,
386 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000387 xmlSAX2GetParameterEntity,
388 xmlSAX2CDataBlock,
389 xmlSAX2ExternalSubset,
390 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000391};
Daniel Veillard81273902003-09-30 00:43:48 +0000392#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillardb8478642001-10-12 17:29:10 +0000393
Daniel Veillard9d06d302002-01-22 18:15:52 +0000394/**
395 * xmlDefaultSAXLocator:
396 *
397 * The default SAX Locator
398 * { getPublicId, getSystemId, getLineNumber, getColumnNumber}
Daniel Veillardb8478642001-10-12 17:29:10 +0000399 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000400xmlSAXLocator xmlDefaultSAXLocator = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000401 xmlSAX2GetPublicId,
402 xmlSAX2GetSystemId,
403 xmlSAX2GetLineNumber,
404 xmlSAX2GetColumnNumber
Daniel Veillardb8478642001-10-12 17:29:10 +0000405};
406
407#ifdef LIBXML_HTML_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000408/**
409 * htmlDefaultSAXHandler:
410 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000411 * Default old SAX v1 handler for HTML, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000412 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000413xmlSAXHandlerV1 htmlDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000414 xmlSAX2InternalSubset,
Daniel Veillardb8478642001-10-12 17:29:10 +0000415 NULL,
416 NULL,
417 NULL,
418 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000419 xmlSAX2GetEntity,
Daniel Veillardb8478642001-10-12 17:29:10 +0000420 NULL,
421 NULL,
422 NULL,
423 NULL,
424 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000425 xmlSAX2SetDocumentLocator,
426 xmlSAX2StartDocument,
427 xmlSAX2EndDocument,
428 xmlSAX2StartElement,
429 xmlSAX2EndElement,
Daniel Veillardb8478642001-10-12 17:29:10 +0000430 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000431 xmlSAX2Characters,
432 xmlSAX2IgnorableWhitespace,
Daniel Veillardb8478642001-10-12 17:29:10 +0000433 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000434 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000435 xmlParserWarning,
436 xmlParserError,
437 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000438 xmlSAX2GetParameterEntity,
439 xmlSAX2CDataBlock,
Daniel Veillardb8478642001-10-12 17:29:10 +0000440 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000441 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000442};
443#endif /* LIBXML_HTML_ENABLED */
444
445#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000446/**
447 * docbDefaultSAXHandler:
448 *
Daniel Veillard092643b2003-09-25 14:29:29 +0000449 * Default old SAX v1 handler for SGML DocBook, builds the DOM tree
Daniel Veillardb8478642001-10-12 17:29:10 +0000450 */
Daniel Veillard092643b2003-09-25 14:29:29 +0000451xmlSAXHandlerV1 docbDefaultSAXHandler = {
Daniel Veillard1af9a412003-08-20 22:54:39 +0000452 xmlSAX2InternalSubset,
453 xmlSAX2IsStandalone,
454 xmlSAX2HasInternalSubset,
455 xmlSAX2HasExternalSubset,
456 xmlSAX2ResolveEntity,
457 xmlSAX2GetEntity,
458 xmlSAX2EntityDecl,
Daniel Veillardb8478642001-10-12 17:29:10 +0000459 NULL,
460 NULL,
461 NULL,
462 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000463 xmlSAX2SetDocumentLocator,
464 xmlSAX2StartDocument,
465 xmlSAX2EndDocument,
466 xmlSAX2StartElement,
467 xmlSAX2EndElement,
468 xmlSAX2Reference,
469 xmlSAX2Characters,
470 xmlSAX2IgnorableWhitespace,
Daniel Veillardb8478642001-10-12 17:29:10 +0000471 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000472 xmlSAX2Comment,
Daniel Veillardb8478642001-10-12 17:29:10 +0000473 xmlParserWarning,
474 xmlParserError,
475 xmlParserError,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000476 xmlSAX2GetParameterEntity,
Daniel Veillardb8478642001-10-12 17:29:10 +0000477 NULL,
478 NULL,
Daniel Veillard1af9a412003-08-20 22:54:39 +0000479 0,
Daniel Veillardb8478642001-10-12 17:29:10 +0000480};
481#endif /* LIBXML_DOCB_ENABLED */
482
483/**
484 * xmlInitializeGlobalState:
485 * @gs: a pointer to a newly allocated global state
486 *
487 * xmlInitializeGlobalState() initialize a global state with all the
488 * default values of the library.
489 */
490void
491xmlInitializeGlobalState(xmlGlobalStatePtr gs)
492{
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000493#ifdef DEBUG_GLOBALS
494 fprintf(stderr, "Initializing globals at %lu for thread %d\n",
495 (unsigned long) gs, xmlGetThreadId());
496#endif
497
Daniel Veillardb8478642001-10-12 17:29:10 +0000498 /*
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000499 * Perform initialization as required by libxml
Daniel Veillardb8478642001-10-12 17:29:10 +0000500 */
Daniel Veillard5805be22003-08-28 08:03:23 +0000501 if (xmlThrDefMutex == NULL)
502 xmlInitGlobals();
503
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000504 xmlMutexLock(xmlThrDefMutex);
William M. Brack8b2c7f12002-11-22 05:07:29 +0000505
Daniel Veillarda4617b82001-11-04 20:19:12 +0000506#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard092643b2003-09-25 14:29:29 +0000507 initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000508#endif
509#ifdef LIBXML_HTML_ENABLED
Daniel Veillard092643b2003-09-25 14:29:29 +0000510 inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000511#endif
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000512
Daniel Veillardb8478642001-10-12 17:29:10 +0000513 gs->oldXMLWDcompatibility = 0;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000514 gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
515 gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;
Daniel Veillard81273902003-09-30 00:43:48 +0000516#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard092643b2003-09-25 14:29:29 +0000517 initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
Daniel Veillard81273902003-09-30 00:43:48 +0000518#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillard4432df22003-09-28 18:58:27 +0000519 gs->xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId;
520 gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
521 gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
522 gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000523 gs->xmlDoValidityCheckingDefaultValue =
524 xmlDoValidityCheckingDefaultValueThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000525#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
526 gs->xmlFree = (xmlFreeFunc) xmlMemFree;
527 gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000528 gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000529 gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
530 gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
531#else
532 gs->xmlFree = (xmlFreeFunc) free;
533 gs->xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000534 gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000535 gs->xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard572577e2002-01-18 16:23:55 +0000536 gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillardb8478642001-10-12 17:29:10 +0000537#endif
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000538 gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
539 gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
540 gs->xmlTreeIndentString = xmlTreeIndentStringThrDef;
541 gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
542 gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
543 gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
544 gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
Daniel Veillardb8478642001-10-12 17:29:10 +0000545 gs->xmlParserVersion = LIBXML_VERSION_STRING;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000546 gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
547 gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
548 gs->xmlSubstituteEntitiesDefaultValue =
549 xmlSubstituteEntitiesDefaultValueThrDef;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000550
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000551 gs->xmlGenericError = xmlGenericErrorThrDef;
Daniel Veillard659e71e2003-10-10 14:10:40 +0000552 gs->xmlStructuredError = xmlStructuredErrorThrDef;
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000553 gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
554 gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
555 gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
Daniel Veillard0335a842004-06-02 16:18:40 +0000556
557 gs->xmlParserInputBufferCreateFilenameValue = xmlParserInputBufferCreateFilenameValueThrDef;
558 gs->xmlOutputBufferCreateFilenameValue = xmlOutputBufferCreateFilenameValueThrDef;
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000559 memset(&gs->xmlLastError, 0, sizeof(xmlError));
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000560
561 xmlMutexUnlock(xmlThrDefMutex);
562}
563
Daniel Veillard1e906612003-12-05 14:57:46 +0000564/**
565 * DOC_DISABLE : we ignore missing doc for the xmlThrDef functions,
566 * those are really internal work
567 */
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000568void
569xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
570 xmlMutexLock(xmlThrDefMutex);
571 xmlGenericErrorContextThrDef = ctx;
572 if (handler != NULL)
573 xmlGenericErrorThrDef = handler;
574 else
575 xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
576 xmlMutexUnlock(xmlThrDefMutex);
Daniel Veillardb8478642001-10-12 17:29:10 +0000577}
578
Daniel Veillard659e71e2003-10-10 14:10:40 +0000579void
580xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
581 xmlMutexLock(xmlThrDefMutex);
582 xmlGenericErrorContextThrDef = ctx;
583 xmlStructuredErrorThrDef = handler;
584 xmlMutexUnlock(xmlThrDefMutex);
585}
586
Daniel Veillard5335dc52003-01-01 20:59:38 +0000587/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000588 * xmlRegisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000589 * @func: function pointer to the new RegisterNodeFunc
590 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000591 * Registers a callback for node creation
592 *
593 * Returns the old value of the registration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000594 */
595xmlRegisterNodeFunc
596xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
597{
598 xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue;
599
Daniel Veillarda880b122003-04-21 21:36:41 +0000600 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000601 xmlRegisterNodeDefaultValue = func;
602 return(old);
603}
604
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000605xmlRegisterNodeFunc
606xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
607{
608 xmlRegisterNodeFunc old;
609
610 xmlMutexLock(xmlThrDefMutex);
611 old = xmlRegisterNodeDefaultValueThrDef;
612
613 __xmlRegisterCallbacks = 1;
614 xmlRegisterNodeDefaultValueThrDef = func;
615 xmlMutexUnlock(xmlThrDefMutex);
616
617 return(old);
618}
619
Daniel Veillard5335dc52003-01-01 20:59:38 +0000620/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000621 * xmlDeregisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000622 * @func: function pointer to the new DeregisterNodeFunc
623 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000624 * Registers a callback for node destruction
625 *
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000626 * Returns the previous value of the deregistration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000627 */
628xmlDeregisterNodeFunc
629xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
630{
631 xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue;
632
Daniel Veillarda880b122003-04-21 21:36:41 +0000633 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000634 xmlDeregisterNodeDefaultValue = func;
635 return(old);
636}
637
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000638xmlDeregisterNodeFunc
639xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
640{
641 xmlDeregisterNodeFunc old;
642
643 xmlMutexLock(xmlThrDefMutex);
644 old = xmlDeregisterNodeDefaultValueThrDef;
645
646 __xmlRegisterCallbacks = 1;
647 xmlDeregisterNodeDefaultValueThrDef = func;
648 xmlMutexUnlock(xmlThrDefMutex);
649
650 return(old);
651}
652
Daniel Veillard0335a842004-06-02 16:18:40 +0000653/**
654 * xmlParserInputBufferCreateFilename:
655 * @func: function pointer to the new ParserInputBufferCreateFilenameFunc
656 *
657 * Registers a callback for URI input file handling
658 *
659 * Returns the old value of the registration function
660 */
661xmlParserInputBufferCreateFilenameFunc
662xmlParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
663{
664 xmlParserInputBufferCreateFilenameFunc old = xmlParserInputBufferCreateFilenameValue;
665
666 xmlParserInputBufferCreateFilenameValue = func;
667 return(old);
668}
669
670xmlParserInputBufferCreateFilenameFunc
671xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
672{
673 xmlParserInputBufferCreateFilenameFunc old;
674
675 xmlMutexLock(xmlThrDefMutex);
676 old = xmlParserInputBufferCreateFilenameValueThrDef;
677
678 xmlParserInputBufferCreateFilenameValueThrDef = func;
679 xmlMutexUnlock(xmlThrDefMutex);
680
681 return(old);
682}
683
684/**
685 * xmlOutputBufferCreateFilename:
686 * @func: function pointer to the new OutputBufferCreateFilenameFunc
687 *
688 * Registers a callback for URI output file handling
689 *
690 * Returns the old value of the registration function
691 */
692xmlOutputBufferCreateFilenameFunc
693xmlOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
694{
695 xmlOutputBufferCreateFilenameFunc old = xmlOutputBufferCreateFilenameValue;
696
697 xmlOutputBufferCreateFilenameValue = func;
698 return(old);
699}
700
701xmlOutputBufferCreateFilenameFunc
702xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
703{
704 xmlOutputBufferCreateFilenameFunc old;
705
706 xmlMutexLock(xmlThrDefMutex);
707 old = xmlOutputBufferCreateFilenameValueThrDef;
708
709 xmlOutputBufferCreateFilenameValueThrDef = func;
710 xmlMutexUnlock(xmlThrDefMutex);
711
712 return(old);
713}
Daniel Veillard5335dc52003-01-01 20:59:38 +0000714
Daniel Veillarda4617b82001-11-04 20:19:12 +0000715#ifdef LIBXML_DOCB_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000716#undef docbDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000717xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000718__docbDefaultSAXHandler(void) {
719 if (IS_MAIN_THREAD)
720 return (&docbDefaultSAXHandler);
721 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000722 return (&xmlGetGlobalState()->docbDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000723}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000724#endif
Daniel Veillardb8478642001-10-12 17:29:10 +0000725
Daniel Veillarda4617b82001-11-04 20:19:12 +0000726#ifdef LIBXML_HTML_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000727#undef htmlDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000728xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000729__htmlDefaultSAXHandler(void) {
730 if (IS_MAIN_THREAD)
731 return (&htmlDefaultSAXHandler);
732 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000733 return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000734}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000735#endif
736
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000737#undef xmlLastError
738xmlError *
739__xmlLastError(void) {
740 if (IS_MAIN_THREAD)
741 return (&xmlLastError);
742 else
743 return (&xmlGetGlobalState()->xmlLastError);
744}
745
Daniel Veillarda4617b82001-11-04 20:19:12 +0000746/*
747 * Everything starting from the line below is
748 * Automatically generated by build_glob.py.
749 * Do not modify the previous line.
750 */
751
Daniel Veillardb8478642001-10-12 17:29:10 +0000752
Daniel Veillardb8478642001-10-12 17:29:10 +0000753#undef oldXMLWDcompatibility
754int *
755__oldXMLWDcompatibility(void) {
756 if (IS_MAIN_THREAD)
757 return (&oldXMLWDcompatibility);
758 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000759 return (&xmlGetGlobalState()->oldXMLWDcompatibility);
Daniel Veillardb8478642001-10-12 17:29:10 +0000760}
761
Daniel Veillardb8478642001-10-12 17:29:10 +0000762#undef xmlBufferAllocScheme
763xmlBufferAllocationScheme *
764__xmlBufferAllocScheme(void) {
765 if (IS_MAIN_THREAD)
766 return (&xmlBufferAllocScheme);
767 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000768 return (&xmlGetGlobalState()->xmlBufferAllocScheme);
Daniel Veillardb8478642001-10-12 17:29:10 +0000769}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000770xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
771 xmlBufferAllocationScheme ret;
772 xmlMutexLock(xmlThrDefMutex);
773 ret = xmlBufferAllocSchemeThrDef;
774 xmlBufferAllocSchemeThrDef = v;
775 xmlMutexUnlock(xmlThrDefMutex);
776 return ret;
777}
Daniel Veillardb8478642001-10-12 17:29:10 +0000778
Daniel Veillardb8478642001-10-12 17:29:10 +0000779#undef xmlDefaultBufferSize
780int *
781__xmlDefaultBufferSize(void) {
782 if (IS_MAIN_THREAD)
783 return (&xmlDefaultBufferSize);
784 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000785 return (&xmlGetGlobalState()->xmlDefaultBufferSize);
Daniel Veillardb8478642001-10-12 17:29:10 +0000786}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000787int xmlThrDefDefaultBufferSize(int v) {
788 int ret;
789 xmlMutexLock(xmlThrDefMutex);
790 ret = xmlDefaultBufferSizeThrDef;
791 xmlDefaultBufferSizeThrDef = v;
792 xmlMutexUnlock(xmlThrDefMutex);
793 return ret;
794}
Daniel Veillardb8478642001-10-12 17:29:10 +0000795
Daniel Veillard81273902003-09-30 00:43:48 +0000796#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000797#undef xmlDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000798xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000799__xmlDefaultSAXHandler(void) {
800 if (IS_MAIN_THREAD)
801 return (&xmlDefaultSAXHandler);
802 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000803 return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000804}
Daniel Veillard81273902003-09-30 00:43:48 +0000805#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillardb8478642001-10-12 17:29:10 +0000806
Daniel Veillardb8478642001-10-12 17:29:10 +0000807#undef xmlDefaultSAXLocator
808xmlSAXLocator *
809__xmlDefaultSAXLocator(void) {
810 if (IS_MAIN_THREAD)
811 return (&xmlDefaultSAXLocator);
812 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000813 return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
Daniel Veillardb8478642001-10-12 17:29:10 +0000814}
815
Daniel Veillardb8478642001-10-12 17:29:10 +0000816#undef xmlDoValidityCheckingDefaultValue
817int *
818__xmlDoValidityCheckingDefaultValue(void) {
819 if (IS_MAIN_THREAD)
820 return (&xmlDoValidityCheckingDefaultValue);
821 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000822 return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000823}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000824int xmlThrDefDoValidityCheckingDefaultValue(int v) {
825 int ret;
826 xmlMutexLock(xmlThrDefMutex);
827 ret = xmlDoValidityCheckingDefaultValueThrDef;
828 xmlDoValidityCheckingDefaultValueThrDef = v;
829 xmlMutexUnlock(xmlThrDefMutex);
830 return ret;
831}
Daniel Veillardb8478642001-10-12 17:29:10 +0000832
Daniel Veillardb8478642001-10-12 17:29:10 +0000833#undef xmlGenericError
834xmlGenericErrorFunc *
835__xmlGenericError(void) {
836 if (IS_MAIN_THREAD)
837 return (&xmlGenericError);
838 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000839 return (&xmlGetGlobalState()->xmlGenericError);
Daniel Veillardb8478642001-10-12 17:29:10 +0000840}
841
Daniel Veillard659e71e2003-10-10 14:10:40 +0000842#undef xmlStructuredError
843xmlStructuredErrorFunc *
844__xmlStructuredError(void) {
845 if (IS_MAIN_THREAD)
846 return (&xmlStructuredError);
847 else
848 return (&xmlGetGlobalState()->xmlStructuredError);
849}
850
Daniel Veillardb8478642001-10-12 17:29:10 +0000851#undef xmlGenericErrorContext
852void * *
853__xmlGenericErrorContext(void) {
854 if (IS_MAIN_THREAD)
855 return (&xmlGenericErrorContext);
856 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000857 return (&xmlGetGlobalState()->xmlGenericErrorContext);
Daniel Veillardb8478642001-10-12 17:29:10 +0000858}
859
Daniel Veillardb8478642001-10-12 17:29:10 +0000860#undef xmlGetWarningsDefaultValue
861int *
862__xmlGetWarningsDefaultValue(void) {
863 if (IS_MAIN_THREAD)
864 return (&xmlGetWarningsDefaultValue);
865 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000866 return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000867}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000868int xmlThrDefGetWarningsDefaultValue(int v) {
869 int ret;
870 xmlMutexLock(xmlThrDefMutex);
871 ret = xmlGetWarningsDefaultValueThrDef;
872 xmlGetWarningsDefaultValueThrDef = v;
873 xmlMutexUnlock(xmlThrDefMutex);
874 return ret;
875}
Daniel Veillardb8478642001-10-12 17:29:10 +0000876
Daniel Veillardb8478642001-10-12 17:29:10 +0000877#undef xmlIndentTreeOutput
878int *
879__xmlIndentTreeOutput(void) {
880 if (IS_MAIN_THREAD)
881 return (&xmlIndentTreeOutput);
882 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000883 return (&xmlGetGlobalState()->xmlIndentTreeOutput);
Daniel Veillardb8478642001-10-12 17:29:10 +0000884}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000885int xmlThrDefIndentTreeOutput(int v) {
886 int ret;
887 xmlMutexLock(xmlThrDefMutex);
888 ret = xmlIndentTreeOutputThrDef;
889 xmlIndentTreeOutputThrDef = v;
890 xmlMutexUnlock(xmlThrDefMutex);
891 return ret;
892}
Daniel Veillardb8478642001-10-12 17:29:10 +0000893
Aleksey Sanin23002562002-05-24 07:18:40 +0000894#undef xmlTreeIndentString
895const char * *
896__xmlTreeIndentString(void) {
897 if (IS_MAIN_THREAD)
898 return (&xmlTreeIndentString);
899 else
900 return (&xmlGetGlobalState()->xmlTreeIndentString);
901}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000902const char * xmlThrDefTreeIndentString(const char * v) {
903 const char * ret;
904 xmlMutexLock(xmlThrDefMutex);
905 ret = xmlTreeIndentStringThrDef;
906 xmlTreeIndentStringThrDef = v;
907 xmlMutexUnlock(xmlThrDefMutex);
908 return ret;
909}
Aleksey Sanin23002562002-05-24 07:18:40 +0000910
Daniel Veillardb8478642001-10-12 17:29:10 +0000911#undef xmlKeepBlanksDefaultValue
912int *
913__xmlKeepBlanksDefaultValue(void) {
914 if (IS_MAIN_THREAD)
915 return (&xmlKeepBlanksDefaultValue);
916 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000917 return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000918}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000919int xmlThrDefKeepBlanksDefaultValue(int v) {
920 int ret;
921 xmlMutexLock(xmlThrDefMutex);
922 ret = xmlKeepBlanksDefaultValueThrDef;
923 xmlKeepBlanksDefaultValueThrDef = v;
924 xmlMutexUnlock(xmlThrDefMutex);
925 return ret;
926}
Daniel Veillardb8478642001-10-12 17:29:10 +0000927
Daniel Veillardb8478642001-10-12 17:29:10 +0000928#undef xmlLineNumbersDefaultValue
929int *
930__xmlLineNumbersDefaultValue(void) {
931 if (IS_MAIN_THREAD)
932 return (&xmlLineNumbersDefaultValue);
933 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000934 return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000935}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000936int xmlThrDefLineNumbersDefaultValue(int v) {
937 int ret;
938 xmlMutexLock(xmlThrDefMutex);
939 ret = xmlLineNumbersDefaultValueThrDef;
940 xmlLineNumbersDefaultValueThrDef = v;
941 xmlMutexUnlock(xmlThrDefMutex);
942 return ret;
943}
Daniel Veillardb8478642001-10-12 17:29:10 +0000944
Daniel Veillardb8478642001-10-12 17:29:10 +0000945#undef xmlLoadExtDtdDefaultValue
946int *
947__xmlLoadExtDtdDefaultValue(void) {
948 if (IS_MAIN_THREAD)
949 return (&xmlLoadExtDtdDefaultValue);
950 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000951 return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000952}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000953int xmlThrDefLoadExtDtdDefaultValue(int v) {
954 int ret;
955 xmlMutexLock(xmlThrDefMutex);
956 ret = xmlLoadExtDtdDefaultValueThrDef;
957 xmlLoadExtDtdDefaultValueThrDef = v;
958 xmlMutexUnlock(xmlThrDefMutex);
959 return ret;
960}
Daniel Veillardb8478642001-10-12 17:29:10 +0000961
Daniel Veillardb8478642001-10-12 17:29:10 +0000962#undef xmlParserDebugEntities
963int *
964__xmlParserDebugEntities(void) {
965 if (IS_MAIN_THREAD)
966 return (&xmlParserDebugEntities);
967 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000968 return (&xmlGetGlobalState()->xmlParserDebugEntities);
Daniel Veillardb8478642001-10-12 17:29:10 +0000969}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000970int xmlThrDefParserDebugEntities(int v) {
971 int ret;
972 xmlMutexLock(xmlThrDefMutex);
973 ret = xmlParserDebugEntitiesThrDef;
974 xmlParserDebugEntitiesThrDef = v;
975 xmlMutexUnlock(xmlThrDefMutex);
976 return ret;
977}
Daniel Veillardb8478642001-10-12 17:29:10 +0000978
Daniel Veillardb8478642001-10-12 17:29:10 +0000979#undef xmlParserVersion
980const char * *
981__xmlParserVersion(void) {
982 if (IS_MAIN_THREAD)
983 return (&xmlParserVersion);
984 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000985 return (&xmlGetGlobalState()->xmlParserVersion);
Daniel Veillardb8478642001-10-12 17:29:10 +0000986}
987
Daniel Veillardb8478642001-10-12 17:29:10 +0000988#undef xmlPedanticParserDefaultValue
989int *
990__xmlPedanticParserDefaultValue(void) {
991 if (IS_MAIN_THREAD)
992 return (&xmlPedanticParserDefaultValue);
993 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000994 return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000995}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000996int xmlThrDefPedanticParserDefaultValue(int v) {
997 int ret;
998 xmlMutexLock(xmlThrDefMutex);
999 ret = xmlPedanticParserDefaultValueThrDef;
1000 xmlPedanticParserDefaultValueThrDef = v;
1001 xmlMutexUnlock(xmlThrDefMutex);
1002 return ret;
1003}
Daniel Veillardb8478642001-10-12 17:29:10 +00001004
Daniel Veillardb8478642001-10-12 17:29:10 +00001005#undef xmlSaveNoEmptyTags
1006int *
1007__xmlSaveNoEmptyTags(void) {
1008 if (IS_MAIN_THREAD)
1009 return (&xmlSaveNoEmptyTags);
1010 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001011 return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
Daniel Veillardb8478642001-10-12 17:29:10 +00001012}
Daniel Veillard781ac8b2003-05-15 22:11:36 +00001013int xmlThrDefSaveNoEmptyTags(int v) {
1014 int ret;
1015 xmlMutexLock(xmlThrDefMutex);
1016 ret = xmlSaveNoEmptyTagsThrDef;
1017 xmlSaveNoEmptyTagsThrDef = v;
1018 xmlMutexUnlock(xmlThrDefMutex);
1019 return ret;
1020}
Daniel Veillardb8478642001-10-12 17:29:10 +00001021
Daniel Veillardb8478642001-10-12 17:29:10 +00001022#undef xmlSubstituteEntitiesDefaultValue
1023int *
1024__xmlSubstituteEntitiesDefaultValue(void) {
1025 if (IS_MAIN_THREAD)
1026 return (&xmlSubstituteEntitiesDefaultValue);
1027 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001028 return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +00001029}
Daniel Veillard781ac8b2003-05-15 22:11:36 +00001030int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
1031 int ret;
1032 xmlMutexLock(xmlThrDefMutex);
1033 ret = xmlSubstituteEntitiesDefaultValueThrDef;
1034 xmlSubstituteEntitiesDefaultValueThrDef = v;
1035 xmlMutexUnlock(xmlThrDefMutex);
1036 return ret;
1037}
Daniel Veillard5335dc52003-01-01 20:59:38 +00001038
1039#undef xmlRegisterNodeDefaultValue
1040xmlRegisterNodeFunc *
1041__xmlRegisterNodeDefaultValue(void) {
1042 if (IS_MAIN_THREAD)
1043 return (&xmlRegisterNodeDefaultValue);
1044 else
1045 return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue);
1046}
1047
1048#undef xmlDeregisterNodeDefaultValue
1049xmlDeregisterNodeFunc *
1050__xmlDeregisterNodeDefaultValue(void) {
1051 if (IS_MAIN_THREAD)
1052 return (&xmlDeregisterNodeDefaultValue);
1053 else
1054 return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue);
1055}
Daniel Veillard0335a842004-06-02 16:18:40 +00001056
1057#undef xmlParserInputBufferCreateFilenameValue
1058xmlParserInputBufferCreateFilenameFunc *
1059__xmlParserInputBufferCreateFilenameValue(void) {
1060 if (IS_MAIN_THREAD)
1061 return (&xmlParserInputBufferCreateFilenameValue);
1062 else
1063 return (&xmlGetGlobalState()->xmlParserInputBufferCreateFilenameValue);
1064}
1065
1066#undef xmlOutputBufferCreateFilenameValue
1067xmlOutputBufferCreateFilenameFunc *
1068__xmlOutputBufferCreateFilenameValue(void) {
1069 if (IS_MAIN_THREAD)
1070 return (&xmlOutputBufferCreateFilenameValue);
1071 else
1072 return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue);
William M. Brack803812b2004-06-03 02:11:24 +00001073}
1074