ntdll: Support extended address requirements in NtMapViewOfSectionEx().
[wine.git] / libs / xml2 / globals.c
blob6d8e75175a6c104fc1e59c7b996e11392c402d0a
1 /*
2 * globals.c: definition and handling of the set of global variables
3 * of the library
5 * The bottom of this file is automatically generated by build_glob.py
6 * based on the description file global.data
8 * See Copyright for the status of this software.
10 * Gary Pennington <Gary.Pennington@uk.sun.com>
11 * daniel@veillard.com
14 #define IN_LIBXML
15 #include "libxml.h"
17 #include <stdlib.h>
18 #include <string.h>
20 #include <libxml/globals.h>
21 #include <libxml/xmlmemory.h>
22 #include <libxml/threads.h>
24 /* #define DEBUG_GLOBALS */
27 * Helpful Macro
29 #ifdef LIBXML_THREAD_ENABLED
30 #define IS_MAIN_THREAD (xmlIsMainThread())
31 #else
32 #define IS_MAIN_THREAD 1
33 #endif
36 * Mutex to protect "ForNewThreads" variables
38 static xmlMutexPtr xmlThrDefMutex = NULL;
40 /**
41 * xmlInitGlobals:
43 * DEPRECATED: This function will be made private. Call xmlInitParser to
44 * initialize the library.
46 * Additional initialisation for multi-threading
48 void xmlInitGlobals(void)
50 if (xmlThrDefMutex == NULL)
51 xmlThrDefMutex = xmlNewMutex();
54 /************************************************************************
55 * *
56 * All the user accessible global variables of the library *
57 * *
58 ************************************************************************/
61 * Memory allocation routines
63 #undef xmlFree
64 #undef xmlMalloc
65 #undef xmlMallocAtomic
66 #undef xmlMemStrdup
67 #undef xmlRealloc
69 #if defined(DEBUG_MEMORY_LOCATION) || defined(DEBUG_MEMORY)
70 xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
71 xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
72 xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
73 xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
74 xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
75 #else
76 /**
77 * xmlFree:
78 * @mem: an already allocated block of memory
80 * The variable holding the libxml free() implementation
82 xmlFreeFunc xmlFree = free;
83 /**
84 * xmlMalloc:
85 * @size: the size requested in bytes
87 * The variable holding the libxml malloc() implementation
89 * Returns a pointer to the newly allocated block or NULL in case of error
91 xmlMallocFunc xmlMalloc = malloc;
92 /**
93 * xmlMallocAtomic:
94 * @size: the size requested in bytes
96 * The variable holding the libxml malloc() implementation for atomic
97 * data (i.e. blocks not containing pointers), useful when using a
98 * garbage collecting allocator.
100 * Returns a pointer to the newly allocated block or NULL in case of error
102 xmlMallocFunc xmlMallocAtomic = malloc;
104 * xmlRealloc:
105 * @mem: an already allocated block of memory
106 * @size: the new size requested in bytes
108 * The variable holding the libxml realloc() implementation
110 * Returns a pointer to the newly reallocated block or NULL in case of error
112 xmlReallocFunc xmlRealloc = realloc;
114 * xmlPosixStrdup
115 * @cur: the input char *
117 * a strdup implementation with a type signature matching POSIX
119 * Returns a new xmlChar * or NULL
121 static char *
122 xmlPosixStrdup(const char *cur) {
123 return((char*) xmlCharStrdup(cur));
126 * xmlMemStrdup:
127 * @str: a zero terminated string
129 * The variable holding the libxml strdup() implementation
131 * Returns the copy of the string or NULL in case of error
133 xmlStrdupFunc xmlMemStrdup = xmlPosixStrdup;
134 #endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */
136 #include <libxml/threads.h>
137 #include <libxml/globals.h>
138 #include <libxml/SAX.h>
140 #undef htmlDefaultSAXHandler
141 #undef oldXMLWDcompatibility
142 #undef xmlBufferAllocScheme
143 #undef xmlDefaultBufferSize
144 #undef xmlDefaultSAXHandler
145 #undef xmlDefaultSAXLocator
146 #undef xmlDoValidityCheckingDefaultValue
147 #undef xmlGenericError
148 #undef xmlStructuredError
149 #undef xmlGenericErrorContext
150 #undef xmlStructuredErrorContext
151 #undef xmlGetWarningsDefaultValue
152 #undef xmlIndentTreeOutput
153 #undef xmlTreeIndentString
154 #undef xmlKeepBlanksDefaultValue
155 #undef xmlLineNumbersDefaultValue
156 #undef xmlLoadExtDtdDefaultValue
157 #undef xmlParserDebugEntities
158 #undef xmlParserVersion
159 #undef xmlPedanticParserDefaultValue
160 #undef xmlSaveNoEmptyTags
161 #undef xmlSubstituteEntitiesDefaultValue
162 #undef xmlRegisterNodeDefaultValue
163 #undef xmlDeregisterNodeDefaultValue
164 #undef xmlLastError
166 #undef xmlParserInputBufferCreateFilenameValue
167 #undef xmlOutputBufferCreateFilenameValue
169 * xmlParserVersion:
171 * Constant string describing the internal version of the library
173 const char *xmlParserVersion = LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA;
176 * xmlBufferAllocScheme:
178 * Global setting, default allocation policy for buffers, default is
179 * XML_BUFFER_ALLOC_EXACT
181 xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
182 static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_EXACT;
184 * xmlDefaultBufferSize:
186 * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
188 int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
189 static int xmlDefaultBufferSizeThrDef = BASE_BUFFER_SIZE;
192 * Parser defaults
196 * oldXMLWDcompatibility:
198 * Global setting, DEPRECATED.
200 int oldXMLWDcompatibility = 0; /* DEPRECATED */
202 * xmlParserDebugEntities:
204 * Global setting, asking the parser to print out debugging information.
205 * while handling entities.
206 * Disabled by default
208 int xmlParserDebugEntities = 0;
209 static int xmlParserDebugEntitiesThrDef = 0;
211 * xmlDoValidityCheckingDefaultValue:
213 * Global setting, indicate that the parser should work in validating mode.
214 * Disabled by default.
216 int xmlDoValidityCheckingDefaultValue = 0;
217 static int xmlDoValidityCheckingDefaultValueThrDef = 0;
219 * xmlGetWarningsDefaultValue:
221 * Global setting, indicate that the parser should provide warnings.
222 * Activated by default.
224 int xmlGetWarningsDefaultValue = 1;
225 static int xmlGetWarningsDefaultValueThrDef = 1;
227 * xmlLoadExtDtdDefaultValue:
229 * Global setting, indicate that the parser should load DTD while not
230 * validating.
231 * Disabled by default.
233 int xmlLoadExtDtdDefaultValue = 0;
234 static int xmlLoadExtDtdDefaultValueThrDef = 0;
236 * xmlPedanticParserDefaultValue:
238 * Global setting, indicate that the parser be pedantic
239 * Disabled by default.
241 int xmlPedanticParserDefaultValue = 0;
242 static int xmlPedanticParserDefaultValueThrDef = 0;
244 * xmlLineNumbersDefaultValue:
246 * Global setting, indicate that the parser should store the line number
247 * in the content field of elements in the DOM tree.
248 * Disabled by default since this may not be safe for old classes of
249 * application.
251 int xmlLineNumbersDefaultValue = 0;
252 static int xmlLineNumbersDefaultValueThrDef = 0;
254 * xmlKeepBlanksDefaultValue:
256 * Global setting, indicate that the parser should keep all blanks
257 * nodes found in the content
258 * Activated by default, this is actually needed to have the parser
259 * conformant to the XML Recommendation, however the option is kept
260 * for some applications since this was libxml1 default behaviour.
262 int xmlKeepBlanksDefaultValue = 1;
263 static int xmlKeepBlanksDefaultValueThrDef = 1;
265 * xmlSubstituteEntitiesDefaultValue:
267 * Global setting, indicate that the parser should not generate entity
268 * references but replace them with the actual content of the entity
269 * Disabled by default, this should be activated when using XPath since
270 * the XPath data model requires entities replacement and the XPath
271 * engine does not handle entities references transparently.
273 int xmlSubstituteEntitiesDefaultValue = 0;
274 static int xmlSubstituteEntitiesDefaultValueThrDef = 0;
276 xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL;
277 static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL;
278 xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL;
279 static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL;
281 xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue = NULL;
282 static xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValueThrDef = NULL;
284 xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue = NULL;
285 static xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValueThrDef = NULL;
288 * Error handling
291 /* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
292 /* Must initialize xmlGenericError in xmlInitParser */
293 void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
294 const char *msg,
295 ...);
297 * xmlGenericError:
299 * Global setting: function used for generic error callbacks
301 xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc;
302 static xmlGenericErrorFunc xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
304 * xmlStructuredError:
306 * Global setting: function used for structured error callbacks
308 xmlStructuredErrorFunc xmlStructuredError = NULL;
309 static xmlStructuredErrorFunc xmlStructuredErrorThrDef = NULL;
311 * xmlGenericErrorContext:
313 * Global setting passed to generic error callbacks
315 void *xmlGenericErrorContext = NULL;
316 static void *xmlGenericErrorContextThrDef = NULL;
318 * xmlStructuredErrorContext:
320 * Global setting passed to structured error callbacks
322 void *xmlStructuredErrorContext = NULL;
323 static void *xmlStructuredErrorContextThrDef = NULL;
324 xmlError xmlLastError;
327 * output defaults
330 * xmlIndentTreeOutput:
332 * Global setting, asking the serializer to indent the output tree by default
333 * Enabled by default
335 int xmlIndentTreeOutput = 1;
336 static int xmlIndentTreeOutputThrDef = 1;
339 * xmlTreeIndentString:
341 * The string used to do one-level indent. By default is equal to " " (two spaces)
343 const char *xmlTreeIndentString = " ";
344 static const char *xmlTreeIndentStringThrDef = " ";
347 * xmlSaveNoEmptyTags:
349 * Global setting, asking the serializer to not output empty tags
350 * as <empty/> but <empty></empty>. those two forms are indistinguishable
351 * once parsed.
352 * Disabled by default
354 int xmlSaveNoEmptyTags = 0;
355 static int xmlSaveNoEmptyTagsThrDef = 0;
357 #ifdef LIBXML_SAX1_ENABLED
359 * xmlDefaultSAXHandler:
361 * Default SAX version1 handler for XML, builds the DOM tree
363 xmlSAXHandlerV1 xmlDefaultSAXHandler = {
364 xmlSAX2InternalSubset,
365 xmlSAX2IsStandalone,
366 xmlSAX2HasInternalSubset,
367 xmlSAX2HasExternalSubset,
368 xmlSAX2ResolveEntity,
369 xmlSAX2GetEntity,
370 xmlSAX2EntityDecl,
371 xmlSAX2NotationDecl,
372 xmlSAX2AttributeDecl,
373 xmlSAX2ElementDecl,
374 xmlSAX2UnparsedEntityDecl,
375 xmlSAX2SetDocumentLocator,
376 xmlSAX2StartDocument,
377 xmlSAX2EndDocument,
378 xmlSAX2StartElement,
379 xmlSAX2EndElement,
380 xmlSAX2Reference,
381 xmlSAX2Characters,
382 xmlSAX2Characters,
383 xmlSAX2ProcessingInstruction,
384 xmlSAX2Comment,
385 xmlParserWarning,
386 xmlParserError,
387 xmlParserError,
388 xmlSAX2GetParameterEntity,
389 xmlSAX2CDataBlock,
390 xmlSAX2ExternalSubset,
393 #endif /* LIBXML_SAX1_ENABLED */
396 * xmlDefaultSAXLocator:
398 * The default SAX Locator
399 * { getPublicId, getSystemId, getLineNumber, getColumnNumber}
401 xmlSAXLocator xmlDefaultSAXLocator = {
402 xmlSAX2GetPublicId,
403 xmlSAX2GetSystemId,
404 xmlSAX2GetLineNumber,
405 xmlSAX2GetColumnNumber
408 #ifdef LIBXML_HTML_ENABLED
410 * htmlDefaultSAXHandler:
412 * Default old SAX v1 handler for HTML, builds the DOM tree
414 xmlSAXHandlerV1 htmlDefaultSAXHandler = {
415 xmlSAX2InternalSubset,
416 NULL,
417 NULL,
418 NULL,
419 NULL,
420 xmlSAX2GetEntity,
421 NULL,
422 NULL,
423 NULL,
424 NULL,
425 NULL,
426 xmlSAX2SetDocumentLocator,
427 xmlSAX2StartDocument,
428 xmlSAX2EndDocument,
429 xmlSAX2StartElement,
430 xmlSAX2EndElement,
431 NULL,
432 xmlSAX2Characters,
433 xmlSAX2IgnorableWhitespace,
434 xmlSAX2ProcessingInstruction,
435 xmlSAX2Comment,
436 xmlParserWarning,
437 xmlParserError,
438 xmlParserError,
439 xmlSAX2GetParameterEntity,
440 xmlSAX2CDataBlock,
441 NULL,
444 #endif /* LIBXML_HTML_ENABLED */
447 * xmlInitializeGlobalState:
448 * @gs: a pointer to a newly allocated global state
450 * xmlInitializeGlobalState() initialize a global state with all the
451 * default values of the library.
453 void
454 xmlInitializeGlobalState(xmlGlobalStatePtr gs)
456 #ifdef DEBUG_GLOBALS
457 fprintf(stderr, "Initializing globals at %lu for thread %d\n",
458 (unsigned long) gs, xmlGetThreadId());
459 #endif
462 * Perform initialization as required by libxml
464 if (xmlThrDefMutex == NULL)
465 xmlInitGlobals();
467 xmlMutexLock(xmlThrDefMutex);
469 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
470 inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
471 #endif
473 gs->oldXMLWDcompatibility = 0;
474 gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
475 gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;
476 #if defined(LIBXML_SAX1_ENABLED) && defined(LIBXML_LEGACY_ENABLED)
477 initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
478 #endif /* LIBXML_SAX1_ENABLED */
479 gs->xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId;
480 gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
481 gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
482 gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
483 gs->xmlDoValidityCheckingDefaultValue =
484 xmlDoValidityCheckingDefaultValueThrDef;
485 #if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
486 gs->xmlFree = (xmlFreeFunc) xmlMemFree;
487 gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
488 gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
489 gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
490 gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
491 #else
492 gs->xmlFree = (xmlFreeFunc) free;
493 gs->xmlMalloc = (xmlMallocFunc) malloc;
494 gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
495 gs->xmlRealloc = (xmlReallocFunc) realloc;
496 gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
497 #endif
498 gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
499 gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
500 gs->xmlTreeIndentString = xmlTreeIndentStringThrDef;
501 gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
502 gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
503 gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
504 gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
505 gs->xmlParserVersion = LIBXML_VERSION_STRING;
506 gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
507 gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
508 gs->xmlSubstituteEntitiesDefaultValue =
509 xmlSubstituteEntitiesDefaultValueThrDef;
511 gs->xmlGenericError = xmlGenericErrorThrDef;
512 gs->xmlStructuredError = xmlStructuredErrorThrDef;
513 gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
514 gs->xmlStructuredErrorContext = xmlStructuredErrorContextThrDef;
515 gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
516 gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
518 gs->xmlParserInputBufferCreateFilenameValue = xmlParserInputBufferCreateFilenameValueThrDef;
519 gs->xmlOutputBufferCreateFilenameValue = xmlOutputBufferCreateFilenameValueThrDef;
520 memset(&gs->xmlLastError, 0, sizeof(xmlError));
522 xmlMutexUnlock(xmlThrDefMutex);
526 * xmlCleanupGlobals:
528 * DEPRECATED: This function will be made private. Call xmlCleanupParser
529 * to free global state but see the warnings there. xmlCleanupParser
530 * should be only called once at program exit. In most cases, you don't
531 * have call cleanup functions at all.
533 * Additional cleanup for multi-threading
535 void xmlCleanupGlobals(void)
537 xmlResetError(&xmlLastError);
539 if (xmlThrDefMutex != NULL) {
540 xmlFreeMutex(xmlThrDefMutex);
541 xmlThrDefMutex = NULL;
543 __xmlGlobalInitMutexDestroy();
547 * DOC_DISABLE : we ignore missing doc for the xmlThrDef functions,
548 * those are really internal work
550 void
551 xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
552 xmlMutexLock(xmlThrDefMutex);
553 xmlGenericErrorContextThrDef = ctx;
554 if (handler != NULL)
555 xmlGenericErrorThrDef = handler;
556 else
557 xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
558 xmlMutexUnlock(xmlThrDefMutex);
561 void
562 xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
563 xmlMutexLock(xmlThrDefMutex);
564 xmlStructuredErrorContextThrDef = ctx;
565 xmlStructuredErrorThrDef = handler;
566 xmlMutexUnlock(xmlThrDefMutex);
570 * xmlRegisterNodeDefault:
571 * @func: function pointer to the new RegisterNodeFunc
573 * Registers a callback for node creation
575 * Returns the old value of the registration function
577 xmlRegisterNodeFunc
578 xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
580 xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue;
582 __xmlRegisterCallbacks = 1;
583 xmlRegisterNodeDefaultValue = func;
584 return(old);
587 xmlRegisterNodeFunc
588 xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
590 xmlRegisterNodeFunc old;
592 xmlMutexLock(xmlThrDefMutex);
593 old = xmlRegisterNodeDefaultValueThrDef;
595 __xmlRegisterCallbacks = 1;
596 xmlRegisterNodeDefaultValueThrDef = func;
597 xmlMutexUnlock(xmlThrDefMutex);
599 return(old);
603 * xmlDeregisterNodeDefault:
604 * @func: function pointer to the new DeregisterNodeFunc
606 * Registers a callback for node destruction
608 * Returns the previous value of the deregistration function
610 xmlDeregisterNodeFunc
611 xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
613 xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue;
615 __xmlRegisterCallbacks = 1;
616 xmlDeregisterNodeDefaultValue = func;
617 return(old);
620 xmlDeregisterNodeFunc
621 xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
623 xmlDeregisterNodeFunc old;
625 xmlMutexLock(xmlThrDefMutex);
626 old = xmlDeregisterNodeDefaultValueThrDef;
628 __xmlRegisterCallbacks = 1;
629 xmlDeregisterNodeDefaultValueThrDef = func;
630 xmlMutexUnlock(xmlThrDefMutex);
632 return(old);
635 xmlParserInputBufferCreateFilenameFunc
636 xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
638 xmlParserInputBufferCreateFilenameFunc old;
640 xmlMutexLock(xmlThrDefMutex);
641 old = xmlParserInputBufferCreateFilenameValueThrDef;
642 if (old == NULL) {
643 old = __xmlParserInputBufferCreateFilename;
646 xmlParserInputBufferCreateFilenameValueThrDef = func;
647 xmlMutexUnlock(xmlThrDefMutex);
649 return(old);
652 xmlOutputBufferCreateFilenameFunc
653 xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
655 xmlOutputBufferCreateFilenameFunc old;
657 xmlMutexLock(xmlThrDefMutex);
658 old = xmlOutputBufferCreateFilenameValueThrDef;
659 #ifdef LIBXML_OUTPUT_ENABLED
660 if (old == NULL) {
661 old = __xmlOutputBufferCreateFilename;
663 #endif
664 xmlOutputBufferCreateFilenameValueThrDef = func;
665 xmlMutexUnlock(xmlThrDefMutex);
667 return(old);
670 #ifdef LIBXML_HTML_ENABLED
671 #undef htmlDefaultSAXHandler
672 xmlSAXHandlerV1 *
673 __htmlDefaultSAXHandler(void) {
674 if (IS_MAIN_THREAD)
675 return (&htmlDefaultSAXHandler);
676 else
677 return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
679 #endif
681 #undef xmlLastError
682 xmlError *
683 __xmlLastError(void) {
684 if (IS_MAIN_THREAD)
685 return (&xmlLastError);
686 else
687 return (&xmlGetGlobalState()->xmlLastError);
691 * The following memory routines were apparently lost at some point,
692 * and were re-inserted at this point on June 10, 2004. Hope it's
693 * the right place for them :-)
695 #if defined(LIBXML_THREAD_ALLOC_ENABLED) && defined(LIBXML_THREAD_ENABLED)
696 #undef xmlMalloc
697 xmlMallocFunc *
698 __xmlMalloc(void){
699 if (IS_MAIN_THREAD)
700 return (&xmlMalloc);
701 else
702 return (&xmlGetGlobalState()->xmlMalloc);
705 #undef xmlMallocAtomic
706 xmlMallocFunc *
707 __xmlMallocAtomic(void){
708 if (IS_MAIN_THREAD)
709 return (&xmlMallocAtomic);
710 else
711 return (&xmlGetGlobalState()->xmlMallocAtomic);
714 #undef xmlRealloc
715 xmlReallocFunc *
716 __xmlRealloc(void){
717 if (IS_MAIN_THREAD)
718 return (&xmlRealloc);
719 else
720 return (&xmlGetGlobalState()->xmlRealloc);
723 #undef xmlFree
724 xmlFreeFunc *
725 __xmlFree(void){
726 if (IS_MAIN_THREAD)
727 return (&xmlFree);
728 else
729 return (&xmlGetGlobalState()->xmlFree);
732 xmlStrdupFunc *
733 __xmlMemStrdup(void){
734 if (IS_MAIN_THREAD)
735 return (&xmlMemStrdup);
736 else
737 return (&xmlGetGlobalState()->xmlMemStrdup);
740 #endif
743 * Everything starting from the line below is
744 * Automatically generated by build_glob.py.
745 * Do not modify the previous line.
749 #undef oldXMLWDcompatibility
750 int *
751 __oldXMLWDcompatibility(void) {
752 if (IS_MAIN_THREAD)
753 return (&oldXMLWDcompatibility);
754 else
755 return (&xmlGetGlobalState()->oldXMLWDcompatibility);
758 #undef xmlBufferAllocScheme
759 xmlBufferAllocationScheme *
760 __xmlBufferAllocScheme(void) {
761 if (IS_MAIN_THREAD)
762 return (&xmlBufferAllocScheme);
763 else
764 return (&xmlGetGlobalState()->xmlBufferAllocScheme);
766 xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
767 xmlBufferAllocationScheme ret;
768 xmlMutexLock(xmlThrDefMutex);
769 ret = xmlBufferAllocSchemeThrDef;
770 xmlBufferAllocSchemeThrDef = v;
771 xmlMutexUnlock(xmlThrDefMutex);
772 return ret;
775 #undef xmlDefaultBufferSize
776 int *
777 __xmlDefaultBufferSize(void) {
778 if (IS_MAIN_THREAD)
779 return (&xmlDefaultBufferSize);
780 else
781 return (&xmlGetGlobalState()->xmlDefaultBufferSize);
783 int xmlThrDefDefaultBufferSize(int v) {
784 int ret;
785 xmlMutexLock(xmlThrDefMutex);
786 ret = xmlDefaultBufferSizeThrDef;
787 xmlDefaultBufferSizeThrDef = v;
788 xmlMutexUnlock(xmlThrDefMutex);
789 return ret;
792 #ifdef LIBXML_SAX1_ENABLED
793 #undef xmlDefaultSAXHandler
794 xmlSAXHandlerV1 *
795 __xmlDefaultSAXHandler(void) {
796 if (IS_MAIN_THREAD)
797 return (&xmlDefaultSAXHandler);
798 else
799 return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
801 #endif /* LIBXML_SAX1_ENABLED */
803 #undef xmlDefaultSAXLocator
804 xmlSAXLocator *
805 __xmlDefaultSAXLocator(void) {
806 if (IS_MAIN_THREAD)
807 return (&xmlDefaultSAXLocator);
808 else
809 return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
812 #undef xmlDoValidityCheckingDefaultValue
813 int *
814 __xmlDoValidityCheckingDefaultValue(void) {
815 if (IS_MAIN_THREAD)
816 return (&xmlDoValidityCheckingDefaultValue);
817 else
818 return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
820 int xmlThrDefDoValidityCheckingDefaultValue(int v) {
821 int ret;
822 xmlMutexLock(xmlThrDefMutex);
823 ret = xmlDoValidityCheckingDefaultValueThrDef;
824 xmlDoValidityCheckingDefaultValueThrDef = v;
825 xmlMutexUnlock(xmlThrDefMutex);
826 return ret;
829 #undef xmlGenericError
830 xmlGenericErrorFunc * XMLCALL
831 __xmlGenericError(void) {
832 if (IS_MAIN_THREAD)
833 return (&xmlGenericError);
834 else
835 return (&xmlGetGlobalState()->xmlGenericError);
838 #undef xmlStructuredError
839 xmlStructuredErrorFunc *
840 __xmlStructuredError(void) {
841 if (IS_MAIN_THREAD)
842 return (&xmlStructuredError);
843 else
844 return (&xmlGetGlobalState()->xmlStructuredError);
847 #undef xmlGenericErrorContext
848 void * *
849 __xmlGenericErrorContext(void) {
850 if (IS_MAIN_THREAD)
851 return (&xmlGenericErrorContext);
852 else
853 return (&xmlGetGlobalState()->xmlGenericErrorContext);
856 #undef xmlStructuredErrorContext
857 void * *
858 __xmlStructuredErrorContext(void) {
859 if (IS_MAIN_THREAD)
860 return (&xmlStructuredErrorContext);
861 else
862 return (&xmlGetGlobalState()->xmlStructuredErrorContext);
865 #undef xmlGetWarningsDefaultValue
866 int *
867 __xmlGetWarningsDefaultValue(void) {
868 if (IS_MAIN_THREAD)
869 return (&xmlGetWarningsDefaultValue);
870 else
871 return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
873 int xmlThrDefGetWarningsDefaultValue(int v) {
874 int ret;
875 xmlMutexLock(xmlThrDefMutex);
876 ret = xmlGetWarningsDefaultValueThrDef;
877 xmlGetWarningsDefaultValueThrDef = v;
878 xmlMutexUnlock(xmlThrDefMutex);
879 return ret;
882 #undef xmlIndentTreeOutput
883 int *
884 __xmlIndentTreeOutput(void) {
885 if (IS_MAIN_THREAD)
886 return (&xmlIndentTreeOutput);
887 else
888 return (&xmlGetGlobalState()->xmlIndentTreeOutput);
890 int xmlThrDefIndentTreeOutput(int v) {
891 int ret;
892 xmlMutexLock(xmlThrDefMutex);
893 ret = xmlIndentTreeOutputThrDef;
894 xmlIndentTreeOutputThrDef = v;
895 xmlMutexUnlock(xmlThrDefMutex);
896 return ret;
899 #undef xmlTreeIndentString
900 const char * *
901 __xmlTreeIndentString(void) {
902 if (IS_MAIN_THREAD)
903 return (&xmlTreeIndentString);
904 else
905 return (&xmlGetGlobalState()->xmlTreeIndentString);
907 const char * xmlThrDefTreeIndentString(const char * v) {
908 const char * ret;
909 xmlMutexLock(xmlThrDefMutex);
910 ret = xmlTreeIndentStringThrDef;
911 xmlTreeIndentStringThrDef = v;
912 xmlMutexUnlock(xmlThrDefMutex);
913 return ret;
916 #undef xmlKeepBlanksDefaultValue
917 int *
918 __xmlKeepBlanksDefaultValue(void) {
919 if (IS_MAIN_THREAD)
920 return (&xmlKeepBlanksDefaultValue);
921 else
922 return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
924 int xmlThrDefKeepBlanksDefaultValue(int v) {
925 int ret;
926 xmlMutexLock(xmlThrDefMutex);
927 ret = xmlKeepBlanksDefaultValueThrDef;
928 xmlKeepBlanksDefaultValueThrDef = v;
929 xmlMutexUnlock(xmlThrDefMutex);
930 return ret;
933 #undef xmlLineNumbersDefaultValue
934 int *
935 __xmlLineNumbersDefaultValue(void) {
936 if (IS_MAIN_THREAD)
937 return (&xmlLineNumbersDefaultValue);
938 else
939 return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
941 int xmlThrDefLineNumbersDefaultValue(int v) {
942 int ret;
943 xmlMutexLock(xmlThrDefMutex);
944 ret = xmlLineNumbersDefaultValueThrDef;
945 xmlLineNumbersDefaultValueThrDef = v;
946 xmlMutexUnlock(xmlThrDefMutex);
947 return ret;
950 #undef xmlLoadExtDtdDefaultValue
951 int *
952 __xmlLoadExtDtdDefaultValue(void) {
953 if (IS_MAIN_THREAD)
954 return (&xmlLoadExtDtdDefaultValue);
955 else
956 return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
958 int xmlThrDefLoadExtDtdDefaultValue(int v) {
959 int ret;
960 xmlMutexLock(xmlThrDefMutex);
961 ret = xmlLoadExtDtdDefaultValueThrDef;
962 xmlLoadExtDtdDefaultValueThrDef = v;
963 xmlMutexUnlock(xmlThrDefMutex);
964 return ret;
967 #undef xmlParserDebugEntities
968 int *
969 __xmlParserDebugEntities(void) {
970 if (IS_MAIN_THREAD)
971 return (&xmlParserDebugEntities);
972 else
973 return (&xmlGetGlobalState()->xmlParserDebugEntities);
975 int xmlThrDefParserDebugEntities(int v) {
976 int ret;
977 xmlMutexLock(xmlThrDefMutex);
978 ret = xmlParserDebugEntitiesThrDef;
979 xmlParserDebugEntitiesThrDef = v;
980 xmlMutexUnlock(xmlThrDefMutex);
981 return ret;
984 #undef xmlParserVersion
985 const char * *
986 __xmlParserVersion(void) {
987 if (IS_MAIN_THREAD)
988 return (&xmlParserVersion);
989 else
990 return (&xmlGetGlobalState()->xmlParserVersion);
993 #undef xmlPedanticParserDefaultValue
994 int *
995 __xmlPedanticParserDefaultValue(void) {
996 if (IS_MAIN_THREAD)
997 return (&xmlPedanticParserDefaultValue);
998 else
999 return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
1001 int xmlThrDefPedanticParserDefaultValue(int v) {
1002 int ret;
1003 xmlMutexLock(xmlThrDefMutex);
1004 ret = xmlPedanticParserDefaultValueThrDef;
1005 xmlPedanticParserDefaultValueThrDef = v;
1006 xmlMutexUnlock(xmlThrDefMutex);
1007 return ret;
1010 #undef xmlSaveNoEmptyTags
1011 int *
1012 __xmlSaveNoEmptyTags(void) {
1013 if (IS_MAIN_THREAD)
1014 return (&xmlSaveNoEmptyTags);
1015 else
1016 return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
1018 int xmlThrDefSaveNoEmptyTags(int v) {
1019 int ret;
1020 xmlMutexLock(xmlThrDefMutex);
1021 ret = xmlSaveNoEmptyTagsThrDef;
1022 xmlSaveNoEmptyTagsThrDef = v;
1023 xmlMutexUnlock(xmlThrDefMutex);
1024 return ret;
1027 #undef xmlSubstituteEntitiesDefaultValue
1028 int *
1029 __xmlSubstituteEntitiesDefaultValue(void) {
1030 if (IS_MAIN_THREAD)
1031 return (&xmlSubstituteEntitiesDefaultValue);
1032 else
1033 return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
1035 int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
1036 int ret;
1037 xmlMutexLock(xmlThrDefMutex);
1038 ret = xmlSubstituteEntitiesDefaultValueThrDef;
1039 xmlSubstituteEntitiesDefaultValueThrDef = v;
1040 xmlMutexUnlock(xmlThrDefMutex);
1041 return ret;
1044 #undef xmlRegisterNodeDefaultValue
1045 xmlRegisterNodeFunc * XMLCALL
1046 __xmlRegisterNodeDefaultValue(void) {
1047 if (IS_MAIN_THREAD)
1048 return (&xmlRegisterNodeDefaultValue);
1049 else
1050 return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue);
1053 #undef xmlDeregisterNodeDefaultValue
1054 xmlDeregisterNodeFunc * XMLCALL
1055 __xmlDeregisterNodeDefaultValue(void) {
1056 if (IS_MAIN_THREAD)
1057 return (&xmlDeregisterNodeDefaultValue);
1058 else
1059 return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue);
1062 #undef xmlParserInputBufferCreateFilenameValue
1063 xmlParserInputBufferCreateFilenameFunc * XMLCALL
1064 __xmlParserInputBufferCreateFilenameValue(void) {
1065 if (IS_MAIN_THREAD)
1066 return (&xmlParserInputBufferCreateFilenameValue);
1067 else
1068 return (&xmlGetGlobalState()->xmlParserInputBufferCreateFilenameValue);
1071 #undef xmlOutputBufferCreateFilenameValue
1072 xmlOutputBufferCreateFilenameFunc * XMLCALL
1073 __xmlOutputBufferCreateFilenameValue(void) {
1074 if (IS_MAIN_THREAD)
1075 return (&xmlOutputBufferCreateFilenameValue);
1076 else
1077 return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue);