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