Instruction_t QBeaEngine::DecodeDataAt(byte_t* data, duint size, duint origBase, duint origInstRVA, ENCODETYPE type) { //tokenize CapstoneTokenizer::InstructionToken cap; auto & infoIter = dataInstMap.find(type); if(infoIter == dataInstMap.end()) infoIter = dataInstMap.find(enc_byte); int len = mEncodeMap->getDataSize(origBase + origInstRVA, 1); QString mnemonic = _bLongDataInst ? infoIter.value().longName : infoIter.value().shortName; len = std::min(len, (int)size); QString datastr = GetDataTypeString(data, len, type); _tokenizer.TokenizeData(mnemonic, datastr, cap); Instruction_t wInst; wInst.instStr = mnemonic + " " + datastr; wInst.dump = QByteArray((const char*)data, len); wInst.rva = origInstRVA; wInst.length = len; wInst.branchType = Instruction_t::None; wInst.branchDestination = 0; wInst.tokens = cap; return wInst; }
void CBllHelp::QueryByCondit(_RecordsetPtr pRecordSet,vector<string> &vecField, vector<string> &vecRecordSet, long &lFieldCounts) { //判断存在记录 if(pRecordSet == NULL) return ; if (!vecRecordSet.empty()) { vecRecordSet.clear(); } if (!vecField.empty()) { vecField.clear(); } try { //字段个数 lFieldCounts = pRecordSet->GetFields()->GetCount(); adoDataTypeEnum enumDataType; _bstr_t str; //字段名称、类型、大小 for(long i = 0; i<lFieldCounts; i++) { str= pRecordSet->GetFields()->GetItem(i)->GetName(); vecField.push_back((LPSTR)str); enumDataType = pRecordSet->GetFields()->GetItem(i)->GetType(); str = GetDataTypeString(enumDataType); vecField.push_back((LPSTR)str); str = pRecordSet->GetFields()->GetItem(i)->GetDefinedSize(); vecField.push_back((LPSTR)str); } pRecordSet->MoveFirst(); long lCounts = 0; _variant_t var; //获取记录 while(!pRecordSet->adoEOF) { for(long j=0; j<lFieldCounts; j++) { var=pRecordSet->GetCollect(j); str=(_bstr_t)(var.vt==1?"":var); vecRecordSet.push_back((LPSTR)str); } pRecordSet->MoveNext(); lCounts++; } } catch(_com_error e) { //AfxMessageBox("记录为空"); } }
// ################################################################# // ヘッダーデータファイルの出力 bool cio_DFI_AVS::write_avs_header() { FILE* fp=NULL; std::string dType; std::string out_fname; bool mio=false; //データタイプのセット if( GetDataType() == CIO::E_CIO_INT8 ) { dType = "byte"; } else if( GetDataType() == CIO::E_CIO_INT16 ) { dType = "short"; } else if( GetDataType() == CIO::E_CIO_INT32 ) { dType = "integer"; } else if( GetDataType() == CIO::E_CIO_FLOAT32 ) { dType = "float"; } else if( GetDataType() == CIO::E_CIO_FLOAT64 ) { dType = "double"; } else { dType = GetDataTypeString(); printf("\tillergal data type.(%s)\n",dType.c_str()); return false; } //ファイル名生成 if( DFI_MPI.NumberOfRank > 1 ) mio = true; std::string fname,tmp; tmp = Generate_FileName(DFI_Finfo.Prefix,m_RankID,-1,"fld",m_output_fname,mio, DFI_Finfo.TimeSliceDirFlag); if( CIO::cioPath_isAbsolute(DFI_Finfo.DirectoryPath) ){ fname = DFI_Finfo.DirectoryPath +"/"+ tmp; } else { fname = m_directoryPath + "/" + DFI_Finfo.DirectoryPath +"/"+ tmp; } //printf("fld file name : %s\n",fname.c_str()); //出力ヘッダーファイルオープン if( (fp = fopen(fname.c_str(),"w")) == NULL ) { printf("\tCan't open file.(%s)\n",fname.c_str()); return false; } int ndim = 3; int nspace = 3; //dims = DFI_Process.RankList[m_RankID].VoxelSize[0] //先頭レコードの出力 fprintf(fp,"# AVS field file\n"); //計算空間の次元数を出力 fprintf(fp,"ndim=%d\n",ndim); //計算空間サイズを出力 fprintf(fp,"dim1=%d\n",DFI_Process.RankList[m_RankID].VoxelSize[0]+1); fprintf(fp,"dim2=%d\n",DFI_Process.RankList[m_RankID].VoxelSize[1]+1); fprintf(fp,"dim3=%d\n",DFI_Process.RankList[m_RankID].VoxelSize[2]+1); //物理空間の次元数を出力 fprintf(fp,"nspace=%d\n",nspace); //成分数の出力 fprintf(fp,"veclen=%d\n",DFI_Finfo.Component); //データのタイプ出力 fprintf(fp,"data=%s\n",dType.c_str()); //座標定義情報の出力 fprintf(fp,"field=uniform\n"); //labelの出力 for(int i=0; i<DFI_Finfo.Component; i++) { std::string label=getComponentVariable(i); if( label == "" ) continue; fprintf(fp,"label=%s\n",label.c_str()); } //step毎の出力 if( DFI_TimeSlice.SliceList.size()>1 ) { fprintf(fp,"nstep=%d\n",(int)DFI_TimeSlice.SliceList.size()); } for(int i=0; i<DFI_TimeSlice.SliceList.size(); i++) { fprintf(fp,"time value=%.6f\n",DFI_TimeSlice.SliceList[i].time); //field data file name 出力 for(int j=1; j<=DFI_Finfo.Component; j++) { int skip; if( dType == "float" ) { skip=96+(j-1)*4; } else { skip=140+(j-1)*8; } out_fname=Generate_FileName(DFI_Finfo.Prefix, m_RankID, DFI_TimeSlice.SliceList[i].step, "sph", m_output_fname, mio, DFI_Finfo.TimeSliceDirFlag); //std::string xxx = CIO::cioPath_FileName(out_fname,"sph"); fprintf(fp,"variable %d file=%s filetype=binary skip=%d stride=%d\n", j,out_fname.c_str(),skip,DFI_Finfo.Component); } //coord data file name 出力 tmp = Generate_FileName("cord",m_RankID,-1,"cod",m_output_fname,mio, DFI_Finfo.TimeSliceDirFlag); fprintf(fp,"coord 1 file=%s filetype=ascii skip=1\n",tmp.c_str()); fprintf(fp,"coord 2 file=%s filetype=ascii skip=4\n",tmp.c_str()); fprintf(fp,"coord 3 file=%s filetype=ascii skip=7\n",tmp.c_str()); fprintf(fp,"EOT\n"); } //出力ヘッダーファイルクローズ fclose(fp); //if( tmp ) delete tmp; return true; }