1/*
2 * Summary: interface for all global variables of the library
3 * Description: all the global variables and thread handling for
4 * those variables is handled by this module.
5 *
6 * The bottom of this file is automatically generated by build_glob.py
7 * based on the description file global.data
8 *
9 * Copy: See Copyright for the status of this software.
10 *
11 * Author: Gary Pennington <Gary.Pennington@uk.sun.com>, Daniel Veillard
12 */
13
14#ifndef __XML_GLOBALS_H
15#define __XML_GLOBALS_H
16
17#include <libxml/xmlversion.h>
18#include <libxml/parser.h>
19#include <libxml/xmlerror.h>
20#include <libxml/SAX2.h>
21#include <libxml/xmlmemory.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27XMLPUBFUN void XMLCALL xmlInitGlobals(void);
28XMLPUBFUN void XMLCALL xmlCleanupGlobals(void);
29
30/**
31 * xmlParserInputBufferCreateFilenameFunc:
32 * @URI: the URI to read from
33 * @enc: the requested source encoding
34 *
35 * Signature for the function doing the lookup for a suitable input method
36 * corresponding to an URI.
37 *
38 * Returns the new xmlParserInputBufferPtr in case of success or NULL if no
39 * method was found.
40 */
41typedef xmlParserInputBufferPtr (*xmlParserInputBufferCreateFilenameFunc) (const char *URI,
42 xmlCharEncoding enc);
43
44
45/**
46 * xmlOutputBufferCreateFilenameFunc:
47 * @URI: the URI to write to
48 * @enc: the requested target encoding
49 *
50 * Signature for the function doing the lookup for a suitable output method
51 * corresponding to an URI.
52 *
53 * Returns the new xmlOutputBufferPtr in case of success or NULL if no
54 * method was found.
55 */
56typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI,
57 xmlCharEncodingHandlerPtr encoder,
58 int compression);
59
60XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
61XMLCALL xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func);
62XMLPUBFUN xmlOutputBufferCreateFilenameFunc
63XMLCALL xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc func);
64
65/*
66 * Externally global symbols which need to be protected for backwards
67 * compatibility support.
68 */
69
70#undef docbDefaultSAXHandler
71#undef htmlDefaultSAXHandler
72#undef oldXMLWDcompatibility
73#undef xmlBufferAllocScheme
74#undef xmlDefaultBufferSize
75#undef xmlDefaultSAXHandler
76#undef xmlDefaultSAXLocator
77#undef xmlDoValidityCheckingDefaultValue
78#undef xmlFree
79#undef xmlGenericError
80#undef xmlStructuredError
81#undef xmlGenericErrorContext
82#undef xmlStructuredErrorContext
83#undef xmlGetWarningsDefaultValue
84#undef xmlIndentTreeOutput
85#undef xmlTreeIndentString
86#undef xmlKeepBlanksDefaultValue
87#undef xmlLineNumbersDefaultValue
88#undef xmlLoadExtDtdDefaultValue
89#undef xmlMalloc
90#undef xmlMallocAtomic
91#undef xmlMemStrdup
92#undef xmlParserDebugEntities
93#undef xmlParserVersion
94#undef xmlPedanticParserDefaultValue
95#undef xmlRealloc
96#undef xmlSaveNoEmptyTags
97#undef xmlSubstituteEntitiesDefaultValue
98#undef xmlRegisterNodeDefaultValue
99#undef xmlDeregisterNodeDefaultValue
100#undef xmlLastError
101#undef xmlParserInputBufferCreateFilenameValue
102#undef xmlOutputBufferCreateFilenameValue
103
104/**
105 * xmlRegisterNodeFunc:
106 * @node: the current node
107 *
108 * Signature for the registration callback of a created node
109 */
110typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node);
111/**
112 * xmlDeregisterNodeFunc:
113 * @node: the current node
114 *
115 * Signature for the deregistration callback of a discarded node
116 */
117typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node);
118
119typedef struct _xmlGlobalState xmlGlobalState;
120typedef xmlGlobalState *xmlGlobalStatePtr;
121struct _xmlGlobalState
122{
123 const char *xmlParserVersion;
124
125 xmlSAXLocator xmlDefaultSAXLocator;
126 xmlSAXHandlerV1 xmlDefaultSAXHandler;
127 xmlSAXHandlerV1 docbDefaultSAXHandler;
128 xmlSAXHandlerV1 htmlDefaultSAXHandler;
129
130 xmlFreeFunc xmlFree;
131 xmlMallocFunc xmlMalloc;
132 xmlStrdupFunc xmlMemStrdup;
133 xmlReallocFunc xmlRealloc;
134
135 xmlGenericErrorFunc xmlGenericError;
136 xmlStructuredErrorFunc xmlStructuredError;
137 void *xmlGenericErrorContext;
138
139 int oldXMLWDcompatibility;
140
141 xmlBufferAllocationScheme xmlBufferAllocScheme;
142 int xmlDefaultBufferSize;
143
144 int xmlSubstituteEntitiesDefaultValue;
145 int xmlDoValidityCheckingDefaultValue;
146 int xmlGetWarningsDefaultValue;
147 int xmlKeepBlanksDefaultValue;
148 int xmlLineNumbersDefaultValue;
149 int xmlLoadExtDtdDefaultValue;
150 int xmlParserDebugEntities;
151 int xmlPedanticParserDefaultValue;
152
153 int xmlSaveNoEmptyTags;
154 int xmlIndentTreeOutput;
155 const char *xmlTreeIndentString;
156
157 xmlRegisterNodeFunc xmlRegisterNodeDefaultValue;
158 xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
159
160 xmlMallocFunc xmlMallocAtomic;
161 xmlError xmlLastError;
162
163 xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue;
164 xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue;
165
166 void *xmlStructuredErrorContext;
167};
168
169#ifdef __cplusplus
170}
171#endif
172#include <libxml/threads.h>
173#ifdef __cplusplus
174extern "C" {
175#endif
176
177XMLPUBFUN void XMLCALL xmlInitializeGlobalState(xmlGlobalStatePtr gs);
178
179XMLPUBFUN void XMLCALL xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler);
180
181XMLPUBFUN void XMLCALL xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler);
182
183XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlRegisterNodeDefault(xmlRegisterNodeFunc func);
184XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func);
185XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func);
186XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func);
187
188XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL
189 xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func);
190XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL
191 xmlThrDefParserInputBufferCreateFilenameDefault(
192 xmlParserInputBufferCreateFilenameFunc func);
193
194/** DOC_DISABLE */
195/*
196 * In general the memory allocation entry points are not kept
197 * thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED
198 * - xmlMalloc
199 * - xmlMallocAtomic
200 * - xmlRealloc
201 * - xmlMemStrdup
202 * - xmlFree
203 */
204
205#ifdef LIBXML_THREAD_ALLOC_ENABLED
206#ifdef LIBXML_THREAD_ENABLED
207XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMalloc(void);
208#define xmlMalloc \
209(*(__xmlMalloc()))
210#else
211XMLPUBVAR xmlMallocFunc xmlMalloc;
212#endif
213
214#ifdef LIBXML_THREAD_ENABLED
215XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMallocAtomic(void);
216#define xmlMallocAtomic \
217(*(__xmlMallocAtomic()))
218#else
219XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
220#endif
221
222#ifdef LIBXML_THREAD_ENABLED
223XMLPUBFUN xmlReallocFunc * XMLCALL __xmlRealloc(void);
224#define xmlRealloc \
225(*(__xmlRealloc()))
226#else
227XMLPUBVAR xmlReallocFunc xmlRealloc;
228#endif
229
230#ifdef LIBXML_THREAD_ENABLED
231XMLPUBFUN xmlFreeFunc * XMLCALL __xmlFree(void);
232#define xmlFree \
233(*(__xmlFree()))
234#else
235XMLPUBVAR xmlFreeFunc xmlFree;
236#endif
237
238#ifdef LIBXML_THREAD_ENABLED
239XMLPUBFUN xmlStrdupFunc * XMLCALL __xmlMemStrdup(void);
240#define xmlMemStrdup \
241(*(__xmlMemStrdup()))
242#else
243XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
244#endif
245
246#else /* !LIBXML_THREAD_ALLOC_ENABLED */
247XMLPUBVAR xmlMallocFunc xmlMalloc;
248XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
249XMLPUBVAR xmlReallocFunc xmlRealloc;
250XMLPUBVAR xmlFreeFunc xmlFree;
251XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
252#endif /* LIBXML_THREAD_ALLOC_ENABLED */
253
254#ifdef LIBXML_DOCB_ENABLED
255XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __docbDefaultSAXHandler(void);
256#ifdef LIBXML_THREAD_ENABLED
257#define docbDefaultSAXHandler \
258(*(__docbDefaultSAXHandler()))
259#else
260XMLPUBVAR xmlSAXHandlerV1 docbDefaultSAXHandler;
261#endif
262#endif
263
264#ifdef LIBXML_HTML_ENABLED
265XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __htmlDefaultSAXHandler(void);
266#ifdef LIBXML_THREAD_ENABLED
267#define htmlDefaultSAXHandler \
268(*(__htmlDefaultSAXHandler()))
269#else
270XMLPUBVAR xmlSAXHandlerV1 htmlDefaultSAXHandler;
271#endif
272#endif
273
274XMLPUBFUN xmlError * XMLCALL __xmlLastError(void);
275#ifdef LIBXML_THREAD_ENABLED
276#define xmlLastError \
277(*(__xmlLastError()))
278#else
279XMLPUBVAR xmlError xmlLastError;
280#endif
281
282/*
283 * Everything starting from the line below is
284 * Automatically generated by build_glob.py.
285 * Do not modify the previous line.
286 */
287
288
289XMLPUBFUN int * XMLCALL __oldXMLWDcompatibility(void);
290#ifdef LIBXML_THREAD_ENABLED
291#define oldXMLWDcompatibility \
292(*(__oldXMLWDcompatibility()))
293#else
294XMLPUBVAR int oldXMLWDcompatibility;
295#endif
296
297XMLPUBFUN xmlBufferAllocationScheme * XMLCALL __xmlBufferAllocScheme(void);
298#ifdef LIBXML_THREAD_ENABLED
299#define xmlBufferAllocScheme \
300(*(__xmlBufferAllocScheme()))
301#else
302XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme;
303#endif
304XMLPUBFUN xmlBufferAllocationScheme XMLCALL
305 xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v);
306
307XMLPUBFUN int * XMLCALL __xmlDefaultBufferSize(void);
308#ifdef LIBXML_THREAD_ENABLED
309#define xmlDefaultBufferSize \
310(*(__xmlDefaultBufferSize()))
311#else
312XMLPUBVAR int xmlDefaultBufferSize;
313#endif
314XMLPUBFUN int XMLCALL xmlThrDefDefaultBufferSize(int v);
315
316XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __xmlDefaultSAXHandler(void);
317#ifdef LIBXML_THREAD_ENABLED
318#define xmlDefaultSAXHandler \
319(*(__xmlDefaultSAXHandler()))
320#else
321XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler;
322#endif
323
324XMLPUBFUN xmlSAXLocator * XMLCALL __xmlDefaultSAXLocator(void);
325#ifdef LIBXML_THREAD_ENABLED
326#define xmlDefaultSAXLocator \
327(*(__xmlDefaultSAXLocator()))
328#else
329XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator;
330#endif
331
332XMLPUBFUN int * XMLCALL __xmlDoValidityCheckingDefaultValue(void);
333#ifdef LIBXML_THREAD_ENABLED
334#define xmlDoValidityCheckingDefaultValue \
335(*(__xmlDoValidityCheckingDefaultValue()))
336#else
337XMLPUBVAR int xmlDoValidityCheckingDefaultValue;
338#endif
339XMLPUBFUN int XMLCALL xmlThrDefDoValidityCheckingDefaultValue(int v);
340
341XMLPUBFUN xmlGenericErrorFunc * XMLCALL __xmlGenericError(void);
342#ifdef LIBXML_THREAD_ENABLED
343#define xmlGenericError \
344(*(__xmlGenericError()))
345#else
346XMLPUBVAR xmlGenericErrorFunc xmlGenericError;
347#endif
348
349XMLPUBFUN xmlStructuredErrorFunc * XMLCALL __xmlStructuredError(void);
350#ifdef LIBXML_THREAD_ENABLED
351#define xmlStructuredError \
352(*(__xmlStructuredError()))
353#else
354XMLPUBVAR xmlStructuredErrorFunc xmlStructuredError;
355#endif
356
357XMLPUBFUN void * * XMLCALL __xmlGenericErrorContext(void);
358#ifdef LIBXML_THREAD_ENABLED
359#define xmlGenericErrorContext \
360(*(__xmlGenericErrorContext()))
361#else
362XMLPUBVAR void * xmlGenericErrorContext;
363#endif
364
365XMLPUBFUN void * * XMLCALL __xmlStructuredErrorContext(void);
366#ifdef LIBXML_THREAD_ENABLED
367#define xmlStructuredErrorContext \
368(*(__xmlStructuredErrorContext()))
369#else
370XMLPUBVAR void * xmlStructuredErrorContext;
371#endif
372
373XMLPUBFUN int * XMLCALL __xmlGetWarningsDefaultValue(void);
374#ifdef LIBXML_THREAD_ENABLED
375#define xmlGetWarningsDefaultValue \
376(*(__xmlGetWarningsDefaultValue()))
377#else
378XMLPUBVAR int xmlGetWarningsDefaultValue;
379#endif
380XMLPUBFUN int XMLCALL xmlThrDefGetWarningsDefaultValue(int v);
381
382XMLPUBFUN int * XMLCALL __xmlIndentTreeOutput(void);
383#ifdef LIBXML_THREAD_ENABLED
384#define xmlIndentTreeOutput \
385(*(__xmlIndentTreeOutput()))
386#else
387XMLPUBVAR int xmlIndentTreeOutput;
388#endif
389XMLPUBFUN int XMLCALL xmlThrDefIndentTreeOutput(int v);
390
391XMLPUBFUN const char * * XMLCALL __xmlTreeIndentString(void);
392#ifdef LIBXML_THREAD_ENABLED
393#define xmlTreeIndentString \
394(*(__xmlTreeIndentString()))
395#else
396XMLPUBVAR const char * xmlTreeIndentString;
397#endif
398XMLPUBFUN const char * XMLCALL xmlThrDefTreeIndentString(const char * v);
399
400XMLPUBFUN int * XMLCALL __xmlKeepBlanksDefaultValue(void);
401#ifdef LIBXML_THREAD_ENABLED
402#define xmlKeepBlanksDefaultValue \
403(*(__xmlKeepBlanksDefaultValue()))
404#else
405XMLPUBVAR int xmlKeepBlanksDefaultValue;
406#endif
407XMLPUBFUN int XMLCALL xmlThrDefKeepBlanksDefaultValue(int v);
408
409XMLPUBFUN int * XMLCALL __xmlLineNumbersDefaultValue(void);
410#ifdef LIBXML_THREAD_ENABLED
411#define xmlLineNumbersDefaultValue \
412(*(__xmlLineNumbersDefaultValue()))
413#else
414XMLPUBVAR int xmlLineNumbersDefaultValue;
415#endif
416XMLPUBFUN int XMLCALL xmlThrDefLineNumbersDefaultValue(int v);
417
418XMLPUBFUN int * XMLCALL __xmlLoadExtDtdDefaultValue(void);
419#ifdef LIBXML_THREAD_ENABLED
420#define xmlLoadExtDtdDefaultValue \
421(*(__xmlLoadExtDtdDefaultValue()))
422#else
423XMLPUBVAR int xmlLoadExtDtdDefaultValue;
424#endif
425XMLPUBFUN int XMLCALL xmlThrDefLoadExtDtdDefaultValue(int v);
426
427XMLPUBFUN int * XMLCALL __xmlParserDebugEntities(void);
428#ifdef LIBXML_THREAD_ENABLED
429#define xmlParserDebugEntities \
430(*(__xmlParserDebugEntities()))
431#else
432XMLPUBVAR int xmlParserDebugEntities;
433#endif
434XMLPUBFUN int XMLCALL xmlThrDefParserDebugEntities(int v);
435
436XMLPUBFUN const char * * XMLCALL __xmlParserVersion(void);
437#ifdef LIBXML_THREAD_ENABLED
438#define xmlParserVersion \
439(*(__xmlParserVersion()))
440#else
441XMLPUBVAR const char * xmlParserVersion;
442#endif
443
444XMLPUBFUN int * XMLCALL __xmlPedanticParserDefaultValue(void);
445#ifdef LIBXML_THREAD_ENABLED
446#define xmlPedanticParserDefaultValue \
447(*(__xmlPedanticParserDefaultValue()))
448#else
449XMLPUBVAR int xmlPedanticParserDefaultValue;
450#endif
451XMLPUBFUN int XMLCALL xmlThrDefPedanticParserDefaultValue(int v);
452
453XMLPUBFUN int * XMLCALL __xmlSaveNoEmptyTags(void);
454#ifdef LIBXML_THREAD_ENABLED
455#define xmlSaveNoEmptyTags \
456(*(__xmlSaveNoEmptyTags()))
457#else
458XMLPUBVAR int xmlSaveNoEmptyTags;
459#endif
460XMLPUBFUN int XMLCALL xmlThrDefSaveNoEmptyTags(int v);
461
462XMLPUBFUN int * XMLCALL __xmlSubstituteEntitiesDefaultValue(void);
463#ifdef LIBXML_THREAD_ENABLED
464#define xmlSubstituteEntitiesDefaultValue \
465(*(__xmlSubstituteEntitiesDefaultValue()))
466#else
467XMLPUBVAR int xmlSubstituteEntitiesDefaultValue;
468#endif
469XMLPUBFUN int XMLCALL xmlThrDefSubstituteEntitiesDefaultValue(int v);
470
471XMLPUBFUN xmlRegisterNodeFunc * XMLCALL __xmlRegisterNodeDefaultValue(void);
472#ifdef LIBXML_THREAD_ENABLED
473#define xmlRegisterNodeDefaultValue \
474(*(__xmlRegisterNodeDefaultValue()))
475#else
476XMLPUBVAR xmlRegisterNodeFunc xmlRegisterNodeDefaultValue;
477#endif
478
479XMLPUBFUN xmlDeregisterNodeFunc * XMLCALL __xmlDeregisterNodeDefaultValue(void);
480#ifdef LIBXML_THREAD_ENABLED
481#define xmlDeregisterNodeDefaultValue \
482(*(__xmlDeregisterNodeDefaultValue()))
483#else
484XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
485#endif
486
487XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * XMLCALL \
488 __xmlParserInputBufferCreateFilenameValue(void);
489#ifdef LIBXML_THREAD_ENABLED
490#define xmlParserInputBufferCreateFilenameValue \
491(*(__xmlParserInputBufferCreateFilenameValue()))
492#else
493XMLPUBVAR xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue;
494#endif
495
496XMLPUBFUN xmlOutputBufferCreateFilenameFunc * XMLCALL __xmlOutputBufferCreateFilenameValue(void);
497#ifdef LIBXML_THREAD_ENABLED
498#define xmlOutputBufferCreateFilenameValue \
499(*(__xmlOutputBufferCreateFilenameValue()))
500#else
501XMLPUBVAR xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue;
502#endif
503
504#ifdef __cplusplus
505}
506#endif
507
508#endif /* __XML_GLOBALS_H */
509