blob: feb19cc7a6e5d770bab3b2064a3ac3cb3ff4ae15 [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 */
William M. Brack5ab479b2004-06-10 13:00:15 +000074#undef xmlFree
75#undef xmlMalloc
76#undef xmlMallocAtomic
77#undef xmlMemStrdup
78#undef xmlRealloc
79
Daniel Veillard7216cfd2002-11-08 15:10:00 +000080#if defined(DEBUG_MEMORY_LOCATION) || defined(DEBUG_MEMORY)
Daniel Veillard092643b2003-09-25 14:29:29 +000081#ifndef __DEBUG_MEMORY_ALLOC__
Daniel Veillardd0463562001-10-13 09:15:48 +000082extern void xmlMemFree(void *ptr);
83extern void * xmlMemMalloc(size_t size);
84extern void * xmlMemRealloc(void *ptr,size_t size);
85extern char * xmlMemoryStrdup(const char *str);
Daniel Veillard98485322003-08-14 15:44:40 +000086#endif
Daniel Veillardd0463562001-10-13 09:15:48 +000087
Daniel Veillardb8478642001-10-12 17:29:10 +000088xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
89xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +000090xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillardb8478642001-10-12 17:29:10 +000091xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
92xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
93#else
Daniel Veillard9d06d302002-01-22 18:15:52 +000094/**
95 * xmlFree:
96 * @mem: an already allocated block of memory
97 *
98 * The variable holding the libxml free() implementation
99 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000100xmlFreeFunc xmlFree = (xmlFreeFunc) free;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000101/**
102 * xmlMalloc:
103 * @size: the size requested in bytes
104 *
105 * The variable holding the libxml malloc() implementation
106 *
107 * Returns a pointer to the newly allocated block or NULL in case of error
108 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000109xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000110/**
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000111 * xmlMallocAtomic:
112 * @size: the size requested in bytes
113 *
114 * The variable holding the libxml malloc() implementation for atomic
115 * data (i.e. blocks not containings pointers), useful when using a
116 * garbage collecting allocator.
117 *
118 * Returns a pointer to the newly allocated block or NULL in case of error
119 */
120xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) malloc;
121/**
Daniel Veillard9d06d302002-01-22 18:15:52 +0000122 * xmlRealloc:
123 * @mem: an already allocated block of memory
124 * @size: the new size requested in bytes
125 *
126 * The variable holding the libxml realloc() implementation
127 *
128 * Returns a pointer to the newly reallocated block or NULL in case of error
129 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000130xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000131/**
132 * xmlMemStrdup:
133 * @str: a zero terminated string
134 *
135 * The variable holding the libxml strdup() implementation
136 *
137 * Returns the copy of the string or NULL in case of error
138 */
Daniel Veillardb82c1662001-12-09 14:00:54 +0000139xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000140#endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */
Daniel Veillardb8478642001-10-12 17:29:10 +0000141
Daniel Veillardd0463562001-10-13 09:15:48 +0000142#include <libxml/threads.h>
143#include <libxml/globals.h>
144#include <libxml/SAX.h>
145
146#undef docbDefaultSAXHandler
147#undef htmlDefaultSAXHandler
148#undef oldXMLWDcompatibility
149#undef xmlBufferAllocScheme
150#undef xmlDefaultBufferSize
151#undef xmlDefaultSAXHandler
152#undef xmlDefaultSAXLocator
153#undef xmlDoValidityCheckingDefaultValue
154#undef xmlGenericError
Daniel Veillard659e71e2003-10-10 14:10:40 +0000155#undef xmlStructuredError
Daniel Veillardd0463562001-10-13 09:15:48 +0000156#undef xmlGenericErrorContext
157#undef xmlGetWarningsDefaultValue
158#undef xmlIndentTreeOutput
Aleksey Sanin23002562002-05-24 07:18:40 +0000159#undef xmlTreeIndentString
Daniel Veillardd0463562001-10-13 09:15:48 +0000160#undef xmlKeepBlanksDefaultValue
161#undef xmlLineNumbersDefaultValue
162#undef xmlLoadExtDtdDefaultValue
163#undef xmlParserDebugEntities
164#undef xmlParserVersion
165#undef xmlPedanticParserDefaultValue
166#undef xmlSaveNoEmptyTags
167#undef xmlSubstituteEntitiesDefaultValue
Daniel Veillard8326e732003-01-07 00:19:07 +0000168#undef xmlRegisterNodeDefaultValue
169#undef xmlDeregisterNodeDefaultValue
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000170#undef xmlLastError
Daniel Veillardd0463562001-10-13 09:15:48 +0000171
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 */
William M. Brackf4025492004-08-18 21:08:46 +0000179const char *xmlParserVersion = LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA;
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000180
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 +0000653xmlParserInputBufferCreateFilenameFunc
654xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
655{
656 xmlParserInputBufferCreateFilenameFunc old;
657
658 xmlMutexLock(xmlThrDefMutex);
659 old = xmlParserInputBufferCreateFilenameValueThrDef;
Daniel Veillard1b243b42004-06-08 10:16:42 +0000660 if (old == NULL) {
661 old = __xmlParserInputBufferCreateFilename;
662 }
663
Daniel Veillard0335a842004-06-02 16:18:40 +0000664 xmlParserInputBufferCreateFilenameValueThrDef = func;
665 xmlMutexUnlock(xmlThrDefMutex);
666
667 return(old);
668}
669
Daniel Veillard0335a842004-06-02 16:18:40 +0000670xmlOutputBufferCreateFilenameFunc
671xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
672{
673 xmlOutputBufferCreateFilenameFunc old;
674
675 xmlMutexLock(xmlThrDefMutex);
676 old = xmlOutputBufferCreateFilenameValueThrDef;
Daniel Veillard1b243b42004-06-08 10:16:42 +0000677#ifdef LIBXML_OUTPUT_ENABLED
678 if (old == NULL) {
679 old = __xmlOutputBufferCreateFilename;
680 }
681#endif
Daniel Veillard0335a842004-06-02 16:18:40 +0000682 xmlOutputBufferCreateFilenameValueThrDef = func;
683 xmlMutexUnlock(xmlThrDefMutex);
684
685 return(old);
686}
Daniel Veillard5335dc52003-01-01 20:59:38 +0000687
Daniel Veillarda4617b82001-11-04 20:19:12 +0000688#ifdef LIBXML_DOCB_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000689#undef docbDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000690xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000691__docbDefaultSAXHandler(void) {
692 if (IS_MAIN_THREAD)
693 return (&docbDefaultSAXHandler);
694 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000695 return (&xmlGetGlobalState()->docbDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000696}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000697#endif
Daniel Veillardb8478642001-10-12 17:29:10 +0000698
Daniel Veillarda4617b82001-11-04 20:19:12 +0000699#ifdef LIBXML_HTML_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000700#undef htmlDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000701xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000702__htmlDefaultSAXHandler(void) {
703 if (IS_MAIN_THREAD)
704 return (&htmlDefaultSAXHandler);
705 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000706 return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000707}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000708#endif
709
Daniel Veillard2b8c4a12003-10-02 22:28:19 +0000710#undef xmlLastError
711xmlError *
712__xmlLastError(void) {
713 if (IS_MAIN_THREAD)
714 return (&xmlLastError);
715 else
716 return (&xmlGetGlobalState()->xmlLastError);
717}
718
Daniel Veillarda4617b82001-11-04 20:19:12 +0000719/*
William M. Brack5ab479b2004-06-10 13:00:15 +0000720 * The following memory routines were apparently lost at some point,
721 * and were re-inserted at this point on June 10, 2004. Hope it's
722 * the right place for them :-)
723 */
724#if defined(LIBXML_THREAD_ALLOC_ENABLED) && defined(LIBXML_THREAD_ENABLED)
725#undef xmlMalloc
726xmlMallocFunc *
727__xmlMalloc(void){
728 if (IS_MAIN_THREAD)
729 return (&xmlMalloc);
730 else
731 return (&xmlGetGlobalState()->xmlMalloc);
732}
733
734#undef xmlMallocAtomic
735xmlMallocFunc *
736__xmlMallocAtomic(void){
737 if (IS_MAIN_THREAD)
738 return (&xmlMallocAtomic);
739 else
740 return (&xmlGetGlobalState()->xmlMallocAtomic);
741}
742
743#undef xmlRealloc
744xmlReallocFunc *
745__xmlRealloc(void){
746 if (IS_MAIN_THREAD)
747 return (&xmlRealloc);
748 else
749 return (&xmlGetGlobalState()->xmlRealloc);
750}
751
752#undef xmlFree
753xmlFreeFunc *
754__xmlFree(void){
755 if (IS_MAIN_THREAD)
756 return (&xmlFree);
757 else
758 return (&xmlGetGlobalState()->xmlFree);
759}
760
761xmlStrdupFunc *
762__xmlMemStrdup(void){
763 if (IS_MAIN_THREAD)
764 return (&xmlMemStrdup);
765 else
766 return (&xmlGetGlobalState()->xmlMemStrdup);
767}
768
769#endif
770
771/*
Daniel Veillarda4617b82001-11-04 20:19:12 +0000772 * Everything starting from the line below is
773 * Automatically generated by build_glob.py.
774 * Do not modify the previous line.
775 */
776
Daniel Veillardb8478642001-10-12 17:29:10 +0000777
Daniel Veillardb8478642001-10-12 17:29:10 +0000778#undef oldXMLWDcompatibility
779int *
780__oldXMLWDcompatibility(void) {
781 if (IS_MAIN_THREAD)
782 return (&oldXMLWDcompatibility);
783 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000784 return (&xmlGetGlobalState()->oldXMLWDcompatibility);
Daniel Veillardb8478642001-10-12 17:29:10 +0000785}
786
Daniel Veillardb8478642001-10-12 17:29:10 +0000787#undef xmlBufferAllocScheme
788xmlBufferAllocationScheme *
789__xmlBufferAllocScheme(void) {
790 if (IS_MAIN_THREAD)
791 return (&xmlBufferAllocScheme);
792 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000793 return (&xmlGetGlobalState()->xmlBufferAllocScheme);
Daniel Veillardb8478642001-10-12 17:29:10 +0000794}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000795xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
796 xmlBufferAllocationScheme ret;
797 xmlMutexLock(xmlThrDefMutex);
798 ret = xmlBufferAllocSchemeThrDef;
799 xmlBufferAllocSchemeThrDef = v;
800 xmlMutexUnlock(xmlThrDefMutex);
801 return ret;
802}
Daniel Veillardb8478642001-10-12 17:29:10 +0000803
Daniel Veillardb8478642001-10-12 17:29:10 +0000804#undef xmlDefaultBufferSize
805int *
806__xmlDefaultBufferSize(void) {
807 if (IS_MAIN_THREAD)
808 return (&xmlDefaultBufferSize);
809 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000810 return (&xmlGetGlobalState()->xmlDefaultBufferSize);
Daniel Veillardb8478642001-10-12 17:29:10 +0000811}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000812int xmlThrDefDefaultBufferSize(int v) {
813 int ret;
814 xmlMutexLock(xmlThrDefMutex);
815 ret = xmlDefaultBufferSizeThrDef;
816 xmlDefaultBufferSizeThrDef = v;
817 xmlMutexUnlock(xmlThrDefMutex);
818 return ret;
819}
Daniel Veillardb8478642001-10-12 17:29:10 +0000820
Daniel Veillard81273902003-09-30 00:43:48 +0000821#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000822#undef xmlDefaultSAXHandler
Daniel Veillard092643b2003-09-25 14:29:29 +0000823xmlSAXHandlerV1 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000824__xmlDefaultSAXHandler(void) {
825 if (IS_MAIN_THREAD)
826 return (&xmlDefaultSAXHandler);
827 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000828 return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000829}
Daniel Veillard81273902003-09-30 00:43:48 +0000830#endif /* LIBXML_SAX1_ENABLED */
Daniel Veillardb8478642001-10-12 17:29:10 +0000831
Daniel Veillardb8478642001-10-12 17:29:10 +0000832#undef xmlDefaultSAXLocator
833xmlSAXLocator *
834__xmlDefaultSAXLocator(void) {
835 if (IS_MAIN_THREAD)
836 return (&xmlDefaultSAXLocator);
837 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000838 return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
Daniel Veillardb8478642001-10-12 17:29:10 +0000839}
840
Daniel Veillardb8478642001-10-12 17:29:10 +0000841#undef xmlDoValidityCheckingDefaultValue
842int *
843__xmlDoValidityCheckingDefaultValue(void) {
844 if (IS_MAIN_THREAD)
845 return (&xmlDoValidityCheckingDefaultValue);
846 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000847 return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000848}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000849int xmlThrDefDoValidityCheckingDefaultValue(int v) {
850 int ret;
851 xmlMutexLock(xmlThrDefMutex);
852 ret = xmlDoValidityCheckingDefaultValueThrDef;
853 xmlDoValidityCheckingDefaultValueThrDef = v;
854 xmlMutexUnlock(xmlThrDefMutex);
855 return ret;
856}
Daniel Veillardb8478642001-10-12 17:29:10 +0000857
Daniel Veillardb8478642001-10-12 17:29:10 +0000858#undef xmlGenericError
859xmlGenericErrorFunc *
860__xmlGenericError(void) {
861 if (IS_MAIN_THREAD)
862 return (&xmlGenericError);
863 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000864 return (&xmlGetGlobalState()->xmlGenericError);
Daniel Veillardb8478642001-10-12 17:29:10 +0000865}
866
Daniel Veillard659e71e2003-10-10 14:10:40 +0000867#undef xmlStructuredError
868xmlStructuredErrorFunc *
869__xmlStructuredError(void) {
870 if (IS_MAIN_THREAD)
871 return (&xmlStructuredError);
872 else
873 return (&xmlGetGlobalState()->xmlStructuredError);
874}
875
Daniel Veillardb8478642001-10-12 17:29:10 +0000876#undef xmlGenericErrorContext
877void * *
878__xmlGenericErrorContext(void) {
879 if (IS_MAIN_THREAD)
880 return (&xmlGenericErrorContext);
881 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000882 return (&xmlGetGlobalState()->xmlGenericErrorContext);
Daniel Veillardb8478642001-10-12 17:29:10 +0000883}
884
Daniel Veillardb8478642001-10-12 17:29:10 +0000885#undef xmlGetWarningsDefaultValue
886int *
887__xmlGetWarningsDefaultValue(void) {
888 if (IS_MAIN_THREAD)
889 return (&xmlGetWarningsDefaultValue);
890 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000891 return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000892}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000893int xmlThrDefGetWarningsDefaultValue(int v) {
894 int ret;
895 xmlMutexLock(xmlThrDefMutex);
896 ret = xmlGetWarningsDefaultValueThrDef;
897 xmlGetWarningsDefaultValueThrDef = v;
898 xmlMutexUnlock(xmlThrDefMutex);
899 return ret;
900}
Daniel Veillardb8478642001-10-12 17:29:10 +0000901
Daniel Veillardb8478642001-10-12 17:29:10 +0000902#undef xmlIndentTreeOutput
903int *
904__xmlIndentTreeOutput(void) {
905 if (IS_MAIN_THREAD)
906 return (&xmlIndentTreeOutput);
907 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000908 return (&xmlGetGlobalState()->xmlIndentTreeOutput);
Daniel Veillardb8478642001-10-12 17:29:10 +0000909}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000910int xmlThrDefIndentTreeOutput(int v) {
911 int ret;
912 xmlMutexLock(xmlThrDefMutex);
913 ret = xmlIndentTreeOutputThrDef;
914 xmlIndentTreeOutputThrDef = v;
915 xmlMutexUnlock(xmlThrDefMutex);
916 return ret;
917}
Daniel Veillardb8478642001-10-12 17:29:10 +0000918
Aleksey Sanin23002562002-05-24 07:18:40 +0000919#undef xmlTreeIndentString
920const char * *
921__xmlTreeIndentString(void) {
922 if (IS_MAIN_THREAD)
923 return (&xmlTreeIndentString);
924 else
925 return (&xmlGetGlobalState()->xmlTreeIndentString);
926}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000927const char * xmlThrDefTreeIndentString(const char * v) {
928 const char * ret;
929 xmlMutexLock(xmlThrDefMutex);
930 ret = xmlTreeIndentStringThrDef;
931 xmlTreeIndentStringThrDef = v;
932 xmlMutexUnlock(xmlThrDefMutex);
933 return ret;
934}
Aleksey Sanin23002562002-05-24 07:18:40 +0000935
Daniel Veillardb8478642001-10-12 17:29:10 +0000936#undef xmlKeepBlanksDefaultValue
937int *
938__xmlKeepBlanksDefaultValue(void) {
939 if (IS_MAIN_THREAD)
940 return (&xmlKeepBlanksDefaultValue);
941 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000942 return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000943}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000944int xmlThrDefKeepBlanksDefaultValue(int v) {
945 int ret;
946 xmlMutexLock(xmlThrDefMutex);
947 ret = xmlKeepBlanksDefaultValueThrDef;
948 xmlKeepBlanksDefaultValueThrDef = v;
949 xmlMutexUnlock(xmlThrDefMutex);
950 return ret;
951}
Daniel Veillardb8478642001-10-12 17:29:10 +0000952
Daniel Veillardb8478642001-10-12 17:29:10 +0000953#undef xmlLineNumbersDefaultValue
954int *
955__xmlLineNumbersDefaultValue(void) {
956 if (IS_MAIN_THREAD)
957 return (&xmlLineNumbersDefaultValue);
958 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000959 return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000960}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000961int xmlThrDefLineNumbersDefaultValue(int v) {
962 int ret;
963 xmlMutexLock(xmlThrDefMutex);
964 ret = xmlLineNumbersDefaultValueThrDef;
965 xmlLineNumbersDefaultValueThrDef = v;
966 xmlMutexUnlock(xmlThrDefMutex);
967 return ret;
968}
Daniel Veillardb8478642001-10-12 17:29:10 +0000969
Daniel Veillardb8478642001-10-12 17:29:10 +0000970#undef xmlLoadExtDtdDefaultValue
971int *
972__xmlLoadExtDtdDefaultValue(void) {
973 if (IS_MAIN_THREAD)
974 return (&xmlLoadExtDtdDefaultValue);
975 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000976 return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000977}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000978int xmlThrDefLoadExtDtdDefaultValue(int v) {
979 int ret;
980 xmlMutexLock(xmlThrDefMutex);
981 ret = xmlLoadExtDtdDefaultValueThrDef;
982 xmlLoadExtDtdDefaultValueThrDef = v;
983 xmlMutexUnlock(xmlThrDefMutex);
984 return ret;
985}
Daniel Veillardb8478642001-10-12 17:29:10 +0000986
Daniel Veillardb8478642001-10-12 17:29:10 +0000987#undef xmlParserDebugEntities
988int *
989__xmlParserDebugEntities(void) {
990 if (IS_MAIN_THREAD)
991 return (&xmlParserDebugEntities);
992 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000993 return (&xmlGetGlobalState()->xmlParserDebugEntities);
Daniel Veillardb8478642001-10-12 17:29:10 +0000994}
Daniel Veillard781ac8b2003-05-15 22:11:36 +0000995int xmlThrDefParserDebugEntities(int v) {
996 int ret;
997 xmlMutexLock(xmlThrDefMutex);
998 ret = xmlParserDebugEntitiesThrDef;
999 xmlParserDebugEntitiesThrDef = v;
1000 xmlMutexUnlock(xmlThrDefMutex);
1001 return ret;
1002}
Daniel Veillardb8478642001-10-12 17:29:10 +00001003
Daniel Veillardb8478642001-10-12 17:29:10 +00001004#undef xmlParserVersion
1005const char * *
1006__xmlParserVersion(void) {
1007 if (IS_MAIN_THREAD)
1008 return (&xmlParserVersion);
1009 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001010 return (&xmlGetGlobalState()->xmlParserVersion);
Daniel Veillardb8478642001-10-12 17:29:10 +00001011}
1012
Daniel Veillardb8478642001-10-12 17:29:10 +00001013#undef xmlPedanticParserDefaultValue
1014int *
1015__xmlPedanticParserDefaultValue(void) {
1016 if (IS_MAIN_THREAD)
1017 return (&xmlPedanticParserDefaultValue);
1018 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001019 return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +00001020}
Daniel Veillard781ac8b2003-05-15 22:11:36 +00001021int xmlThrDefPedanticParserDefaultValue(int v) {
1022 int ret;
1023 xmlMutexLock(xmlThrDefMutex);
1024 ret = xmlPedanticParserDefaultValueThrDef;
1025 xmlPedanticParserDefaultValueThrDef = v;
1026 xmlMutexUnlock(xmlThrDefMutex);
1027 return ret;
1028}
Daniel Veillardb8478642001-10-12 17:29:10 +00001029
Daniel Veillardb8478642001-10-12 17:29:10 +00001030#undef xmlSaveNoEmptyTags
1031int *
1032__xmlSaveNoEmptyTags(void) {
1033 if (IS_MAIN_THREAD)
1034 return (&xmlSaveNoEmptyTags);
1035 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001036 return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
Daniel Veillardb8478642001-10-12 17:29:10 +00001037}
Daniel Veillard781ac8b2003-05-15 22:11:36 +00001038int xmlThrDefSaveNoEmptyTags(int v) {
1039 int ret;
1040 xmlMutexLock(xmlThrDefMutex);
1041 ret = xmlSaveNoEmptyTagsThrDef;
1042 xmlSaveNoEmptyTagsThrDef = v;
1043 xmlMutexUnlock(xmlThrDefMutex);
1044 return ret;
1045}
Daniel Veillardb8478642001-10-12 17:29:10 +00001046
Daniel Veillardb8478642001-10-12 17:29:10 +00001047#undef xmlSubstituteEntitiesDefaultValue
1048int *
1049__xmlSubstituteEntitiesDefaultValue(void) {
1050 if (IS_MAIN_THREAD)
1051 return (&xmlSubstituteEntitiesDefaultValue);
1052 else
Daniel Veillardd0463562001-10-13 09:15:48 +00001053 return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +00001054}
Daniel Veillard781ac8b2003-05-15 22:11:36 +00001055int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
1056 int ret;
1057 xmlMutexLock(xmlThrDefMutex);
1058 ret = xmlSubstituteEntitiesDefaultValueThrDef;
1059 xmlSubstituteEntitiesDefaultValueThrDef = v;
1060 xmlMutexUnlock(xmlThrDefMutex);
1061 return ret;
1062}
Daniel Veillard5335dc52003-01-01 20:59:38 +00001063
1064#undef xmlRegisterNodeDefaultValue
1065xmlRegisterNodeFunc *
1066__xmlRegisterNodeDefaultValue(void) {
1067 if (IS_MAIN_THREAD)
1068 return (&xmlRegisterNodeDefaultValue);
1069 else
1070 return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue);
1071}
1072
1073#undef xmlDeregisterNodeDefaultValue
1074xmlDeregisterNodeFunc *
1075__xmlDeregisterNodeDefaultValue(void) {
1076 if (IS_MAIN_THREAD)
1077 return (&xmlDeregisterNodeDefaultValue);
1078 else
1079 return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue);
1080}
Daniel Veillard0335a842004-06-02 16:18:40 +00001081
1082#undef xmlParserInputBufferCreateFilenameValue
1083xmlParserInputBufferCreateFilenameFunc *
1084__xmlParserInputBufferCreateFilenameValue(void) {
1085 if (IS_MAIN_THREAD)
1086 return (&xmlParserInputBufferCreateFilenameValue);
1087 else
1088 return (&xmlGetGlobalState()->xmlParserInputBufferCreateFilenameValue);
1089}
1090
1091#undef xmlOutputBufferCreateFilenameValue
1092xmlOutputBufferCreateFilenameFunc *
1093__xmlOutputBufferCreateFilenameValue(void) {
1094 if (IS_MAIN_THREAD)
1095 return (&xmlOutputBufferCreateFilenameValue);
1096 else
1097 return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue);
William M. Brack803812b2004-06-03 02:11:24 +00001098}