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