d2d1: Add partial support for image brushes.
[wine.git] / libs / xml2 / globals.c
blob3822c7e806717d8fad8578351fc4da805c2c3e51
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 #ifdef HAVE_STDLIB_H
18 #include <stdlib.h>
19 #endif
20 #include <string.h>
22 #include <libxml/globals.h>
23 #include <libxml/xmlmemory.h>
24 #include <libxml/threads.h>
26 /* #define DEBUG_GLOBALS */
29 * Helpful Macro
31 #ifdef LIBXML_THREAD_ENABLED
32 #define IS_MAIN_THREAD (xmlIsMainThread())
33 #else
34 #define IS_MAIN_THREAD 1
35 #endif
38 * Mutex to protect "ForNewThreads" variables
40 static xmlMutexPtr xmlThrDefMutex = NULL;
42 /**
43 * xmlInitGlobals:
45 * Additional initialisation for multi-threading
47 void xmlInitGlobals(void)
49 if (xmlThrDefMutex == NULL)
50 xmlThrDefMutex = xmlNewMutex();
53 /************************************************************************
54 * *
55 * All the user accessible global variables of the library *
56 * *
57 ************************************************************************/
60 * Memory allocation routines
62 #undef xmlFree
63 #undef xmlMalloc
64 #undef xmlMallocAtomic
65 #undef xmlMemStrdup
66 #undef xmlRealloc
68 #if defined(DEBUG_MEMORY_LOCATION) || defined(DEBUG_MEMORY)
69 xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
70 xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
71 xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
72 xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
73 xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
74 #else
75 /**
76 * xmlFree:
77 * @mem: an already allocated block of memory
79 * The variable holding the libxml free() implementation
81 xmlFreeFunc xmlFree = free;
82 /**
83 * xmlMalloc:
84 * @size: the size requested in bytes
86 * The variable holding the libxml malloc() implementation
88 * Returns a pointer to the newly allocated block or NULL in case of error
90 xmlMallocFunc xmlMalloc = malloc;
91 /**
92 * xmlMallocAtomic:
93 * @size: the size requested in bytes
95 * The variable holding the libxml malloc() implementation for atomic
96 * data (i.e. blocks not containing pointers), useful when using a
97 * garbage collecting allocator.
99 * Returns a pointer to the newly allocated block or NULL in case of error
101 xmlMallocFunc xmlMallocAtomic = malloc;
103 * xmlRealloc:
104 * @mem: an already allocated block of memory
105 * @size: the new size requested in bytes
107 * The variable holding the libxml realloc() implementation
109 * Returns a pointer to the newly reallocated block or NULL in case of error
111 xmlReallocFunc xmlRealloc = realloc;
113 * xmlPosixStrdup
114 * @cur: the input char *
116 * a strdup implementation with a type signature matching POSIX
118 * Returns a new xmlChar * or NULL
120 static char *
121 xmlPosixStrdup(const char *cur) {
122 return((char*) xmlCharStrdup(cur));
125 * xmlMemStrdup:
126 * @str: a zero terminated string
128 * The variable holding the libxml strdup() implementation
130 * Returns the copy of the string or NULL in case of error
132 xmlStrdupFunc xmlMemStrdup = xmlPosixStrdup;
133 #endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */
135 #include <libxml/threads.h>
136 #include <libxml/globals.h>
137 #include <libxml/SAX.h>
139 #undef docbDefaultSAXHandler
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 */
446 #ifdef LIBXML_DOCB_ENABLED
448 * docbDefaultSAXHandler:
450 * Default old SAX v1 handler for SGML DocBook, builds the DOM tree
452 xmlSAXHandlerV1 docbDefaultSAXHandler = {
453 xmlSAX2InternalSubset,
454 xmlSAX2IsStandalone,
455 xmlSAX2HasInternalSubset,
456 xmlSAX2HasExternalSubset,
457 xmlSAX2ResolveEntity,
458 xmlSAX2GetEntity,
459 xmlSAX2EntityDecl,
460 NULL,
461 NULL,
462 NULL,
463 NULL,
464 xmlSAX2SetDocumentLocator,
465 xmlSAX2StartDocument,
466 xmlSAX2EndDocument,
467 xmlSAX2StartElement,
468 xmlSAX2EndElement,
469 xmlSAX2Reference,
470 xmlSAX2Characters,
471 xmlSAX2IgnorableWhitespace,
472 NULL,
473 xmlSAX2Comment,
474 xmlParserWarning,
475 xmlParserError,
476 xmlParserError,
477 xmlSAX2GetParameterEntity,
478 NULL,
479 NULL,
482 #endif /* LIBXML_DOCB_ENABLED */
485 * xmlInitializeGlobalState:
486 * @gs: a pointer to a newly allocated global state
488 * xmlInitializeGlobalState() initialize a global state with all the
489 * default values of the library.
491 void
492 xmlInitializeGlobalState(xmlGlobalStatePtr gs)
494 #ifdef DEBUG_GLOBALS
495 fprintf(stderr, "Initializing globals at %lu for thread %d\n",
496 (unsigned long) gs, xmlGetThreadId());
497 #endif
500 * Perform initialization as required by libxml
502 if (xmlThrDefMutex == NULL)
503 xmlInitGlobals();
505 xmlMutexLock(xmlThrDefMutex);
507 #if defined(LIBXML_DOCB_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
508 initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
509 #endif
510 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
511 inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
512 #endif
514 gs->oldXMLWDcompatibility = 0;
515 gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
516 gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;
517 #if defined(LIBXML_SAX1_ENABLED) && defined(LIBXML_LEGACY_ENABLED)
518 initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
519 #endif /* LIBXML_SAX1_ENABLED */
520 gs->xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId;
521 gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
522 gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
523 gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
524 gs->xmlDoValidityCheckingDefaultValue =
525 xmlDoValidityCheckingDefaultValueThrDef;
526 #if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
527 gs->xmlFree = (xmlFreeFunc) xmlMemFree;
528 gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
529 gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
530 gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
531 gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
532 #else
533 gs->xmlFree = (xmlFreeFunc) free;
534 gs->xmlMalloc = (xmlMallocFunc) malloc;
535 gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
536 gs->xmlRealloc = (xmlReallocFunc) realloc;
537 gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
538 #endif
539 gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
540 gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
541 gs->xmlTreeIndentString = xmlTreeIndentStringThrDef;
542 gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
543 gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
544 gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
545 gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
546 gs->xmlParserVersion = LIBXML_VERSION_STRING;
547 gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
548 gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
549 gs->xmlSubstituteEntitiesDefaultValue =
550 xmlSubstituteEntitiesDefaultValueThrDef;
552 gs->xmlGenericError = xmlGenericErrorThrDef;
553 gs->xmlStructuredError = xmlStructuredErrorThrDef;
554 gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
555 gs->xmlStructuredErrorContext = xmlStructuredErrorContextThrDef;
556 gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
557 gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
559 gs->xmlParserInputBufferCreateFilenameValue = xmlParserInputBufferCreateFilenameValueThrDef;
560 gs->xmlOutputBufferCreateFilenameValue = xmlOutputBufferCreateFilenameValueThrDef;
561 memset(&gs->xmlLastError, 0, sizeof(xmlError));
563 xmlMutexUnlock(xmlThrDefMutex);
567 * xmlCleanupGlobals:
569 * Additional cleanup for multi-threading
571 void xmlCleanupGlobals(void)
573 xmlResetError(&xmlLastError);
575 if (xmlThrDefMutex != NULL) {
576 xmlFreeMutex(xmlThrDefMutex);
577 xmlThrDefMutex = NULL;
579 __xmlGlobalInitMutexDestroy();
583 * DOC_DISABLE : we ignore missing doc for the xmlThrDef functions,
584 * those are really internal work
586 void
587 xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
588 xmlMutexLock(xmlThrDefMutex);
589 xmlGenericErrorContextThrDef = ctx;
590 if (handler != NULL)
591 xmlGenericErrorThrDef = handler;
592 else
593 xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
594 xmlMutexUnlock(xmlThrDefMutex);
597 void
598 xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
599 xmlMutexLock(xmlThrDefMutex);
600 xmlStructuredErrorContextThrDef = ctx;
601 xmlStructuredErrorThrDef = handler;
602 xmlMutexUnlock(xmlThrDefMutex);
606 * xmlRegisterNodeDefault:
607 * @func: function pointer to the new RegisterNodeFunc
609 * Registers a callback for node creation
611 * Returns the old value of the registration function
613 xmlRegisterNodeFunc
614 xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
616 xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue;
618 __xmlRegisterCallbacks = 1;
619 xmlRegisterNodeDefaultValue = func;
620 return(old);
623 xmlRegisterNodeFunc
624 xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
626 xmlRegisterNodeFunc old;
628 xmlMutexLock(xmlThrDefMutex);
629 old = xmlRegisterNodeDefaultValueThrDef;
631 __xmlRegisterCallbacks = 1;
632 xmlRegisterNodeDefaultValueThrDef = func;
633 xmlMutexUnlock(xmlThrDefMutex);
635 return(old);
639 * xmlDeregisterNodeDefault:
640 * @func: function pointer to the new DeregisterNodeFunc
642 * Registers a callback for node destruction
644 * Returns the previous value of the deregistration function
646 xmlDeregisterNodeFunc
647 xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
649 xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue;
651 __xmlRegisterCallbacks = 1;
652 xmlDeregisterNodeDefaultValue = func;
653 return(old);
656 xmlDeregisterNodeFunc
657 xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
659 xmlDeregisterNodeFunc old;
661 xmlMutexLock(xmlThrDefMutex);
662 old = xmlDeregisterNodeDefaultValueThrDef;
664 __xmlRegisterCallbacks = 1;
665 xmlDeregisterNodeDefaultValueThrDef = func;
666 xmlMutexUnlock(xmlThrDefMutex);
668 return(old);
671 xmlParserInputBufferCreateFilenameFunc
672 xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
674 xmlParserInputBufferCreateFilenameFunc old;
676 xmlMutexLock(xmlThrDefMutex);
677 old = xmlParserInputBufferCreateFilenameValueThrDef;
678 if (old == NULL) {
679 old = __xmlParserInputBufferCreateFilename;
682 xmlParserInputBufferCreateFilenameValueThrDef = func;
683 xmlMutexUnlock(xmlThrDefMutex);
685 return(old);
688 xmlOutputBufferCreateFilenameFunc
689 xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
691 xmlOutputBufferCreateFilenameFunc old;
693 xmlMutexLock(xmlThrDefMutex);
694 old = xmlOutputBufferCreateFilenameValueThrDef;
695 #ifdef LIBXML_OUTPUT_ENABLED
696 if (old == NULL) {
697 old = __xmlOutputBufferCreateFilename;
699 #endif
700 xmlOutputBufferCreateFilenameValueThrDef = func;
701 xmlMutexUnlock(xmlThrDefMutex);
703 return(old);
706 #ifdef LIBXML_DOCB_ENABLED
707 #undef docbDefaultSAXHandler
708 xmlSAXHandlerV1 *
709 __docbDefaultSAXHandler(void) {
710 if (IS_MAIN_THREAD)
711 return (&docbDefaultSAXHandler);
712 else
713 return (&xmlGetGlobalState()->docbDefaultSAXHandler);
715 #endif
717 #ifdef LIBXML_HTML_ENABLED
718 #undef htmlDefaultSAXHandler
719 xmlSAXHandlerV1 *
720 __htmlDefaultSAXHandler(void) {
721 if (IS_MAIN_THREAD)
722 return (&htmlDefaultSAXHandler);
723 else
724 return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
726 #endif
728 #undef xmlLastError
729 xmlError *
730 __xmlLastError(void) {
731 if (IS_MAIN_THREAD)
732 return (&xmlLastError);
733 else
734 return (&xmlGetGlobalState()->xmlLastError);
738 * The following memory routines were apparently lost at some point,
739 * and were re-inserted at this point on June 10, 2004. Hope it's
740 * the right place for them :-)
742 #if defined(LIBXML_THREAD_ALLOC_ENABLED) && defined(LIBXML_THREAD_ENABLED)
743 #undef xmlMalloc
744 xmlMallocFunc *
745 __xmlMalloc(void){
746 if (IS_MAIN_THREAD)
747 return (&xmlMalloc);
748 else
749 return (&xmlGetGlobalState()->xmlMalloc);
752 #undef xmlMallocAtomic
753 xmlMallocFunc *
754 __xmlMallocAtomic(void){
755 if (IS_MAIN_THREAD)
756 return (&xmlMallocAtomic);
757 else
758 return (&xmlGetGlobalState()->xmlMallocAtomic);
761 #undef xmlRealloc
762 xmlReallocFunc *
763 __xmlRealloc(void){
764 if (IS_MAIN_THREAD)
765 return (&xmlRealloc);
766 else
767 return (&xmlGetGlobalState()->xmlRealloc);
770 #undef xmlFree
771 xmlFreeFunc *
772 __xmlFree(void){
773 if (IS_MAIN_THREAD)
774 return (&xmlFree);
775 else
776 return (&xmlGetGlobalState()->xmlFree);
779 xmlStrdupFunc *
780 __xmlMemStrdup(void){
781 if (IS_MAIN_THREAD)
782 return (&xmlMemStrdup);
783 else
784 return (&xmlGetGlobalState()->xmlMemStrdup);
787 #endif
790 * Everything starting from the line below is
791 * Automatically generated by build_glob.py.
792 * Do not modify the previous line.
796 #undef oldXMLWDcompatibility
797 int *
798 __oldXMLWDcompatibility(void) {
799 if (IS_MAIN_THREAD)
800 return (&oldXMLWDcompatibility);
801 else
802 return (&xmlGetGlobalState()->oldXMLWDcompatibility);
805 #undef xmlBufferAllocScheme
806 xmlBufferAllocationScheme *
807 __xmlBufferAllocScheme(void) {
808 if (IS_MAIN_THREAD)
809 return (&xmlBufferAllocScheme);
810 else
811 return (&xmlGetGlobalState()->xmlBufferAllocScheme);
813 xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
814 xmlBufferAllocationScheme ret;
815 xmlMutexLock(xmlThrDefMutex);
816 ret = xmlBufferAllocSchemeThrDef;
817 xmlBufferAllocSchemeThrDef = v;
818 xmlMutexUnlock(xmlThrDefMutex);
819 return ret;
822 #undef xmlDefaultBufferSize
823 int *
824 __xmlDefaultBufferSize(void) {
825 if (IS_MAIN_THREAD)
826 return (&xmlDefaultBufferSize);
827 else
828 return (&xmlGetGlobalState()->xmlDefaultBufferSize);
830 int xmlThrDefDefaultBufferSize(int v) {
831 int ret;
832 xmlMutexLock(xmlThrDefMutex);
833 ret = xmlDefaultBufferSizeThrDef;
834 xmlDefaultBufferSizeThrDef = v;
835 xmlMutexUnlock(xmlThrDefMutex);
836 return ret;
839 #ifdef LIBXML_SAX1_ENABLED
840 #undef xmlDefaultSAXHandler
841 xmlSAXHandlerV1 *
842 __xmlDefaultSAXHandler(void) {
843 if (IS_MAIN_THREAD)
844 return (&xmlDefaultSAXHandler);
845 else
846 return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
848 #endif /* LIBXML_SAX1_ENABLED */
850 #undef xmlDefaultSAXLocator
851 xmlSAXLocator *
852 __xmlDefaultSAXLocator(void) {
853 if (IS_MAIN_THREAD)
854 return (&xmlDefaultSAXLocator);
855 else
856 return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
859 #undef xmlDoValidityCheckingDefaultValue
860 int *
861 __xmlDoValidityCheckingDefaultValue(void) {
862 if (IS_MAIN_THREAD)
863 return (&xmlDoValidityCheckingDefaultValue);
864 else
865 return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
867 int xmlThrDefDoValidityCheckingDefaultValue(int v) {
868 int ret;
869 xmlMutexLock(xmlThrDefMutex);
870 ret = xmlDoValidityCheckingDefaultValueThrDef;
871 xmlDoValidityCheckingDefaultValueThrDef = v;
872 xmlMutexUnlock(xmlThrDefMutex);
873 return ret;
876 #undef xmlGenericError
877 xmlGenericErrorFunc *
878 __xmlGenericError(void) {
879 if (IS_MAIN_THREAD)
880 return (&xmlGenericError);
881 else
882 return (&xmlGetGlobalState()->xmlGenericError);
885 #undef xmlStructuredError
886 xmlStructuredErrorFunc *
887 __xmlStructuredError(void) {
888 if (IS_MAIN_THREAD)
889 return (&xmlStructuredError);
890 else
891 return (&xmlGetGlobalState()->xmlStructuredError);
894 #undef xmlGenericErrorContext
895 void * *
896 __xmlGenericErrorContext(void) {
897 if (IS_MAIN_THREAD)
898 return (&xmlGenericErrorContext);
899 else
900 return (&xmlGetGlobalState()->xmlGenericErrorContext);
903 #undef xmlStructuredErrorContext
904 void * *
905 __xmlStructuredErrorContext(void) {
906 if (IS_MAIN_THREAD)
907 return (&xmlStructuredErrorContext);
908 else
909 return (&xmlGetGlobalState()->xmlStructuredErrorContext);
912 #undef xmlGetWarningsDefaultValue
913 int *
914 __xmlGetWarningsDefaultValue(void) {
915 if (IS_MAIN_THREAD)
916 return (&xmlGetWarningsDefaultValue);
917 else
918 return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
920 int xmlThrDefGetWarningsDefaultValue(int v) {
921 int ret;
922 xmlMutexLock(xmlThrDefMutex);
923 ret = xmlGetWarningsDefaultValueThrDef;
924 xmlGetWarningsDefaultValueThrDef = v;
925 xmlMutexUnlock(xmlThrDefMutex);
926 return ret;
929 #undef xmlIndentTreeOutput
930 int *
931 __xmlIndentTreeOutput(void) {
932 if (IS_MAIN_THREAD)
933 return (&xmlIndentTreeOutput);
934 else
935 return (&xmlGetGlobalState()->xmlIndentTreeOutput);
937 int xmlThrDefIndentTreeOutput(int v) {
938 int ret;
939 xmlMutexLock(xmlThrDefMutex);
940 ret = xmlIndentTreeOutputThrDef;
941 xmlIndentTreeOutputThrDef = v;
942 xmlMutexUnlock(xmlThrDefMutex);
943 return ret;
946 #undef xmlTreeIndentString
947 const char * *
948 __xmlTreeIndentString(void) {
949 if (IS_MAIN_THREAD)
950 return (&xmlTreeIndentString);
951 else
952 return (&xmlGetGlobalState()->xmlTreeIndentString);
954 const char * xmlThrDefTreeIndentString(const char * v) {
955 const char * ret;
956 xmlMutexLock(xmlThrDefMutex);
957 ret = xmlTreeIndentStringThrDef;
958 xmlTreeIndentStringThrDef = v;
959 xmlMutexUnlock(xmlThrDefMutex);
960 return ret;
963 #undef xmlKeepBlanksDefaultValue
964 int *
965 __xmlKeepBlanksDefaultValue(void) {
966 if (IS_MAIN_THREAD)
967 return (&xmlKeepBlanksDefaultValue);
968 else
969 return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
971 int xmlThrDefKeepBlanksDefaultValue(int v) {
972 int ret;
973 xmlMutexLock(xmlThrDefMutex);
974 ret = xmlKeepBlanksDefaultValueThrDef;
975 xmlKeepBlanksDefaultValueThrDef = v;
976 xmlMutexUnlock(xmlThrDefMutex);
977 return ret;
980 #undef xmlLineNumbersDefaultValue
981 int *
982 __xmlLineNumbersDefaultValue(void) {
983 if (IS_MAIN_THREAD)
984 return (&xmlLineNumbersDefaultValue);
985 else
986 return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
988 int xmlThrDefLineNumbersDefaultValue(int v) {
989 int ret;
990 xmlMutexLock(xmlThrDefMutex);
991 ret = xmlLineNumbersDefaultValueThrDef;
992 xmlLineNumbersDefaultValueThrDef = v;
993 xmlMutexUnlock(xmlThrDefMutex);
994 return ret;
997 #undef xmlLoadExtDtdDefaultValue
998 int *
999 __xmlLoadExtDtdDefaultValue(void) {
1000 if (IS_MAIN_THREAD)
1001 return (&xmlLoadExtDtdDefaultValue);
1002 else
1003 return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
1005 int xmlThrDefLoadExtDtdDefaultValue(int v) {
1006 int ret;
1007 xmlMutexLock(xmlThrDefMutex);
1008 ret = xmlLoadExtDtdDefaultValueThrDef;
1009 xmlLoadExtDtdDefaultValueThrDef = v;
1010 xmlMutexUnlock(xmlThrDefMutex);
1011 return ret;
1014 #undef xmlParserDebugEntities
1015 int *
1016 __xmlParserDebugEntities(void) {
1017 if (IS_MAIN_THREAD)
1018 return (&xmlParserDebugEntities);
1019 else
1020 return (&xmlGetGlobalState()->xmlParserDebugEntities);
1022 int xmlThrDefParserDebugEntities(int v) {
1023 int ret;
1024 xmlMutexLock(xmlThrDefMutex);
1025 ret = xmlParserDebugEntitiesThrDef;
1026 xmlParserDebugEntitiesThrDef = v;
1027 xmlMutexUnlock(xmlThrDefMutex);
1028 return ret;
1031 #undef xmlParserVersion
1032 const char * *
1033 __xmlParserVersion(void) {
1034 if (IS_MAIN_THREAD)
1035 return (&xmlParserVersion);
1036 else
1037 return (&xmlGetGlobalState()->xmlParserVersion);
1040 #undef xmlPedanticParserDefaultValue
1041 int *
1042 __xmlPedanticParserDefaultValue(void) {
1043 if (IS_MAIN_THREAD)
1044 return (&xmlPedanticParserDefaultValue);
1045 else
1046 return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
1048 int xmlThrDefPedanticParserDefaultValue(int v) {
1049 int ret;
1050 xmlMutexLock(xmlThrDefMutex);
1051 ret = xmlPedanticParserDefaultValueThrDef;
1052 xmlPedanticParserDefaultValueThrDef = v;
1053 xmlMutexUnlock(xmlThrDefMutex);
1054 return ret;
1057 #undef xmlSaveNoEmptyTags
1058 int *
1059 __xmlSaveNoEmptyTags(void) {
1060 if (IS_MAIN_THREAD)
1061 return (&xmlSaveNoEmptyTags);
1062 else
1063 return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
1065 int xmlThrDefSaveNoEmptyTags(int v) {
1066 int ret;
1067 xmlMutexLock(xmlThrDefMutex);
1068 ret = xmlSaveNoEmptyTagsThrDef;
1069 xmlSaveNoEmptyTagsThrDef = v;
1070 xmlMutexUnlock(xmlThrDefMutex);
1071 return ret;
1074 #undef xmlSubstituteEntitiesDefaultValue
1075 int *
1076 __xmlSubstituteEntitiesDefaultValue(void) {
1077 if (IS_MAIN_THREAD)
1078 return (&xmlSubstituteEntitiesDefaultValue);
1079 else
1080 return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
1082 int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
1083 int ret;
1084 xmlMutexLock(xmlThrDefMutex);
1085 ret = xmlSubstituteEntitiesDefaultValueThrDef;
1086 xmlSubstituteEntitiesDefaultValueThrDef = v;
1087 xmlMutexUnlock(xmlThrDefMutex);
1088 return ret;
1091 #undef xmlRegisterNodeDefaultValue
1092 xmlRegisterNodeFunc * XMLCALL
1093 __xmlRegisterNodeDefaultValue(void) {
1094 if (IS_MAIN_THREAD)
1095 return (&xmlRegisterNodeDefaultValue);
1096 else
1097 return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue);
1100 #undef xmlDeregisterNodeDefaultValue
1101 xmlDeregisterNodeFunc * XMLCALL
1102 __xmlDeregisterNodeDefaultValue(void) {
1103 if (IS_MAIN_THREAD)
1104 return (&xmlDeregisterNodeDefaultValue);
1105 else
1106 return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue);
1109 #undef xmlParserInputBufferCreateFilenameValue
1110 xmlParserInputBufferCreateFilenameFunc * XMLCALL
1111 __xmlParserInputBufferCreateFilenameValue(void) {
1112 if (IS_MAIN_THREAD)
1113 return (&xmlParserInputBufferCreateFilenameValue);
1114 else
1115 return (&xmlGetGlobalState()->xmlParserInputBufferCreateFilenameValue);
1118 #undef xmlOutputBufferCreateFilenameValue
1119 xmlOutputBufferCreateFilenameFunc * XMLCALL
1120 __xmlOutputBufferCreateFilenameValue(void) {
1121 if (IS_MAIN_THREAD)
1122 return (&xmlOutputBufferCreateFilenameValue);
1123 else
1124 return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue);
1127 #define bottom_globals
1128 #include "elfgcchack.h"