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