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