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