scp-decode.cpp

来自「c++编写的用于生物信号处理的软件库」· C++ 代码 · 共 2,178 行 · 第 1/5 页

CPP
2,178
字号
			case 1:				section_1_1(inf.ana); break;			case 2:				section_1_2(inf.ana); break;			case 3:				section_1_3(inf.ana); break;			case 4:				section_1_4(inf.ana); break;			case 5:				section_1_5(inf.ana); break;			case 6:				section_1_6(inf.ana); break;			case 7:				section_1_7(inf.ana); break;			case 8:				section_1_8(inf.ana); break;			case 9:				section_1_9(inf.ana); break;			case 10:				if(!inf.cli.number_drug)				{					inf.cli.drug=NULL;					inf.cli.text_drug=NULL;					dim=0;				}				section_1_10(inf.cli,dim); break;			case 11:				section_1_11(inf.ana); break;			case 12:				section_1_12(inf.ana); break;			case 13:				if(!inf.cli.number_diagnose)				{					inf.cli.diagnose=NULL;					inf.cli.text_diagnose=NULL;					dim=0;				}				section_1_13(inf.cli,dim); break;			case 14:				section_1_14(inf.des); break;			case 15:				section_1_15(inf.des); break;			case 16:				section_1_16(inf.des); break;			case 17:				section_1_17(inf.des); break;			case 18:				section_1_18(inf.des); break;			case 19:				section_1_19(inf.des); break;			case 20:				section_1_20(inf.cli); break;			case 21:				section_1_21(inf.cli); break;			case 22:				section_1_22(inf.cli); break;			case 23:				section_1_23(inf.des); break;			case 24:				section_1_24(inf.des); break;			case 25:				section_1_25(inf.dev); break;			case 26:				section_1_26(inf.dev); break;			case 27:				section_1_27(inf.dev); break;			case 28:				section_1_28(inf.dev); break;			case 29:				section_1_29(inf.dev); break;			case 30:				if(!inf.cli.number_text)				{					inf.cli.free_text=NULL;					inf.cli.text_free_text=NULL;					dim=0;				}				section_1_30(inf.cli,dim); break;			case 31:				section_1_31(inf.dev); break;			case 32:				if(!inf.cli.number_hystory)				{					inf.cli.medical_hystory=NULL;					dim=0;				}				section_1_32(inf.cli,dim,inf.des.acquiring.protocol_revision_number); break;			case 33:				section_1_33(inf.dev); break;			case 34:				section_1_34(inf.dev); break;			case 35:				if(!inf.cli.number_free_hystory)				{					inf.cli.free_medical_hystory=NULL;					inf.cli.text_free_medical_hystory=NULL;					dim=0;				}				section_1_35(inf.cli,dim); break;			case 255:				section_1_255(); break;			default:				section_1_();				break;		}//end switch	}//end do	while((tag!=255) && (_COUNT_BYTE<num));	if ((inf.des.analyzing.protocol_revision_number==0) && (version>0))		inf.des.analyzing.protocol_revision_number=version;  // by E.C. may 2004 CARDIOLINE 1.0}//end section_1void section_1_0(demographic &ana)// section 1 tag 0{	U_int_M dim;	ReadByte(dim);	ana.last_name=ReadString(ana.last_name=NULL,dim);}//end section_1_0void section_1_1(demographic &ana)// section 1 tag 1{	U_int_M dim;	ReadByte(dim);	ana.first_name=ReadString(ana.first_name=NULL,dim);}//end section_1_1void section_1_2(demographic &ana)//section 1 tag 2{	U_int_M dim;	ReadByte(dim);	ana.ID=ReadString(ana.ID=NULL,dim);}//end section_1_2void section_1_3(demographic &ana)// section 1 tag 3{	U_int_M dim;	ReadByte(dim);	ana.second_last_name=ReadString(ana.second_last_name=NULL,dim);}//end section_1_3void section_1_4(demographic &ana)// section 1 tag 4{	U_int_M dim;	ReadByte(dim);	ReadByte(ana.age.value);	ReadByte(ana.age.unit);	if(ana.age.unit>5)		ana.age.unit=0;}//end section_1_4void section_1_5(demographic &ana)// section 1 tag 5{	U_int_M dim;	char data[18], temp[18];	U_int_S m, g, num;	U_int_M a;	ReadByte(dim);	ReadByte(a);	ReadByte(m);	ReadByte(g);	sprintf(data,"%u%s%u",g,_month[m].sentence,a);	num=strlen(data);	if(num!=0 && (ana.date_birth=(char*)mymalloc(num+1))==NULL)	{		fprintf(stderr,"Not enough memory");  // no, exit //		exit(2);	}	strcpy(ana.date_birth,data);        struct tm tmf;                      // by E.C. feb 2006        tmf.tm_year = a - 1900;        tmf.tm_mon  = m - 1;        tmf.tm_mday = g;        tmf.tm_hour = 0;        tmf.tm_min  = 0;        tmf.tm_sec  = 0;        tmf.tm_isdst = 0;        ana.date_birth2 = mktime(&tmf);    // store date in native format}//end section_1_5void section_1_6(demographic &ana)// section 1 tag 6{	U_int_M dim;	ReadByte(dim);	ReadByte(ana.height.value);	ReadByte(ana.height.unit);	if(ana.height.unit>3)		ana.height.unit=0;}//end section_1_6void section_1_7(demographic &ana)// section 1 tag 7{	U_int_M dim;	ReadByte(dim);	ReadByte(ana.weight.value);	ReadByte(ana.weight.unit);	if(ana.weight.unit>4)		ana.weight.unit=0;}//end section_1_7void section_1_8(demographic &ana)// section 1 tag 8{	U_int_M dim;	ReadByte(dim);	ReadByte(ana.sex);	if(ana.sex>2)		ana.sex=3;}//end section_1_8void section_1_9(demographic &ana)// section 1 tag 9{	U_int_M dim;	ReadByte(dim);	ReadByte(ana.race);	if(ana.race>3)		ana.race=0;}//end section_1_9void section_1_10(clinic &cli, U_int_M &dim)// section 1 tag 10{	U_int_M val;	U_int_S code_;	char *temp_string, *pos_char;	int_M pos;	ReadByte(val);	/*		this tag may have more instances; each instance have a: table code (1 byte), class code (1 byte)		drug code (1 byte), text description of the drug (at least 1 byte with NULL).	*/	if(val)	{		if((cli.drug=(info_drug*)realloc(cli.drug,sizeof(info_drug)*(cli.number_drug+1)))==NULL)		{			fprintf(stderr,"Not enough memory");  // no, exit //			exit(2);		}		ReadByte(cli.drug[cli.number_drug].table);		ReadByte(code_);		if(!cli.drug[cli.number_drug].table)		{			pos=Look(class_drug,0,15,code_);			if(pos<=0)				cli.drug[cli.number_drug].classes=0;			else				cli.drug[cli.number_drug].classes=pos;		}		else			cli.drug[cli.number_drug].classes=code_;		ReadByte(cli.drug[cli.number_drug].drug_code );		if(!cli.drug[cli.number_drug].table)		{			code_=cli.drug[cli.number_drug].drug_code +256*cli.drug[cli.number_drug].classes;			pos=Look(class_drug,16,88,code_);			if(pos<0)				pos=0;			cli.drug[cli.number_drug].drug_code =pos;		}		cli.drug[cli.number_drug].length=val-3;        //string length + NULL		if(cli.drug[cli.number_drug].length)		{			temp_string=ReadString(temp_string=NULL,cli.drug[cli.number_drug].length);			strcat(temp_string,STR_END);			dim+=strlen(temp_string);			if((cli.text_drug=(char*)realloc(cli.text_drug,sizeof(char)*(dim+1)))==NULL)			{				fprintf(stderr,"Not enough memory");  // no, exit //				exit(2);			}			pos_char=cli.text_drug;			pos_char+=dim-strlen(temp_string);			strcpy(pos_char,temp_string);			free(temp_string);		}		cli.number_drug++;	}}//end section_1_10void section_1_11(demographic &ana)// section 1 tag 11{	U_int_M dim;	ReadByte(dim);	if(dim)		ReadByte(ana.systolic_pressure);	else		ana.systolic_pressure=0;}//end section_1_11void section_1_12(demographic &ana)// section 1 tag 12{	U_int_M dim;	ReadByte(dim);	if(dim)		ReadByte(ana.diastolic_pressure);	else		ana.diastolic_pressure=0;}//end section_1_12void section_1_13(clinic &cli, U_int_M &dim)// section 1 tag 13{	U_int_M val;	char *temp_string, *pos_char;	ReadByte(val);	if(val)	{		if((cli.diagnose=(numeric*)realloc(cli.diagnose,sizeof(numeric)*(cli.number_diagnose+1)))==NULL)		{			fprintf(stderr,"Not enough memory");  // no, exit //			exit(2);		}		cli.diagnose[cli.number_diagnose].unit=cli.number_diagnose+1;		cli.diagnose[cli.number_diagnose].value=val;		temp_string=ReadString(temp_string=NULL,cli.diagnose[cli.number_diagnose].value);		strcat(temp_string,STR_END);		dim+=strlen(temp_string);		if((cli.text_diagnose=(char*)realloc(cli.text_diagnose,dim+1))==NULL)		{			fprintf(stderr,"Not enough memory");  // no, exit //			exit(2);		}		pos_char=cli.text_diagnose;		pos_char+=dim-strlen(temp_string);		strcpy(pos_char,temp_string);		free(temp_string);		cli.number_diagnose++;	}}//end section_1_13void section_1_14(descriptive &des)// section 1 tag 14{	U_int_M dim, dim_to_skip;	U_int_S i, mask, code_;	int_M pos;	//fpos_t filepos, filepos_iniz;	long filepos, filepos_iniz;	ReadByte(dim);	filepos = iftell(in); //FGETPOS(in,&filepos);	//FGETPOS(in,&filepos_iniz);    // by E.C. may 2004 ESAOTE    save to reposition at the end of this section	filepos_iniz=filepos;	dim_to_skip=dim;	dim+=filepos COMPAT;	ReadByte(des.acquiring.institution_number);	ReadByte(des.acquiring.department_number);	ReadByte(des.acquiring.ID);	ReadByte(des.acquiring.type);	if(des.acquiring.type>1)		des.acquiring.type=2;	ReadByte(des.acquiring.manifacturer);	if(des.acquiring.manifacturer>20 && des.acquiring.manifacturer!=255)		des.acquiring.manifacturer=0;	des.acquiring.model_description=ReadString(des.acquiring.model_description=NULL,6);	ReadByte(des.acquiring.protocol_revision_number);	ReadByte(des.acquiring.category);	pos=Look(compatibility,0,3,des.acquiring.category);	if(pos<0)		pos=4;	des.acquiring.category=pos;	ReadByte(code_);	if(code_<128U)		pos=0;	else if((code_<192U) && (code_>=128U))		pos=1;	else	{		pos=Look(language_code,2,15,code_);		if(pos<0)			pos=16;	}	des.acquiring.language=pos;	ReadByte(code_);	mask=0x10;	for(i=0;i<4;i++)	{		if(code_&mask)			des.acquiring.capability[i]=i+4;		else			des.acquiring.capability[i]=i;		mask<<=1;	}	ReadByte(des.acquiring.AC);	if(des.acquiring.AC>2)		des.acquiring.AC=0;	Skip(16);	des.acquiring.analysing_program_revision_number="\0";	des.acquiring.serial_number_device="\0";	des.acquiring.device_system_software="\0";	des.acquiring.device_SCP_implementation_software="\0";	des.acquiring.manifacturer_trade_name="\0";	ReadByte(i);	if(!i)		des.acquiring.analysing_program_revision_number="\0";	else		des.acquiring.analysing_program_revision_number=ReadString(des.acquiring.analysing_program_revision_number=NULL,i);	filepos = iftell(in); //FGETPOS(in,&filepos);	des.acquiring.serial_number_device=FindString(dim-filepos COMPAT);	if ((des.acquiring.protocol_revision_number==10) || (des.acquiring.protocol_revision_number==11))													 // by E.C. may 2004 CARDIOLINE 1.0 & ESAOTE 1.1		ifseek(in,filepos_iniz COMPAT +dim_to_skip,0);   //  reposition file pointer	else {		filepos = iftell(in); //FGETPOS(in,&filepos);		des.acquiring.device_system_software=FindString(dim-filepos COMPAT);		filepos = iftell(in); //FGETPOS(in,&filepos);		des.acquiring.device_SCP_implementation_software=FindString(dim-filepos COMPAT);		filepos = iftell(in); //FGETPOS(in,&filepos);

⌨️ 快捷键说明

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