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

📄 parser_chdl_spec.c

📁 图片显示,电脑光于望技术湖连望键往,网络
💻 C
📖 第 1 页 / 共 5 页
字号:
#include <libxml/parser.h>
#include <ch.h>
#include "getvariables.h"

static ChInterp_t interp;

static void internalSubset_chdl_funarg(void *ctx, xmlChar *name, xmlChar *ExternalID, xmlChar *SystemID);
static void *internalSubset_chdl_funptr;


static int isStandalone_chdl_funarg(void *ctx);
static void *isStandalone_chdl_funptr;

static int hasInternalSubset_chdl_funarg(void *ctx);
static void *hasInternalSubset_chdl_funptr;

static int hasExternalSubset_chdl_funarg(void *ctx);
static void *hasExternalSubset_chdl_funptr;

static xmlParserInputPtr resolveEntity_chdl_funarg(void *ctx, xmlChar *publicId, xmlChar *systemId);
static void *resolveEntity_chdl_funptr;

static xmlEntityPtr getEntity_chdl_funarg(void *ctx, xmlChar *name);
static void *getEntity_chdl_funptr;

static void entityDecl_chdl_funarg(void *ctx, xmlChar *name, int type, xmlChar *publicId, xmlChar *systemId, xmlChar *content);
static void *entityDecl_chdl_funptr;

static void notationDecl_chdl_funarg(void *ctx, xmlChar *name, xmlChar *publicId, xmlChar *systemId);
static void *notationDecl_chdl_funptr;

static void attributeDecl_chdl_funarg(void *ctx, xmlChar *elem, xmlChar *fullname, int type, int def, xmlChar *defaultValue, xmlEnumerationPtr tree);
static void *attributeDecl_chdl_funptr;

static void elementDecl_chdl_funarg(void *ctx, xmlChar *name, int type, xmlElementContentPtr content);
static void *elementDecl_chdl_funptr;

static void unparsedEntityDecl_chdl_funarg(void *ctx, xmlChar *name, xmlChar *publicId, xmlChar *systemId, xmlChar *notationName);
static void *unparsedEntityDecl_chdl_funptr;

static void setDocumentLocator_chdl_funarg(void *ctx, xmlSAXLocatorPtr loc);
static void *setDocumentLocator_chdl_funptr;

static void startDocument_chdl_funarg(void *ctx);
static void *startDocument_chdl_funptr;

static void endDocument_chdl_funarg(void *ctx);
static void *endDocument_chdl_funptr;

static void startElement_chdl_funarg(void *ctx, xmlChar *name, xmlChar **atts);
static void *startElement_chdl_funptr;

static void endElement_chdl_funarg(void *ctx, xmlChar *name);
static void *endElement_chdl_funptr;

static void reference_chdl_funarg(void *ctx, xmlChar *name);
static void *reference_chdl_funptr;

static void characters_chdl_funarg(void *ctx, xmlChar *ch, int len);
static void *characters_chdl_funptr;

static void ignorableWhitespace_chdl_funarg(void *ctx, xmlChar *ch, int len);
static void *ignorableWhitespace_chdl_funptr;

static void processingInstruction_chdl_funarg(void *ctx, xmlChar *target, xmlChar *data);
static void *processingInstruction_chdl_funptr;

static void comment_chdl_funarg(void *ctx, xmlChar *value);
static void *comment_chdl_funptr;

static void warning_chdl_funarg(void *ctx, char *msg, ...);	
static void *warning_chdl_funptr;

static void error_chdl_funarg(void *ctx, char *msg, ...);
static void *error_chdl_funptr;

static void fatalError_chdl_funarg(void *ctx, char *msg, ...);
static void *fatalError_chdl_funptr;

static xmlEntityPtr getParameterEntity_chdl_funarg(void *ctx, xmlChar *name);
static void *getParameterEntity_chdl_funptr;

static void cdataBlock_chdl_funarg( void *ctx, xmlChar *value, int len);
static void *cdataBlock_chdl_funptr;

static void externalSubset_chdl_funarg(void *ctx, xmlChar *name, xmlChar *ExternalID, xmlChar *SystemID);
static void *externalSubset_chdl_funptr;

static void startElementNs_chdl_funarg(void *ctx, xmlChar *localname, xmlChar *prefix, xmlChar *URI, int nb_namespaces, xmlChar **namespaces, int nb_attributes, int nb_defaulted, xmlChar **attributes);
static void *startElementNs_chdl_funptr;

static void endElementNs_chdl_funarg(void *ctx, xmlChar *localname, xmlChar *prefix, xmlChar *URI);
static void *endElementNs_chdl_funptr;

static void serror_chdl_funarg(void *userData, xmlErrorPtr error);
static void *serror_chdl_funptr;


EXPORTCH xmlDocPtr xmlSAXParseDoc_chdl(void *varg) {
    va_list ap;
    xmlSAXHandlerPtr sax;
    xmlSAXHandler sax_tmp, *sax_tmp_ptr;
    xmlChar *cur;
    int recovery;
    xmlDocPtr retval;

    Ch_VaStart(interp, ap, varg);
    sax = Ch_VaArg(interp, ap, xmlSAXHandlerPtr);
    if(sax){
      sax_tmp = *sax;
      if(sax->internalSubset){
         internalSubset_chdl_funptr = sax->internalSubset;
         sax_tmp.internalSubset = internalSubset_chdl_funarg;
      }else
         sax_tmp.internalSubset = NULL;
      if(sax->isStandalone){
         isStandalone_chdl_funptr = sax->isStandalone;
         sax_tmp.isStandalone = isStandalone_chdl_funarg;
      }else
         sax_tmp.isStandalone = NULL; 
      if(sax->hasInternalSubset){
         hasInternalSubset_chdl_funptr = sax->hasInternalSubset;
         sax_tmp.hasInternalSubset = hasInternalSubset_chdl_funarg;
      }else
         sax_tmp.hasInternalSubset = NULL;
      if(sax->hasExternalSubset){
         hasExternalSubset_chdl_funptr = sax->hasExternalSubset;
         sax_tmp.hasExternalSubset = hasExternalSubset_chdl_funarg;
      }else
         sax_tmp.hasExternalSubset = NULL;
      if(sax->resolveEntity){
         resolveEntity_chdl_funptr = sax->resolveEntity;
         sax_tmp.resolveEntity = resolveEntity_chdl_funarg;
      }else
         sax_tmp.resolveEntity = NULL;
      if(sax->getEntity){
         getEntity_chdl_funptr = sax->getEntity;
         sax_tmp.getEntity = getEntity_chdl_funarg;
      }else
         sax_tmp.getEntity = NULL;
      if(sax->entityDecl){
         entityDecl_chdl_funptr = sax->entityDecl;
         sax_tmp.entityDecl = entityDecl_chdl_funarg;
      }else
         sax_tmp.entityDecl = NULL;
      if(sax->notationDecl){
         notationDecl_chdl_funptr = sax->notationDecl;
         sax_tmp.notationDecl = notationDecl_chdl_funarg;
      }else
         sax_tmp.notationDecl = NULL;
      if(sax->attributeDecl){
         attributeDecl_chdl_funptr = sax->attributeDecl;
         sax_tmp.attributeDecl = attributeDecl_chdl_funarg;
      }else
         sax_tmp.attributeDecl = NULL;
      if(sax->elementDecl){
         elementDecl_chdl_funptr = sax->elementDecl;
         sax_tmp.elementDecl = elementDecl_chdl_funarg;
      }else
         sax_tmp.elementDecl = NULL;
      if(sax->unparsedEntityDecl){
         unparsedEntityDecl_chdl_funptr = sax->unparsedEntityDecl;
         sax_tmp.unparsedEntityDecl = unparsedEntityDecl_chdl_funarg;
      }else
         sax_tmp.unparsedEntityDecl = NULL;
      if(sax->setDocumentLocator){
         setDocumentLocator_chdl_funptr = sax->setDocumentLocator;
         sax_tmp.setDocumentLocator = setDocumentLocator_chdl_funarg;
      }else
         sax_tmp.setDocumentLocator = NULL;
      if(sax->startDocument){
         startDocument_chdl_funptr = sax->startDocument;
         sax_tmp.startDocument = startDocument_chdl_funarg;
      }else
         sax_tmp.startDocument = NULL;
      if(sax->endDocument){
         endDocument_chdl_funptr = sax->endDocument;
         sax_tmp.endDocument = endDocument_chdl_funarg;
      }
         sax_tmp.endDocument = NULL;
      if(sax->startElement){
         startElement_chdl_funptr = sax->startElement;
         sax_tmp.startElement = startElement_chdl_funarg;
      }else
         sax_tmp.startElement = NULL;
      if(sax->endElement){
         endElement_chdl_funptr = sax->endElement;
         sax_tmp.endElement = endElement_chdl_funarg;
      }else
         sax_tmp.endElement = NULL;
      if(sax->reference){
         reference_chdl_funptr = sax->reference;
         sax_tmp.reference = reference_chdl_funarg;
      }else
         sax_tmp.reference = NULL;
      if(sax->characters){
         characters_chdl_funptr = sax->characters;
         sax_tmp.characters = characters_chdl_funarg;
      }else
         sax_tmp.characters = NULL;
      if(sax->ignorableWhitespace){
         ignorableWhitespace_chdl_funptr = sax->ignorableWhitespace;
         sax_tmp.ignorableWhitespace = ignorableWhitespace_chdl_funarg;
      }else
         sax_tmp.ignorableWhitespace = NULL;
      if(sax->processingInstruction){
         processingInstruction_chdl_funptr = sax->processingInstruction;
         sax_tmp.processingInstruction = processingInstruction_chdl_funarg;
      }else
         sax_tmp.processingInstruction = NULL;
      if(sax->comment){
         comment_chdl_funptr = sax->comment;
         sax_tmp.comment = comment_chdl_funarg;
      }else
         sax_tmp.comment = NULL;
      if(sax->warning){
         warning_chdl_funptr = sax->warning;
         sax_tmp.warning = warning_chdl_funarg;
      }else
         sax_tmp.warning = NULL;
      if(sax->error){
         error_chdl_funptr = sax->error;
         sax_tmp.error = error_chdl_funarg;
      }else
         sax_tmp.error = NULL;
      if(sax->fatalError){
         /* unused error() get all the errors */
         fatalError_chdl_funptr = sax->fatalError; 
         sax_tmp.fatalError = fatalError_chdl_funarg; 
      }else
         sax_tmp.fatalError = NULL;
      if(sax->getParameterEntity){
         getParameterEntity_chdl_funptr = sax->getParameterEntity;
         sax_tmp.getParameterEntity = getParameterEntity_chdl_funarg;
      }else
         sax_tmp.getParameterEntity = NULL;
      if(sax->cdataBlock){
         cdataBlock_chdl_funptr = sax->cdataBlock;
         sax_tmp.cdataBlock = cdataBlock_chdl_funarg;
      }else
         sax_tmp.cdataBlock = NULL;
      if(sax->externalSubset){
         externalSubset_chdl_funptr= sax->externalSubset;
         sax_tmp.externalSubset= externalSubset_chdl_funarg;
      }else
         sax_tmp.externalSubset= NULL;
      sax_tmp.initialized = sax->initialized; /*int*/
      sax_tmp._private = sax->_private;
      if(sax->startElementNs){
         startElementNs_chdl_funptr = sax->startElementNs;
         sax_tmp.startElementNs = startElementNs_chdl_funarg;
      }else
         sax_tmp.startElementNs = NULL;
      if(sax->endElementNs){
         endElementNs_chdl_funptr = sax->endElementNs;
         sax_tmp.endElementNs = endElementNs_chdl_funarg;
      }else
         sax_tmp.endElementNs = NULL;
      if(sax->serror){
         serror_chdl_funptr = sax->serror;
         sax_tmp.serror = serror_chdl_funarg;
      }
         sax_tmp.serror = NULL;
      sax_tmp_ptr = &sax_tmp;

	}else
      sax_tmp_ptr = NULL;
	
    cur = Ch_VaArg(interp, ap, xmlChar *);
    recovery = Ch_VaArg(interp, ap, int);
    retval = xmlSAXParseDoc(sax_tmp_ptr, cur, recovery);
    Ch_VaEnd(interp, ap);
    return retval;
}

EXPORTCH int xmlSAXUserParseFile_chdl(void *varg) {
    va_list ap;
    xmlSAXHandlerPtr sax;
    xmlSAXHandler sax_tmp, *sax_tmp_ptr;
    void *user_data;
    char *filename;
    int retval;

    Ch_VaStart(interp, ap, varg);
    sax = Ch_VaArg(interp, ap, xmlSAXHandlerPtr);
    if(sax){
      sax_tmp = *sax;
      if(sax->internalSubset){
         internalSubset_chdl_funptr = sax->internalSubset;
         sax_tmp.internalSubset = internalSubset_chdl_funarg;
      }else
         sax_tmp.internalSubset = NULL;
      if(sax->isStandalone){
         isStandalone_chdl_funptr = sax->isStandalone;
         sax_tmp.isStandalone = isStandalone_chdl_funarg;
      }else
         sax_tmp.isStandalone = NULL; 
      if(sax->hasInternalSubset){
         hasInternalSubset_chdl_funptr = sax->hasInternalSubset;
         sax_tmp.hasInternalSubset = hasInternalSubset_chdl_funarg;
      }else
         sax_tmp.hasInternalSubset = NULL;
      if(sax->hasExternalSubset){
         hasExternalSubset_chdl_funptr = sax->hasExternalSubset;
         sax_tmp.hasExternalSubset = hasExternalSubset_chdl_funarg;
      }else
         sax_tmp.hasExternalSubset = NULL;
      if(sax->resolveEntity){
         resolveEntity_chdl_funptr = sax->resolveEntity;
         sax_tmp.resolveEntity = resolveEntity_chdl_funarg;
      }else
         sax_tmp.resolveEntity = NULL;
      if(sax->getEntity){
         getEntity_chdl_funptr = sax->getEntity;
         sax_tmp.getEntity = getEntity_chdl_funarg;
      }else
         sax_tmp.getEntity = NULL;
      if(sax->entityDecl){
         entityDecl_chdl_funptr = sax->entityDecl;
         sax_tmp.entityDecl = entityDecl_chdl_funarg;
      }else
         sax_tmp.entityDecl = NULL;
      if(sax->notationDecl){
         notationDecl_chdl_funptr = sax->notationDecl;
         sax_tmp.notationDecl = notationDecl_chdl_funarg;
      }else
         sax_tmp.notationDecl = NULL;
      if(sax->attributeDecl){
         attributeDecl_chdl_funptr = sax->attributeDecl;
         sax_tmp.attributeDecl = attributeDecl_chdl_funarg;
      }else
         sax_tmp.attributeDecl = NULL;
      if(sax->elementDecl){
         elementDecl_chdl_funptr = sax->elementDecl;
         sax_tmp.elementDecl = elementDecl_chdl_funarg;
      }else
         sax_tmp.elementDecl = NULL;
      if(sax->unparsedEntityDecl){
         unparsedEntityDecl_chdl_funptr = sax->unparsedEntityDecl;
         sax_tmp.unparsedEntityDecl = unparsedEntityDecl_chdl_funarg;
      }else
         sax_tmp.unparsedEntityDecl = NULL;
      if(sax->setDocumentLocator){
         setDocumentLocator_chdl_funptr = sax->setDocumentLocator;
         sax_tmp.setDocumentLocator = setDocumentLocator_chdl_funarg;

⌨️ 快捷键说明

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