winebus.sys: Identify DualSense Edge as a DualSense controller.
[wine.git] / libs / xml2 / globals.c
blobba7e9653cdc9acabd347cc0af0103d77157bc93c
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 #include "private/error.h"
25 #include "private/globals.h"
26 #include "private/threads.h"
27 #include "private/tree.h"
29 /* #define DEBUG_GLOBALS */
32 * Helpful Macro
34 #ifdef LIBXML_THREAD_ENABLED
35 #define IS_MAIN_THREAD (xmlIsMainThread())
36 #else
37 #define IS_MAIN_THREAD 1
38 #endif
41 * Mutex to protect "ForNewThreads" variables
43 static xmlMutex xmlThrDefMutex;
45 /**
46 * xmlInitGlobals:
48 * DEPRECATED: Alias for xmlInitParser.
50 void xmlInitGlobals(void) {
51 xmlInitParser();
54 /**
55 * xmlInitGlobalsInternal:
57 * Additional initialisation for multi-threading
59 void xmlInitGlobalsInternal(void) {
60 xmlInitMutex(&xmlThrDefMutex);
63 /************************************************************************
64 * *
65 * All the user accessible global variables of the library *
66 * *
67 ************************************************************************/
70 * Memory allocation routines
72 #undef xmlFree
73 #undef xmlMalloc
74 #undef xmlMallocAtomic
75 #undef xmlMemStrdup
76 #undef xmlRealloc
78 #if defined(DEBUG_MEMORY_LOCATION) || defined(DEBUG_MEMORY)
79 xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
80 xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
81 xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
82 xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
83 xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
84 #else
85 /**
86 * xmlFree:
87 * @mem: an already allocated block of memory
89 * The variable holding the libxml free() implementation
91 xmlFreeFunc xmlFree = free;
92 /**
93 * xmlMalloc:
94 * @size: the size requested in bytes
96 * The variable holding the libxml malloc() implementation
98 * Returns a pointer to the newly allocated block or NULL in case of error
100 xmlMallocFunc xmlMalloc = malloc;
102 * xmlMallocAtomic:
103 * @size: the size requested in bytes
105 * The variable holding the libxml malloc() implementation for atomic
106 * data (i.e. blocks not containing pointers), useful when using a
107 * garbage collecting allocator.
109 * Returns a pointer to the newly allocated block or NULL in case of error
111 xmlMallocFunc xmlMallocAtomic = malloc;
113 * xmlRealloc:
114 * @mem: an already allocated block of memory
115 * @size: the new size requested in bytes
117 * The variable holding the libxml realloc() implementation
119 * Returns a pointer to the newly reallocated block or NULL in case of error
121 xmlReallocFunc xmlRealloc = realloc;
123 * xmlPosixStrdup
124 * @cur: the input char *
126 * a strdup implementation with a type signature matching POSIX
128 * Returns a new xmlChar * or NULL
130 static char *
131 xmlPosixStrdup(const char *cur) {
132 return((char*) xmlCharStrdup(cur));
135 * xmlMemStrdup:
136 * @str: a zero terminated string
138 * The variable holding the libxml strdup() implementation
140 * Returns the copy of the string or NULL in case of error
142 xmlStrdupFunc xmlMemStrdup = xmlPosixStrdup;
143 #endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */
145 #include <libxml/threads.h>
146 #include <libxml/globals.h>
147 #include <libxml/SAX.h>
149 #undef htmlDefaultSAXHandler
150 #undef oldXMLWDcompatibility
151 #undef xmlBufferAllocScheme
152 #undef xmlDefaultBufferSize
153 #undef xmlDefaultSAXHandler
154 #undef xmlDefaultSAXLocator
155 #undef xmlDoValidityCheckingDefaultValue
156 #undef xmlGenericError
157 #undef xmlStructuredError
158 #undef xmlGenericErrorContext
159 #undef xmlStructuredErrorContext
160 #undef xmlGetWarningsDefaultValue
161 #undef xmlIndentTreeOutput
162 #undef xmlTreeIndentString
163 #undef xmlKeepBlanksDefaultValue
164 #undef xmlLineNumbersDefaultValue
165 #undef xmlLoadExtDtdDefaultValue
166 #undef xmlParserDebugEntities
167 #undef xmlParserVersion
168 #undef xmlPedanticParserDefaultValue
169 #undef xmlSaveNoEmptyTags
170 #undef xmlSubstituteEntitiesDefaultValue
171 #undef xmlRegisterNodeDefaultValue
172 #undef xmlDeregisterNodeDefaultValue
173 #undef xmlLastError
175 #undef xmlParserInputBufferCreateFilenameValue
176 #undef xmlOutputBufferCreateFilenameValue
178 * xmlParserVersion:
180 * Constant string describing the internal version of the library
182 const char *xmlParserVersion = LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA;
185 * xmlBufferAllocScheme:
187 * DEPRECATED: Don't use.
189 * Global setting, default allocation policy for buffers, default is
190 * XML_BUFFER_ALLOC_EXACT
192 xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
193 static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_EXACT;
195 * xmlDefaultBufferSize:
197 * DEPRECATED: Don't use.
199 * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
201 int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
202 static int xmlDefaultBufferSizeThrDef = BASE_BUFFER_SIZE;
205 * Parser defaults
209 * oldXMLWDcompatibility:
211 * Global setting, DEPRECATED.
213 int oldXMLWDcompatibility = 0; /* DEPRECATED */
215 * xmlParserDebugEntities:
217 * DEPRECATED: Don't use
219 * Global setting, asking the parser to print out debugging information.
220 * while handling entities.
221 * Disabled by default
223 int xmlParserDebugEntities = 0;
224 static int xmlParserDebugEntitiesThrDef = 0;
226 * xmlDoValidityCheckingDefaultValue:
228 * DEPRECATED: Use the modern options API with XML_PARSE_DTDVALID.
230 * Global setting, indicate that the parser should work in validating mode.
231 * Disabled by default.
233 int xmlDoValidityCheckingDefaultValue = 0;
234 static int xmlDoValidityCheckingDefaultValueThrDef = 0;
236 * xmlGetWarningsDefaultValue:
238 * DEPRECATED: Don't use
240 * Global setting, indicate that the DTD validation should provide warnings.
241 * Activated by default.
243 int xmlGetWarningsDefaultValue = 1;
244 static int xmlGetWarningsDefaultValueThrDef = 1;
246 * xmlLoadExtDtdDefaultValue:
248 * DEPRECATED: Use the modern options API with XML_PARSE_DTDLOAD.
250 * Global setting, indicate that the parser should load DTD while not
251 * validating.
252 * Disabled by default.
254 int xmlLoadExtDtdDefaultValue = 0;
255 static int xmlLoadExtDtdDefaultValueThrDef = 0;
257 * xmlPedanticParserDefaultValue:
259 * DEPRECATED: Use the modern options API with XML_PARSE_PEDANTIC.
261 * Global setting, indicate that the parser be pedantic
262 * Disabled by default.
264 int xmlPedanticParserDefaultValue = 0;
265 static int xmlPedanticParserDefaultValueThrDef = 0;
267 * xmlLineNumbersDefaultValue:
269 * DEPRECATED: The modern options API always enables line numbers.
271 * Global setting, indicate that the parser should store the line number
272 * in the content field of elements in the DOM tree.
273 * Disabled by default since this may not be safe for old classes of
274 * application.
276 int xmlLineNumbersDefaultValue = 0;
277 static int xmlLineNumbersDefaultValueThrDef = 0;
279 * xmlKeepBlanksDefaultValue:
281 * DEPRECATED: Use the modern options API with XML_PARSE_NOBLANKS.
283 * Global setting, indicate that the parser should keep all blanks
284 * nodes found in the content
285 * Activated by default, this is actually needed to have the parser
286 * conformant to the XML Recommendation, however the option is kept
287 * for some applications since this was libxml1 default behaviour.
289 int xmlKeepBlanksDefaultValue = 1;
290 static int xmlKeepBlanksDefaultValueThrDef = 1;
292 * xmlSubstituteEntitiesDefaultValue:
294 * DEPRECATED: Use the modern options API with XML_PARSE_NOENT.
296 * Global setting, indicate that the parser should not generate entity
297 * references but replace them with the actual content of the entity
298 * Disabled by default, this should be activated when using XPath since
299 * the XPath data model requires entities replacement and the XPath
300 * engine does not handle entities references transparently.
302 int xmlSubstituteEntitiesDefaultValue = 0;
303 static int xmlSubstituteEntitiesDefaultValueThrDef = 0;
306 * xmlRegisterNodeDefaultValue:
308 * DEPRECATED: Don't use
310 xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL;
311 static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL;
314 * xmlDeregisterNodeDefaultValue:
316 * DEPRECATED: Don't use
318 xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL;
319 static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL;
322 * xmlParserInputBufferCreateFilenameValue:
324 * DEPRECATED: Don't use
326 xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue = NULL;
327 static xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValueThrDef = NULL;
330 * xmlOutputBufferCreateFilenameValue:
332 * DEPRECATED: Don't use
334 xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue = NULL;
335 static xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValueThrDef = NULL;
338 * xmlGenericError:
340 * Global setting: function used for generic error callbacks
342 xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc;
343 static xmlGenericErrorFunc xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
345 * xmlStructuredError:
347 * Global setting: function used for structured error callbacks
349 xmlStructuredErrorFunc xmlStructuredError = NULL;
350 static xmlStructuredErrorFunc xmlStructuredErrorThrDef = NULL;
352 * xmlGenericErrorContext:
354 * Global setting passed to generic error callbacks
356 void *xmlGenericErrorContext = NULL;
357 static void *xmlGenericErrorContextThrDef = NULL;
359 * xmlStructuredErrorContext:
361 * Global setting passed to structured error callbacks
363 void *xmlStructuredErrorContext = NULL;
364 static void *xmlStructuredErrorContextThrDef = NULL;
365 xmlError xmlLastError;
368 * output defaults
371 * xmlIndentTreeOutput:
373 * Global setting, asking the serializer to indent the output tree by default
374 * Enabled by default
376 int xmlIndentTreeOutput = 1;
377 static int xmlIndentTreeOutputThrDef = 1;
380 * xmlTreeIndentString:
382 * The string used to do one-level indent. By default is equal to " " (two spaces)
384 const char *xmlTreeIndentString = " ";
385 static const char *xmlTreeIndentStringThrDef = " ";
388 * xmlSaveNoEmptyTags:
390 * Global setting, asking the serializer to not output empty tags
391 * as <empty/> but <empty></empty>. those two forms are indistinguishable
392 * once parsed.
393 * Disabled by default
395 int xmlSaveNoEmptyTags = 0;
396 static int xmlSaveNoEmptyTagsThrDef = 0;
398 #ifdef LIBXML_SAX1_ENABLED
400 * xmlDefaultSAXHandler:
402 * DEPRECATED: This handler is unused and will be removed from future
403 * versions.
405 * Default SAX version1 handler for XML, builds the DOM tree
407 xmlSAXHandlerV1 xmlDefaultSAXHandler = {
408 xmlSAX2InternalSubset,
409 xmlSAX2IsStandalone,
410 xmlSAX2HasInternalSubset,
411 xmlSAX2HasExternalSubset,
412 xmlSAX2ResolveEntity,
413 xmlSAX2GetEntity,
414 xmlSAX2EntityDecl,
415 xmlSAX2NotationDecl,
416 xmlSAX2AttributeDecl,
417 xmlSAX2ElementDecl,
418 xmlSAX2UnparsedEntityDecl,
419 xmlSAX2SetDocumentLocator,
420 xmlSAX2StartDocument,
421 xmlSAX2EndDocument,
422 xmlSAX2StartElement,
423 xmlSAX2EndElement,
424 xmlSAX2Reference,
425 xmlSAX2Characters,
426 xmlSAX2Characters,
427 xmlSAX2ProcessingInstruction,
428 xmlSAX2Comment,
429 xmlParserWarning,
430 xmlParserError,
431 xmlParserError,
432 xmlSAX2GetParameterEntity,
433 xmlSAX2CDataBlock,
434 xmlSAX2ExternalSubset,
437 #endif /* LIBXML_SAX1_ENABLED */
440 * xmlDefaultSAXLocator:
442 * DEPRECATED: Don't use
444 * The default SAX Locator
445 * { getPublicId, getSystemId, getLineNumber, getColumnNumber}
447 xmlSAXLocator xmlDefaultSAXLocator = {
448 xmlSAX2GetPublicId,
449 xmlSAX2GetSystemId,
450 xmlSAX2GetLineNumber,
451 xmlSAX2GetColumnNumber
454 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_SAX1_ENABLED)
456 * htmlDefaultSAXHandler:
458 * DEPRECATED: This handler is unused and will be removed from future
459 * versions.
461 * Default old SAX v1 handler for HTML, builds the DOM tree
463 xmlSAXHandlerV1 htmlDefaultSAXHandler = {
464 xmlSAX2InternalSubset,
465 NULL,
466 NULL,
467 NULL,
468 NULL,
469 xmlSAX2GetEntity,
470 NULL,
471 NULL,
472 NULL,
473 NULL,
474 NULL,
475 xmlSAX2SetDocumentLocator,
476 xmlSAX2StartDocument,
477 xmlSAX2EndDocument,
478 xmlSAX2StartElement,
479 xmlSAX2EndElement,
480 NULL,
481 xmlSAX2Characters,
482 xmlSAX2IgnorableWhitespace,
483 xmlSAX2ProcessingInstruction,
484 xmlSAX2Comment,
485 xmlParserWarning,
486 xmlParserError,
487 xmlParserError,
488 NULL,
489 xmlSAX2CDataBlock,
490 NULL,
493 #endif /* LIBXML_HTML_ENABLED */
496 * xmlInitializeGlobalState:
497 * @gs: a pointer to a newly allocated global state
499 * xmlInitializeGlobalState() initialize a global state with all the
500 * default values of the library.
502 void
503 xmlInitializeGlobalState(xmlGlobalStatePtr gs)
505 #ifdef DEBUG_GLOBALS
506 fprintf(stderr, "Initializing globals at %p for thread %d\n",
507 (void *) gs, xmlGetThreadId());
508 #endif
510 xmlMutexLock(&xmlThrDefMutex);
512 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
513 inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
514 #endif
516 gs->oldXMLWDcompatibility = 0;
517 gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
518 gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;
519 #if defined(LIBXML_SAX1_ENABLED) && defined(LIBXML_LEGACY_ENABLED)
520 initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
521 #endif /* LIBXML_SAX1_ENABLED */
522 gs->xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId;
523 gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
524 gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
525 gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
526 gs->xmlDoValidityCheckingDefaultValue =
527 xmlDoValidityCheckingDefaultValueThrDef;
528 #if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
529 gs->xmlFree = (xmlFreeFunc) xmlMemFree;
530 gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
531 gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
532 gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
533 gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
534 #else
535 gs->xmlFree = (xmlFreeFunc) free;
536 gs->xmlMalloc = (xmlMallocFunc) malloc;
537 gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
538 gs->xmlRealloc = (xmlReallocFunc) realloc;
539 gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
540 #endif
541 gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
542 gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
543 gs->xmlTreeIndentString = xmlTreeIndentStringThrDef;
544 gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
545 gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
546 gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
547 gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
548 gs->xmlParserVersion = LIBXML_VERSION_STRING;
549 gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
550 gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
551 gs->xmlSubstituteEntitiesDefaultValue =
552 xmlSubstituteEntitiesDefaultValueThrDef;
554 gs->xmlGenericError = xmlGenericErrorThrDef;
555 gs->xmlStructuredError = xmlStructuredErrorThrDef;
556 gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
557 gs->xmlStructuredErrorContext = xmlStructuredErrorContextThrDef;
558 gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
559 gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
561 gs->xmlParserInputBufferCreateFilenameValue = xmlParserInputBufferCreateFilenameValueThrDef;
562 gs->xmlOutputBufferCreateFilenameValue = xmlOutputBufferCreateFilenameValueThrDef;
563 memset(&gs->xmlLastError, 0, sizeof(xmlError));
565 xmlMutexUnlock(&xmlThrDefMutex);
569 * xmlCleanupGlobals:
571 * DEPRECATED: This function is a no-op. Call xmlCleanupParser
572 * to free global state but see the warnings there. xmlCleanupParser
573 * should be only called once at program exit. In most cases, you don't
574 * have call cleanup functions at all.
576 void xmlCleanupGlobals(void) {
580 * xmlCleanupGlobalsInternal:
582 * Additional cleanup for multi-threading
584 void xmlCleanupGlobalsInternal(void) {
585 xmlResetError(&xmlLastError);
587 xmlCleanupMutex(&xmlThrDefMutex);
588 __xmlGlobalInitMutexDestroy();
591 void
592 xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
593 xmlMutexLock(&xmlThrDefMutex);
594 xmlGenericErrorContextThrDef = ctx;
595 if (handler != NULL)
596 xmlGenericErrorThrDef = handler;
597 else
598 xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
599 xmlMutexUnlock(&xmlThrDefMutex);
602 void
603 xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
604 xmlMutexLock(&xmlThrDefMutex);
605 xmlStructuredErrorContextThrDef = ctx;
606 xmlStructuredErrorThrDef = handler;
607 xmlMutexUnlock(&xmlThrDefMutex);
611 * xmlRegisterNodeDefault:
612 * @func: function pointer to the new RegisterNodeFunc
614 * Registers a callback for node creation
616 * Returns the old value of the registration function
618 xmlRegisterNodeFunc
619 xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
621 xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue;
623 __xmlRegisterCallbacks = 1;
624 xmlRegisterNodeDefaultValue = func;
625 return(old);
628 xmlRegisterNodeFunc
629 xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
631 xmlRegisterNodeFunc old;
633 xmlMutexLock(&xmlThrDefMutex);
634 old = xmlRegisterNodeDefaultValueThrDef;
636 __xmlRegisterCallbacks = 1;
637 xmlRegisterNodeDefaultValueThrDef = func;
638 xmlMutexUnlock(&xmlThrDefMutex);
640 return(old);
644 * xmlDeregisterNodeDefault:
645 * @func: function pointer to the new DeregisterNodeFunc
647 * Registers a callback for node destruction
649 * Returns the previous value of the deregistration function
651 xmlDeregisterNodeFunc
652 xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
654 xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue;
656 __xmlRegisterCallbacks = 1;
657 xmlDeregisterNodeDefaultValue = func;
658 return(old);
661 xmlDeregisterNodeFunc
662 xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
664 xmlDeregisterNodeFunc old;
666 xmlMutexLock(&xmlThrDefMutex);
667 old = xmlDeregisterNodeDefaultValueThrDef;
669 __xmlRegisterCallbacks = 1;
670 xmlDeregisterNodeDefaultValueThrDef = func;
671 xmlMutexUnlock(&xmlThrDefMutex);
673 return(old);
676 xmlParserInputBufferCreateFilenameFunc
677 xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
679 xmlParserInputBufferCreateFilenameFunc old;
681 xmlMutexLock(&xmlThrDefMutex);
682 old = xmlParserInputBufferCreateFilenameValueThrDef;
683 if (old == NULL) {
684 old = __xmlParserInputBufferCreateFilename;
687 xmlParserInputBufferCreateFilenameValueThrDef = func;
688 xmlMutexUnlock(&xmlThrDefMutex);
690 return(old);
693 xmlOutputBufferCreateFilenameFunc
694 xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
696 xmlOutputBufferCreateFilenameFunc old;
698 xmlMutexLock(&xmlThrDefMutex);
699 old = xmlOutputBufferCreateFilenameValueThrDef;
700 #ifdef LIBXML_OUTPUT_ENABLED
701 if (old == NULL) {
702 old = __xmlOutputBufferCreateFilename;
704 #endif
705 xmlOutputBufferCreateFilenameValueThrDef = func;
706 xmlMutexUnlock(&xmlThrDefMutex);
708 return(old);
711 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_SAX1_ENABLED)
712 #undef htmlDefaultSAXHandler
713 xmlSAXHandlerV1 *
714 __htmlDefaultSAXHandler(void) {
715 if (IS_MAIN_THREAD)
716 return (&htmlDefaultSAXHandler);
717 else
718 return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
720 #endif
722 #undef xmlLastError
723 xmlError *
724 __xmlLastError(void) {
725 if (IS_MAIN_THREAD)
726 return (&xmlLastError);
727 else
728 return (&xmlGetGlobalState()->xmlLastError);
732 * The following memory routines were apparently lost at some point,
733 * and were re-inserted at this point on June 10, 2004. Hope it's
734 * the right place for them :-)
736 #if defined(LIBXML_THREAD_ALLOC_ENABLED) && defined(LIBXML_THREAD_ENABLED)
737 #undef xmlMalloc
738 xmlMallocFunc *
739 __xmlMalloc(void){
740 if (IS_MAIN_THREAD)
741 return (&xmlMalloc);
742 else
743 return (&xmlGetGlobalState()->xmlMalloc);
746 #undef xmlMallocAtomic
747 xmlMallocFunc *
748 __xmlMallocAtomic(void){
749 if (IS_MAIN_THREAD)
750 return (&xmlMallocAtomic);
751 else
752 return (&xmlGetGlobalState()->xmlMallocAtomic);
755 #undef xmlRealloc
756 xmlReallocFunc *
757 __xmlRealloc(void){
758 if (IS_MAIN_THREAD)
759 return (&xmlRealloc);
760 else
761 return (&xmlGetGlobalState()->xmlRealloc);
764 #undef xmlFree
765 xmlFreeFunc *
766 __xmlFree(void){
767 if (IS_MAIN_THREAD)
768 return (&xmlFree);
769 else
770 return (&xmlGetGlobalState()->xmlFree);
773 xmlStrdupFunc *
774 __xmlMemStrdup(void){
775 if (IS_MAIN_THREAD)
776 return (&xmlMemStrdup);
777 else
778 return (&xmlGetGlobalState()->xmlMemStrdup);
781 #endif
784 * Everything starting from the line below is
785 * Automatically generated by build_glob.py.
786 * Do not modify the previous line.
790 #undef oldXMLWDcompatibility
791 int *
792 __oldXMLWDcompatibility(void) {
793 if (IS_MAIN_THREAD)
794 return (&oldXMLWDcompatibility);
795 else
796 return (&xmlGetGlobalState()->oldXMLWDcompatibility);
799 #undef xmlBufferAllocScheme
800 xmlBufferAllocationScheme *
801 __xmlBufferAllocScheme(void) {
802 if (IS_MAIN_THREAD)
803 return (&xmlBufferAllocScheme);
804 else
805 return (&xmlGetGlobalState()->xmlBufferAllocScheme);
807 xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
808 xmlBufferAllocationScheme ret;
809 xmlMutexLock(&xmlThrDefMutex);
810 ret = xmlBufferAllocSchemeThrDef;
811 xmlBufferAllocSchemeThrDef = v;
812 xmlMutexUnlock(&xmlThrDefMutex);
813 return ret;
816 #undef xmlDefaultBufferSize
817 int *
818 __xmlDefaultBufferSize(void) {
819 if (IS_MAIN_THREAD)
820 return (&xmlDefaultBufferSize);
821 else
822 return (&xmlGetGlobalState()->xmlDefaultBufferSize);
824 int xmlThrDefDefaultBufferSize(int v) {
825 int ret;
826 xmlMutexLock(&xmlThrDefMutex);
827 ret = xmlDefaultBufferSizeThrDef;
828 xmlDefaultBufferSizeThrDef = v;
829 xmlMutexUnlock(&xmlThrDefMutex);
830 return ret;
833 #ifdef LIBXML_SAX1_ENABLED
834 #undef xmlDefaultSAXHandler
835 xmlSAXHandlerV1 *
836 __xmlDefaultSAXHandler(void) {
837 if (IS_MAIN_THREAD)
838 return (&xmlDefaultSAXHandler);
839 else
840 return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
842 #endif /* LIBXML_SAX1_ENABLED */
844 #undef xmlDefaultSAXLocator
845 xmlSAXLocator *
846 __xmlDefaultSAXLocator(void) {
847 if (IS_MAIN_THREAD)
848 return (&xmlDefaultSAXLocator);
849 else
850 return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
853 #undef xmlDoValidityCheckingDefaultValue
854 int *
855 __xmlDoValidityCheckingDefaultValue(void) {
856 if (IS_MAIN_THREAD)
857 return (&xmlDoValidityCheckingDefaultValue);
858 else
859 return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
861 int xmlThrDefDoValidityCheckingDefaultValue(int v) {
862 int ret;
863 xmlMutexLock(&xmlThrDefMutex);
864 ret = xmlDoValidityCheckingDefaultValueThrDef;
865 xmlDoValidityCheckingDefaultValueThrDef = v;
866 xmlMutexUnlock(&xmlThrDefMutex);
867 return ret;
870 #undef xmlGenericError
871 xmlGenericErrorFunc *
872 __xmlGenericError(void) {
873 if (IS_MAIN_THREAD)
874 return (&xmlGenericError);
875 else
876 return (&xmlGetGlobalState()->xmlGenericError);
879 #undef xmlStructuredError
880 xmlStructuredErrorFunc *
881 __xmlStructuredError(void) {
882 if (IS_MAIN_THREAD)
883 return (&xmlStructuredError);
884 else
885 return (&xmlGetGlobalState()->xmlStructuredError);
888 #undef xmlGenericErrorContext
889 void * *
890 __xmlGenericErrorContext(void) {
891 if (IS_MAIN_THREAD)
892 return (&xmlGenericErrorContext);
893 else
894 return (&xmlGetGlobalState()->xmlGenericErrorContext);
897 #undef xmlStructuredErrorContext
898 void * *
899 __xmlStructuredErrorContext(void) {
900 if (IS_MAIN_THREAD)
901 return (&xmlStructuredErrorContext);
902 else
903 return (&xmlGetGlobalState()->xmlStructuredErrorContext);
906 #undef xmlGetWarningsDefaultValue
907 int *
908 __xmlGetWarningsDefaultValue(void) {
909 if (IS_MAIN_THREAD)
910 return (&xmlGetWarningsDefaultValue);
911 else
912 return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
914 int xmlThrDefGetWarningsDefaultValue(int v) {
915 int ret;
916 xmlMutexLock(&xmlThrDefMutex);
917 ret = xmlGetWarningsDefaultValueThrDef;
918 xmlGetWarningsDefaultValueThrDef = v;
919 xmlMutexUnlock(&xmlThrDefMutex);
920 return ret;
923 #undef xmlIndentTreeOutput
924 int *
925 __xmlIndentTreeOutput(void) {
926 if (IS_MAIN_THREAD)
927 return (&xmlIndentTreeOutput);
928 else
929 return (&xmlGetGlobalState()->xmlIndentTreeOutput);
931 int xmlThrDefIndentTreeOutput(int v) {
932 int ret;
933 xmlMutexLock(&xmlThrDefMutex);
934 ret = xmlIndentTreeOutputThrDef;
935 xmlIndentTreeOutputThrDef = v;
936 xmlMutexUnlock(&xmlThrDefMutex);
937 return ret;
940 #undef xmlTreeIndentString
941 const char * *
942 __xmlTreeIndentString(void) {
943 if (IS_MAIN_THREAD)
944 return (&xmlTreeIndentString);
945 else
946 return (&xmlGetGlobalState()->xmlTreeIndentString);
948 const char * xmlThrDefTreeIndentString(const char * v) {
949 const char * ret;
950 xmlMutexLock(&xmlThrDefMutex);
951 ret = xmlTreeIndentStringThrDef;
952 xmlTreeIndentStringThrDef = v;
953 xmlMutexUnlock(&xmlThrDefMutex);
954 return ret;
957 #undef xmlKeepBlanksDefaultValue
958 int *
959 __xmlKeepBlanksDefaultValue(void) {
960 if (IS_MAIN_THREAD)
961 return (&xmlKeepBlanksDefaultValue);
962 else
963 return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
965 int xmlThrDefKeepBlanksDefaultValue(int v) {
966 int ret;
967 xmlMutexLock(&xmlThrDefMutex);
968 ret = xmlKeepBlanksDefaultValueThrDef;
969 xmlKeepBlanksDefaultValueThrDef = v;
970 xmlMutexUnlock(&xmlThrDefMutex);
971 return ret;
974 #undef xmlLineNumbersDefaultValue
975 int *
976 __xmlLineNumbersDefaultValue(void) {
977 if (IS_MAIN_THREAD)
978 return (&xmlLineNumbersDefaultValue);
979 else
980 return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
982 int xmlThrDefLineNumbersDefaultValue(int v) {
983 int ret;
984 xmlMutexLock(&xmlThrDefMutex);
985 ret = xmlLineNumbersDefaultValueThrDef;
986 xmlLineNumbersDefaultValueThrDef = v;
987 xmlMutexUnlock(&xmlThrDefMutex);
988 return ret;
991 #undef xmlLoadExtDtdDefaultValue
992 int *
993 __xmlLoadExtDtdDefaultValue(void) {
994 if (IS_MAIN_THREAD)
995 return (&xmlLoadExtDtdDefaultValue);
996 else
997 return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
999 int xmlThrDefLoadExtDtdDefaultValue(int v) {
1000 int ret;
1001 xmlMutexLock(&xmlThrDefMutex);
1002 ret = xmlLoadExtDtdDefaultValueThrDef;
1003 xmlLoadExtDtdDefaultValueThrDef = v;
1004 xmlMutexUnlock(&xmlThrDefMutex);
1005 return ret;
1008 #undef xmlParserDebugEntities
1009 int *
1010 __xmlParserDebugEntities(void) {
1011 if (IS_MAIN_THREAD)
1012 return (&xmlParserDebugEntities);
1013 else
1014 return (&xmlGetGlobalState()->xmlParserDebugEntities);
1016 int xmlThrDefParserDebugEntities(int v) {
1017 int ret;
1018 xmlMutexLock(&xmlThrDefMutex);
1019 ret = xmlParserDebugEntitiesThrDef;
1020 xmlParserDebugEntitiesThrDef = v;
1021 xmlMutexUnlock(&xmlThrDefMutex);
1022 return ret;
1025 #undef xmlParserVersion
1026 const char * *
1027 __xmlParserVersion(void) {
1028 if (IS_MAIN_THREAD)
1029 return (&xmlParserVersion);
1030 else
1031 return (&xmlGetGlobalState()->xmlParserVersion);
1034 #undef xmlPedanticParserDefaultValue
1035 int *
1036 __xmlPedanticParserDefaultValue(void) {
1037 if (IS_MAIN_THREAD)
1038 return (&xmlPedanticParserDefaultValue);
1039 else
1040 return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
1042 int xmlThrDefPedanticParserDefaultValue(int v) {
1043 int ret;
1044 xmlMutexLock(&xmlThrDefMutex);
1045 ret = xmlPedanticParserDefaultValueThrDef;
1046 xmlPedanticParserDefaultValueThrDef = v;
1047 xmlMutexUnlock(&xmlThrDefMutex);
1048 return ret;
1051 #undef xmlSaveNoEmptyTags
1052 int *
1053 __xmlSaveNoEmptyTags(void) {
1054 if (IS_MAIN_THREAD)
1055 return (&xmlSaveNoEmptyTags);
1056 else
1057 return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
1059 int xmlThrDefSaveNoEmptyTags(int v) {
1060 int ret;
1061 xmlMutexLock(&xmlThrDefMutex);
1062 ret = xmlSaveNoEmptyTagsThrDef;
1063 xmlSaveNoEmptyTagsThrDef = v;
1064 xmlMutexUnlock(&xmlThrDefMutex);
1065 return ret;
1068 #undef xmlSubstituteEntitiesDefaultValue
1069 int *
1070 __xmlSubstituteEntitiesDefaultValue(void) {
1071 if (IS_MAIN_THREAD)
1072 return (&xmlSubstituteEntitiesDefaultValue);
1073 else
1074 return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
1076 int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
1077 int ret;
1078 xmlMutexLock(&xmlThrDefMutex);
1079 ret = xmlSubstituteEntitiesDefaultValueThrDef;
1080 xmlSubstituteEntitiesDefaultValueThrDef = v;
1081 xmlMutexUnlock(&xmlThrDefMutex);
1082 return ret;
1085 #undef xmlRegisterNodeDefaultValue
1086 xmlRegisterNodeFunc * XMLCALL
1087 __xmlRegisterNodeDefaultValue(void) {
1088 if (IS_MAIN_THREAD)
1089 return (&xmlRegisterNodeDefaultValue);
1090 else
1091 return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue);
1094 #undef xmlDeregisterNodeDefaultValue
1095 xmlDeregisterNodeFunc * XMLCALL
1096 __xmlDeregisterNodeDefaultValue(void) {
1097 if (IS_MAIN_THREAD)
1098 return (&xmlDeregisterNodeDefaultValue);
1099 else
1100 return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue);
1103 #undef xmlParserInputBufferCreateFilenameValue
1104 xmlParserInputBufferCreateFilenameFunc * XMLCALL
1105 __xmlParserInputBufferCreateFilenameValue(void) {
1106 if (IS_MAIN_THREAD)
1107 return (&xmlParserInputBufferCreateFilenameValue);
1108 else
1109 return (&xmlGetGlobalState()->xmlParserInputBufferCreateFilenameValue);
1112 #undef xmlOutputBufferCreateFilenameValue
1113 xmlOutputBufferCreateFilenameFunc * XMLCALL
1114 __xmlOutputBufferCreateFilenameValue(void) {
1115 if (IS_MAIN_THREAD)
1116 return (&xmlOutputBufferCreateFilenameValue);
1117 else
1118 return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue);