blob: e4817a2b199e0dba8ddb341d62cb9905d0962c88 [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
14#include "libxml.h"
15
Daniel Veillarde7090612001-10-13 12:18:28 +000016#ifdef HAVE_STDLIB_H
Jaka Mocnik77d19ae2001-10-13 12:06:09 +000017#include <stdlib.h>
Daniel Veillarde7090612001-10-13 12:18:28 +000018#endif
Jaka Mocnik77d19ae2001-10-13 12:06:09 +000019#include <string.h>
20
Daniel Veillard3c01b1d2001-10-17 15:58:35 +000021#include <libxml/globals.h>
Daniel Veillarde7090612001-10-13 12:18:28 +000022#include <libxml/xmlmemory.h>
23
Daniel Veillard3c01b1d2001-10-17 15:58:35 +000024/* #define DEBUG_GLOBALS */
25
Daniel Veillardb8478642001-10-12 17:29:10 +000026/*
27 * Helpful Macro
28 */
Daniel Veillard3c01b1d2001-10-17 15:58:35 +000029#ifdef LIBXML_THREAD_ENABLED
30#define IS_MAIN_THREAD (xmlIsMainThread())
Daniel Veillardb8478642001-10-12 17:29:10 +000031#else
32#define IS_MAIN_THREAD 1
33#endif
34
35/************************************************************************
36 * *
37 * All the user accessible global variables of the library *
38 * *
39 ************************************************************************/
40
Daniel Veillardb8478642001-10-12 17:29:10 +000041/*
42 * Memory allocation routines
43 */
44#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
Daniel Veillardd0463562001-10-13 09:15:48 +000045extern void xmlMemFree(void *ptr);
46extern void * xmlMemMalloc(size_t size);
47extern void * xmlMemRealloc(void *ptr,size_t size);
48extern char * xmlMemoryStrdup(const char *str);
49
Daniel Veillardb8478642001-10-12 17:29:10 +000050xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
51xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
52xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
53xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
54#else
Daniel Veillard9d06d302002-01-22 18:15:52 +000055/**
56 * xmlFree:
57 * @mem: an already allocated block of memory
58 *
59 * The variable holding the libxml free() implementation
60 */
Daniel Veillardb8478642001-10-12 17:29:10 +000061xmlFreeFunc xmlFree = (xmlFreeFunc) free;
Daniel Veillard9d06d302002-01-22 18:15:52 +000062/**
63 * xmlMalloc:
64 * @size: the size requested in bytes
65 *
66 * The variable holding the libxml malloc() implementation
67 *
68 * Returns a pointer to the newly allocated block or NULL in case of error
69 */
Daniel Veillardb8478642001-10-12 17:29:10 +000070xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard9d06d302002-01-22 18:15:52 +000071/**
72 * xmlRealloc:
73 * @mem: an already allocated block of memory
74 * @size: the new size requested in bytes
75 *
76 * The variable holding the libxml realloc() implementation
77 *
78 * Returns a pointer to the newly reallocated block or NULL in case of error
79 */
Daniel Veillardb8478642001-10-12 17:29:10 +000080xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard9d06d302002-01-22 18:15:52 +000081/**
82 * xmlMemStrdup:
83 * @str: a zero terminated string
84 *
85 * The variable holding the libxml strdup() implementation
86 *
87 * Returns the copy of the string or NULL in case of error
88 */
Daniel Veillardb82c1662001-12-09 14:00:54 +000089xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillardb8478642001-10-12 17:29:10 +000090#endif
91
Daniel Veillardd0463562001-10-13 09:15:48 +000092#include <libxml/threads.h>
93#include <libxml/globals.h>
94#include <libxml/SAX.h>
95
96#undef docbDefaultSAXHandler
97#undef htmlDefaultSAXHandler
98#undef oldXMLWDcompatibility
99#undef xmlBufferAllocScheme
100#undef xmlDefaultBufferSize
101#undef xmlDefaultSAXHandler
102#undef xmlDefaultSAXLocator
103#undef xmlDoValidityCheckingDefaultValue
104#undef xmlGenericError
105#undef xmlGenericErrorContext
106#undef xmlGetWarningsDefaultValue
107#undef xmlIndentTreeOutput
108#undef xmlKeepBlanksDefaultValue
109#undef xmlLineNumbersDefaultValue
110#undef xmlLoadExtDtdDefaultValue
111#undef xmlParserDebugEntities
112#undef xmlParserVersion
113#undef xmlPedanticParserDefaultValue
114#undef xmlSaveNoEmptyTags
115#undef xmlSubstituteEntitiesDefaultValue
116
117#undef xmlFree
118#undef xmlMalloc
119#undef xmlMemStrdup
120#undef xmlRealloc
121
Daniel Veillard9d06d302002-01-22 18:15:52 +0000122/**
123 * xmlParserVersion:
124 *
125 * Constant string describing the internal version of the library
126 */
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000127const char *xmlParserVersion = LIBXML_VERSION_STRING;
128
Daniel Veillard9d06d302002-01-22 18:15:52 +0000129/**
130 * xmlBufferAllocScheme:
131 *
132 * Global setting, default allocation policy for buffers, default is
133 * XML_BUFFER_ALLOC_EXACT
Daniel Veillardb8478642001-10-12 17:29:10 +0000134 */
135xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000136/**
137 * xmlDefaultBufferSize:
138 *
139 * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
140 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000141int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
142
143/*
144 * Parser defaults
145 */
Daniel Veillardd0463562001-10-13 09:15:48 +0000146
Daniel Veillard9d06d302002-01-22 18:15:52 +0000147/**
148 * oldXMLWDcompatibility:
149 *
150 * Global setting, DEPRECATED.
151 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000152int oldXMLWDcompatibility = 0; /* DEPRECATED */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000153/**
154 * xmlParserDebugEntities:
155 *
156 * Global setting, asking the parser to print out debugging informations.
157 * while handling entities.
158 * Disabled by default
159 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000160int xmlParserDebugEntities = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000161/**
162 * xmlDoValidityCheckingDefaultValue:
163 *
164 * Global setting, indicate that the parser should work in validating mode.
165 * Disabled by default.
166 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000167int xmlDoValidityCheckingDefaultValue = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000168/**
169 * xmlGetWarningsDefaultValue:
170 *
171 * Global setting, indicate that the parser should provide warnings.
172 * Activated by default.
173 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000174int xmlGetWarningsDefaultValue = 1;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000175/**
176 * xmlLoadExtDtdDefaultValue:
177 *
178 * Global setting, indicate that the parser should load DTD while not
179 * validating.
180 * Disabled by default.
181 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000182int xmlLoadExtDtdDefaultValue = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000183/**
184 * xmlPedanticParserDefaultValue:
185 *
186 * Global setting, indicate that the parser be pedantic
187 * Disabled by default.
188 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000189int xmlPedanticParserDefaultValue = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000190/**
191 * xmlLineNumbersDefaultValue:
192 *
193 * Global setting, indicate that the parser should store the line number
194 * in the content field of elements in the DOM tree.
195 * Disabled by default since this may not be safe for old classes of
196 * applicaton.
197 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000198int xmlLineNumbersDefaultValue = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000199/**
200 * xmlKeepBlanksDefaultValue:
201 *
202 * Global setting, indicate that the parser should keep all blanks
203 * nodes found in the content
204 * Activated by default, this is actually needed to have the parser
205 * conformant to the XML Recommendation, however the option is kept
206 * for some applications since this was libxml1 default behaviour.
207 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000208int xmlKeepBlanksDefaultValue = 1;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000209/**
210 * xmlSubstituteEntitiesDefaultValue:
211 *
212 * Global setting, indicate that the parser should not generate entity
213 * references but replace them with the actual content of the entity
214 * Disabled by default, this should be activated when using XPath since
215 * the XPath data model requires entities replacement and the XPath
216 * engine does not handle entities references transparently.
217 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000218int xmlSubstituteEntitiesDefaultValue = 0;
219
220/*
221 * Error handling
222 */
223
224/* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
225/* Must initialize xmlGenericError in xmlInitParser */
Daniel Veillard635ef722001-10-29 11:48:19 +0000226void xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
227 const char *msg,
228 ...);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000229/**
230 * xmlGenericError:
231 *
232 * Global setting: function used for generic error callbacks
233 */
Daniel Veillard635ef722001-10-29 11:48:19 +0000234xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000235/**
236 * xmlGenericErrorContext:
237 *
238 * Global setting passed to generic error callbacks
239 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000240void *xmlGenericErrorContext = NULL;
241
242/*
243 * output defaults
244 */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000245/**
246 * xmlIndentTreeOutput:
247 *
248 * Global setting, asking the serializer to indent the output tree by default
249 * Disabled by default
250 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000251int xmlIndentTreeOutput = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000252/**
253 * xmlSaveNoEmptyTags:
254 *
255 * Global setting, asking the serializer to not output empty tags
256 * as <empty/> but <empty></empty>. those two forms are undistinguishable
257 * once parsed.
258 * Disabled by default
259 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000260int xmlSaveNoEmptyTags = 0;
261
Daniel Veillard9d06d302002-01-22 18:15:52 +0000262/**
263 * xmlDefaultSAXHandler:
264 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000265 * Default handler for XML, builds the DOM tree
266 */
267xmlSAXHandler xmlDefaultSAXHandler = {
268 internalSubset,
269 isStandalone,
270 hasInternalSubset,
271 hasExternalSubset,
272 resolveEntity,
273 getEntity,
274 entityDecl,
275 notationDecl,
276 attributeDecl,
277 elementDecl,
278 unparsedEntityDecl,
279 setDocumentLocator,
280 startDocument,
281 endDocument,
282 startElement,
283 endElement,
284 reference,
285 characters,
286 characters,
287 processingInstruction,
288 comment,
289 xmlParserWarning,
290 xmlParserError,
291 xmlParserError,
292 getParameterEntity,
293 cdataBlock,
294 externalSubset,
295 0
296};
297
Daniel Veillard9d06d302002-01-22 18:15:52 +0000298/**
299 * xmlDefaultSAXLocator:
300 *
301 * The default SAX Locator
302 * { getPublicId, getSystemId, getLineNumber, getColumnNumber}
Daniel Veillardb8478642001-10-12 17:29:10 +0000303 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000304xmlSAXLocator xmlDefaultSAXLocator = {
305 getPublicId, getSystemId, getLineNumber, getColumnNumber
306};
307
308#ifdef LIBXML_HTML_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000309/**
310 * htmlDefaultSAXHandler:
311 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000312 * Default handler for HTML, builds the DOM tree
313 */
314xmlSAXHandler htmlDefaultSAXHandler = {
315 internalSubset,
316 NULL,
317 NULL,
318 NULL,
319 NULL,
320 getEntity,
321 NULL,
322 NULL,
323 NULL,
324 NULL,
325 NULL,
326 setDocumentLocator,
327 startDocument,
328 endDocument,
329 startElement,
330 endElement,
331 NULL,
332 characters,
333 ignorableWhitespace,
334 NULL,
335 comment,
336 xmlParserWarning,
337 xmlParserError,
338 xmlParserError,
339 getParameterEntity,
340 cdataBlock,
341 NULL,
342 0
343};
344#endif /* LIBXML_HTML_ENABLED */
345
346#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000347/**
348 * docbDefaultSAXHandler:
349 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000350 * Default handler for SGML DocBook, builds the DOM tree
351 */
352xmlSAXHandler docbDefaultSAXHandler = {
353 internalSubset,
354 isStandalone,
355 hasInternalSubset,
356 hasExternalSubset,
357 resolveEntity,
358 getEntity,
359 entityDecl,
360 NULL,
361 NULL,
362 NULL,
363 NULL,
364 setDocumentLocator,
365 startDocument,
366 endDocument,
367 startElement,
368 endElement,
369 reference,
370 characters,
371 ignorableWhitespace,
372 NULL,
373 comment,
374 xmlParserWarning,
375 xmlParserError,
376 xmlParserError,
377 getParameterEntity,
378 NULL,
379 NULL,
380 0
381};
382#endif /* LIBXML_DOCB_ENABLED */
383
384/**
385 * xmlInitializeGlobalState:
386 * @gs: a pointer to a newly allocated global state
387 *
388 * xmlInitializeGlobalState() initialize a global state with all the
389 * default values of the library.
390 */
391void
392xmlInitializeGlobalState(xmlGlobalStatePtr gs)
393{
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000394#ifdef DEBUG_GLOBALS
395 fprintf(stderr, "Initializing globals at %lu for thread %d\n",
396 (unsigned long) gs, xmlGetThreadId());
397#endif
398
Daniel Veillardb8478642001-10-12 17:29:10 +0000399 /*
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000400 * Perform initialization as required by libxml
Daniel Veillardb8478642001-10-12 17:29:10 +0000401 */
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000402 initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000403#ifdef LIBXML_DOCB_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000404 initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000405#endif
406#ifdef LIBXML_HTML_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000407 inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000408#endif
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000409 initGenericErrorDefaultFunc(&gs->xmlGenericError);
410
Daniel Veillardb8478642001-10-12 17:29:10 +0000411 gs->oldXMLWDcompatibility = 0;
412 gs->xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
413 gs->xmlDefaultBufferSize = BASE_BUFFER_SIZE;
414 initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
415 gs->xmlDefaultSAXLocator.getPublicId = getPublicId;
416 gs->xmlDefaultSAXLocator.getSystemId = getSystemId;
417 gs->xmlDefaultSAXLocator.getLineNumber = getLineNumber;
418 gs->xmlDefaultSAXLocator.getColumnNumber = getColumnNumber;
419 gs->xmlDoValidityCheckingDefaultValue = 0;
420#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
421 gs->xmlFree = (xmlFreeFunc) xmlMemFree;
422 gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
423 gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
424 gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
425#else
426 gs->xmlFree = (xmlFreeFunc) free;
427 gs->xmlMalloc = (xmlMallocFunc) malloc;
428 gs->xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard572577e2002-01-18 16:23:55 +0000429 gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillardb8478642001-10-12 17:29:10 +0000430#endif
Daniel Veillardb8478642001-10-12 17:29:10 +0000431 gs->xmlGenericErrorContext = NULL;
432 gs->xmlGetWarningsDefaultValue = 1;
433 gs->xmlIndentTreeOutput = 0;
434 gs->xmlKeepBlanksDefaultValue = 1;
435 gs->xmlLineNumbersDefaultValue = 0;
436 gs->xmlLoadExtDtdDefaultValue = 0;
437 gs->xmlParserDebugEntities = 0;
438 gs->xmlParserVersion = LIBXML_VERSION_STRING;
439 gs->xmlPedanticParserDefaultValue = 0;
440 gs->xmlSaveNoEmptyTags = 0;
441 gs->xmlSubstituteEntitiesDefaultValue = 0;
442}
443
Daniel Veillarda4617b82001-11-04 20:19:12 +0000444#ifdef LIBXML_DOCB_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000445extern xmlSAXHandler docbDefaultSAXHandler;
446#undef docbDefaultSAXHandler
447xmlSAXHandler *
448__docbDefaultSAXHandler(void) {
449 if (IS_MAIN_THREAD)
450 return (&docbDefaultSAXHandler);
451 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000452 return (&xmlGetGlobalState()->docbDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000453}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000454#endif
Daniel Veillardb8478642001-10-12 17:29:10 +0000455
Daniel Veillarda4617b82001-11-04 20:19:12 +0000456#ifdef LIBXML_HTML_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000457extern xmlSAXHandler htmlDefaultSAXHandler;
458#undef htmlDefaultSAXHandler
459xmlSAXHandler *
460__htmlDefaultSAXHandler(void) {
461 if (IS_MAIN_THREAD)
462 return (&htmlDefaultSAXHandler);
463 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000464 return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000465}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000466#endif
467
468/*
469 * Everything starting from the line below is
470 * Automatically generated by build_glob.py.
471 * Do not modify the previous line.
472 */
473
Daniel Veillardb8478642001-10-12 17:29:10 +0000474
475extern int oldXMLWDcompatibility;
476#undef oldXMLWDcompatibility
477int *
478__oldXMLWDcompatibility(void) {
479 if (IS_MAIN_THREAD)
480 return (&oldXMLWDcompatibility);
481 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000482 return (&xmlGetGlobalState()->oldXMLWDcompatibility);
Daniel Veillardb8478642001-10-12 17:29:10 +0000483}
484
485extern xmlBufferAllocationScheme xmlBufferAllocScheme;
486#undef xmlBufferAllocScheme
487xmlBufferAllocationScheme *
488__xmlBufferAllocScheme(void) {
489 if (IS_MAIN_THREAD)
490 return (&xmlBufferAllocScheme);
491 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000492 return (&xmlGetGlobalState()->xmlBufferAllocScheme);
Daniel Veillardb8478642001-10-12 17:29:10 +0000493}
494
495extern int xmlDefaultBufferSize;
496#undef xmlDefaultBufferSize
497int *
498__xmlDefaultBufferSize(void) {
499 if (IS_MAIN_THREAD)
500 return (&xmlDefaultBufferSize);
501 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000502 return (&xmlGetGlobalState()->xmlDefaultBufferSize);
Daniel Veillardb8478642001-10-12 17:29:10 +0000503}
504
505extern xmlSAXHandler xmlDefaultSAXHandler;
506#undef xmlDefaultSAXHandler
507xmlSAXHandler *
508__xmlDefaultSAXHandler(void) {
509 if (IS_MAIN_THREAD)
510 return (&xmlDefaultSAXHandler);
511 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000512 return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000513}
514
515extern xmlSAXLocator xmlDefaultSAXLocator;
516#undef xmlDefaultSAXLocator
517xmlSAXLocator *
518__xmlDefaultSAXLocator(void) {
519 if (IS_MAIN_THREAD)
520 return (&xmlDefaultSAXLocator);
521 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000522 return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
Daniel Veillardb8478642001-10-12 17:29:10 +0000523}
524
525extern int xmlDoValidityCheckingDefaultValue;
526#undef xmlDoValidityCheckingDefaultValue
527int *
528__xmlDoValidityCheckingDefaultValue(void) {
529 if (IS_MAIN_THREAD)
530 return (&xmlDoValidityCheckingDefaultValue);
531 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000532 return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000533}
534
535extern xmlFreeFunc xmlFree;
536#undef xmlFree
537xmlFreeFunc *
538__xmlFree(void) {
539 if (IS_MAIN_THREAD)
540 return (&xmlFree);
541 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000542 return (&xmlGetGlobalState()->xmlFree);
Daniel Veillardb8478642001-10-12 17:29:10 +0000543}
544
545extern xmlGenericErrorFunc xmlGenericError;
546#undef xmlGenericError
547xmlGenericErrorFunc *
548__xmlGenericError(void) {
549 if (IS_MAIN_THREAD)
550 return (&xmlGenericError);
551 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000552 return (&xmlGetGlobalState()->xmlGenericError);
Daniel Veillardb8478642001-10-12 17:29:10 +0000553}
554
555extern void * xmlGenericErrorContext;
556#undef xmlGenericErrorContext
557void * *
558__xmlGenericErrorContext(void) {
559 if (IS_MAIN_THREAD)
560 return (&xmlGenericErrorContext);
561 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000562 return (&xmlGetGlobalState()->xmlGenericErrorContext);
Daniel Veillardb8478642001-10-12 17:29:10 +0000563}
564
565extern int xmlGetWarningsDefaultValue;
566#undef xmlGetWarningsDefaultValue
567int *
568__xmlGetWarningsDefaultValue(void) {
569 if (IS_MAIN_THREAD)
570 return (&xmlGetWarningsDefaultValue);
571 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000572 return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000573}
574
575extern int xmlIndentTreeOutput;
576#undef xmlIndentTreeOutput
577int *
578__xmlIndentTreeOutput(void) {
579 if (IS_MAIN_THREAD)
580 return (&xmlIndentTreeOutput);
581 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000582 return (&xmlGetGlobalState()->xmlIndentTreeOutput);
Daniel Veillardb8478642001-10-12 17:29:10 +0000583}
584
585extern int xmlKeepBlanksDefaultValue;
586#undef xmlKeepBlanksDefaultValue
587int *
588__xmlKeepBlanksDefaultValue(void) {
589 if (IS_MAIN_THREAD)
590 return (&xmlKeepBlanksDefaultValue);
591 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000592 return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000593}
594
595extern int xmlLineNumbersDefaultValue;
596#undef xmlLineNumbersDefaultValue
597int *
598__xmlLineNumbersDefaultValue(void) {
599 if (IS_MAIN_THREAD)
600 return (&xmlLineNumbersDefaultValue);
601 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000602 return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000603}
604
605extern int xmlLoadExtDtdDefaultValue;
606#undef xmlLoadExtDtdDefaultValue
607int *
608__xmlLoadExtDtdDefaultValue(void) {
609 if (IS_MAIN_THREAD)
610 return (&xmlLoadExtDtdDefaultValue);
611 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000612 return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000613}
614
615extern xmlMallocFunc xmlMalloc;
616#undef xmlMalloc
617xmlMallocFunc *
618__xmlMalloc(void) {
619 if (IS_MAIN_THREAD)
620 return (&xmlMalloc);
621 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000622 return (&xmlGetGlobalState()->xmlMalloc);
Daniel Veillardb8478642001-10-12 17:29:10 +0000623}
624
625extern xmlStrdupFunc xmlMemStrdup;
626#undef xmlMemStrdup
627xmlStrdupFunc *
628__xmlMemStrdup(void) {
629 if (IS_MAIN_THREAD)
630 return (&xmlMemStrdup);
631 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000632 return (&xmlGetGlobalState()->xmlMemStrdup);
Daniel Veillardb8478642001-10-12 17:29:10 +0000633}
634
635extern int xmlParserDebugEntities;
636#undef xmlParserDebugEntities
637int *
638__xmlParserDebugEntities(void) {
639 if (IS_MAIN_THREAD)
640 return (&xmlParserDebugEntities);
641 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000642 return (&xmlGetGlobalState()->xmlParserDebugEntities);
Daniel Veillardb8478642001-10-12 17:29:10 +0000643}
644
645extern const char * xmlParserVersion;
646#undef xmlParserVersion
647const char * *
648__xmlParserVersion(void) {
649 if (IS_MAIN_THREAD)
650 return (&xmlParserVersion);
651 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000652 return (&xmlGetGlobalState()->xmlParserVersion);
Daniel Veillardb8478642001-10-12 17:29:10 +0000653}
654
655extern int xmlPedanticParserDefaultValue;
656#undef xmlPedanticParserDefaultValue
657int *
658__xmlPedanticParserDefaultValue(void) {
659 if (IS_MAIN_THREAD)
660 return (&xmlPedanticParserDefaultValue);
661 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000662 return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000663}
664
665extern xmlReallocFunc xmlRealloc;
666#undef xmlRealloc
667xmlReallocFunc *
668__xmlRealloc(void) {
669 if (IS_MAIN_THREAD)
670 return (&xmlRealloc);
671 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000672 return (&xmlGetGlobalState()->xmlRealloc);
Daniel Veillardb8478642001-10-12 17:29:10 +0000673}
674
675extern int xmlSaveNoEmptyTags;
676#undef xmlSaveNoEmptyTags
677int *
678__xmlSaveNoEmptyTags(void) {
679 if (IS_MAIN_THREAD)
680 return (&xmlSaveNoEmptyTags);
681 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000682 return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
Daniel Veillardb8478642001-10-12 17:29:10 +0000683}
684
685extern int xmlSubstituteEntitiesDefaultValue;
686#undef xmlSubstituteEntitiesDefaultValue
687int *
688__xmlSubstituteEntitiesDefaultValue(void) {
689 if (IS_MAIN_THREAD)
690 return (&xmlSubstituteEntitiesDefaultValue);
691 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000692 return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000693}