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