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