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> |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 24 | #include <libxml/threads.h> |
Daniel Veillard | e709061 | 2001-10-13 12:18:28 +0000 | [diff] [blame] | 25 | |
Daniel Veillard | 3c01b1d | 2001-10-17 15:58:35 +0000 | [diff] [blame] | 26 | /* #define DEBUG_GLOBALS */ |
| 27 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 28 | /* |
| 29 | * Helpful Macro |
| 30 | */ |
Daniel Veillard | 3c01b1d | 2001-10-17 15:58:35 +0000 | [diff] [blame] | 31 | #ifdef LIBXML_THREAD_ENABLED |
| 32 | #define IS_MAIN_THREAD (xmlIsMainThread()) |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 33 | #else |
| 34 | #define IS_MAIN_THREAD 1 |
| 35 | #endif |
| 36 | |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 37 | /* |
| 38 | * Mutex to protect "ForNewThreads" variables |
| 39 | */ |
| 40 | static xmlMutexPtr xmlThrDefMutex = NULL; |
| 41 | |
| 42 | void xmlInitGlobals() |
| 43 | { |
| 44 | xmlThrDefMutex = xmlNewMutex(); |
| 45 | } |
| 46 | |
| 47 | void xmlCleanupGlobals() |
| 48 | { |
Daniel Veillard | 2009c4e | 2003-07-15 20:04:34 +0000 | [diff] [blame] | 49 | if (xmlThrDefMutex != NULL) { |
Daniel Veillard | df101d8 | 2003-07-08 14:03:36 +0000 | [diff] [blame] | 50 | xmlFreeMutex(xmlThrDefMutex); |
Daniel Veillard | 2009c4e | 2003-07-15 20:04:34 +0000 | [diff] [blame] | 51 | xmlThrDefMutex = NULL; |
| 52 | } |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 53 | } |
| 54 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 55 | /************************************************************************ |
| 56 | * * |
| 57 | * All the user accessible global variables of the library * |
| 58 | * * |
| 59 | ************************************************************************/ |
| 60 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 61 | /* |
| 62 | * Memory allocation routines |
| 63 | */ |
Daniel Veillard | 7216cfd | 2002-11-08 15:10:00 +0000 | [diff] [blame] | 64 | #if defined(DEBUG_MEMORY_LOCATION) || defined(DEBUG_MEMORY) |
Daniel Veillard | 9848532 | 2003-08-14 15:44:40 +0000 | [diff] [blame] | 65 | #ifndef _DEBUG_MEMORY_ALLOC_ |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 66 | extern void xmlMemFree(void *ptr); |
| 67 | extern void * xmlMemMalloc(size_t size); |
| 68 | extern void * xmlMemRealloc(void *ptr,size_t size); |
| 69 | extern char * xmlMemoryStrdup(const char *str); |
Daniel Veillard | 9848532 | 2003-08-14 15:44:40 +0000 | [diff] [blame] | 70 | #endif |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 71 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 72 | xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree; |
| 73 | xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc; |
Daniel Veillard | 3c908dc | 2003-04-19 00:07:51 +0000 | [diff] [blame] | 74 | xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc; |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 75 | xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc; |
| 76 | xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup; |
| 77 | #else |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 78 | /** |
| 79 | * xmlFree: |
| 80 | * @mem: an already allocated block of memory |
| 81 | * |
| 82 | * The variable holding the libxml free() implementation |
| 83 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 84 | xmlFreeFunc xmlFree = (xmlFreeFunc) free; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 85 | /** |
| 86 | * xmlMalloc: |
| 87 | * @size: the size requested in bytes |
| 88 | * |
| 89 | * The variable holding the libxml malloc() implementation |
| 90 | * |
| 91 | * Returns a pointer to the newly allocated block or NULL in case of error |
| 92 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 93 | xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 94 | /** |
Daniel Veillard | 3c908dc | 2003-04-19 00:07:51 +0000 | [diff] [blame] | 95 | * xmlMallocAtomic: |
| 96 | * @size: the size requested in bytes |
| 97 | * |
| 98 | * The variable holding the libxml malloc() implementation for atomic |
| 99 | * data (i.e. blocks not containings pointers), useful when using a |
| 100 | * garbage collecting allocator. |
| 101 | * |
| 102 | * Returns a pointer to the newly allocated block or NULL in case of error |
| 103 | */ |
| 104 | xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) malloc; |
| 105 | /** |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 106 | * xmlRealloc: |
| 107 | * @mem: an already allocated block of memory |
| 108 | * @size: the new size requested in bytes |
| 109 | * |
| 110 | * The variable holding the libxml realloc() implementation |
| 111 | * |
| 112 | * Returns a pointer to the newly reallocated block or NULL in case of error |
| 113 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 114 | xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 115 | /** |
| 116 | * xmlMemStrdup: |
| 117 | * @str: a zero terminated string |
| 118 | * |
| 119 | * The variable holding the libxml strdup() implementation |
| 120 | * |
| 121 | * Returns the copy of the string or NULL in case of error |
| 122 | */ |
Daniel Veillard | b82c166 | 2001-12-09 14:00:54 +0000 | [diff] [blame] | 123 | xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup; |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 124 | #endif |
| 125 | |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 126 | #include <libxml/threads.h> |
| 127 | #include <libxml/globals.h> |
| 128 | #include <libxml/SAX.h> |
| 129 | |
| 130 | #undef docbDefaultSAXHandler |
| 131 | #undef htmlDefaultSAXHandler |
| 132 | #undef oldXMLWDcompatibility |
| 133 | #undef xmlBufferAllocScheme |
| 134 | #undef xmlDefaultBufferSize |
| 135 | #undef xmlDefaultSAXHandler |
| 136 | #undef xmlDefaultSAXLocator |
| 137 | #undef xmlDoValidityCheckingDefaultValue |
| 138 | #undef xmlGenericError |
| 139 | #undef xmlGenericErrorContext |
| 140 | #undef xmlGetWarningsDefaultValue |
| 141 | #undef xmlIndentTreeOutput |
Aleksey Sanin | 2300256 | 2002-05-24 07:18:40 +0000 | [diff] [blame] | 142 | #undef xmlTreeIndentString |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 143 | #undef xmlKeepBlanksDefaultValue |
| 144 | #undef xmlLineNumbersDefaultValue |
| 145 | #undef xmlLoadExtDtdDefaultValue |
| 146 | #undef xmlParserDebugEntities |
| 147 | #undef xmlParserVersion |
| 148 | #undef xmlPedanticParserDefaultValue |
| 149 | #undef xmlSaveNoEmptyTags |
| 150 | #undef xmlSubstituteEntitiesDefaultValue |
Daniel Veillard | 8326e73 | 2003-01-07 00:19:07 +0000 | [diff] [blame] | 151 | #undef xmlRegisterNodeDefaultValue |
| 152 | #undef xmlDeregisterNodeDefaultValue |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 153 | |
| 154 | #undef xmlFree |
| 155 | #undef xmlMalloc |
Daniel Veillard | 3c908dc | 2003-04-19 00:07:51 +0000 | [diff] [blame] | 156 | #undef xmlMallocAtomic |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 157 | #undef xmlMemStrdup |
| 158 | #undef xmlRealloc |
| 159 | |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 160 | /** |
| 161 | * xmlParserVersion: |
| 162 | * |
| 163 | * Constant string describing the internal version of the library |
| 164 | */ |
Daniel Veillard | 3c01b1d | 2001-10-17 15:58:35 +0000 | [diff] [blame] | 165 | const char *xmlParserVersion = LIBXML_VERSION_STRING; |
| 166 | |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 167 | /** |
| 168 | * xmlBufferAllocScheme: |
| 169 | * |
| 170 | * Global setting, default allocation policy for buffers, default is |
| 171 | * XML_BUFFER_ALLOC_EXACT |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 172 | */ |
| 173 | xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT; |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 174 | static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_EXACT; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 175 | /** |
| 176 | * xmlDefaultBufferSize: |
| 177 | * |
| 178 | * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE |
| 179 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 180 | int xmlDefaultBufferSize = BASE_BUFFER_SIZE; |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 181 | static int xmlDefaultBufferSizeThrDef = BASE_BUFFER_SIZE; |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 182 | |
| 183 | /* |
| 184 | * Parser defaults |
| 185 | */ |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 186 | |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 187 | /** |
| 188 | * oldXMLWDcompatibility: |
| 189 | * |
| 190 | * Global setting, DEPRECATED. |
| 191 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 192 | int oldXMLWDcompatibility = 0; /* DEPRECATED */ |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 193 | /** |
| 194 | * xmlParserDebugEntities: |
| 195 | * |
| 196 | * Global setting, asking the parser to print out debugging informations. |
| 197 | * while handling entities. |
| 198 | * Disabled by default |
| 199 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 200 | int xmlParserDebugEntities = 0; |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 201 | static int xmlParserDebugEntitiesThrDef = 0; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 202 | /** |
| 203 | * xmlDoValidityCheckingDefaultValue: |
| 204 | * |
| 205 | * Global setting, indicate that the parser should work in validating mode. |
| 206 | * Disabled by default. |
| 207 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 208 | int xmlDoValidityCheckingDefaultValue = 0; |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 209 | static int xmlDoValidityCheckingDefaultValueThrDef = 0; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 210 | /** |
| 211 | * xmlGetWarningsDefaultValue: |
| 212 | * |
| 213 | * Global setting, indicate that the parser should provide warnings. |
| 214 | * Activated by default. |
| 215 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 216 | int xmlGetWarningsDefaultValue = 1; |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 217 | static int xmlGetWarningsDefaultValueThrDef = 1; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 218 | /** |
| 219 | * xmlLoadExtDtdDefaultValue: |
| 220 | * |
| 221 | * Global setting, indicate that the parser should load DTD while not |
| 222 | * validating. |
| 223 | * Disabled by default. |
| 224 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 225 | int xmlLoadExtDtdDefaultValue = 0; |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 226 | static int xmlLoadExtDtdDefaultValueThrDef = 0; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 227 | /** |
| 228 | * xmlPedanticParserDefaultValue: |
| 229 | * |
| 230 | * Global setting, indicate that the parser be pedantic |
| 231 | * Disabled by default. |
| 232 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 233 | int xmlPedanticParserDefaultValue = 0; |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 234 | static int xmlPedanticParserDefaultValueThrDef = 0; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 235 | /** |
| 236 | * xmlLineNumbersDefaultValue: |
| 237 | * |
| 238 | * Global setting, indicate that the parser should store the line number |
| 239 | * in the content field of elements in the DOM tree. |
| 240 | * Disabled by default since this may not be safe for old classes of |
| 241 | * applicaton. |
| 242 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 243 | int xmlLineNumbersDefaultValue = 0; |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 244 | static int xmlLineNumbersDefaultValueThrDef = 0; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 245 | /** |
| 246 | * xmlKeepBlanksDefaultValue: |
| 247 | * |
| 248 | * Global setting, indicate that the parser should keep all blanks |
| 249 | * nodes found in the content |
| 250 | * Activated by default, this is actually needed to have the parser |
| 251 | * conformant to the XML Recommendation, however the option is kept |
| 252 | * for some applications since this was libxml1 default behaviour. |
| 253 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 254 | int xmlKeepBlanksDefaultValue = 1; |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 255 | static int xmlKeepBlanksDefaultValueThrDef = 1; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 256 | /** |
| 257 | * xmlSubstituteEntitiesDefaultValue: |
| 258 | * |
| 259 | * Global setting, indicate that the parser should not generate entity |
| 260 | * references but replace them with the actual content of the entity |
| 261 | * Disabled by default, this should be activated when using XPath since |
| 262 | * the XPath data model requires entities replacement and the XPath |
| 263 | * engine does not handle entities references transparently. |
| 264 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 265 | int xmlSubstituteEntitiesDefaultValue = 0; |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 266 | static int xmlSubstituteEntitiesDefaultValueThrDef = 0; |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 267 | |
Daniel Veillard | 5335dc5 | 2003-01-01 20:59:38 +0000 | [diff] [blame] | 268 | xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL; |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 269 | static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL; |
Daniel Veillard | 5335dc5 | 2003-01-01 20:59:38 +0000 | [diff] [blame] | 270 | xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL; |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 271 | static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL; |
Daniel Veillard | 5335dc5 | 2003-01-01 20:59:38 +0000 | [diff] [blame] | 272 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 273 | /* |
| 274 | * Error handling |
| 275 | */ |
| 276 | |
| 277 | /* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */ |
| 278 | /* Must initialize xmlGenericError in xmlInitParser */ |
Daniel Veillard | 635ef72 | 2001-10-29 11:48:19 +0000 | [diff] [blame] | 279 | void xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED, |
| 280 | const char *msg, |
| 281 | ...); |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 282 | /** |
| 283 | * xmlGenericError: |
| 284 | * |
| 285 | * Global setting: function used for generic error callbacks |
| 286 | */ |
Daniel Veillard | 635ef72 | 2001-10-29 11:48:19 +0000 | [diff] [blame] | 287 | xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 288 | static xmlGenericErrorFunc xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc; |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 289 | /** |
| 290 | * xmlGenericErrorContext: |
| 291 | * |
| 292 | * Global setting passed to generic error callbacks |
| 293 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 294 | void *xmlGenericErrorContext = NULL; |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 295 | static void *xmlGenericErrorContextThrDef = NULL; |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 296 | |
| 297 | /* |
| 298 | * output defaults |
| 299 | */ |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 300 | /** |
| 301 | * xmlIndentTreeOutput: |
| 302 | * |
| 303 | * Global setting, asking the serializer to indent the output tree by default |
Aleksey Sanin | 2300256 | 2002-05-24 07:18:40 +0000 | [diff] [blame] | 304 | * Enabled by default |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 305 | */ |
Aleksey Sanin | 2300256 | 2002-05-24 07:18:40 +0000 | [diff] [blame] | 306 | int xmlIndentTreeOutput = 1; |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 307 | static int xmlIndentTreeOutputThrDef = 1; |
Aleksey Sanin | 2300256 | 2002-05-24 07:18:40 +0000 | [diff] [blame] | 308 | |
| 309 | /** |
| 310 | * xmlTreeIndentString: |
| 311 | * |
| 312 | * The string used to do one-level indent. By default is equal to " " (two spaces) |
| 313 | */ |
| 314 | const char *xmlTreeIndentString = " "; |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 315 | static const char *xmlTreeIndentStringThrDef = " "; |
Aleksey Sanin | 2300256 | 2002-05-24 07:18:40 +0000 | [diff] [blame] | 316 | |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 317 | /** |
| 318 | * xmlSaveNoEmptyTags: |
| 319 | * |
| 320 | * Global setting, asking the serializer to not output empty tags |
| 321 | * as <empty/> but <empty></empty>. those two forms are undistinguishable |
| 322 | * once parsed. |
| 323 | * Disabled by default |
| 324 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 325 | int xmlSaveNoEmptyTags = 0; |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 326 | int xmlSaveNoEmptyTagsThrDef = 0; |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 327 | |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 328 | /** |
| 329 | * xmlDefaultSAXHandler: |
| 330 | * |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 331 | * Default handler for XML, builds the DOM tree |
| 332 | */ |
| 333 | xmlSAXHandler xmlDefaultSAXHandler = { |
Daniel Veillard | 1af9a41 | 2003-08-20 22:54:39 +0000 | [diff] [blame] | 334 | xmlSAX2InternalSubset, |
| 335 | xmlSAX2IsStandalone, |
| 336 | xmlSAX2HasInternalSubset, |
| 337 | xmlSAX2HasExternalSubset, |
| 338 | xmlSAX2ResolveEntity, |
| 339 | xmlSAX2GetEntity, |
| 340 | xmlSAX2EntityDecl, |
| 341 | xmlSAX2NotationDecl, |
| 342 | xmlSAX2AttributeDecl, |
| 343 | xmlSAX2ElementDecl, |
| 344 | xmlSAX2UnparsedEntityDecl, |
| 345 | xmlSAX2SetDocumentLocator, |
| 346 | xmlSAX2StartDocument, |
| 347 | xmlSAX2EndDocument, |
| 348 | xmlSAX2StartElement, |
| 349 | xmlSAX2EndElement, |
| 350 | xmlSAX2Reference, |
| 351 | xmlSAX2Characters, |
| 352 | xmlSAX2Characters, |
| 353 | xmlSAX2ProcessingInstruction, |
| 354 | xmlSAX2Comment, |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 355 | xmlParserWarning, |
| 356 | xmlParserError, |
| 357 | xmlParserError, |
Daniel Veillard | 1af9a41 | 2003-08-20 22:54:39 +0000 | [diff] [blame] | 358 | xmlSAX2GetParameterEntity, |
| 359 | xmlSAX2CDataBlock, |
| 360 | xmlSAX2ExternalSubset, |
| 361 | 0, |
| 362 | NULL, |
| 363 | NULL, |
| 364 | NULL, |
| 365 | NULL |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 366 | }; |
| 367 | |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 368 | /** |
| 369 | * xmlDefaultSAXLocator: |
| 370 | * |
| 371 | * The default SAX Locator |
| 372 | * { getPublicId, getSystemId, getLineNumber, getColumnNumber} |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 373 | */ |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 374 | xmlSAXLocator xmlDefaultSAXLocator = { |
Daniel Veillard | 1af9a41 | 2003-08-20 22:54:39 +0000 | [diff] [blame] | 375 | xmlSAX2GetPublicId, |
| 376 | xmlSAX2GetSystemId, |
| 377 | xmlSAX2GetLineNumber, |
| 378 | xmlSAX2GetColumnNumber |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 379 | }; |
| 380 | |
| 381 | #ifdef LIBXML_HTML_ENABLED |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 382 | /** |
| 383 | * htmlDefaultSAXHandler: |
| 384 | * |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 385 | * Default handler for HTML, builds the DOM tree |
| 386 | */ |
| 387 | xmlSAXHandler htmlDefaultSAXHandler = { |
Daniel Veillard | 1af9a41 | 2003-08-20 22:54:39 +0000 | [diff] [blame] | 388 | xmlSAX2InternalSubset, |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 389 | NULL, |
| 390 | NULL, |
| 391 | NULL, |
| 392 | NULL, |
Daniel Veillard | 1af9a41 | 2003-08-20 22:54:39 +0000 | [diff] [blame] | 393 | xmlSAX2GetEntity, |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 394 | NULL, |
| 395 | NULL, |
| 396 | NULL, |
| 397 | NULL, |
| 398 | NULL, |
Daniel Veillard | 1af9a41 | 2003-08-20 22:54:39 +0000 | [diff] [blame] | 399 | xmlSAX2SetDocumentLocator, |
| 400 | xmlSAX2StartDocument, |
| 401 | xmlSAX2EndDocument, |
| 402 | xmlSAX2StartElement, |
| 403 | xmlSAX2EndElement, |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 404 | NULL, |
Daniel Veillard | 1af9a41 | 2003-08-20 22:54:39 +0000 | [diff] [blame] | 405 | xmlSAX2Characters, |
| 406 | xmlSAX2IgnorableWhitespace, |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 407 | NULL, |
Daniel Veillard | 1af9a41 | 2003-08-20 22:54:39 +0000 | [diff] [blame] | 408 | xmlSAX2Comment, |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 409 | xmlParserWarning, |
| 410 | xmlParserError, |
| 411 | xmlParserError, |
Daniel Veillard | 1af9a41 | 2003-08-20 22:54:39 +0000 | [diff] [blame] | 412 | xmlSAX2GetParameterEntity, |
| 413 | xmlSAX2CDataBlock, |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 414 | NULL, |
Daniel Veillard | 1af9a41 | 2003-08-20 22:54:39 +0000 | [diff] [blame] | 415 | 0, |
| 416 | NULL, |
| 417 | NULL, |
| 418 | NULL, |
| 419 | NULL |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 420 | }; |
| 421 | #endif /* LIBXML_HTML_ENABLED */ |
| 422 | |
| 423 | #ifdef LIBXML_DOCB_ENABLED |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 424 | /** |
| 425 | * docbDefaultSAXHandler: |
| 426 | * |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 427 | * Default handler for SGML DocBook, builds the DOM tree |
| 428 | */ |
| 429 | xmlSAXHandler docbDefaultSAXHandler = { |
Daniel Veillard | 1af9a41 | 2003-08-20 22:54:39 +0000 | [diff] [blame] | 430 | xmlSAX2InternalSubset, |
| 431 | xmlSAX2IsStandalone, |
| 432 | xmlSAX2HasInternalSubset, |
| 433 | xmlSAX2HasExternalSubset, |
| 434 | xmlSAX2ResolveEntity, |
| 435 | xmlSAX2GetEntity, |
| 436 | xmlSAX2EntityDecl, |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 437 | NULL, |
| 438 | NULL, |
| 439 | NULL, |
| 440 | NULL, |
Daniel Veillard | 1af9a41 | 2003-08-20 22:54:39 +0000 | [diff] [blame] | 441 | xmlSAX2SetDocumentLocator, |
| 442 | xmlSAX2StartDocument, |
| 443 | xmlSAX2EndDocument, |
| 444 | xmlSAX2StartElement, |
| 445 | xmlSAX2EndElement, |
| 446 | xmlSAX2Reference, |
| 447 | xmlSAX2Characters, |
| 448 | xmlSAX2IgnorableWhitespace, |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 449 | NULL, |
Daniel Veillard | 1af9a41 | 2003-08-20 22:54:39 +0000 | [diff] [blame] | 450 | xmlSAX2Comment, |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 451 | xmlParserWarning, |
| 452 | xmlParserError, |
| 453 | xmlParserError, |
Daniel Veillard | 1af9a41 | 2003-08-20 22:54:39 +0000 | [diff] [blame] | 454 | xmlSAX2GetParameterEntity, |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 455 | NULL, |
| 456 | NULL, |
Daniel Veillard | 1af9a41 | 2003-08-20 22:54:39 +0000 | [diff] [blame] | 457 | 0, |
| 458 | NULL, |
| 459 | NULL, |
| 460 | NULL, |
| 461 | NULL |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 462 | }; |
| 463 | #endif /* LIBXML_DOCB_ENABLED */ |
| 464 | |
| 465 | /** |
| 466 | * xmlInitializeGlobalState: |
| 467 | * @gs: a pointer to a newly allocated global state |
| 468 | * |
| 469 | * xmlInitializeGlobalState() initialize a global state with all the |
| 470 | * default values of the library. |
| 471 | */ |
| 472 | void |
| 473 | xmlInitializeGlobalState(xmlGlobalStatePtr gs) |
| 474 | { |
Daniel Veillard | 3c01b1d | 2001-10-17 15:58:35 +0000 | [diff] [blame] | 475 | #ifdef DEBUG_GLOBALS |
| 476 | fprintf(stderr, "Initializing globals at %lu for thread %d\n", |
| 477 | (unsigned long) gs, xmlGetThreadId()); |
| 478 | #endif |
| 479 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 480 | /* |
Daniel Veillard | cbaf399 | 2001-12-31 16:16:02 +0000 | [diff] [blame] | 481 | * Perform initialization as required by libxml |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 482 | */ |
Daniel Veillard | 5805be2 | 2003-08-28 08:03:23 +0000 | [diff] [blame^] | 483 | if (xmlThrDefMutex == NULL) |
| 484 | xmlInitGlobals(); |
| 485 | |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 486 | xmlMutexLock(xmlThrDefMutex); |
William M. Brack | 8b2c7f1 | 2002-11-22 05:07:29 +0000 | [diff] [blame] | 487 | |
Daniel Veillard | a4617b8 | 2001-11-04 20:19:12 +0000 | [diff] [blame] | 488 | #ifdef LIBXML_DOCB_ENABLED |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 489 | initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler); |
Daniel Veillard | a4617b8 | 2001-11-04 20:19:12 +0000 | [diff] [blame] | 490 | #endif |
| 491 | #ifdef LIBXML_HTML_ENABLED |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 492 | inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler); |
Daniel Veillard | a4617b8 | 2001-11-04 20:19:12 +0000 | [diff] [blame] | 493 | #endif |
Daniel Veillard | 3c01b1d | 2001-10-17 15:58:35 +0000 | [diff] [blame] | 494 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 495 | gs->oldXMLWDcompatibility = 0; |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 496 | gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef; |
| 497 | gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef; |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 498 | initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1); |
| 499 | gs->xmlDefaultSAXLocator.getPublicId = getPublicId; |
| 500 | gs->xmlDefaultSAXLocator.getSystemId = getSystemId; |
| 501 | gs->xmlDefaultSAXLocator.getLineNumber = getLineNumber; |
| 502 | gs->xmlDefaultSAXLocator.getColumnNumber = getColumnNumber; |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 503 | gs->xmlDoValidityCheckingDefaultValue = |
| 504 | xmlDoValidityCheckingDefaultValueThrDef; |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 505 | #if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY) |
| 506 | gs->xmlFree = (xmlFreeFunc) xmlMemFree; |
| 507 | gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc; |
Daniel Veillard | 3c908dc | 2003-04-19 00:07:51 +0000 | [diff] [blame] | 508 | gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc; |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 509 | gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc; |
| 510 | gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup; |
| 511 | #else |
| 512 | gs->xmlFree = (xmlFreeFunc) free; |
| 513 | gs->xmlMalloc = (xmlMallocFunc) malloc; |
Daniel Veillard | 3c908dc | 2003-04-19 00:07:51 +0000 | [diff] [blame] | 514 | gs->xmlMallocAtomic = (xmlMallocFunc) malloc; |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 515 | gs->xmlRealloc = (xmlReallocFunc) realloc; |
Daniel Veillard | 572577e | 2002-01-18 16:23:55 +0000 | [diff] [blame] | 516 | gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup; |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 517 | #endif |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 518 | gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef; |
| 519 | gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef; |
| 520 | gs->xmlTreeIndentString = xmlTreeIndentStringThrDef; |
| 521 | gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef; |
| 522 | gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef; |
| 523 | gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef; |
| 524 | gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef; |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 525 | gs->xmlParserVersion = LIBXML_VERSION_STRING; |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 526 | gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef; |
| 527 | gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef; |
| 528 | gs->xmlSubstituteEntitiesDefaultValue = |
| 529 | xmlSubstituteEntitiesDefaultValueThrDef; |
Daniel Veillard | 5335dc5 | 2003-01-01 20:59:38 +0000 | [diff] [blame] | 530 | |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 531 | gs->xmlGenericError = xmlGenericErrorThrDef; |
| 532 | gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef; |
| 533 | gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef; |
| 534 | gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef; |
| 535 | |
| 536 | xmlMutexUnlock(xmlThrDefMutex); |
| 537 | } |
| 538 | |
| 539 | void |
| 540 | xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) { |
| 541 | xmlMutexLock(xmlThrDefMutex); |
| 542 | xmlGenericErrorContextThrDef = ctx; |
| 543 | if (handler != NULL) |
| 544 | xmlGenericErrorThrDef = handler; |
| 545 | else |
| 546 | xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc; |
| 547 | xmlMutexUnlock(xmlThrDefMutex); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 548 | } |
| 549 | |
Daniel Veillard | 5335dc5 | 2003-01-01 20:59:38 +0000 | [diff] [blame] | 550 | /** |
Daniel Veillard | 7b4b2f9 | 2003-01-06 13:11:20 +0000 | [diff] [blame] | 551 | * xmlRegisterNodeDefault: |
Daniel Veillard | 5335dc5 | 2003-01-01 20:59:38 +0000 | [diff] [blame] | 552 | * @func: function pointer to the new RegisterNodeFunc |
| 553 | * |
Daniel Veillard | 1703c5f | 2003-02-10 14:28:44 +0000 | [diff] [blame] | 554 | * Registers a callback for node creation |
| 555 | * |
| 556 | * Returns the old value of the registration function |
Daniel Veillard | 5335dc5 | 2003-01-01 20:59:38 +0000 | [diff] [blame] | 557 | */ |
| 558 | xmlRegisterNodeFunc |
| 559 | xmlRegisterNodeDefault(xmlRegisterNodeFunc func) |
| 560 | { |
| 561 | xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue; |
| 562 | |
Daniel Veillard | a880b12 | 2003-04-21 21:36:41 +0000 | [diff] [blame] | 563 | __xmlRegisterCallbacks = 1; |
Daniel Veillard | 5335dc5 | 2003-01-01 20:59:38 +0000 | [diff] [blame] | 564 | xmlRegisterNodeDefaultValue = func; |
| 565 | return(old); |
| 566 | } |
| 567 | |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 568 | xmlRegisterNodeFunc |
| 569 | xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func) |
| 570 | { |
| 571 | xmlRegisterNodeFunc old; |
| 572 | |
| 573 | xmlMutexLock(xmlThrDefMutex); |
| 574 | old = xmlRegisterNodeDefaultValueThrDef; |
| 575 | |
| 576 | __xmlRegisterCallbacks = 1; |
| 577 | xmlRegisterNodeDefaultValueThrDef = func; |
| 578 | xmlMutexUnlock(xmlThrDefMutex); |
| 579 | |
| 580 | return(old); |
| 581 | } |
| 582 | |
Daniel Veillard | 5335dc5 | 2003-01-01 20:59:38 +0000 | [diff] [blame] | 583 | /** |
Daniel Veillard | 7b4b2f9 | 2003-01-06 13:11:20 +0000 | [diff] [blame] | 584 | * xmlDeregisterNodeDefault: |
Daniel Veillard | 5335dc5 | 2003-01-01 20:59:38 +0000 | [diff] [blame] | 585 | * @func: function pointer to the new DeregisterNodeFunc |
| 586 | * |
Daniel Veillard | 1703c5f | 2003-02-10 14:28:44 +0000 | [diff] [blame] | 587 | * Registers a callback for node destruction |
| 588 | * |
Daniel Veillard | 7b4b2f9 | 2003-01-06 13:11:20 +0000 | [diff] [blame] | 589 | * Returns the previous value of the deregistration function |
Daniel Veillard | 5335dc5 | 2003-01-01 20:59:38 +0000 | [diff] [blame] | 590 | */ |
| 591 | xmlDeregisterNodeFunc |
| 592 | xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func) |
| 593 | { |
| 594 | xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue; |
| 595 | |
Daniel Veillard | a880b12 | 2003-04-21 21:36:41 +0000 | [diff] [blame] | 596 | __xmlRegisterCallbacks = 1; |
Daniel Veillard | 5335dc5 | 2003-01-01 20:59:38 +0000 | [diff] [blame] | 597 | xmlDeregisterNodeDefaultValue = func; |
| 598 | return(old); |
| 599 | } |
| 600 | |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 601 | xmlDeregisterNodeFunc |
| 602 | xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func) |
| 603 | { |
| 604 | xmlDeregisterNodeFunc old; |
| 605 | |
| 606 | xmlMutexLock(xmlThrDefMutex); |
| 607 | old = xmlDeregisterNodeDefaultValueThrDef; |
| 608 | |
| 609 | __xmlRegisterCallbacks = 1; |
| 610 | xmlDeregisterNodeDefaultValueThrDef = func; |
| 611 | xmlMutexUnlock(xmlThrDefMutex); |
| 612 | |
| 613 | return(old); |
| 614 | } |
| 615 | |
Daniel Veillard | 5335dc5 | 2003-01-01 20:59:38 +0000 | [diff] [blame] | 616 | |
Daniel Veillard | a4617b8 | 2001-11-04 20:19:12 +0000 | [diff] [blame] | 617 | #ifdef LIBXML_DOCB_ENABLED |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 618 | #undef docbDefaultSAXHandler |
| 619 | xmlSAXHandler * |
| 620 | __docbDefaultSAXHandler(void) { |
| 621 | if (IS_MAIN_THREAD) |
| 622 | return (&docbDefaultSAXHandler); |
| 623 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 624 | return (&xmlGetGlobalState()->docbDefaultSAXHandler); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 625 | } |
Daniel Veillard | a4617b8 | 2001-11-04 20:19:12 +0000 | [diff] [blame] | 626 | #endif |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 627 | |
Daniel Veillard | a4617b8 | 2001-11-04 20:19:12 +0000 | [diff] [blame] | 628 | #ifdef LIBXML_HTML_ENABLED |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 629 | #undef htmlDefaultSAXHandler |
| 630 | xmlSAXHandler * |
| 631 | __htmlDefaultSAXHandler(void) { |
| 632 | if (IS_MAIN_THREAD) |
| 633 | return (&htmlDefaultSAXHandler); |
| 634 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 635 | return (&xmlGetGlobalState()->htmlDefaultSAXHandler); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 636 | } |
Daniel Veillard | a4617b8 | 2001-11-04 20:19:12 +0000 | [diff] [blame] | 637 | #endif |
| 638 | |
| 639 | /* |
| 640 | * Everything starting from the line below is |
| 641 | * Automatically generated by build_glob.py. |
| 642 | * Do not modify the previous line. |
| 643 | */ |
| 644 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 645 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 646 | #undef oldXMLWDcompatibility |
| 647 | int * |
| 648 | __oldXMLWDcompatibility(void) { |
| 649 | if (IS_MAIN_THREAD) |
| 650 | return (&oldXMLWDcompatibility); |
| 651 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 652 | return (&xmlGetGlobalState()->oldXMLWDcompatibility); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 653 | } |
| 654 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 655 | #undef xmlBufferAllocScheme |
| 656 | xmlBufferAllocationScheme * |
| 657 | __xmlBufferAllocScheme(void) { |
| 658 | if (IS_MAIN_THREAD) |
| 659 | return (&xmlBufferAllocScheme); |
| 660 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 661 | return (&xmlGetGlobalState()->xmlBufferAllocScheme); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 662 | } |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 663 | xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) { |
| 664 | xmlBufferAllocationScheme ret; |
| 665 | xmlMutexLock(xmlThrDefMutex); |
| 666 | ret = xmlBufferAllocSchemeThrDef; |
| 667 | xmlBufferAllocSchemeThrDef = v; |
| 668 | xmlMutexUnlock(xmlThrDefMutex); |
| 669 | return ret; |
| 670 | } |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 671 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 672 | #undef xmlDefaultBufferSize |
| 673 | int * |
| 674 | __xmlDefaultBufferSize(void) { |
| 675 | if (IS_MAIN_THREAD) |
| 676 | return (&xmlDefaultBufferSize); |
| 677 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 678 | return (&xmlGetGlobalState()->xmlDefaultBufferSize); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 679 | } |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 680 | int xmlThrDefDefaultBufferSize(int v) { |
| 681 | int ret; |
| 682 | xmlMutexLock(xmlThrDefMutex); |
| 683 | ret = xmlDefaultBufferSizeThrDef; |
| 684 | xmlDefaultBufferSizeThrDef = v; |
| 685 | xmlMutexUnlock(xmlThrDefMutex); |
| 686 | return ret; |
| 687 | } |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 688 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 689 | #undef xmlDefaultSAXHandler |
| 690 | xmlSAXHandler * |
| 691 | __xmlDefaultSAXHandler(void) { |
| 692 | if (IS_MAIN_THREAD) |
| 693 | return (&xmlDefaultSAXHandler); |
| 694 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 695 | return (&xmlGetGlobalState()->xmlDefaultSAXHandler); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 696 | } |
| 697 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 698 | #undef xmlDefaultSAXLocator |
| 699 | xmlSAXLocator * |
| 700 | __xmlDefaultSAXLocator(void) { |
| 701 | if (IS_MAIN_THREAD) |
| 702 | return (&xmlDefaultSAXLocator); |
| 703 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 704 | return (&xmlGetGlobalState()->xmlDefaultSAXLocator); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 705 | } |
| 706 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 707 | #undef xmlDoValidityCheckingDefaultValue |
| 708 | int * |
| 709 | __xmlDoValidityCheckingDefaultValue(void) { |
| 710 | if (IS_MAIN_THREAD) |
| 711 | return (&xmlDoValidityCheckingDefaultValue); |
| 712 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 713 | return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 714 | } |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 715 | int xmlThrDefDoValidityCheckingDefaultValue(int v) { |
| 716 | int ret; |
| 717 | xmlMutexLock(xmlThrDefMutex); |
| 718 | ret = xmlDoValidityCheckingDefaultValueThrDef; |
| 719 | xmlDoValidityCheckingDefaultValueThrDef = v; |
| 720 | xmlMutexUnlock(xmlThrDefMutex); |
| 721 | return ret; |
| 722 | } |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 723 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 724 | #undef xmlGenericError |
| 725 | xmlGenericErrorFunc * |
| 726 | __xmlGenericError(void) { |
| 727 | if (IS_MAIN_THREAD) |
| 728 | return (&xmlGenericError); |
| 729 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 730 | return (&xmlGetGlobalState()->xmlGenericError); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 731 | } |
| 732 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 733 | #undef xmlGenericErrorContext |
| 734 | void * * |
| 735 | __xmlGenericErrorContext(void) { |
| 736 | if (IS_MAIN_THREAD) |
| 737 | return (&xmlGenericErrorContext); |
| 738 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 739 | return (&xmlGetGlobalState()->xmlGenericErrorContext); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 740 | } |
| 741 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 742 | #undef xmlGetWarningsDefaultValue |
| 743 | int * |
| 744 | __xmlGetWarningsDefaultValue(void) { |
| 745 | if (IS_MAIN_THREAD) |
| 746 | return (&xmlGetWarningsDefaultValue); |
| 747 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 748 | return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 749 | } |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 750 | int xmlThrDefGetWarningsDefaultValue(int v) { |
| 751 | int ret; |
| 752 | xmlMutexLock(xmlThrDefMutex); |
| 753 | ret = xmlGetWarningsDefaultValueThrDef; |
| 754 | xmlGetWarningsDefaultValueThrDef = v; |
| 755 | xmlMutexUnlock(xmlThrDefMutex); |
| 756 | return ret; |
| 757 | } |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 758 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 759 | #undef xmlIndentTreeOutput |
| 760 | int * |
| 761 | __xmlIndentTreeOutput(void) { |
| 762 | if (IS_MAIN_THREAD) |
| 763 | return (&xmlIndentTreeOutput); |
| 764 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 765 | return (&xmlGetGlobalState()->xmlIndentTreeOutput); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 766 | } |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 767 | int xmlThrDefIndentTreeOutput(int v) { |
| 768 | int ret; |
| 769 | xmlMutexLock(xmlThrDefMutex); |
| 770 | ret = xmlIndentTreeOutputThrDef; |
| 771 | xmlIndentTreeOutputThrDef = v; |
| 772 | xmlMutexUnlock(xmlThrDefMutex); |
| 773 | return ret; |
| 774 | } |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 775 | |
Aleksey Sanin | 2300256 | 2002-05-24 07:18:40 +0000 | [diff] [blame] | 776 | #undef xmlTreeIndentString |
| 777 | const char * * |
| 778 | __xmlTreeIndentString(void) { |
| 779 | if (IS_MAIN_THREAD) |
| 780 | return (&xmlTreeIndentString); |
| 781 | else |
| 782 | return (&xmlGetGlobalState()->xmlTreeIndentString); |
| 783 | } |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 784 | const char * xmlThrDefTreeIndentString(const char * v) { |
| 785 | const char * ret; |
| 786 | xmlMutexLock(xmlThrDefMutex); |
| 787 | ret = xmlTreeIndentStringThrDef; |
| 788 | xmlTreeIndentStringThrDef = v; |
| 789 | xmlMutexUnlock(xmlThrDefMutex); |
| 790 | return ret; |
| 791 | } |
Aleksey Sanin | 2300256 | 2002-05-24 07:18:40 +0000 | [diff] [blame] | 792 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 793 | #undef xmlKeepBlanksDefaultValue |
| 794 | int * |
| 795 | __xmlKeepBlanksDefaultValue(void) { |
| 796 | if (IS_MAIN_THREAD) |
| 797 | return (&xmlKeepBlanksDefaultValue); |
| 798 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 799 | return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 800 | } |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 801 | int xmlThrDefKeepBlanksDefaultValue(int v) { |
| 802 | int ret; |
| 803 | xmlMutexLock(xmlThrDefMutex); |
| 804 | ret = xmlKeepBlanksDefaultValueThrDef; |
| 805 | xmlKeepBlanksDefaultValueThrDef = v; |
| 806 | xmlMutexUnlock(xmlThrDefMutex); |
| 807 | return ret; |
| 808 | } |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 809 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 810 | #undef xmlLineNumbersDefaultValue |
| 811 | int * |
| 812 | __xmlLineNumbersDefaultValue(void) { |
| 813 | if (IS_MAIN_THREAD) |
| 814 | return (&xmlLineNumbersDefaultValue); |
| 815 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 816 | return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 817 | } |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 818 | int xmlThrDefLineNumbersDefaultValue(int v) { |
| 819 | int ret; |
| 820 | xmlMutexLock(xmlThrDefMutex); |
| 821 | ret = xmlLineNumbersDefaultValueThrDef; |
| 822 | xmlLineNumbersDefaultValueThrDef = v; |
| 823 | xmlMutexUnlock(xmlThrDefMutex); |
| 824 | return ret; |
| 825 | } |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 826 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 827 | #undef xmlLoadExtDtdDefaultValue |
| 828 | int * |
| 829 | __xmlLoadExtDtdDefaultValue(void) { |
| 830 | if (IS_MAIN_THREAD) |
| 831 | return (&xmlLoadExtDtdDefaultValue); |
| 832 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 833 | return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 834 | } |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 835 | int xmlThrDefLoadExtDtdDefaultValue(int v) { |
| 836 | int ret; |
| 837 | xmlMutexLock(xmlThrDefMutex); |
| 838 | ret = xmlLoadExtDtdDefaultValueThrDef; |
| 839 | xmlLoadExtDtdDefaultValueThrDef = v; |
| 840 | xmlMutexUnlock(xmlThrDefMutex); |
| 841 | return ret; |
| 842 | } |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 843 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 844 | #undef xmlParserDebugEntities |
| 845 | int * |
| 846 | __xmlParserDebugEntities(void) { |
| 847 | if (IS_MAIN_THREAD) |
| 848 | return (&xmlParserDebugEntities); |
| 849 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 850 | return (&xmlGetGlobalState()->xmlParserDebugEntities); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 851 | } |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 852 | int xmlThrDefParserDebugEntities(int v) { |
| 853 | int ret; |
| 854 | xmlMutexLock(xmlThrDefMutex); |
| 855 | ret = xmlParserDebugEntitiesThrDef; |
| 856 | xmlParserDebugEntitiesThrDef = v; |
| 857 | xmlMutexUnlock(xmlThrDefMutex); |
| 858 | return ret; |
| 859 | } |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 860 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 861 | #undef xmlParserVersion |
| 862 | const char * * |
| 863 | __xmlParserVersion(void) { |
| 864 | if (IS_MAIN_THREAD) |
| 865 | return (&xmlParserVersion); |
| 866 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 867 | return (&xmlGetGlobalState()->xmlParserVersion); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 868 | } |
| 869 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 870 | #undef xmlPedanticParserDefaultValue |
| 871 | int * |
| 872 | __xmlPedanticParserDefaultValue(void) { |
| 873 | if (IS_MAIN_THREAD) |
| 874 | return (&xmlPedanticParserDefaultValue); |
| 875 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 876 | return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 877 | } |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 878 | int xmlThrDefPedanticParserDefaultValue(int v) { |
| 879 | int ret; |
| 880 | xmlMutexLock(xmlThrDefMutex); |
| 881 | ret = xmlPedanticParserDefaultValueThrDef; |
| 882 | xmlPedanticParserDefaultValueThrDef = v; |
| 883 | xmlMutexUnlock(xmlThrDefMutex); |
| 884 | return ret; |
| 885 | } |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 886 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 887 | #undef xmlSaveNoEmptyTags |
| 888 | int * |
| 889 | __xmlSaveNoEmptyTags(void) { |
| 890 | if (IS_MAIN_THREAD) |
| 891 | return (&xmlSaveNoEmptyTags); |
| 892 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 893 | return (&xmlGetGlobalState()->xmlSaveNoEmptyTags); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 894 | } |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 895 | int xmlThrDefSaveNoEmptyTags(int v) { |
| 896 | int ret; |
| 897 | xmlMutexLock(xmlThrDefMutex); |
| 898 | ret = xmlSaveNoEmptyTagsThrDef; |
| 899 | xmlSaveNoEmptyTagsThrDef = v; |
| 900 | xmlMutexUnlock(xmlThrDefMutex); |
| 901 | return ret; |
| 902 | } |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 903 | |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 904 | #undef xmlSubstituteEntitiesDefaultValue |
| 905 | int * |
| 906 | __xmlSubstituteEntitiesDefaultValue(void) { |
| 907 | if (IS_MAIN_THREAD) |
| 908 | return (&xmlSubstituteEntitiesDefaultValue); |
| 909 | else |
Daniel Veillard | d046356 | 2001-10-13 09:15:48 +0000 | [diff] [blame] | 910 | return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue); |
Daniel Veillard | b847864 | 2001-10-12 17:29:10 +0000 | [diff] [blame] | 911 | } |
Daniel Veillard | 781ac8b | 2003-05-15 22:11:36 +0000 | [diff] [blame] | 912 | int xmlThrDefSubstituteEntitiesDefaultValue(int v) { |
| 913 | int ret; |
| 914 | xmlMutexLock(xmlThrDefMutex); |
| 915 | ret = xmlSubstituteEntitiesDefaultValueThrDef; |
| 916 | xmlSubstituteEntitiesDefaultValueThrDef = v; |
| 917 | xmlMutexUnlock(xmlThrDefMutex); |
| 918 | return ret; |
| 919 | } |
Daniel Veillard | 5335dc5 | 2003-01-01 20:59:38 +0000 | [diff] [blame] | 920 | |
| 921 | #undef xmlRegisterNodeDefaultValue |
| 922 | xmlRegisterNodeFunc * |
| 923 | __xmlRegisterNodeDefaultValue(void) { |
| 924 | if (IS_MAIN_THREAD) |
| 925 | return (&xmlRegisterNodeDefaultValue); |
| 926 | else |
| 927 | return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue); |
| 928 | } |
| 929 | |
| 930 | #undef xmlDeregisterNodeDefaultValue |
| 931 | xmlDeregisterNodeFunc * |
| 932 | __xmlDeregisterNodeDefaultValue(void) { |
| 933 | if (IS_MAIN_THREAD) |
| 934 | return (&xmlDeregisterNodeDefaultValue); |
| 935 | else |
| 936 | return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue); |
| 937 | } |