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