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