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