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