xmlregisterinputcallbacks_chdl.c

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

C
77
字号
#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 readFunc_chdl_funarg(void * context, char * buffer, int len);
static void *readFunc_chdl_funptr;

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

EXPORTCH int xmlRegisterInputCallbacks_chdl(void *varg) {
    va_list ap;
    xmlInputMatchCallback matchFunc, matchFunc_ch=NULL;
    xmlInputOpenCallback openFunc, openFunc_ch=NULL;
    xmlInputReadCallback readFunc, readFunc_ch=NULL;
    xmlInputCloseCallback closeFunc, closeFunc_ch=NULL;
    int retval;

    Ch_VaStart(interp, ap, varg);
    matchFunc = Ch_VaArg(interp, ap, xmlInputMatchCallback);
    if(matchFunc!=NULL){
        matchFunc_chdl_funptr = (void *)matchFunc;
		matchFunc_ch = (xmlInputMatchCallback)matchFunc_chdl_funarg;
    }
    openFunc = Ch_VaArg(interp, ap, xmlInputOpenCallback);
    if(openFunc!=NULL){
        openFunc_chdl_funptr = (void *)openFunc;
        openFunc_ch = (xmlInputOpenCallback)openFunc_chdl_funarg;
    }
    readFunc = Ch_VaArg(interp, ap, xmlInputReadCallback);
    if(readFunc!=NULL){
        readFunc_chdl_funptr = (void *)readFunc;
        readFunc_ch = (xmlInputReadCallback)readFunc_chdl_funarg;
    }
    closeFunc = Ch_VaArg(interp, ap, xmlInputCloseCallback);
    if(closeFunc!=NULL){
        closeFunc_chdl_funptr = (void *)closeFunc;
        closeFunc_ch = (xmlInputCloseCallback)closeFunc_chdl_funarg;
    }
    retval = xmlRegisterInputCallbacks(matchFunc_ch, openFunc_ch, readFunc_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 readFunc_chdl_funarg(void * context, char * buffer, int len){
    int retval;

    Ch_CallFuncByAddr(interp, readFunc_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 + -
显示快捷键?