经过采集器的嵌入式测试后,将zengl v1.2.2转为可以用于实际开发的发布版,采集器的源代码已经发布在网盘中,下载地址:http://pan.baidu.com/share/link?shareid=30200810&uk=940392313 (此...
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) : wxFrame(NULL, -1, title, pos, size) { ................................ //省略N行代码 logfp = NULL; zengl_debuglogfile = fopen("zengl_debuglogs.txt","w+"); m_dlgFind = NULL; ZL_EXP_VOID * VM = zenglApi_Open(); zenglApi_SetFlags(VM,(ZENGL_EXPORT_VM_MAIN_ARG_FLAGS)(ZL_EXP_CP_AF_IN_DEBUG_MODE)); zenglApi_SetModFunHandle(VM,0,"bltSetInitManageUrl",global_bltSetInitManageUrl); zenglApi_SetModFunHandle(VM,0,"bltSetModulePath",global_bltSetModulePath); if(zenglApi_Run(VM,"初始化脚本.zl") == -1) wxMessageBox(wxString::Format("'初始化脚本.zl'执行失败:%s",zenglApi_GetErrorString(VM)),"警告"); zenglApi_Close(VM); } |
void *MyThread2::Entry() { ............................ //省略N行代码 CUR_CAIJI_VM = zenglApi_Open(); //zenglApi_SetFlags(CUR_CAIJI_VM,(ZENGL_EXPORT_VM_MAIN_ARG_FLAGS)(ZL_EXP_CP_AF_IN_DEBUG_MODE | ZL_EXP_CP_AF_OUTPUT_DEBUG_INFO)); zenglApi_SetFlags(CUR_CAIJI_VM,(ZENGL_EXPORT_VM_MAIN_ARG_FLAGS)(ZL_EXP_CP_AF_IN_DEBUG_MODE)); zenglApi_SetHandle(CUR_CAIJI_VM,ZL_EXP_VFLAG_HANDLE_COMPILE_INFO,global_userdef_compile_info_forZenglRunV2); zenglApi_SetHandle(CUR_CAIJI_VM,ZL_EXP_VFLAG_HANDLE_RUN_INFO,global_userdef_run_info_forZenglRunV2); zenglApi_SetHandle(CUR_CAIJI_VM,ZL_EXP_VFLAG_HANDLE_RUN_PRINT,global_userdef_run_print_forZenglRunV2); ............................ //省略N行代码 zenglApi_SetModInitHandle(CUR_CAIJI_VM,"builtin",global_builtin_module_init); if(zenglApi_Run(CUR_CAIJI_VM,(char *)ModFilePath.c_str().AsChar()) == -1) //编译执行zengl脚本 { wxMyLogEvent eventforlog( wxEVT_MY_LOG_EVENT,wxID_ANY,wxString::Format("\n编译运行"+ModFilePath+"时发生异常:%s\n",zenglApi_GetErrorString(CUR_CAIJI_VM)), MY_RICHTEXT_RED_STYLE); wxQueueEvent(glmainFrame->GetEventHandler(),eventforlog.Clone()); zenglApi_Close(CUR_CAIJI_VM); CUR_CAIJI_VM = ZL_EXP_NULL; return NULL; } zenglApi_Reset(CUR_CAIJI_VM); ............................ //省略N行代码 if(CUR_CAIJI_VM != ZL_EXP_NULL) { zenglApi_Close(CUR_CAIJI_VM); CUR_CAIJI_VM =ZL_EXP_NULL; } |
void MyKeyDialog::OnJumpToCaijiUrl(wxCommandEvent& event) { ............................ //省略N行代码 ZL_EXP_VOID * VM = zenglApi_Open(); //zenglApi_SetFlags(VM,(ZENGL_EXPORT_VM_MAIN_ARG_FLAGS)(ZL_EXP_CP_AF_IN_DEBUG_MODE | ZL_EXP_CP_AF_OUTPUT_DEBUG_INFO)); zenglApi_SetFlags(VM,(ZENGL_EXPORT_VM_MAIN_ARG_FLAGS)(ZL_EXP_CP_AF_IN_DEBUG_MODE)); zenglApi_SetHandle(VM,ZL_EXP_VFLAG_HANDLE_COMPILE_INFO,global_userdef_compile_info_forZenglRunV2); zenglApi_SetHandle(VM,ZL_EXP_VFLAG_HANDLE_RUN_INFO,global_userdef_run_info_forZenglRunV2); zenglApi_SetHandle(VM,ZL_EXP_VFLAG_HANDLE_RUN_PRINT,global_userdef_run_print_forZenglRunV2); global_JumpToCaiji_InitFuncall(VM); zenglApi_SetExtraData(VM,"catid",(void *)m_catid.c_str().AsChar()); zenglApi_SetExtraData(VM,"modid",(void *)m_modid.c_str().AsChar()); wxString selectedKey = m_listbox->GetString(selectItem); zenglApi_SetExtraData(VM,"selectedKey",(void *)selectedKey.c_str().AsChar()); zenglApi_SetExtraData(VM,"moduleName",(void *)global_MyModules[m_modid].c_str().AsChar()); MyUserExtraData extraData; zenglApi_SetExtraData(VM,"extraData",(void *)(&extraData)); if(zenglApi_Run(VM,"Module/采集跳转规则.zl") == -1) //编译执行zengl脚本 { wxMessageBox(wxString::Format("\n编译运行'Module/采集跳转规则.zl'时发生异常:%s\n",zenglApi_GetErrorString(VM)),"警告"); zenglApi_Close(VM); return ; } zenglApi_Close(VM); } |
/*bltLoadScript模块函数,新建一个虚拟机,加载并执行某个脚本*/ ZL_EXP_VOID global_bltLoadScript(ZL_EXP_VOID * VM_ARG,ZL_EXP_INT argcount) { ZENGL_EXPORT_MOD_FUN_ARG arg = {ZL_EXP_FAT_NONE,{0}}; ZL_EXP_CHAR * scriptName = ZL_EXP_NULL; zenglApi_GetFunArg(VM_ARG,1,&arg); //获取第一个参数为脚本名 if(arg.type != ZL_EXP_FAT_STR) zenglApi_Exit(VM_ARG,"bltLoadScript函数第一个参数必须字符串,代表要加载的脚本文件名"); scriptName = arg.val.str; ZENGL_EXPORT_VM_MAIN_ARGS vm_main_args = {global_userdef_compile_info_forZenglRunV2 , global_userdef_compile_error_forZenglRunV2, global_userdef_run_info_forZenglRunV2, global_userdef_run_print_forZenglRunV2, global_userdef_run_error_forZenglRunV2, global_module_init, ZL_EXP_CP_AF_IN_DEBUG_MODE | ZL_EXP_CP_AF_OUTPUT_DEBUG_INFO}; zenglApi_Load(scriptName,&vm_main_args); zenglApi_SetRetVal(VM_ARG,ZL_EXP_FAT_INT,ZL_EXP_NULL,1,0); } |
.................... //省略N行代码 if(clsArt.ChkContLinkExist()) continue; endif .................... //省略N行代码 class clsArt /*检查内容链接地址是否存在*/ fun ChkContLinkExist() .................... //省略N行代码 endfun .................... //省略N行代码 fun AddToDb_WhenErr(errorStr = '',extraInfo = '') .................... //省略N行代码 endfun .................... //省略N行代码 endclass //class clsArt |