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 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, 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 */ 57 typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI, 58 xmlCharEncodingHandlerPtr encoder, 59 int compression); 60 61 XMLPUBFUN xmlParserInputBufferCreateFilenameFunc 62 XMLCALL xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func); 63 XMLPUBFUN xmlOutputBufferCreateFilenameFunc 64 XMLCALL 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 */ 111 typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node); 112 /** 113 * xmlDeregisterNodeFunc: 114 * @node: the current node 115 * 116 * Signature for the deregistration callback of a discarded node 117 */ 118 typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node); 119 120 typedef struct _xmlGlobalState xmlGlobalState; 121 typedef xmlGlobalState *xmlGlobalStatePtr; 122 struct _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 175 extern "C" { 176 #endif 177 178 XMLPUBFUN void XMLCALL xmlInitializeGlobalState(xmlGlobalStatePtr gs); 179 180 XMLPUBFUN void XMLCALL xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler); 181 182 XMLPUBFUN void XMLCALL xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler); 183 184 XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlRegisterNodeDefault(xmlRegisterNodeFunc func); 185 XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func); 186 XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func); 187 XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func); 188 189 XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL 190 xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func); 191 XMLPUBFUN 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 208 XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMalloc(void); 209 #define xmlMalloc \ 210 (*(__xmlMalloc())) 211 #else 212 XMLPUBVAR xmlMallocFunc xmlMalloc; 213 #endif 214 215 #ifdef LIBXML_THREAD_ENABLED 216 XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMallocAtomic(void); 217 #define xmlMallocAtomic \ 218 (*(__xmlMallocAtomic())) 219 #else 220 XMLPUBVAR xmlMallocFunc xmlMallocAtomic; 221 #endif 222 223 #ifdef LIBXML_THREAD_ENABLED 224 XMLPUBFUN xmlReallocFunc * XMLCALL __xmlRealloc(void); 225 #define xmlRealloc \ 226 (*(__xmlRealloc())) 227 #else 228 XMLPUBVAR xmlReallocFunc xmlRealloc; 229 #endif 230 231 #ifdef LIBXML_THREAD_ENABLED 232 XMLPUBFUN xmlFreeFunc * XMLCALL __xmlFree(void); 233 #define xmlFree \ 234 (*(__xmlFree())) 235 #else 236 XMLPUBVAR xmlFreeFunc xmlFree; 237 #endif 238 239 #ifdef LIBXML_THREAD_ENABLED 240 XMLPUBFUN xmlStrdupFunc * XMLCALL __xmlMemStrdup(void); 241 #define xmlMemStrdup \ 242 (*(__xmlMemStrdup())) 243 #else 244 XMLPUBVAR xmlStrdupFunc xmlMemStrdup; 245 #endif 246 247 #else /* !LIBXML_THREAD_ALLOC_ENABLED */ 248 XMLPUBVAR xmlMallocFunc xmlMalloc; 249 XMLPUBVAR xmlMallocFunc xmlMallocAtomic; 250 XMLPUBVAR xmlReallocFunc xmlRealloc; 251 XMLPUBVAR xmlFreeFunc xmlFree; 252 XMLPUBVAR xmlStrdupFunc xmlMemStrdup; 253 #endif /* LIBXML_THREAD_ALLOC_ENABLED */ 254 255 #ifdef LIBXML_DOCB_ENABLED 256 XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __docbDefaultSAXHandler(void); 257 #ifdef LIBXML_THREAD_ENABLED 258 #define docbDefaultSAXHandler \ 259 (*(__docbDefaultSAXHandler())) 260 #else 261 XMLPUBVAR xmlSAXHandlerV1 docbDefaultSAXHandler; 262 #endif 263 #endif 264 265 #ifdef LIBXML_HTML_ENABLED 266 XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __htmlDefaultSAXHandler(void); 267 #ifdef LIBXML_THREAD_ENABLED 268 #define htmlDefaultSAXHandler \ 269 (*(__htmlDefaultSAXHandler())) 270 #else 271 XMLPUBVAR xmlSAXHandlerV1 htmlDefaultSAXHandler; 272 #endif 273 #endif 274 275 XMLPUBFUN xmlError * XMLCALL __xmlLastError(void); 276 #ifdef LIBXML_THREAD_ENABLED 277 #define xmlLastError \ 278 (*(__xmlLastError())) 279 #else 280 XMLPUBVAR 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 290 XMLPUBFUN int * XMLCALL __oldXMLWDcompatibility(void); 291 #ifdef LIBXML_THREAD_ENABLED 292 #define oldXMLWDcompatibility \ 293 (*(__oldXMLWDcompatibility())) 294 #else 295 XMLPUBVAR int oldXMLWDcompatibility; 296 #endif 297 298 XMLPUBFUN xmlBufferAllocationScheme * XMLCALL __xmlBufferAllocScheme(void); 299 #ifdef LIBXML_THREAD_ENABLED 300 #define xmlBufferAllocScheme \ 301 (*(__xmlBufferAllocScheme())) 302 #else 303 XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme; 304 #endif 305 XMLPUBFUN xmlBufferAllocationScheme XMLCALL 306 xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v); 307 308 XMLPUBFUN int * XMLCALL __xmlDefaultBufferSize(void); 309 #ifdef LIBXML_THREAD_ENABLED 310 #define xmlDefaultBufferSize \ 311 (*(__xmlDefaultBufferSize())) 312 #else 313 XMLPUBVAR int xmlDefaultBufferSize; 314 #endif 315 XMLPUBFUN int XMLCALL xmlThrDefDefaultBufferSize(int v); 316 317 XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __xmlDefaultSAXHandler(void); 318 #ifdef LIBXML_THREAD_ENABLED 319 #define xmlDefaultSAXHandler \ 320 (*(__xmlDefaultSAXHandler())) 321 #else 322 XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler; 323 #endif 324 325 XMLPUBFUN xmlSAXLocator * XMLCALL __xmlDefaultSAXLocator(void); 326 #ifdef LIBXML_THREAD_ENABLED 327 #define xmlDefaultSAXLocator \ 328 (*(__xmlDefaultSAXLocator())) 329 #else 330 XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator; 331 #endif 332 333 XMLPUBFUN int * XMLCALL __xmlDoValidityCheckingDefaultValue(void); 334 #ifdef LIBXML_THREAD_ENABLED 335 #define xmlDoValidityCheckingDefaultValue \ 336 (*(__xmlDoValidityCheckingDefaultValue())) 337 #else 338 XMLPUBVAR int xmlDoValidityCheckingDefaultValue; 339 #endif 340 XMLPUBFUN int XMLCALL xmlThrDefDoValidityCheckingDefaultValue(int v); 341 342 XMLPUBFUN xmlGenericErrorFunc * XMLCALL __xmlGenericError(void); 343 #ifdef LIBXML_THREAD_ENABLED 344 #define xmlGenericError \ 345 (*(__xmlGenericError())) 346 #else 347 XMLPUBVAR xmlGenericErrorFunc xmlGenericError; 348 #endif 349 350 XMLPUBFUN xmlStructuredErrorFunc * XMLCALL __xmlStructuredError(void); 351 #ifdef LIBXML_THREAD_ENABLED 352 #define xmlStructuredError \ 353 (*(__xmlStructuredError())) 354 #else 355 XMLPUBVAR xmlStructuredErrorFunc xmlStructuredError; 356 #endif 357 358 XMLPUBFUN void * * XMLCALL __xmlGenericErrorContext(void); 359 #ifdef LIBXML_THREAD_ENABLED 360 #define xmlGenericErrorContext \ 361 (*(__xmlGenericErrorContext())) 362 #else 363 XMLPUBVAR void * xmlGenericErrorContext; 364 #endif 365 366 XMLPUBFUN void * * XMLCALL __xmlStructuredErrorContext(void); 367 #ifdef LIBXML_THREAD_ENABLED 368 #define xmlStructuredErrorContext \ 369 (*(__xmlStructuredErrorContext())) 370 #else 371 XMLPUBVAR void * xmlStructuredErrorContext; 372 #endif 373 374 XMLPUBFUN int * XMLCALL __xmlGetWarningsDefaultValue(void); 375 #ifdef LIBXML_THREAD_ENABLED 376 #define xmlGetWarningsDefaultValue \ 377 (*(__xmlGetWarningsDefaultValue())) 378 #else 379 XMLPUBVAR int xmlGetWarningsDefaultValue; 380 #endif 381 XMLPUBFUN int XMLCALL xmlThrDefGetWarningsDefaultValue(int v); 382 383 XMLPUBFUN int * XMLCALL __xmlIndentTreeOutput(void); 384 #ifdef LIBXML_THREAD_ENABLED 385 #define xmlIndentTreeOutput \ 386 (*(__xmlIndentTreeOutput())) 387 #else 388 XMLPUBVAR int xmlIndentTreeOutput; 389 #endif 390 XMLPUBFUN int XMLCALL xmlThrDefIndentTreeOutput(int v); 391 392 XMLPUBFUN const char * * XMLCALL __xmlTreeIndentString(void); 393 #ifdef LIBXML_THREAD_ENABLED 394 #define xmlTreeIndentString \ 395 (*(__xmlTreeIndentString())) 396 #else 397 XMLPUBVAR const char * xmlTreeIndentString; 398 #endif 399 XMLPUBFUN const char * XMLCALL xmlThrDefTreeIndentString(const char * v); 400 401 XMLPUBFUN int * XMLCALL __xmlKeepBlanksDefaultValue(void); 402 #ifdef LIBXML_THREAD_ENABLED 403 #define xmlKeepBlanksDefaultValue \ 404 (*(__xmlKeepBlanksDefaultValue())) 405 #else 406 XMLPUBVAR int xmlKeepBlanksDefaultValue; 407 #endif 408 XMLPUBFUN int XMLCALL xmlThrDefKeepBlanksDefaultValue(int v); 409 410 XMLPUBFUN int * XMLCALL __xmlLineNumbersDefaultValue(void); 411 #ifdef LIBXML_THREAD_ENABLED 412 #define xmlLineNumbersDefaultValue \ 413 (*(__xmlLineNumbersDefaultValue())) 414 #else 415 XMLPUBVAR int xmlLineNumbersDefaultValue; 416 #endif 417 XMLPUBFUN int XMLCALL xmlThrDefLineNumbersDefaultValue(int v); 418 419 XMLPUBFUN int * XMLCALL __xmlLoadExtDtdDefaultValue(void); 420 #ifdef LIBXML_THREAD_ENABLED 421 #define xmlLoadExtDtdDefaultValue \ 422 (*(__xmlLoadExtDtdDefaultValue())) 423 #else 424 XMLPUBVAR int xmlLoadExtDtdDefaultValue; 425 #endif 426 XMLPUBFUN int XMLCALL xmlThrDefLoadExtDtdDefaultValue(int v); 427 428 XMLPUBFUN int * XMLCALL __xmlParserDebugEntities(void); 429 #ifdef LIBXML_THREAD_ENABLED 430 #define xmlParserDebugEntities \ 431 (*(__xmlParserDebugEntities())) 432 #else 433 XMLPUBVAR int xmlParserDebugEntities; 434 #endif 435 XMLPUBFUN int XMLCALL xmlThrDefParserDebugEntities(int v); 436 437 XMLPUBFUN const char * * XMLCALL __xmlParserVersion(void); 438 #ifdef LIBXML_THREAD_ENABLED 439 #define xmlParserVersion \ 440 (*(__xmlParserVersion())) 441 #else 442 XMLPUBVAR const char * xmlParserVersion; 443 #endif 444 445 XMLPUBFUN int * XMLCALL __xmlPedanticParserDefaultValue(void); 446 #ifdef LIBXML_THREAD_ENABLED 447 #define xmlPedanticParserDefaultValue \ 448 (*(__xmlPedanticParserDefaultValue())) 449 #else 450 XMLPUBVAR int xmlPedanticParserDefaultValue; 451 #endif 452 XMLPUBFUN int XMLCALL xmlThrDefPedanticParserDefaultValue(int v); 453 454 XMLPUBFUN int * XMLCALL __xmlSaveNoEmptyTags(void); 455 #ifdef LIBXML_THREAD_ENABLED 456 #define xmlSaveNoEmptyTags \ 457 (*(__xmlSaveNoEmptyTags())) 458 #else 459 XMLPUBVAR int xmlSaveNoEmptyTags; 460 #endif 461 XMLPUBFUN int XMLCALL xmlThrDefSaveNoEmptyTags(int v); 462 463 XMLPUBFUN int * XMLCALL __xmlSubstituteEntitiesDefaultValue(void); 464 #ifdef LIBXML_THREAD_ENABLED 465 #define xmlSubstituteEntitiesDefaultValue \ 466 (*(__xmlSubstituteEntitiesDefaultValue())) 467 #else 468 XMLPUBVAR int xmlSubstituteEntitiesDefaultValue; 469 #endif 470 XMLPUBFUN int XMLCALL xmlThrDefSubstituteEntitiesDefaultValue(int v); 471 472 XMLPUBFUN xmlRegisterNodeFunc * XMLCALL __xmlRegisterNodeDefaultValue(void); 473 #ifdef LIBXML_THREAD_ENABLED 474 #define xmlRegisterNodeDefaultValue \ 475 (*(__xmlRegisterNodeDefaultValue())) 476 #else 477 XMLPUBVAR xmlRegisterNodeFunc xmlRegisterNodeDefaultValue; 478 #endif 479 480 XMLPUBFUN xmlDeregisterNodeFunc * XMLCALL __xmlDeregisterNodeDefaultValue(void); 481 #ifdef LIBXML_THREAD_ENABLED 482 #define xmlDeregisterNodeDefaultValue \ 483 (*(__xmlDeregisterNodeDefaultValue())) 484 #else 485 XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; 486 #endif 487 488 XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * XMLCALL \ 489 __xmlParserInputBufferCreateFilenameValue(void); 490 #ifdef LIBXML_THREAD_ENABLED 491 #define xmlParserInputBufferCreateFilenameValue \ 492 (*(__xmlParserInputBufferCreateFilenameValue())) 493 #else 494 XMLPUBVAR xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue; 495 #endif 496 497 XMLPUBFUN xmlOutputBufferCreateFilenameFunc * XMLCALL __xmlOutputBufferCreateFilenameValue(void); 498 #ifdef LIBXML_THREAD_ENABLED 499 #define xmlOutputBufferCreateFilenameValue \ 500 (*(__xmlOutputBufferCreateFilenameValue())) 501 #else 502 XMLPUBVAR xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue; 503 #endif 504 505 #ifdef __cplusplus 506 } 507 #endif 508 509 #endif /* __XML_GLOBALS_H */ 510