/* --------------------------------------- 初始化参数 --------------------------------------- */ static bool_t qst_crh_init ( __CR_IN__ void_t* parm, __CR_IN__ uint_t argc, __CR_IN__ ansi_t** argv ) { sbin_t sbin; CR_NOUSE(parm); CR_NOUSE(argc); CR_NOUSE(argv); /* 用到的外部函数 */ s_gdi_calls = NULL; sbin = sbin_testA("GFX2_GDI.dll"); if (sbin == NULL) sbin = sbin_loadA("GFX2_GDI.dll"); if (sbin != NULL) s_gdi_calls = sbin_callgetT(sbin, "gdi_call_get", sGDI_CALL); return (TRUE); }
/* --------------------------------------- 设置通讯接收模式 --------------------------------------- */ static bool_t qst_com_rtype ( __CR_IN__ void_t* parm, __CR_IN__ uint_t argc, __CR_IN__ ansi_t** argv ) { static ansi_t* name = NULL; /* 参数解析 <接收模式/插件名称> [函数名称] */ if (argc < 2) return (FALSE); sQstComm* ctx = (sQstComm*)parm; CTextOper* opr = (CTextOper*)ctx->oper; _ENTER_COM_SINGLE_ if (str_cmpA(argv[1], "text") == 0) { ctx->comm.text = TRUE; ctx->comm.render = qst_txt_show; ctx->comm.rtype = "text"; } else if (str_cmpA(argv[1], "html") == 0) { ctx->comm.text = TRUE; ctx->comm.render = qst_htm_show; ctx->comm.rtype = "html"; } else if (str_cmpA(argv[1], "hex") == 0) { ctx->comm.text = FALSE; ctx->comm.render = qst_hex_show; ctx->comm.rtype = "hex"; } else if (str_cmpA(argv[1], "ansi") == 0) { qst_csi_clear(); ctx->comm.text = TRUE; ctx->comm.render = qst_csi_show; ctx->comm.rtype = "ansi"; } else { sbin_t sbin; plugin_render_t func; /* 使用外部插件 */ if (argc < 3) goto _failure; sbin = sbin_loadA(argv[1]); if (sbin == NULL) goto _failure; func = sbin_exportT(sbin, argv[2], plugin_render_t); if (func == NULL) { sbin_unload(sbin); goto _failure; } ctx->comm.text = FALSE; ctx->comm.render = func; TRY_FREE(name); name = str_fmtA("%s|%s", argv[1], argv[2]); ctx->comm.rtype = (name == NULL) ? "null" : name; } opr->clear(); _LEAVE_COM_SINGLE_ qst_update_title(ctx); return (TRUE); _failure: _LEAVE_COM_SINGLE_ return (FALSE); }
/* --------------------------------------- 设置通讯发送模式 --------------------------------------- */ static bool_t qst_com_stype ( __CR_IN__ void_t* parm, __CR_IN__ uint_t argc, __CR_IN__ ansi_t** argv ) { static ansi_t* name = NULL; /* 参数解析 <发送模式/插件名称> [函数名称] */ if (argc < 2) return (FALSE); sQstComm* ctx = (sQstComm*)parm; if (str_cmpA(argv[1], "text") == 0) { ctx->comm.tran = NULL; ctx->comm.stype = "text"; } else if (str_cmpA(argv[1], "hex") == 0) { ctx->comm.tran = qst_hex_tran; ctx->comm.stype = "hex"; } else if (str_cmpA(argv[1], "esc") == 0) { ctx->comm.tran = qst_esc_tran; ctx->comm.stype = "esc"; } else if (str_cmpA(argv[1], "dos") == 0) { ctx->comm.tran = qst_dos_tran; ctx->comm.stype = "dos"; } else if (str_cmpA(argv[1], "unix") == 0) { ctx->comm.tran = qst_unx_tran; ctx->comm.stype = "unix"; } else if (str_cmpA(argv[1], "mac") == 0) { ctx->comm.tran = qst_mac_tran; ctx->comm.stype = "mac"; } else { sbin_t sbin; plugin_tran_t func; /* 使用外部插件 */ if (argc < 3) return (FALSE); sbin = sbin_loadA(argv[1]); if (sbin == NULL) return (FALSE); func = sbin_exportT(sbin, argv[2], plugin_tran_t); if (func == NULL) { sbin_unload(sbin); return (FALSE); } ctx->comm.tran = func; TRY_FREE(name); name = str_fmtA("%s|%s", argv[1], argv[2]); ctx->comm.stype = (name == NULL) ? "null" : name; } qst_update_title(ctx); return (TRUE); }