blob: 0fc54e2706770ddec9698d2b02e0d535f185055f [file] [log] [blame]
Daniel Veillardb8478642001-10-12 17:29:10 +00001/*
2 * globals.c: definition and handling of the set of global variables
3 * of the library
4 *
5 * The bottom of this file is automatically generated by build_glob.py
6 * based on the description file global.data
7 *
8 * See Copyright for the status of this software.
9 *
10 * Gary Pennington <Gary.Pennington@uk.sun.com>
11 * daniel@veillard.com
12 */
13
Daniel Veillard34ce8be2002-03-18 19:37:11 +000014#define IN_LIBXML
Daniel Veillardb8478642001-10-12 17:29:10 +000015#include "libxml.h"
16
Daniel Veillarde7090612001-10-13 12:18:28 +000017#ifdef HAVE_STDLIB_H
Jaka Mocnik77d19ae2001-10-13 12:06:09 +000018#include <stdlib.h>
Daniel Veillarde7090612001-10-13 12:18:28 +000019#endif
Jaka Mocnik77d19ae2001-10-13 12:06:09 +000020#include <string.h>
21
Daniel Veillard3c01b1d2001-10-17 15:58:35 +000022#include <libxml/globals.h>
Daniel Veillarde7090612001-10-13 12:18:28 +000023#include <libxml/xmlmemory.h>
24
Daniel Veillard3c01b1d2001-10-17 15:58:35 +000025/* #define DEBUG_GLOBALS */
26
Daniel Veillardb8478642001-10-12 17:29:10 +000027/*
28 * Helpful Macro
29 */
Daniel Veillard3c01b1d2001-10-17 15:58:35 +000030#ifdef LIBXML_THREAD_ENABLED
31#define IS_MAIN_THREAD (xmlIsMainThread())
Daniel Veillardb8478642001-10-12 17:29:10 +000032#else
33#define IS_MAIN_THREAD 1
34#endif
35
36/************************************************************************
37 * *
38 * All the user accessible global variables of the library *
39 * *
40 ************************************************************************/
41
Daniel Veillardb8478642001-10-12 17:29:10 +000042/*
43 * Memory allocation routines
44 */
Daniel Veillard7216cfd2002-11-08 15:10:00 +000045#if defined(DEBUG_MEMORY_LOCATION) || defined(DEBUG_MEMORY)
Daniel Veillardd0463562001-10-13 09:15:48 +000046extern void xmlMemFree(void *ptr);
47extern void * xmlMemMalloc(size_t size);
48extern void * xmlMemRealloc(void *ptr,size_t size);
49extern char * xmlMemoryStrdup(const char *str);
50
Daniel Veillardb8478642001-10-12 17:29:10 +000051xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
52xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +000053xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillardb8478642001-10-12 17:29:10 +000054xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
55xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
56#else
Daniel Veillard9d06d302002-01-22 18:15:52 +000057/**
58 * xmlFree:
59 * @mem: an already allocated block of memory
60 *
61 * The variable holding the libxml free() implementation
62 */
Daniel Veillardb8478642001-10-12 17:29:10 +000063xmlFreeFunc xmlFree = (xmlFreeFunc) free;
Daniel Veillard9d06d302002-01-22 18:15:52 +000064/**
65 * xmlMalloc:
66 * @size: the size requested in bytes
67 *
68 * The variable holding the libxml malloc() implementation
69 *
70 * Returns a pointer to the newly allocated block or NULL in case of error
71 */
Daniel Veillardb8478642001-10-12 17:29:10 +000072xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard9d06d302002-01-22 18:15:52 +000073/**
Daniel Veillard3c908dc2003-04-19 00:07:51 +000074 * xmlMallocAtomic:
75 * @size: the size requested in bytes
76 *
77 * The variable holding the libxml malloc() implementation for atomic
78 * data (i.e. blocks not containings pointers), useful when using a
79 * garbage collecting allocator.
80 *
81 * Returns a pointer to the newly allocated block or NULL in case of error
82 */
83xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) malloc;
84/**
Daniel Veillard9d06d302002-01-22 18:15:52 +000085 * xmlRealloc:
86 * @mem: an already allocated block of memory
87 * @size: the new size requested in bytes
88 *
89 * The variable holding the libxml realloc() implementation
90 *
91 * Returns a pointer to the newly reallocated block or NULL in case of error
92 */
Daniel Veillardb8478642001-10-12 17:29:10 +000093xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard9d06d302002-01-22 18:15:52 +000094/**
95 * xmlMemStrdup:
96 * @str: a zero terminated string
97 *
98 * The variable holding the libxml strdup() implementation
99 *
100 * Returns the copy of the string or NULL in case of error
101 */
Daniel Veillardb82c1662001-12-09 14:00:54 +0000102xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillardb8478642001-10-12 17:29:10 +0000103#endif
104
Daniel Veillardd0463562001-10-13 09:15:48 +0000105#include <libxml/threads.h>
106#include <libxml/globals.h>
107#include <libxml/SAX.h>
108
109#undef docbDefaultSAXHandler
110#undef htmlDefaultSAXHandler
111#undef oldXMLWDcompatibility
112#undef xmlBufferAllocScheme
113#undef xmlDefaultBufferSize
114#undef xmlDefaultSAXHandler
115#undef xmlDefaultSAXLocator
116#undef xmlDoValidityCheckingDefaultValue
117#undef xmlGenericError
118#undef xmlGenericErrorContext
119#undef xmlGetWarningsDefaultValue
120#undef xmlIndentTreeOutput
Aleksey Sanin23002562002-05-24 07:18:40 +0000121#undef xmlTreeIndentString
Daniel Veillardd0463562001-10-13 09:15:48 +0000122#undef xmlKeepBlanksDefaultValue
123#undef xmlLineNumbersDefaultValue
124#undef xmlLoadExtDtdDefaultValue
125#undef xmlParserDebugEntities
126#undef xmlParserVersion
127#undef xmlPedanticParserDefaultValue
128#undef xmlSaveNoEmptyTags
129#undef xmlSubstituteEntitiesDefaultValue
Daniel Veillard8326e732003-01-07 00:19:07 +0000130#undef xmlRegisterNodeDefaultValue
131#undef xmlDeregisterNodeDefaultValue
Daniel Veillardd0463562001-10-13 09:15:48 +0000132
133#undef xmlFree
134#undef xmlMalloc
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000135#undef xmlMallocAtomic
Daniel Veillardd0463562001-10-13 09:15:48 +0000136#undef xmlMemStrdup
137#undef xmlRealloc
138
Daniel Veillard9d06d302002-01-22 18:15:52 +0000139/**
140 * xmlParserVersion:
141 *
142 * Constant string describing the internal version of the library
143 */
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000144const char *xmlParserVersion = LIBXML_VERSION_STRING;
145
Daniel Veillard9d06d302002-01-22 18:15:52 +0000146/**
147 * xmlBufferAllocScheme:
148 *
149 * Global setting, default allocation policy for buffers, default is
150 * XML_BUFFER_ALLOC_EXACT
Daniel Veillardb8478642001-10-12 17:29:10 +0000151 */
152xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000153/**
154 * xmlDefaultBufferSize:
155 *
156 * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
157 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000158int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
159
160/*
161 * Parser defaults
162 */
Daniel Veillardd0463562001-10-13 09:15:48 +0000163
Daniel Veillard9d06d302002-01-22 18:15:52 +0000164/**
165 * oldXMLWDcompatibility:
166 *
167 * Global setting, DEPRECATED.
168 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000169int oldXMLWDcompatibility = 0; /* DEPRECATED */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000170/**
171 * xmlParserDebugEntities:
172 *
173 * Global setting, asking the parser to print out debugging informations.
174 * while handling entities.
175 * Disabled by default
176 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000177int xmlParserDebugEntities = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000178/**
179 * xmlDoValidityCheckingDefaultValue:
180 *
181 * Global setting, indicate that the parser should work in validating mode.
182 * Disabled by default.
183 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000184int xmlDoValidityCheckingDefaultValue = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000185/**
186 * xmlGetWarningsDefaultValue:
187 *
188 * Global setting, indicate that the parser should provide warnings.
189 * Activated by default.
190 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000191int xmlGetWarningsDefaultValue = 1;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000192/**
193 * xmlLoadExtDtdDefaultValue:
194 *
195 * Global setting, indicate that the parser should load DTD while not
196 * validating.
197 * Disabled by default.
198 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000199int xmlLoadExtDtdDefaultValue = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000200/**
201 * xmlPedanticParserDefaultValue:
202 *
203 * Global setting, indicate that the parser be pedantic
204 * Disabled by default.
205 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000206int xmlPedanticParserDefaultValue = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000207/**
208 * xmlLineNumbersDefaultValue:
209 *
210 * Global setting, indicate that the parser should store the line number
211 * in the content field of elements in the DOM tree.
212 * Disabled by default since this may not be safe for old classes of
213 * applicaton.
214 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000215int xmlLineNumbersDefaultValue = 0;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000216/**
217 * xmlKeepBlanksDefaultValue:
218 *
219 * Global setting, indicate that the parser should keep all blanks
220 * nodes found in the content
221 * Activated by default, this is actually needed to have the parser
222 * conformant to the XML Recommendation, however the option is kept
223 * for some applications since this was libxml1 default behaviour.
224 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000225int xmlKeepBlanksDefaultValue = 1;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000226/**
227 * xmlSubstituteEntitiesDefaultValue:
228 *
229 * Global setting, indicate that the parser should not generate entity
230 * references but replace them with the actual content of the entity
231 * Disabled by default, this should be activated when using XPath since
232 * the XPath data model requires entities replacement and the XPath
233 * engine does not handle entities references transparently.
234 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000235int xmlSubstituteEntitiesDefaultValue = 0;
236
Daniel Veillard5335dc52003-01-01 20:59:38 +0000237xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL;
238xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL;
239
Daniel Veillardb8478642001-10-12 17:29:10 +0000240/*
241 * Error handling
242 */
243
244/* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
245/* Must initialize xmlGenericError in xmlInitParser */
Daniel Veillard635ef722001-10-29 11:48:19 +0000246void xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
247 const char *msg,
248 ...);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000249/**
250 * xmlGenericError:
251 *
252 * Global setting: function used for generic error callbacks
253 */
Daniel Veillard635ef722001-10-29 11:48:19 +0000254xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc;
Daniel Veillard9d06d302002-01-22 18:15:52 +0000255/**
256 * xmlGenericErrorContext:
257 *
258 * Global setting passed to generic error callbacks
259 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000260void *xmlGenericErrorContext = NULL;
261
262/*
263 * output defaults
264 */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000265/**
266 * xmlIndentTreeOutput:
267 *
268 * Global setting, asking the serializer to indent the output tree by default
Aleksey Sanin23002562002-05-24 07:18:40 +0000269 * Enabled by default
Daniel Veillard9d06d302002-01-22 18:15:52 +0000270 */
Aleksey Sanin23002562002-05-24 07:18:40 +0000271int xmlIndentTreeOutput = 1;
272
273/**
274 * xmlTreeIndentString:
275 *
276 * The string used to do one-level indent. By default is equal to " " (two spaces)
277 */
278const char *xmlTreeIndentString = " ";
279
Daniel Veillard9d06d302002-01-22 18:15:52 +0000280/**
281 * xmlSaveNoEmptyTags:
282 *
283 * Global setting, asking the serializer to not output empty tags
284 * as <empty/> but <empty></empty>. those two forms are undistinguishable
285 * once parsed.
286 * Disabled by default
287 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000288int xmlSaveNoEmptyTags = 0;
289
Daniel Veillard9d06d302002-01-22 18:15:52 +0000290/**
291 * xmlDefaultSAXHandler:
292 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000293 * Default handler for XML, builds the DOM tree
294 */
295xmlSAXHandler xmlDefaultSAXHandler = {
296 internalSubset,
297 isStandalone,
298 hasInternalSubset,
299 hasExternalSubset,
300 resolveEntity,
301 getEntity,
302 entityDecl,
303 notationDecl,
304 attributeDecl,
305 elementDecl,
306 unparsedEntityDecl,
307 setDocumentLocator,
308 startDocument,
309 endDocument,
310 startElement,
311 endElement,
312 reference,
313 characters,
314 characters,
315 processingInstruction,
316 comment,
317 xmlParserWarning,
318 xmlParserError,
319 xmlParserError,
320 getParameterEntity,
321 cdataBlock,
322 externalSubset,
323 0
324};
325
Daniel Veillard9d06d302002-01-22 18:15:52 +0000326/**
327 * xmlDefaultSAXLocator:
328 *
329 * The default SAX Locator
330 * { getPublicId, getSystemId, getLineNumber, getColumnNumber}
Daniel Veillardb8478642001-10-12 17:29:10 +0000331 */
Daniel Veillardb8478642001-10-12 17:29:10 +0000332xmlSAXLocator xmlDefaultSAXLocator = {
333 getPublicId, getSystemId, getLineNumber, getColumnNumber
334};
335
336#ifdef LIBXML_HTML_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000337/**
338 * htmlDefaultSAXHandler:
339 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000340 * Default handler for HTML, builds the DOM tree
341 */
342xmlSAXHandler htmlDefaultSAXHandler = {
343 internalSubset,
344 NULL,
345 NULL,
346 NULL,
347 NULL,
348 getEntity,
349 NULL,
350 NULL,
351 NULL,
352 NULL,
353 NULL,
354 setDocumentLocator,
355 startDocument,
356 endDocument,
357 startElement,
358 endElement,
359 NULL,
360 characters,
361 ignorableWhitespace,
362 NULL,
363 comment,
364 xmlParserWarning,
365 xmlParserError,
366 xmlParserError,
367 getParameterEntity,
368 cdataBlock,
369 NULL,
370 0
371};
372#endif /* LIBXML_HTML_ENABLED */
373
374#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000375/**
376 * docbDefaultSAXHandler:
377 *
Daniel Veillardb8478642001-10-12 17:29:10 +0000378 * Default handler for SGML DocBook, builds the DOM tree
379 */
380xmlSAXHandler docbDefaultSAXHandler = {
381 internalSubset,
382 isStandalone,
383 hasInternalSubset,
384 hasExternalSubset,
385 resolveEntity,
386 getEntity,
387 entityDecl,
388 NULL,
389 NULL,
390 NULL,
391 NULL,
392 setDocumentLocator,
393 startDocument,
394 endDocument,
395 startElement,
396 endElement,
397 reference,
398 characters,
399 ignorableWhitespace,
400 NULL,
401 comment,
402 xmlParserWarning,
403 xmlParserError,
404 xmlParserError,
405 getParameterEntity,
406 NULL,
407 NULL,
408 0
409};
410#endif /* LIBXML_DOCB_ENABLED */
411
412/**
413 * xmlInitializeGlobalState:
414 * @gs: a pointer to a newly allocated global state
415 *
416 * xmlInitializeGlobalState() initialize a global state with all the
417 * default values of the library.
418 */
419void
420xmlInitializeGlobalState(xmlGlobalStatePtr gs)
421{
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000422#ifdef DEBUG_GLOBALS
423 fprintf(stderr, "Initializing globals at %lu for thread %d\n",
424 (unsigned long) gs, xmlGetThreadId());
425#endif
426
Daniel Veillardb8478642001-10-12 17:29:10 +0000427 /*
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000428 * Perform initialization as required by libxml
Daniel Veillardb8478642001-10-12 17:29:10 +0000429 */
William M. Brack8b2c7f12002-11-22 05:07:29 +0000430
Daniel Veillarda4617b82001-11-04 20:19:12 +0000431#ifdef LIBXML_DOCB_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000432 initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000433#endif
434#ifdef LIBXML_HTML_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000435 inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
Daniel Veillarda4617b82001-11-04 20:19:12 +0000436#endif
Daniel Veillard3c01b1d2001-10-17 15:58:35 +0000437 initGenericErrorDefaultFunc(&gs->xmlGenericError);
438
Daniel Veillardb8478642001-10-12 17:29:10 +0000439 gs->oldXMLWDcompatibility = 0;
440 gs->xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
441 gs->xmlDefaultBufferSize = BASE_BUFFER_SIZE;
442 initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
443 gs->xmlDefaultSAXLocator.getPublicId = getPublicId;
444 gs->xmlDefaultSAXLocator.getSystemId = getSystemId;
445 gs->xmlDefaultSAXLocator.getLineNumber = getLineNumber;
446 gs->xmlDefaultSAXLocator.getColumnNumber = getColumnNumber;
447 gs->xmlDoValidityCheckingDefaultValue = 0;
448#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
449 gs->xmlFree = (xmlFreeFunc) xmlMemFree;
450 gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000451 gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000452 gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
453 gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
454#else
455 gs->xmlFree = (xmlFreeFunc) free;
456 gs->xmlMalloc = (xmlMallocFunc) malloc;
Daniel Veillard3c908dc2003-04-19 00:07:51 +0000457 gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
Daniel Veillardb8478642001-10-12 17:29:10 +0000458 gs->xmlRealloc = (xmlReallocFunc) realloc;
Daniel Veillard572577e2002-01-18 16:23:55 +0000459 gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
Daniel Veillardb8478642001-10-12 17:29:10 +0000460#endif
Daniel Veillardb8478642001-10-12 17:29:10 +0000461 gs->xmlGenericErrorContext = NULL;
462 gs->xmlGetWarningsDefaultValue = 1;
Aleksey Sanin23002562002-05-24 07:18:40 +0000463 gs->xmlIndentTreeOutput = 1;
464 gs->xmlTreeIndentString = " ";
Daniel Veillardb8478642001-10-12 17:29:10 +0000465 gs->xmlKeepBlanksDefaultValue = 1;
466 gs->xmlLineNumbersDefaultValue = 0;
467 gs->xmlLoadExtDtdDefaultValue = 0;
468 gs->xmlParserDebugEntities = 0;
469 gs->xmlParserVersion = LIBXML_VERSION_STRING;
470 gs->xmlPedanticParserDefaultValue = 0;
471 gs->xmlSaveNoEmptyTags = 0;
472 gs->xmlSubstituteEntitiesDefaultValue = 0;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000473
474 gs->xmlRegisterNodeDefaultValue = NULL;
475 gs->xmlDeregisterNodeDefaultValue = NULL;
Daniel Veillardb8478642001-10-12 17:29:10 +0000476}
477
Daniel Veillard5335dc52003-01-01 20:59:38 +0000478/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000479 * xmlRegisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000480 * @func: function pointer to the new RegisterNodeFunc
481 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000482 * Registers a callback for node creation
483 *
484 * Returns the old value of the registration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000485 */
486xmlRegisterNodeFunc
487xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
488{
489 xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue;
490
Daniel Veillarda880b122003-04-21 21:36:41 +0000491 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000492 xmlRegisterNodeDefaultValue = func;
493 return(old);
494}
495
496/**
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000497 * xmlDeregisterNodeDefault:
Daniel Veillard5335dc52003-01-01 20:59:38 +0000498 * @func: function pointer to the new DeregisterNodeFunc
499 *
Daniel Veillard1703c5f2003-02-10 14:28:44 +0000500 * Registers a callback for node destruction
501 *
Daniel Veillard7b4b2f92003-01-06 13:11:20 +0000502 * Returns the previous value of the deregistration function
Daniel Veillard5335dc52003-01-01 20:59:38 +0000503 */
504xmlDeregisterNodeFunc
505xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
506{
507 xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue;
508
Daniel Veillarda880b122003-04-21 21:36:41 +0000509 __xmlRegisterCallbacks = 1;
Daniel Veillard5335dc52003-01-01 20:59:38 +0000510 xmlDeregisterNodeDefaultValue = func;
511 return(old);
512}
513
514
Daniel Veillarda4617b82001-11-04 20:19:12 +0000515#ifdef LIBXML_DOCB_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000516#undef docbDefaultSAXHandler
517xmlSAXHandler *
518__docbDefaultSAXHandler(void) {
519 if (IS_MAIN_THREAD)
520 return (&docbDefaultSAXHandler);
521 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000522 return (&xmlGetGlobalState()->docbDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000523}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000524#endif
Daniel Veillardb8478642001-10-12 17:29:10 +0000525
Daniel Veillarda4617b82001-11-04 20:19:12 +0000526#ifdef LIBXML_HTML_ENABLED
Daniel Veillardb8478642001-10-12 17:29:10 +0000527#undef htmlDefaultSAXHandler
528xmlSAXHandler *
529__htmlDefaultSAXHandler(void) {
530 if (IS_MAIN_THREAD)
531 return (&htmlDefaultSAXHandler);
532 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000533 return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000534}
Daniel Veillarda4617b82001-11-04 20:19:12 +0000535#endif
536
537/*
538 * Everything starting from the line below is
539 * Automatically generated by build_glob.py.
540 * Do not modify the previous line.
541 */
542
Daniel Veillardb8478642001-10-12 17:29:10 +0000543
Daniel Veillardb8478642001-10-12 17:29:10 +0000544#undef oldXMLWDcompatibility
545int *
546__oldXMLWDcompatibility(void) {
547 if (IS_MAIN_THREAD)
548 return (&oldXMLWDcompatibility);
549 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000550 return (&xmlGetGlobalState()->oldXMLWDcompatibility);
Daniel Veillardb8478642001-10-12 17:29:10 +0000551}
552
Daniel Veillardb8478642001-10-12 17:29:10 +0000553#undef xmlBufferAllocScheme
554xmlBufferAllocationScheme *
555__xmlBufferAllocScheme(void) {
556 if (IS_MAIN_THREAD)
557 return (&xmlBufferAllocScheme);
558 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000559 return (&xmlGetGlobalState()->xmlBufferAllocScheme);
Daniel Veillardb8478642001-10-12 17:29:10 +0000560}
561
Daniel Veillardb8478642001-10-12 17:29:10 +0000562#undef xmlDefaultBufferSize
563int *
564__xmlDefaultBufferSize(void) {
565 if (IS_MAIN_THREAD)
566 return (&xmlDefaultBufferSize);
567 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000568 return (&xmlGetGlobalState()->xmlDefaultBufferSize);
Daniel Veillardb8478642001-10-12 17:29:10 +0000569}
570
Daniel Veillardb8478642001-10-12 17:29:10 +0000571#undef xmlDefaultSAXHandler
572xmlSAXHandler *
573__xmlDefaultSAXHandler(void) {
574 if (IS_MAIN_THREAD)
575 return (&xmlDefaultSAXHandler);
576 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000577 return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
Daniel Veillardb8478642001-10-12 17:29:10 +0000578}
579
Daniel Veillardb8478642001-10-12 17:29:10 +0000580#undef xmlDefaultSAXLocator
581xmlSAXLocator *
582__xmlDefaultSAXLocator(void) {
583 if (IS_MAIN_THREAD)
584 return (&xmlDefaultSAXLocator);
585 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000586 return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
Daniel Veillardb8478642001-10-12 17:29:10 +0000587}
588
Daniel Veillardb8478642001-10-12 17:29:10 +0000589#undef xmlDoValidityCheckingDefaultValue
590int *
591__xmlDoValidityCheckingDefaultValue(void) {
592 if (IS_MAIN_THREAD)
593 return (&xmlDoValidityCheckingDefaultValue);
594 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000595 return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000596}
597
Daniel Veillardb8478642001-10-12 17:29:10 +0000598#undef xmlGenericError
599xmlGenericErrorFunc *
600__xmlGenericError(void) {
601 if (IS_MAIN_THREAD)
602 return (&xmlGenericError);
603 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000604 return (&xmlGetGlobalState()->xmlGenericError);
Daniel Veillardb8478642001-10-12 17:29:10 +0000605}
606
Daniel Veillardb8478642001-10-12 17:29:10 +0000607#undef xmlGenericErrorContext
608void * *
609__xmlGenericErrorContext(void) {
610 if (IS_MAIN_THREAD)
611 return (&xmlGenericErrorContext);
612 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000613 return (&xmlGetGlobalState()->xmlGenericErrorContext);
Daniel Veillardb8478642001-10-12 17:29:10 +0000614}
615
Daniel Veillardb8478642001-10-12 17:29:10 +0000616#undef xmlGetWarningsDefaultValue
617int *
618__xmlGetWarningsDefaultValue(void) {
619 if (IS_MAIN_THREAD)
620 return (&xmlGetWarningsDefaultValue);
621 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000622 return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000623}
624
Daniel Veillardb8478642001-10-12 17:29:10 +0000625#undef xmlIndentTreeOutput
626int *
627__xmlIndentTreeOutput(void) {
628 if (IS_MAIN_THREAD)
629 return (&xmlIndentTreeOutput);
630 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000631 return (&xmlGetGlobalState()->xmlIndentTreeOutput);
Daniel Veillardb8478642001-10-12 17:29:10 +0000632}
633
Aleksey Sanin23002562002-05-24 07:18:40 +0000634#undef xmlTreeIndentString
635const char * *
636__xmlTreeIndentString(void) {
637 if (IS_MAIN_THREAD)
638 return (&xmlTreeIndentString);
639 else
640 return (&xmlGetGlobalState()->xmlTreeIndentString);
641}
642
Daniel Veillardb8478642001-10-12 17:29:10 +0000643#undef xmlKeepBlanksDefaultValue
644int *
645__xmlKeepBlanksDefaultValue(void) {
646 if (IS_MAIN_THREAD)
647 return (&xmlKeepBlanksDefaultValue);
648 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000649 return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000650}
651
Daniel Veillardb8478642001-10-12 17:29:10 +0000652#undef xmlLineNumbersDefaultValue
653int *
654__xmlLineNumbersDefaultValue(void) {
655 if (IS_MAIN_THREAD)
656 return (&xmlLineNumbersDefaultValue);
657 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000658 return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000659}
660
Daniel Veillardb8478642001-10-12 17:29:10 +0000661#undef xmlLoadExtDtdDefaultValue
662int *
663__xmlLoadExtDtdDefaultValue(void) {
664 if (IS_MAIN_THREAD)
665 return (&xmlLoadExtDtdDefaultValue);
666 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000667 return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000668}
669
Daniel Veillardb8478642001-10-12 17:29:10 +0000670#undef xmlParserDebugEntities
671int *
672__xmlParserDebugEntities(void) {
673 if (IS_MAIN_THREAD)
674 return (&xmlParserDebugEntities);
675 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000676 return (&xmlGetGlobalState()->xmlParserDebugEntities);
Daniel Veillardb8478642001-10-12 17:29:10 +0000677}
678
Daniel Veillardb8478642001-10-12 17:29:10 +0000679#undef xmlParserVersion
680const char * *
681__xmlParserVersion(void) {
682 if (IS_MAIN_THREAD)
683 return (&xmlParserVersion);
684 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000685 return (&xmlGetGlobalState()->xmlParserVersion);
Daniel Veillardb8478642001-10-12 17:29:10 +0000686}
687
Daniel Veillardb8478642001-10-12 17:29:10 +0000688#undef xmlPedanticParserDefaultValue
689int *
690__xmlPedanticParserDefaultValue(void) {
691 if (IS_MAIN_THREAD)
692 return (&xmlPedanticParserDefaultValue);
693 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000694 return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000695}
696
Daniel Veillardb8478642001-10-12 17:29:10 +0000697#undef xmlSaveNoEmptyTags
698int *
699__xmlSaveNoEmptyTags(void) {
700 if (IS_MAIN_THREAD)
701 return (&xmlSaveNoEmptyTags);
702 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000703 return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
Daniel Veillardb8478642001-10-12 17:29:10 +0000704}
705
Daniel Veillardb8478642001-10-12 17:29:10 +0000706#undef xmlSubstituteEntitiesDefaultValue
707int *
708__xmlSubstituteEntitiesDefaultValue(void) {
709 if (IS_MAIN_THREAD)
710 return (&xmlSubstituteEntitiesDefaultValue);
711 else
Daniel Veillardd0463562001-10-13 09:15:48 +0000712 return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
Daniel Veillardb8478642001-10-12 17:29:10 +0000713}
Daniel Veillard5335dc52003-01-01 20:59:38 +0000714
715#undef xmlRegisterNodeDefaultValue
716xmlRegisterNodeFunc *
717__xmlRegisterNodeDefaultValue(void) {
718 if (IS_MAIN_THREAD)
719 return (&xmlRegisterNodeDefaultValue);
720 else
721 return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue);
722}
723
724#undef xmlDeregisterNodeDefaultValue
725xmlDeregisterNodeFunc *
726__xmlDeregisterNodeDefaultValue(void) {
727 if (IS_MAIN_THREAD)
728 return (&xmlDeregisterNodeDefaultValue);
729 else
730 return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue);
731}