⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 baseflow.cpp

📁 一个多线程
💻 CPP
📖 第 1 页 / 共 2 页
字号:
				break;
			case 8:
				{
					for(int i=0;i+iclen<=ialen;i++){
						if(((double*)(p1+i))[0]==((double*)p2)[0]){
							pdwCommandList[3]=i+(int)pdwCommandList[2];
							return LINE_CONTINUE;
						}
					}
				}
				break;
			default:
				{
					for(int i=0;i+iclen<=ialen;i++){
						if(!memcmp(p1+i,p2,iclen)){
							pdwCommandList[3]=i+(int)pdwCommandList[2];
							return LINE_CONTINUE;
						}
					}
				}
				break;
			}
		}
		break;
	case APIBUSCreateBuffer				://0x00f10032 //int & obj,MAXL int maxlen=0xffffff,GOODL int goodl=0x2fff,DELTA int delta=0x2fff
		{
			pdwCommandList[0]=(int)m_pBus->CreateBuffer((int)pdwCommandList[1],(int)pdwCommandList[2],(int)pdwCommandList[3]);
		}
		break;
	case APIBUSDeleteBuffer				://0x00f10033 //int obj
		{
			CDataBuffer * p=(CDataBuffer *)(int)pdwCommandList[0];
			if(p!=p->m_pThis)break;
			m_pBus->DeleteBuffer(p);
		}
		break;
	case APIBUSFindInBuffer					://0x00f10034 //int obj,int len,datablock 0 data,int & pos
		{
			CDataBuffer * p=(CDataBuffer *)(int)pdwCommandList[0];
			if(p!=p->m_pThis)break;
			int len=(int)pdwCommandList[1];
			char * pBuf=NULL;
			switch(pdwCommandList[2].GetType()){
			case DATA_TYPE_STRING:
			case DATA_TYPE_HANDLE:
				{
					if(len>pdwCommandList[2].GetDataLength()){
						len=pdwCommandList[2].GetDataLength();
					}
					pBuf=pdwCommandList[2].uv.cv;
					pdwCommandList[3]=p->FindData(pBuf,len);
				}
				break;
			case DATA_TYPE_FLOAT:
				if(len==4){
					float a=(float)pdwCommandList[2];
					pBuf=(char *)&a;
					pdwCommandList[3]=p->FindData(pBuf,len);
				}
				else{
					len=8;
					pBuf=(char *)&pdwCommandList[2].uv;
					pdwCommandList[3]=p->FindData(pBuf,len);
				}
				break;
			case DATA_TYPE_INT:
			case DATA_TYPE_DWORD:
			default:
				if(len==1){
					char c=(char)pdwCommandList[2];
					pBuf=(char *)&c;
					pdwCommandList[3]=p->FindData(pBuf,len);
				}
				else if(len==2){
					short c=(short)pdwCommandList[2];
					pBuf=(char *)&c;
					pdwCommandList[3]=p->FindData(pBuf,len);
				}
				else {
					len=4;
					pBuf=(char *)&pdwCommandList[2].uv;
					pdwCommandList[3]=p->FindData(pBuf,len);
				}
				break;
			}
		}
		break;
	case APIBUSGetFromData				://0x00f10035 //int obj,int & len,datablock 0 & data	
		{
			CDataBuffer * p=(CDataBuffer *)(int)pdwCommandList[0];
			if(p!=p->m_pThis)break;
			int len=(int)pdwCommandList[1];
			char * pBuf=NULL;
			switch(pdwCommandList[2].GetType()){
			case DATA_TYPE_STRING:
			case DATA_TYPE_HANDLE:
				{
					pdwCommandList[2].SetValue((void *)NULL,len);
					pBuf=pdwCommandList[2].uv.cv;
					pdwCommandList[1]=p->GetData(pBuf,len);
				}
				break;
			case DATA_TYPE_FLOAT:
				if(len==4){
					float a=(float)pdwCommandList[2];
					pBuf=(char *)&a;
					pdwCommandList[1]=p->GetData(pBuf,len);
					pdwCommandList[2]=(double)a;
				}
				else{
					len=8;
					pBuf=(char *)&pdwCommandList[2].uv;
					pdwCommandList[1]=p->GetData(pBuf,len);
				}
				break;
			case DATA_TYPE_INT:
			case DATA_TYPE_DWORD:
			default:
				if(len==1){
					char c=(char)pdwCommandList[2];
					pBuf=(char *)&c;
					pdwCommandList[1]=p->GetData(pBuf,len);
					pdwCommandList[2]=(int)c;
				}
				else if(len==2){
					short c=(short)pdwCommandList[2];
					pBuf=(char *)&c;
					pdwCommandList[1]=p->GetData(pBuf,len);
					pdwCommandList[2]=(int)c;
				}
				else {
					len=4;
					pBuf=(char *)&pdwCommandList[2].uv;
					pdwCommandList[1]=p->GetData(pBuf,len);
				}
				break;
			}
		}
		break;
	case APIBUSPutToData				://0x00f10036 //int obj,int len,datablock 0 data	
		{
			CDataBuffer * p=(CDataBuffer *)(int)pdwCommandList[0];
			if(p!=p->m_pThis)break;
			int len=(int)pdwCommandList[1];
			char * pBuf=NULL;
			switch(pdwCommandList[2].GetType()){
			case DATA_TYPE_STRING:
			case DATA_TYPE_HANDLE:
				{
					if(len>pdwCommandList[2].GetDataLength()){
						len=pdwCommandList[2].GetDataLength();
					}
					pBuf=pdwCommandList[2].uv.cv;
					p->PutData(pBuf,len);
				}
				break;
			case DATA_TYPE_FLOAT:
				if(len==4){
					float a=(float)pdwCommandList[2];
					pBuf=(char *)&a;
					p->PutData(pBuf,len);
				}
				else{
					len=8;
					pBuf=(char *)&pdwCommandList[2].uv;
					p->PutData(pBuf,len);
				}
				break;
			case DATA_TYPE_INT:
			case DATA_TYPE_DWORD:
			default:
				if(len==1){
					char c=(char)pdwCommandList[2];
					pBuf=(char *)&c;
					p->PutData(pBuf,len);
				}
				else if(len==2){
					short c=(short)pdwCommandList[2];
					pBuf=(char *)&c;
					p->PutData(pBuf,len);
				}
				else {
					len=4;
					pBuf=(char *)&pdwCommandList[2].uv;
					p->PutData(pBuf,len);
				}
				break;
			}
		}
		break;
	case APIBUSRemoveData				://0x00f10037 //int obj,int len
		{
			((CDataBuffer *)(int)pdwCommandList[0])->MovePointer((int)pdwCommandList[0]);
		}
		break;
	case APIBUSTxtToFax					://0x00f10039 //int iret,string TxtFileName, string FaxFileName,datablock 0 Style
		pdwCommandList[0]=::TxtToFax((LPCTSTR)pdwCommandList[1].uv.cv,(LPCTSTR)pdwCommandList[2].uv.cv,pdwCommandList[3].uv.iv);
		break;
	case APIBUSBMPToFax					://0x00f10038 //int iret,string BmpFileName, string FaxFileName,LEFTM int leftm=12
		pdwCommandList[0]=::BMPToFax((LPCTSTR)pdwCommandList[1].uv.cv,(LPCTSTR)pdwCommandList[2].uv.cv,pdwCommandList[3].uv.iv);
		break;
	case APIBUSFaxToBMP					://0x00f1003a //int iret,string FaxFileName, string BMPFileName
		pdwCommandList[0]=::FaxToBMP((LPCTSTR)pdwCommandList[1].uv.cv,(LPCTSTR)pdwCommandList[2].uv.cv);
		break;
	case APIBUSSetFaxStyle				://0x00f1003b //datablock 0 & sty,FNAME string fname='宋体',SIZE int size=9,ITALIC int italic=0,UNDERL int iund=0,BOLD int bold=1,CHARSET int cset=0,LEFTM int leftm=12,RIGHTM int rightm=0,ROWSP int rowsp=2
		{
			STYLEINFO si;
			strcpy(si.szFontName,pdwCommandList[1].uv.cv);
			si.FontSize=pdwCommandList[2].uv.iv;
			si.bItalic=pdwCommandList[3].uv.iv;
			si.bUnderline=pdwCommandList[4].uv.iv;
			si.bBold=pdwCommandList[5].uv.iv;
			si.CharSet=pdwCommandList[6].uv.iv;
			si.nLeftMargin=pdwCommandList[7].uv.iv;
			si.nRightMargin=pdwCommandList[8].uv.iv;
			si.nRowSpace=pdwCommandList[9].uv.iv;
			pdwCommandList[0].SetValue((void *)&si,sizeof(si));
		}
		break;
	case APIBUSSetValueData				://0x00f1003d //string & s1,string s2,int mode
		GetValueData(pdwCommandList[0],pdwCommandList[1]);
		break;
	case APIBUSSetTimeData				://0x00f1003e //string & s1,string s2,int mode
		{
			char * p1=new char [20];
			memset(p1,0,20);
			int ih,im,is;
			CString cs1="",cs2="",cs3="";
			if(pdwCommandList[1].IsEmpty()){
				CTime tm(GetTimeStamp());
				ih=tm.GetHour();
				im=tm.GetMinute();
				is=tm.GetSecond();
			}
			else {
				char * p=(char *)pdwCommandList[1];
				if(strlen(p)==8){
					p1[0]=p[0];
					p1[1]=p[1];
					p1[2]='\0';
					ih=atoi(p1);
					p1[3]=p[3];
					p1[4]=p[4];
					p1[5]='\0';
					im=atoi(p1+3);
					p1[6]=p[6];
					p1[7]=p[7];
					p1[8]='\0';
					is=atoi(p1+6);
				}
				else {
					int ihms=atoi(p);
					ih=ihms/10000;
					im=(ihms%10000)/100;
					is=ihms%100;
				}
			}
			UniVar uvTemp;
			GetValueData(uvTemp,ih);
			cs1=(char *)uvTemp;
			cs1+='.';
			GetValueData(uvTemp,im);
			cs2=(char *)uvTemp;
			cs2+='F';
			if(is){
				GetValueData(uvTemp,is);
				cs3=(char *)uvTemp;
				cs3+='C';
				sprintf(p1,"%s%s%s",cs1,cs2,cs3);
			}
			else{
				sprintf(p1,"%s%s",cs1,cs2);
			}
			pdwCommandList[0]=p1;
			delete [] p1;
		}
		break;
	case APIBUSSGetDateData				://0x00f1003f //string & s1,string s2,int mode
		{
			char * p1=new char [25];
			memset(p1,0,25);
			int iy,id;
			CString cs1="",cs2="",cs3="";

			if(pdwCommandList[1].IsEmpty()){
				CTime tm(GetTimeStamp());
				cs1.Format("%04ldN",tm.GetYear());
				iy=tm.GetMonth();
				id=tm.GetDay();
			}
			else {
				char * p=(char *)pdwCommandList[1];
				if(strlen(p)==10){
					p1[0]=p[0];
					p1[1]=p[1];
					p1[2]=p[2];
					p1[3]=p[3];
					p1[4]='\0';
					int in=atoi(p1);
					in=in%10000;
					cs1.Format("%04ldN",in);
					p1[5]=p[5];
					p1[6]=p[6];
					p1[7]='\0';
					iy=atoi(p1+5);
					p1[8]=p[8];
					p1[9]=p[9];
					p1[10]='\0';
					id=atoi(p1+8);
				}
				else {
					int inyr=atoi(p);
					int in=inyr/10000;
					in=in%10000;
					cs1.Format("%04ldN",in);
					iy=(inyr%10000)/100;
					id=inyr%100;
				}
			}
			UniVar uvTemp;
			GetValueData(uvTemp,iy);
			cs2=(char *)uvTemp;
			cs2+='M';
			GetValueData(uvTemp,id);
			cs3=(char *)uvTemp;
			cs3+='D';
			sprintf(p1,"%s%s%s",cs1,cs2,cs3);

			pdwCommandList[0]=p1;
			delete [] p1;
		}
		break;
	case APIBUSSetWeekData				://0x00f10040 //string & s1,string s2,int mode
		{
			pdwCommandList[1].ToI();
			char tt[3];
			tt[0]='E';
			if(!pdwCommandList[1].IsEmpty())
				tt[1]=((char *)pdwCommandList[1])[0];
			else 
				tt[1]='0';
			tt[2]=0;
			if(tt[1]=='0')tt[1]='D';
			pdwCommandList[0]=tt;
		}
		break;
	default:
		return CUserControl::DefaultParse(dwCommand,pdwCommandList,iNum);
	}
	return LINE_CONTINUE;
}

void CBaseFlow::GetValueData(UniVar & uvVa,UniVar Str)
{
	uvVa="";
	Str.ToA();
	if(Str.IsEmpty())return ;
	char * p=(char *)Str;
	CString csT;
	if(p[0]=='.'){
		csT="0";
		csT=csT+(char *)Str;
		p=(LPSTR)(LPCTSTR)csT;
	}
	int bNag=0;
	if(p[0]=='-'){
		if(p[1]=='.'){
			csT=p+1;
			csT="-0"+csT;
			p=(LPSTR)(LPCTSTR)csT;
		}
		bNag=1;
	}
	char * p1=new char[strlen(p)*2+2];
	memset(p1,0,strlen(p)*2+2);
	char * p5=p1;
	if(bNag){
		p++;
		p1++;
		p5[0]='-';
	};
	int point=strlen(p)-1;
	for(int i=0;p[i];i++){
		if(p[i]=='.'){
			point=i-1;
			break;
		}
		else if(p[i]=='*'){
			p[i]='0';
		}
	}
	int j;
 	char * p2="THKWTHKBTHKWTHKBTHKWTHKBTHKWTHKBTHKWTHKBTHKWTHKBTHKWTHKBTHKWTHKBTHKWTHKBTHKWTHKBTHKWTHKBTHKWTHKBTHKWTHKBTHKWTHKBTHKWTHKBTHKWTHKB";
	if(point>(INT)(strlen(p2)+1))return ;
	char * p3=new char[point];
	for(i=0;i<point;i++){
		p3[i]=p2[point-i-1];
	}
	int ez=-1;
	int ifz=0;
	int zero=0;
	int TWflag=0;
	int TBflag=0;
	int ih0=0;
	for(i=0,j=0;p[i];i++){
		if(i<point){
			if(p[i]=='0'){
				ih0=1;
				if(!ifz)continue;
				if(!zero){
					if(TWflag&&p3[i]=='W'){
						p1[j]=p3[i];
						TWflag=0;
						zero=0;
						j++;
					}
					if(TBflag&&p3[i]=='B'){
						p1[j]=p3[i];
						TWflag=0;
						TBflag=0;
						zero=0;
						j++;
					}
					else {
						zero=1;
						p1[j]=p[i];
						j++;
					}
				}
				else {
					if(TWflag&&(p3[i]=='W')){
						TWflag=0;
						j--;
						p1[j]=p3[i];
						j++;
						zero=0;
					}
					if(TBflag&&p3[i]=='B'){
						j--;
						p1[j]=p3[i];
						TBflag=0;
						TWflag=0;
						j++;
						zero=0;
					}
				}
			}
			else {
				ifz=1;
				TWflag=1;
				TBflag=1;
				zero=0;
				p1[j]=p[i];
				j++;
				p1[j]=p3[i];
				j++;
			}
		}//13603069622
		else if(i==point){
			if(i==0){
				p1[j]=p[i];
				j++;
			}
			else{
				if(p[i]=='0'){
					ih0=1;
					if(zero){
						j--;
						p1[j]=0;
					}
				}
				else{
					p1[j]=p[i];
					j++;
				}
			}
		}
		else {
			ih0=1;
			p1[j]=p[i];
			j++;
			if(p1[j-1]!='0')ez=j;
			else if(p1[j-1]=='.')ez=j-1;
		}
	}
	if(ez!=-1)p1[ez]=0;
	if (p1[strlen(p1)-1]=='.') p1[strlen(p1)-1]=0;
	if(ih0&&p1[0]=='\0'){
		p1[0]='0';
		p1[1]=0;
		uvVa=p5;
	}
	else{
		int iii=strlen(p5);
		if(p5[0]=='.'){
			CString cs=p5;
			cs="0"+cs;
			uvVa=UniVar(cs);
		}
		else if(iii>1&&p5[0]=='-'&&p5[1]=='.'){
			CString cs=p5;
			cs=cs.Right(cs.GetLength()-1);
			cs="-0"+cs;
			uvVa=UniVar(cs);
		}
		else if(iii>1&&p5[0]=='1'&&p5[1]=='T'){
			CString cs=p5;
			cs=cs.Right(cs.GetLength()-1);
			uvVa=UniVar(cs);
		}
		else if(iii>2&&p5[0]=='-'&&p5[1]=='1'&&p5[2]=='T'){
			CString cs=p5;
			cs=cs.Right(cs.GetLength()-2);
			cs="-"+cs;
			uvVa=UniVar(cs);
		}
		else{
			uvVa=p5;
		}
	}
	delete [] p3;
	delete [] p5;
}

⌨️ 快捷键说明

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