cng.sys: New dll.
[wine.git] / libs / xml2 / globals.c
blob7fa317ee533eaa1f494c91eadbd07157b1ffddbc
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 * xmlCleanupGlobals:
56 * Additional cleanup for multi-threading
58 void xmlCleanupGlobals(void)
60 if (xmlThrDefMutex != NULL) {
61 xmlFreeMutex(xmlThrDefMutex);
62 xmlThrDefMutex = NULL;
64 __xmlGlobalInitMutexDestroy();
67 /************************************************************************
68 * *
69 * All the user accessible global variables of the library *
70 * *
71 ************************************************************************/
74 * Memory allocation routines
76 #undef xmlFree
77 #undef xmlMalloc
78 #undef xmlMallocAtomic
79 #undef xmlMemStrdup
80 #undef xmlRealloc
82 #if defined(DEBUG_MEMORY_LOCATION) || defined(DEBUG_MEMORY)
83 xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
84 xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
85 xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
86 xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
87 xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
88 #else
89 /**
90 * xmlFree:
91 * @mem: an already allocated block of memory
93 * The variable holding the libxml free() implementation
95 xmlFreeFunc xmlFree = free;
96 /**
97 * xmlMalloc:
98 * @size: the size requested in bytes
100 * The variable holding the libxml malloc() implementation
102 * Returns a pointer to the newly allocated block or NULL in case of error
104 xmlMallocFunc xmlMalloc = malloc;
106 * xmlMallocAtomic:
107 * @size: the size requested in bytes
109 * The variable holding the libxml malloc() implementation for atomic
110 * data (i.e. blocks not containing pointers), useful when using a
111 * garbage collecting allocator.
113 * Returns a pointer to the newly allocated block or NULL in case of error
115 xmlMallocFunc xmlMallocAtomic = malloc;
117 * xmlRealloc:
118 * @mem: an already allocated block of memory
119 * @size: the new size requested in bytes
121 * The variable holding the libxml realloc() implementation
123 * Returns a pointer to the newly reallocated block or NULL in case of error
125 xmlReallocFunc xmlRealloc = realloc;
127 * xmlPosixStrdup
128 * @cur: the input char *
130 * a strdup implementation with a type signature matching POSIX
132 * Returns a new xmlChar * or NULL
134 static char *
135 xmlPosixStrdup(const char *cur) {
136 return((char*) xmlCharStrdup(cur));
139 * xmlMemStrdup:
140 * @str: a zero terminated string
142 * The variable holding the libxml strdup() implementation
144 * Returns the copy of the string or NULL in case of error
146 xmlStrdupFunc xmlMemStrdup = xmlPosixStrdup;
147 #endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */
149 #include <libxml/threads.h>
150 #include <libxml/globals.h>
151 #include <libxml/SAX.h>
153 #undef docbDefaultSAXHandler
154 #undef htmlDefaultSAXHandler
155 #undef oldXMLWDcompatibility
156 #undef xmlBufferAllocScheme
157 #undef xmlDefaultBufferSize
158 #undef xmlDefaultSAXHandler
159 #undef xmlDefaultSAXLocator
160 #undef xmlDoValidityCheckingDefaultValue
161 #undef xmlGenericError
162 #undef xmlStructuredError
163 #undef xmlGenericErrorContext
164 #undef xmlStructuredErrorContext
165 #undef xmlGetWarningsDefaultValue
166 #undef xmlIndentTreeOutput
167 #undef xmlTreeIndentString
168 #undef xmlKeepBlanksDefaultValue
169 #undef xmlLineNumbersDefaultValue
170 #undef xmlLoadExtDtdDefaultValue
171 #undef xmlParserDebugEntities
172 #undef xmlParserVersion
173 #undef xmlPedanticParserDefaultValue
174 #undef xmlSaveNoEmptyTags
175 #undef xmlSubstituteEntitiesDefaultValue
176 #undef xmlRegisterNodeDefaultValue
177 #undef xmlDeregisterNodeDefaultValue
178 #undef xmlLastError
180 #undef xmlParserInputBufferCreateFilenameValue
181 #undef xmlOutputBufferCreateFilenameValue
183 * xmlParserVersion:
185 * Constant string describing the internal version of the library
187 const char *xmlParserVersion = LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA;
190 * xmlBufferAllocScheme:
192 * Global setting, default allocation policy for buffers, default is
193 * XML_BUFFER_ALLOC_EXACT
195 xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
196 static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_EXACT;
198 * xmlDefaultBufferSize:
200 * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
202 int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
203 static int xmlDefaultBufferSizeThrDef = BASE_BUFFER_SIZE;
206 * Parser defaults
210 * oldXMLWDcompatibility:
212 * Global setting, DEPRECATED.
214 int oldXMLWDcompatibility = 0; /* DEPRECATED */
216 * xmlParserDebugEntities:
218 * Global setting, asking the parser to print out debugging information.
219 * while handling entities.
220 * Disabled by default
222 int xmlParserDebugEntities = 0;
223 static int xmlParserDebugEntitiesThrDef = 0;
225 * xmlDoValidityCheckingDefaultValue:
227 * Global setting, indicate that the parser should work in validating mode.
228 * Disabled by default.
230 int xmlDoValidityCheckingDefaultValue = 0;
231 static int xmlDoValidityCheckingDefaultValueThrDef = 0;
233 * xmlGetWarningsDefaultValue:
235 * Global setting, indicate that the parser should provide warnings.
236 * Activated by default.
238 int xmlGetWarningsDefaultValue = 1;
239 static int xmlGetWarningsDefaultValueThrDef = 1;
241 * xmlLoadExtDtdDefaultValue:
243 * Global setting, indicate that the parser should load DTD while not
244 * validating.
245 * Disabled by default.
247 int xmlLoadExtDtdDefaultValue = 0;
248 static int xmlLoadExtDtdDefaultValueThrDef = 0;
250 * xmlPedanticParserDefaultValue:
252 * Global setting, indicate that the parser be pedantic
253 * Disabled by default.
255 int xmlPedanticParserDefaultValue = 0;
256 static int xmlPedanticParserDefaultValueThrDef = 0;
258 * xmlLineNumbersDefaultValue:
260 * Global setting, indicate that the parser should store the line number
261 * in the content field of elements in the DOM tree.
262 * Disabled by default since this may not be safe for old classes of
263 * application.
265 int xmlLineNumbersDefaultValue = 0;
266 static int xmlLineNumbersDefaultValueThrDef = 0;
268 * xmlKeepBlanksDefaultValue:
270 * Global setting, indicate that the parser should keep all blanks
271 * nodes found in the content
272 * Activated by default, this is actually needed to have the parser
273 * conformant to the XML Recommendation, however the option is kept
274 * for some applications since this was libxml1 default behaviour.
276 int xmlKeepBlanksDefaultValue = 1;
277 static int xmlKeepBlanksDefaultValueThrDef = 1;
279 * xmlSubstituteEntitiesDefaultValue:
281 * Global setting, indicate that the parser should not generate entity
282 * references but replace them with the actual content of the entity
283 * Disabled by default, this should be activated when using XPath since
284 * the XPath data model requires entities replacement and the XPath
285 * engine does not handle entities references transparently.
287 int xmlSubstituteEntitiesDefaultValue = 0;
288 static int xmlSubstituteEntitiesDefaultValueThrDef = 0;
290 xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL;
291 static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL;
292 xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL;
293 static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL;
295 xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue = NULL;
296 static xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValueThrDef = NULL;
298 xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue = NULL;
299 static xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValueThrDef = NULL;
302 * Error handling
305 /* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
306 /* Must initialize xmlGenericError in xmlInitParser */
307 void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
308 const char *msg,
309 ...);
311 * xmlGenericError:
313 * Global setting: function used for generic error callbacks
315 xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc;
316 static xmlGenericErrorFunc xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
318 * xmlStructuredError:
320 * Global setting: function used for structured error callbacks
322 xmlStructuredErrorFunc xmlStructuredError = NULL;
323 static xmlStructuredErrorFunc xmlStructuredErrorThrDef = NULL;
325 * xmlGenericErrorContext:
327 * Global setting passed to generic error callbacks
329 void *xmlGenericErrorContext = NULL;
330 static void *xmlGenericErrorContextThrDef = NULL;
332 * xmlStructuredErrorContext:
334 * Global setting passed to structured error callbacks
336 void *xmlStructuredErrorContext = NULL;
337 static void *xmlStructuredErrorContextThrDef = NULL;
338 xmlError xmlLastError;
341 * output defaults
344 * xmlIndentTreeOutput:
346 * Global setting, asking the serializer to indent the output tree by default
347 * Enabled by default
349 int xmlIndentTreeOutput = 1;
350 static int xmlIndentTreeOutputThrDef = 1;
353 * xmlTreeIndentString:
355 * The string used to do one-level indent. By default is equal to " " (two spaces)
357 const char *xmlTreeIndentString = " ";
358 static const char *xmlTreeIndentStringThrDef = " ";
361 * xmlSaveNoEmptyTags:
363 * Global setting, asking the serializer to not output empty tags
364 * as <empty/> but <empty></empty>. those two forms are indistinguishable
365 * once parsed.
366 * Disabled by default
368 int xmlSaveNoEmptyTags = 0;
369 static int xmlSaveNoEmptyTagsThrDef = 0;
371 #ifdef LIBXML_SAX1_ENABLED
373 * xmlDefaultSAXHandler:
375 * Default SAX version1 handler for XML, builds the DOM tree
377 xmlSAXHandlerV1 xmlDefaultSAXHandler = {
378 xmlSAX2InternalSubset,
379 xmlSAX2IsStandalone,
380 xmlSAX2HasInternalSubset,
381 xmlSAX2HasExternalSubset,
382 xmlSAX2ResolveEntity,
383 xmlSAX2GetEntity,
384 xmlSAX2EntityDecl,
385 xmlSAX2NotationDecl,
386 xmlSAX2AttributeDecl,
387 xmlSAX2ElementDecl,
388 xmlSAX2UnparsedEntityDecl,
389 xmlSAX2SetDocumentLocator,
390 xmlSAX2StartDocument,
391 xmlSAX2EndDocument,
392 xmlSAX2StartElement,
393 xmlSAX2EndElement,
394 xmlSAX2Reference,
395 xmlSAX2Characters,
396 xmlSAX2Characters,
397 xmlSAX2ProcessingInstruction,
398 xmlSAX2Comment,
399 xmlParserWarning,
400 xmlParserError,
401 xmlParserError,
402 xmlSAX2GetParameterEntity,
403 xmlSAX2CDataBlock,
404 xmlSAX2ExternalSubset,
407 #endif /* LIBXML_SAX1_ENABLED */
410 * xmlDefaultSAXLocator:
412 * The default SAX Locator
413 * { getPublicId, getSystemId, getLineNumber, getColumnNumber}
415 xmlSAXLocator xmlDefaultSAXLocator = {
416 xmlSAX2GetPublicId,
417 xmlSAX2GetSystemId,
418 xmlSAX2GetLineNumber,
419 xmlSAX2GetColumnNumber
422 #ifdef LIBXML_HTML_ENABLED
424 * htmlDefaultSAXHandler:
426 * Default old SAX v1 handler for HTML, builds the DOM tree
428 xmlSAXHandlerV1 htmlDefaultSAXHandler = {
429 xmlSAX2InternalSubset,
430 NULL,
431 NULL,
432 NULL,
433 NULL,
434 xmlSAX2GetEntity,
435 NULL,
436 NULL,
437 NULL,
438 NULL,
439 NULL,
440 xmlSAX2SetDocumentLocator,
441 xmlSAX2StartDocument,
442 xmlSAX2EndDocument,
443 xmlSAX2StartElement,
444 xmlSAX2EndElement,
445 NULL,
446 xmlSAX2Characters,
447 xmlSAX2IgnorableWhitespace,
448 xmlSAX2ProcessingInstruction,
449 xmlSAX2Comment,
450 xmlParserWarning,
451 xmlParserError,
452 xmlParserError,
453 xmlSAX2GetParameterEntity,
454 xmlSAX2CDataBlock,
455 NULL,
458 #endif /* LIBXML_HTML_ENABLED */
460 #ifdef LIBXML_DOCB_ENABLED
462 * docbDefaultSAXHandler:
464 * Default old SAX v1 handler for SGML DocBook, builds the DOM tree
466 xmlSAXHandlerV1 docbDefaultSAXHandler = {
467 xmlSAX2InternalSubset,
468 xmlSAX2IsStandalone,
469 xmlSAX2HasInternalSubset,
470 xmlSAX2HasExternalSubset,
471 xmlSAX2ResolveEntity,
472 xmlSAX2GetEntity,
473 xmlSAX2EntityDecl,
474 NULL,
475 NULL,
476 NULL,
477 NULL,
478 xmlSAX2SetDocumentLocator,
479 xmlSAX2StartDocument,
480 xmlSAX2EndDocument,
481 xmlSAX2StartElement,
482 xmlSAX2EndElement,
483 xmlSAX2Reference,
484 xmlSAX2Characters,
485 xmlSAX2IgnorableWhitespace,
486 NULL,
487 xmlSAX2Comment,
488 xmlParserWarning,
489 xmlParserError,
490 xmlParserError,
491 xmlSAX2GetParameterEntity,
492 NULL,
493 NULL,
496 #endif /* LIBXML_DOCB_ENABLED */
499 * xmlInitializeGlobalState:
500 * @gs: a pointer to a newly allocated global state
502 * xmlInitializeGlobalState() initialize a global state with all the
503 * default values of the library.
505 void
506 xmlInitializeGlobalState(xmlGlobalStatePtr gs)
508 #ifdef DEBUG_GLOBALS
509 fprintf(stderr, "Initializing globals at %lu for thread %d\n",
510 (unsigned long) gs, xmlGetThreadId());
511 #endif
514 * Perform initialization as required by libxml
516 if (xmlThrDefMutex == NULL)
517 xmlInitGlobals();
519 xmlMutexLock(xmlThrDefMutex);
521 #if defined(LIBXML_DOCB_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
522 initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
523 #endif
524 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
525 inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
526 #endif
528 gs->oldXMLWDcompatibility = 0;
529 gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
530 gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;
531 #if defined(LIBXML_SAX1_ENABLED) && defined(LIBXML_LEGACY_ENABLED)
532 initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
533 #endif /* LIBXML_SAX1_ENABLED */
534 gs->xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId;
535 gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
536 gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
537 gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
538 gs->xmlDoValidityCheckingDefaultValue =
539 xmlDoValidityCheckingDefaultValueThrDef;
540 #if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
541 gs->xmlFree = (xmlFreeFunc) xmlMemFree;
542 gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
543 gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
544 gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
545 gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
546 #else
547 gs->xmlFree = (xmlFreeFunc) free;
548 gs->xmlMalloc = (xmlMallocFunc) malloc;
549 gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
550 gs->xmlRealloc = (xmlReallocFunc) realloc;
551 gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
552 #endif
553 gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
554 gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
555 gs->xmlTreeIndentString = xmlTreeIndentStringThrDef;
556 gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
557 gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
558 gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
559 gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
560 gs->xmlParserVersion = LIBXML_VERSION_STRING;
561 gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
562 gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
563 gs->xmlSubstituteEntitiesDefaultValue =
564 xmlSubstituteEntitiesDefaultValueThrDef;
566 gs->xmlGenericError = xmlGenericErrorThrDef;
567 gs->xmlStructuredError = xmlStructuredErrorThrDef;
568 gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
569 gs->xmlStructuredErrorContext = xmlStructuredErrorContextThrDef;
570 gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
571 gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
573 gs->xmlParserInputBufferCreateFilenameValue = xmlParserInputBufferCreateFilenameValueThrDef;
574 gs->xmlOutputBufferCreateFilenameValue = xmlOutputBufferCreateFilenameValueThrDef;
575 memset(&gs->xmlLastError, 0, sizeof(xmlError));
577 xmlMutexUnlock(xmlThrDefMutex);
581 * DOC_DISABLE : we ignore missing doc for the xmlThrDef functions,
582 * those are really internal work
584 void
585 xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
586 xmlMutexLock(xmlThrDefMutex);
587 xmlGenericErrorContextThrDef = ctx;
588 if (handler != NULL)
589 xmlGenericErrorThrDef = handler;
590 else
591 xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
592 xmlMutexUnlock(xmlThrDefMutex);
595 void
596 xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
597 xmlMutexLock(xmlThrDefMutex);
598 xmlStructuredErrorContextThrDef = ctx;
599 xmlStructuredErrorThrDef = handler;
600 xmlMutexUnlock(xmlThrDefMutex);
604 * xmlRegisterNodeDefault:
605 * @func: function pointer to the new RegisterNodeFunc
607 * Registers a callback for node creation
609 * Returns the old value of the registration function
611 xmlRegisterNodeFunc
612 xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
614 xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue;
616 __xmlRegisterCallbacks = 1;
617 xmlRegisterNodeDefaultValue = func;
618 return(old);
621 xmlRegisterNodeFunc
622 xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
624 xmlRegisterNodeFunc old;
626 xmlMutexLock(xmlThrDefMutex);
627 old = xmlRegisterNodeDefaultValueThrDef;
629 __xmlRegisterCallbacks = 1;
630 xmlRegisterNodeDefaultValueThrDef = func;
631 xmlMutexUnlock(xmlThrDefMutex);
633 return(old);
637 * xmlDeregisterNodeDefault:
638 * @func: function pointer to the new DeregisterNodeFunc
640 * Registers a callback for node destruction
642 * Returns the previous value of the deregistration function
644 xmlDeregisterNodeFunc
645 xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
647 xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue;
649 __xmlRegisterCallbacks = 1;
650 xmlDeregisterNodeDefaultValue = func;
651 return(old);
654 xmlDeregisterNodeFunc
655 xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
657 xmlDeregisterNodeFunc old;
659 xmlMutexLock(xmlThrDefMutex);
660 old = xmlDeregisterNodeDefaultValueThrDef;
662 __xmlRegisterCallbacks = 1;
663 xmlDeregisterNodeDefaultValueThrDef = func;
664 xmlMutexUnlock(xmlThrDefMutex);
666 return(old);
669 xmlParserInputBufferCreateFilenameFunc
670 xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
672 xmlParserInputBufferCreateFilenameFunc old;
674 xmlMutexLock(xmlThrDefMutex);
675 old = xmlParserInputBufferCreateFilenameValueThrDef;
676 if (old == NULL) {
677 old = __xmlParserInputBufferCreateFilename;
680 xmlParserInputBufferCreateFilenameValueThrDef = func;
681 xmlMutexUnlock(xmlThrDefMutex);
683 return(old);
686 xmlOutputBufferCreateFilenameFunc
687 xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
689 xmlOutputBufferCreateFilenameFunc old;
691 xmlMutexLock(xmlThrDefMutex);
692 old = xmlOutputBufferCreateFilenameValueThrDef;
693 #ifdef LIBXML_OUTPUT_ENABLED
694 if (old == NULL) {
695 old = __xmlOutputBufferCreateFilename;
697 #endif
698 xmlOutputBufferCreateFilenameValueThrDef = func;
699 xmlMutexUnlock(xmlThrDefMutex);
701 return(old);
704 #ifdef LIBXML_DOCB_ENABLED
705 #undef docbDefaultSAXHandler
706 xmlSAXHandlerV1 *
707 __docbDefaultSAXHandler(void) {
708 if (IS_MAIN_THREAD)
709 return (&docbDefaultSAXHandler);
710 else
711 return (&xmlGetGlobalState()->docbDefaultSAXHandler);
713 #endif
715 #ifdef LIBXML_HTML_ENABLED
716 #undef htmlDefaultSAXHandler
717 xmlSAXHandlerV1 *
718 __htmlDefaultSAXHandler(void) {
719 if (IS_MAIN_THREAD)
720 return (&htmlDefaultSAXHandler);
721 else
722 return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
724 #endif
726 #undef xmlLastError
727 xmlError *
728 __xmlLastError(void) {
729 if (IS_MAIN_THREAD)
730 return (&xmlLastError);
731 else
732 return (&xmlGetGlobalState()->xmlLastError);
736 * The following memory routines were apparently lost at some point,
737 * and were re-inserted at this point on June 10, 2004. Hope it's
738 * the right place for them :-)
740 #if defined(LIBXML_THREAD_ALLOC_ENABLED) && defined(LIBXML_THREAD_ENABLED)
741 #undef xmlMalloc
742 xmlMallocFunc *
743 __xmlMalloc(void){
744 if (IS_MAIN_THREAD)
745 return (&xmlMalloc);
746 else
747 return (&xmlGetGlobalState()->xmlMalloc);
750 #undef xmlMallocAtomic
751 xmlMallocFunc *
752 __xmlMallocAtomic(void){
753 if (IS_MAIN_THREAD)
754 return (&xmlMallocAtomic);
755 else
756 return (&xmlGetGlobalState()->xmlMallocAtomic);
759 #undef xmlRealloc
760 xmlReallocFunc *
761 __xmlRealloc(void){
762 if (IS_MAIN_THREAD)
763 return (&xmlRealloc);
764 else
765 return (&xmlGetGlobalState()->xmlRealloc);
768 #undef xmlFree
769 xmlFreeFunc *
770 __xmlFree(void){
771 if (IS_MAIN_THREAD)
772 return (&xmlFree);
773 else
774 return (&xmlGetGlobalState()->xmlFree);
777 xmlStrdupFunc *
778 __xmlMemStrdup(void){
779 if (IS_MAIN_THREAD)
780 return (&xmlMemStrdup);
781 else
782 return (&xmlGetGlobalState()->xmlMemStrdup);
785 #endif
788 * Everything starting from the line below is
789 * Automatically generated by build_glob.py.
790 * Do not modify the previous line.
794 #undef oldXMLWDcompatibility
795 int *
796 __oldXMLWDcompatibility(void) {
797 if (IS_MAIN_THREAD)
798 return (&oldXMLWDcompatibility);
799 else
800 return (&xmlGetGlobalState()->oldXMLWDcompatibility);
803 #undef xmlBufferAllocScheme
804 xmlBufferAllocationScheme *
805 __xmlBufferAllocScheme(void) {
806 if (IS_MAIN_THREAD)
807 return (&xmlBufferAllocScheme);
808 else
809 return (&xmlGetGlobalState()->xmlBufferAllocScheme);
811 xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
812 xmlBufferAllocationScheme ret;
813 xmlMutexLock(xmlThrDefMutex);
814 ret = xmlBufferAllocSchemeThrDef;
815 xmlBufferAllocSchemeThrDef = v;
816 xmlMutexUnlock(xmlThrDefMutex);
817 return ret;
820 #undef xmlDefaultBufferSize
821 int *
822 __xmlDefaultBufferSize(void) {
823 if (IS_MAIN_THREAD)
824 return (&xmlDefaultBufferSize);
825 else
826 return (&xmlGetGlobalState()->xmlDefaultBufferSize);
828 int xmlThrDefDefaultBufferSize(int v) {
829 int ret;
830 xmlMutexLock(xmlThrDefMutex);
831 ret = xmlDefaultBufferSizeThrDef;
832 xmlDefaultBufferSizeThrDef = v;
833 xmlMutexUnlock(xmlThrDefMutex);
834 return ret;
837 #ifdef LIBXML_SAX1_ENABLED
838 #undef xmlDefaultSAXHandler
839 xmlSAXHandlerV1 *
840 __xmlDefaultSAXHandler(void) {
841 if (IS_MAIN_THREAD)
842 return (&xmlDefaultSAXHandler);
843 else
844 return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
846 #endif /* LIBXML_SAX1_ENABLED */
848 #undef xmlDefaultSAXLocator
849 xmlSAXLocator *
850 __xmlDefaultSAXLocator(void) {
851 if (IS_MAIN_THREAD)
852 return (&xmlDefaultSAXLocator);
853 else
854 return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
857 #undef xmlDoValidityCheckingDefaultValue
858 int *
859 __xmlDoValidityCheckingDefaultValue(void) {
860 if (IS_MAIN_THREAD)
861 return (&xmlDoValidityCheckingDefaultValue);
862 else
863 return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
865 int xmlThrDefDoValidityCheckingDefaultValue(int v) {
866 int ret;
867 xmlMutexLock(xmlThrDefMutex);
868 ret = xmlDoValidityCheckingDefaultValueThrDef;
869 xmlDoValidityCheckingDefaultValueThrDef = v;
870 xmlMutexUnlock(xmlThrDefMutex);
871 return ret;
874 #undef xmlGenericError
875 xmlGenericErrorFunc * XMLCALL
876 __xmlGenericError(void) {
877 if (IS_MAIN_THREAD)
878 return (&xmlGenericError);
879 else
880 return (&xmlGetGlobalState()->xmlGenericError);
883 #undef xmlStructuredError
884 xmlStructuredErrorFunc *
885 __xmlStructuredError(void) {
886 if (IS_MAIN_THREAD)
887 return (&xmlStructuredError);
888 else
889 return (&xmlGetGlobalState()->xmlStructuredError);
892 #undef xmlGenericErrorContext
893 void * *
894 __xmlGenericErrorContext(void) {
895 if (IS_MAIN_THREAD)
896 return (&xmlGenericErrorContext);
897 else
898 return (&xmlGetGlobalState()->xmlGenericErrorContext);
901 #undef xmlStructuredErrorContext
902 void * *
903 __xmlStructuredErrorContext(void) {
904 if (IS_MAIN_THREAD)
905 return (&xmlStructuredErrorContext);
906 else
907 return (&xmlGetGlobalState()->xmlStructuredErrorContext);
910 #undef xmlGetWarningsDefaultValue
911 int *
912 __xmlGetWarningsDefaultValue(void) {
913 if (IS_MAIN_THREAD)
914 return (&xmlGetWarningsDefaultValue);
915 else
916 return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
918 int xmlThrDefGetWarningsDefaultValue(int v) {
919 int ret;
920 xmlMutexLock(xmlThrDefMutex);
921 ret = xmlGetWarningsDefaultValueThrDef;
922 xmlGetWarningsDefaultValueThrDef = v;
923 xmlMutexUnlock(xmlThrDefMutex);
924 return ret;
927 #undef xmlIndentTreeOutput
928 int *
929 __xmlIndentTreeOutput(void) {
930 if (IS_MAIN_THREAD)
931 return (&xmlIndentTreeOutput);
932 else
933 return (&xmlGetGlobalState()->xmlIndentTreeOutput);
935 int xmlThrDefIndentTreeOutput(int v) {
936 int ret;
937 xmlMutexLock(xmlThrDefMutex);
938 ret = xmlIndentTreeOutputThrDef;
939 xmlIndentTreeOutputThrDef = v;
940 xmlMutexUnlock(xmlThrDefMutex);
941 return ret;
944 #undef xmlTreeIndentString
945 const char * *
946 __xmlTreeIndentString(void) {
947 if (IS_MAIN_THREAD)
948 return (&xmlTreeIndentString);
949 else
950 return (&xmlGetGlobalState()->xmlTreeIndentString);
952 const char * xmlThrDefTreeIndentString(const char * v) {
953 const char * ret;
954 xmlMutexLock(xmlThrDefMutex);
955 ret = xmlTreeIndentStringThrDef;
956 xmlTreeIndentStringThrDef = v;
957 xmlMutexUnlock(xmlThrDefMutex);
958 return ret;
961 #undef xmlKeepBlanksDefaultValue
962 int *
963 __xmlKeepBlanksDefaultValue(void) {
964 if (IS_MAIN_THREAD)
965 return (&xmlKeepBlanksDefaultValue);
966 else
967 return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
969 int xmlThrDefKeepBlanksDefaultValue(int v) {
970 int ret;
971 xmlMutexLock(xmlThrDefMutex);
972 ret = xmlKeepBlanksDefaultValueThrDef;
973 xmlKeepBlanksDefaultValueThrDef = v;
974 xmlMutexUnlock(xmlThrDefMutex);
975 return ret;
978 #undef xmlLineNumbersDefaultValue
979 int *
980 __xmlLineNumbersDefaultValue(void) {
981 if (IS_MAIN_THREAD)
982 return (&xmlLineNumbersDefaultValue);
983 else
984 return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
986 int xmlThrDefLineNumbersDefaultValue(int v) {
987 int ret;
988 xmlMutexLock(xmlThrDefMutex);
989 ret = xmlLineNumbersDefaultValueThrDef;
990 xmlLineNumbersDefaultValueThrDef = v;
991 xmlMutexUnlock(xmlThrDefMutex);
992 return ret;
995 #undef xmlLoadExtDtdDefaultValue
996 int *
997 __xmlLoadExtDtdDefaultValue(void) {
998 if (IS_MAIN_THREAD)
999 return (&xmlLoadExtDtdDefaultValue);
1000 else
1001 return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
1003 int xmlThrDefLoadExtDtdDefaultValue(int v) {
1004 int ret;
1005 xmlMutexLock(xmlThrDefMutex);
1006 ret = xmlLoadExtDtdDefaultValueThrDef;
1007 xmlLoadExtDtdDefaultValueThrDef = v;
1008 xmlMutexUnlock(xmlThrDefMutex);
1009 return ret;
1012 #undef xmlParserDebugEntities
1013 int *
1014 __xmlParserDebugEntities(void) {
1015 if (IS_MAIN_THREAD)
1016 return (&xmlParserDebugEntities);
1017 else
1018 return (&xmlGetGlobalState()->xmlParserDebugEntities);
1020 int xmlThrDefParserDebugEntities(int v) {
1021 int ret;
1022 xmlMutexLock(xmlThrDefMutex);
1023 ret = xmlParserDebugEntitiesThrDef;
1024 xmlParserDebugEntitiesThrDef = v;
1025 xmlMutexUnlock(xmlThrDefMutex);
1026 return ret;
1029 #undef xmlParserVersion
1030 const char * *
1031 __xmlParserVersion(void) {
1032 if (IS_MAIN_THREAD)
1033 return (&xmlParserVersion);
1034 else
1035 return (&xmlGetGlobalState()->xmlParserVersion);
1038 #undef xmlPedanticParserDefaultValue
1039 int *
1040 __xmlPedanticParserDefaultValue(void) {
1041 if (IS_MAIN_THREAD)
1042 return (&xmlPedanticParserDefaultValue);
1043 else
1044 return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
1046 int xmlThrDefPedanticParserDefaultValue(int v) {
1047 int ret;
1048 xmlMutexLock(xmlThrDefMutex);
1049 ret = xmlPedanticParserDefaultValueThrDef;
1050 xmlPedanticParserDefaultValueThrDef = v;
1051 xmlMutexUnlock(xmlThrDefMutex);
1052 return ret;
1055 #undef xmlSaveNoEmptyTags
1056 int *
1057 __xmlSaveNoEmptyTags(void) {
1058 if (IS_MAIN_THREAD)
1059 return (&xmlSaveNoEmptyTags);
1060 else
1061 return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
1063 int xmlThrDefSaveNoEmptyTags(int v) {
1064 int ret;
1065 xmlMutexLock(xmlThrDefMutex);
1066 ret = xmlSaveNoEmptyTagsThrDef;
1067 xmlSaveNoEmptyTagsThrDef = v;
1068 xmlMutexUnlock(xmlThrDefMutex);
1069 return ret;
1072 #undef xmlSubstituteEntitiesDefaultValue
1073 int *
1074 __xmlSubstituteEntitiesDefaultValue(void) {
1075 if (IS_MAIN_THREAD)
1076 return (&xmlSubstituteEntitiesDefaultValue);
1077 else
1078 return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
1080 int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
1081 int ret;
1082 xmlMutexLock(xmlThrDefMutex);
1083 ret = xmlSubstituteEntitiesDefaultValueThrDef;
1084 xmlSubstituteEntitiesDefaultValueThrDef = v;
1085 xmlMutexUnlock(xmlThrDefMutex);
1086 return ret;
1089 #undef xmlRegisterNodeDefaultValue
1090 xmlRegisterNodeFunc * XMLCALL
1091 __xmlRegisterNodeDefaultValue(void) {
1092 if (IS_MAIN_THREAD)
1093 return (&xmlRegisterNodeDefaultValue);
1094 else
1095 return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue);
1098 #undef xmlDeregisterNodeDefaultValue
1099 xmlDeregisterNodeFunc * XMLCALL
1100 __xmlDeregisterNodeDefaultValue(void) {
1101 if (IS_MAIN_THREAD)
1102 return (&xmlDeregisterNodeDefaultValue);
1103 else
1104 return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue);
1107 #undef xmlParserInputBufferCreateFilenameValue
1108 xmlParserInputBufferCreateFilenameFunc * XMLCALL
1109 __xmlParserInputBufferCreateFilenameValue(void) {
1110 if (IS_MAIN_THREAD)
1111 return (&xmlParserInputBufferCreateFilenameValue);
1112 else
1113 return (&xmlGetGlobalState()->xmlParserInputBufferCreateFilenameValue);
1116 #undef xmlOutputBufferCreateFilenameValue
1117 xmlOutputBufferCreateFilenameFunc * XMLCALL
1118 __xmlOutputBufferCreateFilenameValue(void) {
1119 if (IS_MAIN_THREAD)
1120 return (&xmlOutputBufferCreateFilenameValue);
1121 else
1122 return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue);
1125 #define bottom_globals
1126 #include "elfgcchack.h"