xmlregisteroutputcallbacks_chdl.c

来自「图片显示,电脑光于望技术湖连望键往,网络」· C语言 代码 · 共 79 行

C
79
字号
#include <libxml/xmlIO.h>
#include <ch.h>

static ChInterp_t interp;
static int matchFunc_chdl_funarg(char const *filename);
static void *matchFunc_chdl_funptr;

static void * openFunc_chdl_funarg(char const *filename);
static void *openFunc_chdl_funptr;

static int writeFunc_chdl_funarg(void * context, char * buffer, int len);
static void *writeFunc_chdl_funptr;

static int closeFunc_chdl_funarg(void * context);
static void *closeFunc_chdl_funptr;

EXPORTCH int xmlRegisterOutputCallbacks_chdl(void *varg) {
    va_list ap;
    xmlOutputMatchCallback matchFunc, matchFunc_ch=NULL;
    xmlOutputOpenCallback openFunc, openFunc_ch=NULL;
    xmlOutputWriteCallback writeFunc, writeFunc_ch=NULL;
    xmlOutputCloseCallback closeFunc, closeFunc_ch=NULL;
    int retval;

    Ch_VaStart(interp, ap, varg);
    matchFunc = Ch_VaArg(interp, ap, xmlOutputMatchCallback);
    if(matchFunc){
        matchFunc_chdl_funptr = matchFunc;
        matchFunc_ch = matchFunc_chdl_funarg;
    }
    openFunc = Ch_VaArg(interp, ap, xmlOutputOpenCallback);
    if(openFunc){
        openFunc_chdl_funptr = openFunc;
        openFunc_ch = openFunc_chdl_funarg;
    }
    writeFunc = Ch_VaArg(interp, ap, xmlOutputWriteCallback);
    if(writeFunc){
        writeFunc_chdl_funptr = writeFunc;
        writeFunc_ch = writeFunc_chdl_funarg;
    }
    closeFunc = Ch_VaArg(interp, ap, xmlOutputCloseCallback);
    if(closeFunc){
        closeFunc_chdl_funptr = closeFunc;
        closeFunc_ch = closeFunc_chdl_funarg;
    }
    retval = xmlRegisterOutputCallbacks(matchFunc_ch, openFunc_ch, writeFunc_ch, closeFunc_ch);
    Ch_VaEnd(interp, ap);
    return retval;
}
static int matchFunc_chdl_funarg(char const *filename){
    int retval;

    Ch_CallFuncByAddr(interp, matchFunc_chdl_funptr, &retval, filename);
    return retval;

}

static void * openFunc_chdl_funarg(char const *filename){
    void * retval;

    Ch_CallFuncByAddr(interp, openFunc_chdl_funptr, &retval, filename);
    return retval;
}

static int writeFunc_chdl_funarg(void * context, char * buffer, int len){
    int retval;

    Ch_CallFuncByAddr(interp, writeFunc_chdl_funptr, &retval, context, buffer, len);
    return retval;
}

static int closeFunc_chdl_funarg(void * context){
    int retval;

    Ch_CallFuncByAddr(interp, closeFunc_chdl_funptr, &retval, context);
    return retval;
}

⌨️ 快捷键说明

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