⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 globals.c.svn-base

📁 这是一个用于解析xml文件的类库。使用这个类库
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:
/* * globals.c: definition and handling of the set of global variables *            of the library * * The bottom of this file is automatically generated by build_glob.py * based on the description file global.data * * See Copyright for the status of this software. * * Gary Pennington <Gary.Pennington@uk.sun.com> * daniel@veillard.com */#define IN_LIBXML#include "libxml.h"#ifdef HAVE_STDLIB_H#include <stdlib.h>#endif#include <string.h>#include <libxml/globals.h>#include <libxml/xmlmemory.h>#include <libxml/threads.h>/* #define DEBUG_GLOBALS *//* * Helpful Macro */#ifdef LIBXML_THREAD_ENABLED#define IS_MAIN_THREAD (xmlIsMainThread())#else#define IS_MAIN_THREAD 1#endif/* * Mutex to protect "ForNewThreads" variables */static xmlMutexPtr xmlThrDefMutex = NULL;/** * xmlInitGlobals: * * Additional initialisation for multi-threading */void xmlInitGlobals(){    xmlThrDefMutex = xmlNewMutex();}/** * xmlCleanupGlobals: * * Additional cleanup for multi-threading */void xmlCleanupGlobals(){    if (xmlThrDefMutex != NULL) {	xmlFreeMutex(xmlThrDefMutex);	xmlThrDefMutex = NULL;    }}/************************************************************************ * 									* *	All the user accessible global variables of the library		* * 									* ************************************************************************//* * Memory allocation routines */#if defined(DEBUG_MEMORY_LOCATION) || defined(DEBUG_MEMORY)#ifndef __DEBUG_MEMORY_ALLOC__extern void xmlMemFree(void *ptr);extern void * xmlMemMalloc(size_t size);extern void * xmlMemRealloc(void *ptr,size_t size);extern char * xmlMemoryStrdup(const char *str);#endifxmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;#else/** * xmlFree: * @mem: an already allocated block of memory * * The variable holding the libxml free() implementation */xmlFreeFunc xmlFree = (xmlFreeFunc) free;/** * xmlMalloc: * @size:  the size requested in bytes * * The variable holding the libxml malloc() implementation * * Returns a pointer to the newly allocated block or NULL in case of error */xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc;/** * xmlMallocAtomic: * @size:  the size requested in bytes * * The variable holding the libxml malloc() implementation for atomic * data (i.e. blocks not containings pointers), useful when using a * garbage collecting allocator. * * Returns a pointer to the newly allocated block or NULL in case of error */xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) malloc;/** * xmlRealloc: * @mem: an already allocated block of memory * @size:  the new size requested in bytes * * The variable holding the libxml realloc() implementation * * Returns a pointer to the newly reallocated block or NULL in case of error */xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;/** * xmlMemStrdup: * @str: a zero terminated string * * The variable holding the libxml strdup() implementation * * Returns the copy of the string or NULL in case of error */xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;#endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */#include <libxml/threads.h>#include <libxml/globals.h>#include <libxml/SAX.h>#undef	docbDefaultSAXHandler#undef	htmlDefaultSAXHandler#undef	oldXMLWDcompatibility#undef	xmlBufferAllocScheme#undef	xmlDefaultBufferSize#undef	xmlDefaultSAXHandler#undef	xmlDefaultSAXLocator#undef	xmlDoValidityCheckingDefaultValue#undef	xmlGenericError#undef	xmlStructuredError#undef	xmlGenericErrorContext#undef	xmlGetWarningsDefaultValue#undef	xmlIndentTreeOutput#undef  xmlTreeIndentString#undef	xmlKeepBlanksDefaultValue#undef	xmlLineNumbersDefaultValue#undef	xmlLoadExtDtdDefaultValue#undef	xmlParserDebugEntities#undef	xmlParserVersion#undef	xmlPedanticParserDefaultValue#undef	xmlSaveNoEmptyTags#undef	xmlSubstituteEntitiesDefaultValue#undef	xmlRegisterNodeDefaultValue#undef	xmlDeregisterNodeDefaultValue#undef	xmlLastError#undef	xmlFree#undef	xmlMalloc#undef	xmlMallocAtomic#undef	xmlMemStrdup#undef	xmlRealloc/** * xmlParserVersion: * * Constant string describing the internal version of the library */const char *xmlParserVersion = LIBXML_VERSION_STRING;/** * xmlBufferAllocScheme: * * Global setting, default allocation policy for buffers, default is * XML_BUFFER_ALLOC_EXACT */xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_EXACT;/** * xmlDefaultBufferSize: * * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE */int xmlDefaultBufferSize = BASE_BUFFER_SIZE;static int xmlDefaultBufferSizeThrDef = BASE_BUFFER_SIZE;/* * Parser defaults *//** * oldXMLWDcompatibility: * * Global setting, DEPRECATED. */int oldXMLWDcompatibility = 0; /* DEPRECATED *//** * xmlParserDebugEntities: * * Global setting, asking the parser to print out debugging informations. * while handling entities. * Disabled by default */int xmlParserDebugEntities = 0;static int xmlParserDebugEntitiesThrDef = 0;/** * xmlDoValidityCheckingDefaultValue: * * Global setting, indicate that the parser should work in validating mode. * Disabled by default. */int xmlDoValidityCheckingDefaultValue = 0;static int xmlDoValidityCheckingDefaultValueThrDef = 0;/** * xmlGetWarningsDefaultValue: * * Global setting, indicate that the parser should provide warnings. * Activated by default. */int xmlGetWarningsDefaultValue = 1;static int xmlGetWarningsDefaultValueThrDef = 1;/** * xmlLoadExtDtdDefaultValue: * * Global setting, indicate that the parser should load DTD while not * validating. * Disabled by default. */int xmlLoadExtDtdDefaultValue = 0;static int xmlLoadExtDtdDefaultValueThrDef = 0;/** * xmlPedanticParserDefaultValue: * * Global setting, indicate that the parser be pedantic * Disabled by default. */int xmlPedanticParserDefaultValue = 0;static int xmlPedanticParserDefaultValueThrDef = 0;/** * xmlLineNumbersDefaultValue: * * Global setting, indicate that the parser should store the line number * in the content field of elements in the DOM tree.  * Disabled by default since this may not be safe for old classes of * applicaton. */int xmlLineNumbersDefaultValue = 0;static int xmlLineNumbersDefaultValueThrDef = 0;/** * xmlKeepBlanksDefaultValue: * * Global setting, indicate that the parser should keep all blanks * nodes found in the content * Activated by default, this is actually needed to have the parser * conformant to the XML Recommendation, however the option is kept * for some applications since this was libxml1 default behaviour. */int xmlKeepBlanksDefaultValue = 1;static int xmlKeepBlanksDefaultValueThrDef = 1;/** * xmlSubstituteEntitiesDefaultValue: * * Global setting, indicate that the parser should not generate entity * references but replace them with the actual content of the entity * Disabled by default, this should be activated when using XPath since * the XPath data model requires entities replacement and the XPath * engine does not handle entities references transparently. */int xmlSubstituteEntitiesDefaultValue = 0;static int xmlSubstituteEntitiesDefaultValueThrDef = 0;xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL;static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL;xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL;static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL;/* * Error handling *//* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; *//* Must initialize xmlGenericError in xmlInitParser */void xmlGenericErrorDefaultFunc	(void *ctx ATTRIBUTE_UNUSED,				 const char *msg,				 ...);/** * xmlGenericError: * * Global setting: function used for generic error callbacks */xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc;static xmlGenericErrorFunc xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;/** * xmlStructuredError: * * Global setting: function used for structured error callbacks */xmlStructuredErrorFunc xmlStructuredError = NULL;static xmlStructuredErrorFunc xmlStructuredErrorThrDef = NULL;/** * xmlGenericErrorContext: * * Global setting passed to generic error callbacks */void *xmlGenericErrorContext = NULL;static void *xmlGenericErrorContextThrDef = NULL;xmlError xmlLastError;/* * output defaults *//** * xmlIndentTreeOutput: * * Global setting, asking the serializer to indent the output tree by default * Enabled by default */int xmlIndentTreeOutput = 1;static int xmlIndentTreeOutputThrDef = 1;/** * xmlTreeIndentString: * * The string used to do one-level indent. By default is equal to "  " (two spaces) */const char *xmlTreeIndentString = "  ";static const char *xmlTreeIndentStringThrDef = "  ";/** * xmlSaveNoEmptyTags: * * Global setting, asking the serializer to not output empty tags * as <empty/> but <empty></empty>. those two forms are undistinguishable * once parsed. * Disabled by default */int xmlSaveNoEmptyTags = 0;int xmlSaveNoEmptyTagsThrDef = 0;#ifdef LIBXML_SAX1_ENABLED/** * xmlDefaultSAXHandler: * * Default SAX version1 handler for XML, builds the DOM tree */xmlSAXHandlerV1 xmlDefaultSAXHandler = {    xmlSAX2InternalSubset,    xmlSAX2IsStandalone,    xmlSAX2HasInternalSubset,    xmlSAX2HasExternalSubset,    xmlSAX2ResolveEntity,    xmlSAX2GetEntity,    xmlSAX2EntityDecl,    xmlSAX2NotationDecl,    xmlSAX2AttributeDecl,    xmlSAX2ElementDecl,    xmlSAX2UnparsedEntityDecl,    xmlSAX2SetDocumentLocator,    xmlSAX2StartDocument,    xmlSAX2EndDocument,    xmlSAX2StartElement,    xmlSAX2EndElement,    xmlSAX2Reference,    xmlSAX2Characters,    xmlSAX2Characters,    xmlSAX2ProcessingInstruction,    xmlSAX2Comment,    xmlParserWarning,    xmlParserError,    xmlParserError,    xmlSAX2GetParameterEntity,    xmlSAX2CDataBlock,    xmlSAX2ExternalSubset,    0,};#endif /* LIBXML_SAX1_ENABLED *//** * xmlDefaultSAXLocator: * * The default SAX Locator * { getPublicId, getSystemId, getLineNumber, getColumnNumber} */xmlSAXLocator xmlDefaultSAXLocator = {    xmlSAX2GetPublicId,    xmlSAX2GetSystemId,    xmlSAX2GetLineNumber,    xmlSAX2GetColumnNumber};#ifdef LIBXML_HTML_ENABLED/** * htmlDefaultSAXHandler: * * Default old SAX v1 handler for HTML, builds the DOM tree */xmlSAXHandlerV1 htmlDefaultSAXHandler = {    xmlSAX2InternalSubset,    NULL,    NULL,    NULL,    NULL,    xmlSAX2GetEntity,    NULL,    NULL,    NULL,    NULL,    NULL,    xmlSAX2SetDocumentLocator,    xmlSAX2StartDocument,    xmlSAX2EndDocument,    xmlSAX2StartElement,    xmlSAX2EndElement,    NULL,    xmlSAX2Characters,    xmlSAX2IgnorableWhitespace,    NULL,    xmlSAX2Comment,    xmlParserWarning,    xmlParserError,    xmlParserError,    xmlSAX2GetParameterEntity,    xmlSAX2CDataBlock,    NULL,    0,};#endif /* LIBXML_HTML_ENABLED */#ifdef LIBXML_DOCB_ENABLED/** * docbDefaultSAXHandler: * * Default old SAX v1 handler for SGML DocBook, builds the DOM tree */xmlSAXHandlerV1 docbDefaultSAXHandler = {    xmlSAX2InternalSubset,    xmlSAX2IsStandalone,    xmlSAX2HasInternalSubset,    xmlSAX2HasExternalSubset,    xmlSAX2ResolveEntity,    xmlSAX2GetEntity,    xmlSAX2EntityDecl,    NULL,    NULL,    NULL,    NULL,    xmlSAX2SetDocumentLocator,    xmlSAX2StartDocument,    xmlSAX2EndDocument,    xmlSAX2StartElement,    xmlSAX2EndElement,    xmlSAX2Reference,    xmlSAX2Characters,    xmlSAX2IgnorableWhitespace,    NULL,    xmlSAX2Comment,    xmlParserWarning,    xmlParserError,    xmlParserError,    xmlSAX2GetParameterEntity,    NULL,    NULL,    0,};#endif /* LIBXML_DOCB_ENABLED *//** * xmlInitializeGlobalState: * @gs: a pointer to a newly allocated global state * * xmlInitializeGlobalState() initialize a global state with all the * default values of the library. */voidxmlInitializeGlobalState(xmlGlobalStatePtr gs){#ifdef DEBUG_GLOBALS    fprintf(stderr, "Initializing globals at %lu for thread %d\n",	    (unsigned long) gs, xmlGetThreadId());#endif    /*     * Perform initialization as required by libxml     */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -