Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 1 | /* |
| 2 | * globals.c: definition and handling of the set of global variables |
| 3 | * of the library |
| 4 | * |
| 5 | * The bottom of this file is automatically generated by build_glob.py |
| 6 | * based on the description file global.data |
| 7 | * |
| 8 | * See Copyright for the status of this software. |
| 9 | * |
| 10 | * Gary Pennington <Gary.Pennington@uk.sun.com> |
| 11 | * daniel@veillard.com |
| 12 | */ |
| 13 | |
Daniel Veillard | 34ce8be | 2002-03-18 19:37:11 +0000 | [diff] [blame] | 14 | #define IN_LIBXML |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 15 | #include "libxml.h" |
| 16 | |
Daniel Veillard | e709061 | 2001-10-13 12:18:28 +0000 | [diff] [blame] | 17 | #ifdef HAVE_STDLIB_H |
Jaka Mocnik | 77d19ae | 2001-10-13 12:06:09 +0000 | [diff] [blame] | 18 | #include <stdlib.h> |
Daniel Veillard | e709061 | 2001-10-13 12:18:28 +0000 | [diff] [blame] | 19 | #endif |
Jaka Mocnik | 77d19ae | 2001-10-13 12:06:09 +0000 | [diff] [blame] | 20 | #include <string.h> |
| 21 | |
Daniel Veillard | 3c01b1d | 2001-10-17 15:58:35 +0000 | [diff] [blame] | 22 | #include <libxml/globals.h> |
Daniel Veillard | e709061 | 2001-10-13 12:18:28 +0000 | [diff] [blame] | 23 | #include <libxml/xmlmemory.h> |
| 24 | |
Daniel Veillard | 3c01b1d | 2001-10-17 15:58:35 +0000 | [diff] [blame] | 25 | /* #define DEBUG_GLOBALS */ |
| 26 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 27 | /* |
| 28 | * Helpful Macro |
| 29 | */ |
Daniel Veillard | 3c01b1d | 2001-10-17 15:58:35 +0000 | [diff] [blame] | 30 | #ifdef LIBXML_THREAD_ENABLED |
| 31 | #define IS_MAIN_THREAD (xmlIsMainThread()) |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 32 | #else |
| 33 | #define IS_MAIN_THREAD 1 |
| 34 | #endif |
| 35 | |
| 36 | /************************************************************************ |
| 37 | * * |
| 38 | * All the user accessible global variables of the library * |
| 39 | * * |
| 40 | ************************************************************************/ |
| 41 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 42 | /* |
| 43 | * Memory allocation routines |
| 44 | */ |
| 45 | #if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY) |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 46 | extern void xmlMemFree(void *ptr); |
| 47 | extern void * xmlMemMalloc(size_t size); |
| 48 | extern void * xmlMemRealloc(void *ptr,size_t size); |
| 49 | extern char * xmlMemoryStrdup(const char *str); |
| 50 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 51 | xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree; |
| 52 | xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc; |
| 53 | xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc; |
| 54 | xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup; |
| 55 | #else |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 56 | /** |
| 57 | * xmlFree: |
| 58 | * @mem: an already allocated block of memory |
| 59 | * |
| 60 | * The variable holding the libxml free() implementation |
| 61 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 62 | xmlFreeFunc xmlFree = (xmlFreeFunc) free; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 63 | /** |
| 64 | * xmlMalloc: |
| 65 | * @size: the size requested in bytes |
| 66 | * |
| 67 | * The variable holding the libxml malloc() implementation |
| 68 | * |
| 69 | * Returns a pointer to the newly allocated block or NULL in case of error |
| 70 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 71 | xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 72 | /** |
| 73 | * xmlRealloc: |
| 74 | * @mem: an already allocated block of memory |
| 75 | * @size: the new size requested in bytes |
| 76 | * |
| 77 | * The variable holding the libxml realloc() implementation |
| 78 | * |
| 79 | * Returns a pointer to the newly reallocated block or NULL in case of error |
| 80 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 81 | xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 82 | /** |
| 83 | * xmlMemStrdup: |
| 84 | * @str: a zero terminated string |
| 85 | * |
| 86 | * The variable holding the libxml strdup() implementation |
| 87 | * |
| 88 | * Returns the copy of the string or NULL in case of error |
| 89 | */ |
Daniel Veillard | b82c166 | 2001-12-09 14:00:54 +0000 | [diff] [blame] | 90 | xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup; |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 91 | #endif |
| 92 | |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 93 | #include <libxml/threads.h> |
| 94 | #include <libxml/globals.h> |
| 95 | #include <libxml/SAX.h> |
| 96 | |
| 97 | #undef docbDefaultSAXHandler |
| 98 | #undef htmlDefaultSAXHandler |
| 99 | #undef oldXMLWDcompatibility |
| 100 | #undef xmlBufferAllocScheme |
| 101 | #undef xmlDefaultBufferSize |
| 102 | #undef xmlDefaultSAXHandler |
| 103 | #undef xmlDefaultSAXLocator |
| 104 | #undef xmlDoValidityCheckingDefaultValue |
| 105 | #undef xmlGenericError |
| 106 | #undef xmlGenericErrorContext |
| 107 | #undef xmlGetWarningsDefaultValue |
| 108 | #undef xmlIndentTreeOutput |
Aleksey Sanin | 2300256 | 2002-05-24 07:18:40 +0000 | [diff] [blame] | 109 | #undef xmlTreeIndentString |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 110 | #undef xmlKeepBlanksDefaultValue |
| 111 | #undef xmlLineNumbersDefaultValue |
| 112 | #undef xmlLoadExtDtdDefaultValue |
| 113 | #undef xmlParserDebugEntities |
| 114 | #undef xmlParserVersion |
| 115 | #undef xmlPedanticParserDefaultValue |
| 116 | #undef xmlSaveNoEmptyTags |
| 117 | #undef xmlSubstituteEntitiesDefaultValue |
| 118 | |
| 119 | #undef xmlFree |
| 120 | #undef xmlMalloc |
| 121 | #undef xmlMemStrdup |
| 122 | #undef xmlRealloc |
| 123 | |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 124 | /** |
| 125 | * xmlParserVersion: |
| 126 | * |
| 127 | * Constant string describing the internal version of the library |
| 128 | */ |
Daniel Veillard | 3c01b1d | 2001-10-17 15:58:35 +0000 | [diff] [blame] | 129 | const char *xmlParserVersion = LIBXML_VERSION_STRING; |
| 130 | |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 131 | /** |
| 132 | * xmlBufferAllocScheme: |
| 133 | * |
| 134 | * Global setting, default allocation policy for buffers, default is |
| 135 | * XML_BUFFER_ALLOC_EXACT |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 136 | */ |
| 137 | xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 138 | /** |
| 139 | * xmlDefaultBufferSize: |
| 140 | * |
| 141 | * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE |
| 142 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 143 | int xmlDefaultBufferSize = BASE_BUFFER_SIZE; |
| 144 | |
| 145 | /* |
| 146 | * Parser defaults |
| 147 | */ |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 148 | |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 149 | /** |
| 150 | * oldXMLWDcompatibility: |
| 151 | * |
| 152 | * Global setting, DEPRECATED. |
| 153 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 154 | int oldXMLWDcompatibility = 0; /* DEPRECATED */ |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 155 | /** |
| 156 | * xmlParserDebugEntities: |
| 157 | * |
| 158 | * Global setting, asking the parser to print out debugging informations. |
| 159 | * while handling entities. |
| 160 | * Disabled by default |
| 161 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 162 | int xmlParserDebugEntities = 0; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 163 | /** |
| 164 | * xmlDoValidityCheckingDefaultValue: |
| 165 | * |
| 166 | * Global setting, indicate that the parser should work in validating mode. |
| 167 | * Disabled by default. |
| 168 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 169 | int xmlDoValidityCheckingDefaultValue = 0; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 170 | /** |
| 171 | * xmlGetWarningsDefaultValue: |
| 172 | * |
| 173 | * Global setting, indicate that the parser should provide warnings. |
| 174 | * Activated by default. |
| 175 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 176 | int xmlGetWarningsDefaultValue = 1; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 177 | /** |
| 178 | * xmlLoadExtDtdDefaultValue: |
| 179 | * |
| 180 | * Global setting, indicate that the parser should load DTD while not |
| 181 | * validating. |
| 182 | * Disabled by default. |
| 183 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 184 | int xmlLoadExtDtdDefaultValue = 0; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 185 | /** |
| 186 | * xmlPedanticParserDefaultValue: |
| 187 | * |
| 188 | * Global setting, indicate that the parser be pedantic |
| 189 | * Disabled by default. |
| 190 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 191 | int xmlPedanticParserDefaultValue = 0; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 192 | /** |
| 193 | * xmlLineNumbersDefaultValue: |
| 194 | * |
| 195 | * Global setting, indicate that the parser should store the line number |
| 196 | * in the content field of elements in the DOM tree. |
| 197 | * Disabled by default since this may not be safe for old classes of |
| 198 | * applicaton. |
| 199 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 200 | int xmlLineNumbersDefaultValue = 0; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 201 | /** |
| 202 | * xmlKeepBlanksDefaultValue: |
| 203 | * |
| 204 | * Global setting, indicate that the parser should keep all blanks |
| 205 | * nodes found in the content |
| 206 | * Activated by default, this is actually needed to have the parser |
| 207 | * conformant to the XML Recommendation, however the option is kept |
| 208 | * for some applications since this was libxml1 default behaviour. |
| 209 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 210 | int xmlKeepBlanksDefaultValue = 1; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 211 | /** |
| 212 | * xmlSubstituteEntitiesDefaultValue: |
| 213 | * |
| 214 | * Global setting, indicate that the parser should not generate entity |
| 215 | * references but replace them with the actual content of the entity |
| 216 | * Disabled by default, this should be activated when using XPath since |
| 217 | * the XPath data model requires entities replacement and the XPath |
| 218 | * engine does not handle entities references transparently. |
| 219 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 220 | int xmlSubstituteEntitiesDefaultValue = 0; |
| 221 | |
| 222 | /* |
| 223 | * Error handling |
| 224 | */ |
| 225 | |
| 226 | /* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */ |
| 227 | /* Must initialize xmlGenericError in xmlInitParser */ |
Daniel Veillard | 635ef72 | 2001-10-29 11:48:19 +0000 | [diff] [blame] | 228 | void xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED, |
| 229 | const char *msg, |
| 230 | ...); |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 231 | /** |
| 232 | * xmlGenericError: |
| 233 | * |
| 234 | * Global setting: function used for generic error callbacks |
| 235 | */ |
Daniel Veillard | 635ef72 | 2001-10-29 11:48:19 +0000 | [diff] [blame] | 236 | xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 237 | /** |
| 238 | * xmlGenericErrorContext: |
| 239 | * |
| 240 | * Global setting passed to generic error callbacks |
| 241 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 242 | void *xmlGenericErrorContext = NULL; |
| 243 | |
| 244 | /* |
| 245 | * output defaults |
| 246 | */ |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 247 | /** |
| 248 | * xmlIndentTreeOutput: |
| 249 | * |
| 250 | * Global setting, asking the serializer to indent the output tree by default |
Aleksey Sanin | 2300256 | 2002-05-24 07:18:40 +0000 | [diff] [blame] | 251 | * Enabled by default |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 252 | */ |
Aleksey Sanin | 2300256 | 2002-05-24 07:18:40 +0000 | [diff] [blame] | 253 | int xmlIndentTreeOutput = 1; |
| 254 | |
| 255 | /** |
| 256 | * xmlTreeIndentString: |
| 257 | * |
| 258 | * The string used to do one-level indent. By default is equal to " " (two spaces) |
| 259 | */ |
| 260 | const char *xmlTreeIndentString = " "; |
| 261 | |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 262 | /** |
| 263 | * xmlSaveNoEmptyTags: |
| 264 | * |
| 265 | * Global setting, asking the serializer to not output empty tags |
| 266 | * as <empty/> but <empty></empty>. those two forms are undistinguishable |
| 267 | * once parsed. |
| 268 | * Disabled by default |
| 269 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 270 | int xmlSaveNoEmptyTags = 0; |
| 271 | |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 272 | /** |
| 273 | * xmlDefaultSAXHandler: |
| 274 | * |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 275 | * Default handler for XML, builds the DOM tree |
| 276 | */ |
| 277 | xmlSAXHandler xmlDefaultSAXHandler = { |
| 278 | internalSubset, |
| 279 | isStandalone, |
| 280 | hasInternalSubset, |
| 281 | hasExternalSubset, |
| 282 | resolveEntity, |
| 283 | getEntity, |
| 284 | entityDecl, |
| 285 | notationDecl, |
| 286 | attributeDecl, |
| 287 | elementDecl, |
| 288 | unparsedEntityDecl, |
| 289 | setDocumentLocator, |
| 290 | startDocument, |
| 291 | endDocument, |
| 292 | startElement, |
| 293 | endElement, |
| 294 | reference, |
| 295 | characters, |
| 296 | characters, |
| 297 | processingInstruction, |
| 298 | comment, |
| 299 | xmlParserWarning, |
| 300 | xmlParserError, |
| 301 | xmlParserError, |
| 302 | getParameterEntity, |
| 303 | cdataBlock, |
| 304 | externalSubset, |
| 305 | 0 |
| 306 | }; |
| 307 | |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 308 | /** |
| 309 | * xmlDefaultSAXLocator: |
| 310 | * |
| 311 | * The default SAX Locator |
| 312 | * { getPublicId, getSystemId, getLineNumber, getColumnNumber} |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 313 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 314 | xmlSAXLocator xmlDefaultSAXLocator = { |
| 315 | getPublicId, getSystemId, getLineNumber, getColumnNumber |
| 316 | }; |
| 317 | |
| 318 | #ifdef LIBXML_HTML_ENABLED |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 319 | /** |
| 320 | * htmlDefaultSAXHandler: |
| 321 | * |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 322 | * Default handler for HTML, builds the DOM tree |
| 323 | */ |
| 324 | xmlSAXHandler htmlDefaultSAXHandler = { |
| 325 | internalSubset, |
| 326 | NULL, |
| 327 | NULL, |
| 328 | NULL, |
| 329 | NULL, |
| 330 | getEntity, |
| 331 | NULL, |
| 332 | NULL, |
| 333 | NULL, |
| 334 | NULL, |
| 335 | NULL, |
| 336 | setDocumentLocator, |
| 337 | startDocument, |
| 338 | endDocument, |
| 339 | startElement, |
| 340 | endElement, |
| 341 | NULL, |
| 342 | characters, |
| 343 | ignorableWhitespace, |
| 344 | NULL, |
| 345 | comment, |
| 346 | xmlParserWarning, |
| 347 | xmlParserError, |
| 348 | xmlParserError, |
| 349 | getParameterEntity, |
| 350 | cdataBlock, |
| 351 | NULL, |
| 352 | 0 |
| 353 | }; |
| 354 | #endif /* LIBXML_HTML_ENABLED */ |
| 355 | |
| 356 | #ifdef LIBXML_DOCB_ENABLED |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 357 | /** |
| 358 | * docbDefaultSAXHandler: |
| 359 | * |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 360 | * Default handler for SGML DocBook, builds the DOM tree |
| 361 | */ |
| 362 | xmlSAXHandler docbDefaultSAXHandler = { |
| 363 | internalSubset, |
| 364 | isStandalone, |
| 365 | hasInternalSubset, |
| 366 | hasExternalSubset, |
| 367 | resolveEntity, |
| 368 | getEntity, |
| 369 | entityDecl, |
| 370 | NULL, |
| 371 | NULL, |
| 372 | NULL, |
| 373 | NULL, |
| 374 | setDocumentLocator, |
| 375 | startDocument, |
| 376 | endDocument, |
| 377 | startElement, |
| 378 | endElement, |
| 379 | reference, |
| 380 | characters, |
| 381 | ignorableWhitespace, |
| 382 | NULL, |
| 383 | comment, |
| 384 | xmlParserWarning, |
| 385 | xmlParserError, |
| 386 | xmlParserError, |
| 387 | getParameterEntity, |
| 388 | NULL, |
| 389 | NULL, |
| 390 | 0 |
| 391 | }; |
| 392 | #endif /* LIBXML_DOCB_ENABLED */ |
| 393 | |
| 394 | /** |
| 395 | * xmlInitializeGlobalState: |
| 396 | * @gs: a pointer to a newly allocated global state |
| 397 | * |
| 398 | * xmlInitializeGlobalState() initialize a global state with all the |
| 399 | * default values of the library. |
| 400 | */ |
| 401 | void |
| 402 | xmlInitializeGlobalState(xmlGlobalStatePtr gs) |
| 403 | { |
Daniel Veillard | 3c01b1d | 2001-10-17 15:58:35 +0000 | [diff] [blame] | 404 | #ifdef DEBUG_GLOBALS |
| 405 | fprintf(stderr, "Initializing globals at %lu for thread %d\n", |
| 406 | (unsigned long) gs, xmlGetThreadId()); |
| 407 | #endif |
| 408 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 409 | /* |
Daniel Veillard | cbaf399 | 2001-12-31 16:16:02 +0000 | [diff] [blame] | 410 | * Perform initialization as required by libxml |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 411 | */ |
Daniel Veillard | 3c01b1d | 2001-10-17 15:58:35 +0000 | [diff] [blame] | 412 | initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1); |
Daniel Veillard | a4617b8 | 2001-11-04 20:19:12 +0000 | [diff] [blame] | 413 | #ifdef LIBXML_DOCB_ENABLED |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 414 | initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler); |
Daniel Veillard | a4617b8 | 2001-11-04 20:19:12 +0000 | [diff] [blame] | 415 | #endif |
| 416 | #ifdef LIBXML_HTML_ENABLED |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 417 | inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler); |
Daniel Veillard | a4617b8 | 2001-11-04 20:19:12 +0000 | [diff] [blame] | 418 | #endif |
Daniel Veillard | 3c01b1d | 2001-10-17 15:58:35 +0000 | [diff] [blame] | 419 | initGenericErrorDefaultFunc(&gs->xmlGenericError); |
| 420 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 421 | gs->oldXMLWDcompatibility = 0; |
| 422 | gs->xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT; |
| 423 | gs->xmlDefaultBufferSize = BASE_BUFFER_SIZE; |
| 424 | initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1); |
| 425 | gs->xmlDefaultSAXLocator.getPublicId = getPublicId; |
| 426 | gs->xmlDefaultSAXLocator.getSystemId = getSystemId; |
| 427 | gs->xmlDefaultSAXLocator.getLineNumber = getLineNumber; |
| 428 | gs->xmlDefaultSAXLocator.getColumnNumber = getColumnNumber; |
| 429 | gs->xmlDoValidityCheckingDefaultValue = 0; |
| 430 | #if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY) |
| 431 | gs->xmlFree = (xmlFreeFunc) xmlMemFree; |
| 432 | gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc; |
| 433 | gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc; |
| 434 | gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup; |
| 435 | #else |
| 436 | gs->xmlFree = (xmlFreeFunc) free; |
| 437 | gs->xmlMalloc = (xmlMallocFunc) malloc; |
| 438 | gs->xmlRealloc = (xmlReallocFunc) realloc; |
Daniel Veillard | 572577e | 2002-01-18 16:23:55 +0000 | [diff] [blame] | 439 | gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup; |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 440 | #endif |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 441 | gs->xmlGenericErrorContext = NULL; |
| 442 | gs->xmlGetWarningsDefaultValue = 1; |
Aleksey Sanin | 2300256 | 2002-05-24 07:18:40 +0000 | [diff] [blame] | 443 | gs->xmlIndentTreeOutput = 1; |
| 444 | gs->xmlTreeIndentString = " "; |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 445 | gs->xmlKeepBlanksDefaultValue = 1; |
| 446 | gs->xmlLineNumbersDefaultValue = 0; |
| 447 | gs->xmlLoadExtDtdDefaultValue = 0; |
| 448 | gs->xmlParserDebugEntities = 0; |
| 449 | gs->xmlParserVersion = LIBXML_VERSION_STRING; |
| 450 | gs->xmlPedanticParserDefaultValue = 0; |
| 451 | gs->xmlSaveNoEmptyTags = 0; |
| 452 | gs->xmlSubstituteEntitiesDefaultValue = 0; |
| 453 | } |
| 454 | |
Daniel Veillard | a4617b8 | 2001-11-04 20:19:12 +0000 | [diff] [blame] | 455 | #ifdef LIBXML_DOCB_ENABLED |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 456 | #undef docbDefaultSAXHandler |
| 457 | xmlSAXHandler * |
| 458 | __docbDefaultSAXHandler(void) { |
| 459 | if (IS_MAIN_THREAD) |
| 460 | return (&docbDefaultSAXHandler); |
| 461 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 462 | return (&xmlGetGlobalState()->docbDefaultSAXHandler); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 463 | } |
Daniel Veillard | a4617b8 | 2001-11-04 20:19:12 +0000 | [diff] [blame] | 464 | #endif |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 465 | |
Daniel Veillard | a4617b8 | 2001-11-04 20:19:12 +0000 | [diff] [blame] | 466 | #ifdef LIBXML_HTML_ENABLED |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 467 | #undef htmlDefaultSAXHandler |
| 468 | xmlSAXHandler * |
| 469 | __htmlDefaultSAXHandler(void) { |
| 470 | if (IS_MAIN_THREAD) |
| 471 | return (&htmlDefaultSAXHandler); |
| 472 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 473 | return (&xmlGetGlobalState()->htmlDefaultSAXHandler); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 474 | } |
Daniel Veillard | a4617b8 | 2001-11-04 20:19:12 +0000 | [diff] [blame] | 475 | #endif |
| 476 | |
| 477 | /* |
| 478 | * Everything starting from the line below is |
| 479 | * Automatically generated by build_glob.py. |
| 480 | * Do not modify the previous line. |
| 481 | */ |
| 482 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 483 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 484 | #undef oldXMLWDcompatibility |
| 485 | int * |
| 486 | __oldXMLWDcompatibility(void) { |
| 487 | if (IS_MAIN_THREAD) |
| 488 | return (&oldXMLWDcompatibility); |
| 489 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 490 | return (&xmlGetGlobalState()->oldXMLWDcompatibility); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 491 | } |
| 492 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 493 | #undef xmlBufferAllocScheme |
| 494 | xmlBufferAllocationScheme * |
| 495 | __xmlBufferAllocScheme(void) { |
| 496 | if (IS_MAIN_THREAD) |
| 497 | return (&xmlBufferAllocScheme); |
| 498 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 499 | return (&xmlGetGlobalState()->xmlBufferAllocScheme); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 500 | } |
| 501 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 502 | #undef xmlDefaultBufferSize |
| 503 | int * |
| 504 | __xmlDefaultBufferSize(void) { |
| 505 | if (IS_MAIN_THREAD) |
| 506 | return (&xmlDefaultBufferSize); |
| 507 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 508 | return (&xmlGetGlobalState()->xmlDefaultBufferSize); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 509 | } |
| 510 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 511 | #undef xmlDefaultSAXHandler |
| 512 | xmlSAXHandler * |
| 513 | __xmlDefaultSAXHandler(void) { |
| 514 | if (IS_MAIN_THREAD) |
| 515 | return (&xmlDefaultSAXHandler); |
| 516 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 517 | return (&xmlGetGlobalState()->xmlDefaultSAXHandler); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 518 | } |
| 519 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 520 | #undef xmlDefaultSAXLocator |
| 521 | xmlSAXLocator * |
| 522 | __xmlDefaultSAXLocator(void) { |
| 523 | if (IS_MAIN_THREAD) |
| 524 | return (&xmlDefaultSAXLocator); |
| 525 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 526 | return (&xmlGetGlobalState()->xmlDefaultSAXLocator); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 527 | } |
| 528 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 529 | #undef xmlDoValidityCheckingDefaultValue |
| 530 | int * |
| 531 | __xmlDoValidityCheckingDefaultValue(void) { |
| 532 | if (IS_MAIN_THREAD) |
| 533 | return (&xmlDoValidityCheckingDefaultValue); |
| 534 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 535 | return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 536 | } |
| 537 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 538 | #undef xmlGenericError |
| 539 | xmlGenericErrorFunc * |
| 540 | __xmlGenericError(void) { |
| 541 | if (IS_MAIN_THREAD) |
| 542 | return (&xmlGenericError); |
| 543 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 544 | return (&xmlGetGlobalState()->xmlGenericError); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 545 | } |
| 546 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 547 | #undef xmlGenericErrorContext |
| 548 | void * * |
| 549 | __xmlGenericErrorContext(void) { |
| 550 | if (IS_MAIN_THREAD) |
| 551 | return (&xmlGenericErrorContext); |
| 552 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 553 | return (&xmlGetGlobalState()->xmlGenericErrorContext); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 554 | } |
| 555 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 556 | #undef xmlGetWarningsDefaultValue |
| 557 | int * |
| 558 | __xmlGetWarningsDefaultValue(void) { |
| 559 | if (IS_MAIN_THREAD) |
| 560 | return (&xmlGetWarningsDefaultValue); |
| 561 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 562 | return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 563 | } |
| 564 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 565 | #undef xmlIndentTreeOutput |
| 566 | int * |
| 567 | __xmlIndentTreeOutput(void) { |
| 568 | if (IS_MAIN_THREAD) |
| 569 | return (&xmlIndentTreeOutput); |
| 570 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 571 | return (&xmlGetGlobalState()->xmlIndentTreeOutput); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 572 | } |
| 573 | |
Aleksey Sanin | 2300256 | 2002-05-24 07:18:40 +0000 | [diff] [blame] | 574 | #undef xmlTreeIndentString |
| 575 | const char * * |
| 576 | __xmlTreeIndentString(void) { |
| 577 | if (IS_MAIN_THREAD) |
| 578 | return (&xmlTreeIndentString); |
| 579 | else |
| 580 | return (&xmlGetGlobalState()->xmlTreeIndentString); |
| 581 | } |
| 582 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 583 | #undef xmlKeepBlanksDefaultValue |
| 584 | int * |
| 585 | __xmlKeepBlanksDefaultValue(void) { |
| 586 | if (IS_MAIN_THREAD) |
| 587 | return (&xmlKeepBlanksDefaultValue); |
| 588 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 589 | return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 590 | } |
| 591 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 592 | #undef xmlLineNumbersDefaultValue |
| 593 | int * |
| 594 | __xmlLineNumbersDefaultValue(void) { |
| 595 | if (IS_MAIN_THREAD) |
| 596 | return (&xmlLineNumbersDefaultValue); |
| 597 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 598 | return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 599 | } |
| 600 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 601 | #undef xmlLoadExtDtdDefaultValue |
| 602 | int * |
| 603 | __xmlLoadExtDtdDefaultValue(void) { |
| 604 | if (IS_MAIN_THREAD) |
| 605 | return (&xmlLoadExtDtdDefaultValue); |
| 606 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 607 | return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 608 | } |
| 609 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 610 | #undef xmlParserDebugEntities |
| 611 | int * |
| 612 | __xmlParserDebugEntities(void) { |
| 613 | if (IS_MAIN_THREAD) |
| 614 | return (&xmlParserDebugEntities); |
| 615 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 616 | return (&xmlGetGlobalState()->xmlParserDebugEntities); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 617 | } |
| 618 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 619 | #undef xmlParserVersion |
| 620 | const char * * |
| 621 | __xmlParserVersion(void) { |
| 622 | if (IS_MAIN_THREAD) |
| 623 | return (&xmlParserVersion); |
| 624 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 625 | return (&xmlGetGlobalState()->xmlParserVersion); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 626 | } |
| 627 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 628 | #undef xmlPedanticParserDefaultValue |
| 629 | int * |
| 630 | __xmlPedanticParserDefaultValue(void) { |
| 631 | if (IS_MAIN_THREAD) |
| 632 | return (&xmlPedanticParserDefaultValue); |
| 633 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 634 | return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 635 | } |
| 636 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 637 | #undef xmlSaveNoEmptyTags |
| 638 | int * |
| 639 | __xmlSaveNoEmptyTags(void) { |
| 640 | if (IS_MAIN_THREAD) |
| 641 | return (&xmlSaveNoEmptyTags); |
| 642 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 643 | return (&xmlGetGlobalState()->xmlSaveNoEmptyTags); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 644 | } |
| 645 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 646 | #undef xmlSubstituteEntitiesDefaultValue |
| 647 | int * |
| 648 | __xmlSubstituteEntitiesDefaultValue(void) { |
| 649 | if (IS_MAIN_THREAD) |
| 650 | return (&xmlSubstituteEntitiesDefaultValue); |
| 651 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 652 | return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 653 | } |