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

📄 yyidex.c

📁 170话费催交系统
💻 C
字号:
/**************************************************************************************
*		int Index_time(char *sz_time, DX_IOTT *iott_time,int filenum,int channum)
*	函数说明: 索引时间字串,并将索引后的语音内容填入 *iott_time,返回语音串的长度
*	参数:  DX_IOTT *iott_time 索引数组的指针
*			int filenum   传递时间语音文件在数组中的位置
*			int channum   指定操作的通道
*	年月日 *sz_time
**************************************************************************************/

int Index_time(char *sz_time, DX_IOTT *iott_time,int filenum,int channum)
{
		int count;
		int count_a;

		for(count=0;count<4;count++) {
			iott_time[count].io_offset = fastnumfilewz[sz_time[count]-48].offset;
			iott_time[count].io_length = fastnumfilewz[sz_time[count]-48].length;
		}

		iott_time[count].io_offset = YEARF_OFFSET;
		iott_time[count].io_length = YEARF_LENGTH;
		count++;

		if(sz_time[4]==48) {
			iott_time[count].io_offset = fastnumfilewz[sz_time[5]-48].offset;
			iott_time[count].io_length = fastnumfilewz[sz_time[5]-48].length;
		}
	        else
        	{
			iott_time[count].io_offset = TENF_OFFSET;
			iott_time[count].io_length = TENF_LENGTH; 
			count++;
			iott_time[count].io_offset = fastnumfilewz[sz_time[5]-48].offset;
			iott_time[count].io_length = fastnumfilewz[sz_time[5]-48].length;
		}
		count++;
		
		iott_time[count].io_offset = MONTHF_OFFSET;
		iott_time[count].io_length = MONTHF_LENGTH;
		count++;
		
		if(sz_time[6]==48) {
			iott_time[count].io_offset = fastnumfilewz[sz_time[7]-48].offset;
			iott_time[count].io_length = fastnumfilewz[sz_time[7]-48].length;
		}
		else if(sz_time[6]==49) {
			iott_time[count].io_offset = TENF_OFFSET;
			iott_time[count].io_length = TENF_LENGTH; 
			count++;
			iott_time[count].io_offset = fastnumfilewz[sz_time[7]-48].offset;
			iott_time[count].io_length = fastnumfilewz[sz_time[7]-48].length;
		}
		else
		{
			iott_time[count].io_offset = fastnumfilewz[sz_time[6]-48].offset;
			iott_time[count].io_length = fastnumfilewz[sz_time[6]-48].length;
			count++;
			iott_time[count].io_offset = TENF_OFFSET;
			iott_time[count].io_length = TENF_LENGTH; 
			count++;
			iott_time[count].io_offset = fastnumfilewz[sz_time[7]-48].offset;
			iott_time[count].io_length = fastnumfilewz[sz_time[7]-48].length;
		}
		count++;
		iott_time[count].io_offset = DAYF_OFFSET;
		iott_time[count].io_length = DAYF_LENGTH;

		for(count_a=0;count_a<count;count_a++) {
			iott_time[count_a].io_type = IO_DEV|IO_LINK;
			iott_time[count_a].io_nextp = &iott_time[count_a+1];
			iott_time[count_a].io_fhandle=szfile[filenum].filehandle;
			iott_time[count_a].io_bufp = 0;
		}

		iott_time[count].io_type = IO_DEV|IO_EOT;
		iott_time[count].io_nextp = NULL;
		iott_time[count].io_fhandle=szfile[filenum].filehandle;
		iott_time[count].io_bufp = 0;

		count++;
		return(count);
}

/**************************************************************************************
*		Index_value(char *sz_value,DX_IOTT *iott_value,int filenum,int channum)
*	函数说明: 索引金额字串,并将索引后的语音内容填入 *iott_value,返回语音串的长度
*	参数:  DX_IOTT *iott_value 索引数组的指针
*			int filenum   传递时间语音文件在数组中的位置
*			int channum   指定操作的通道
*	金额 *sz_value
**************************************************************************************/
int Index_value(char *sz_value,DX_IOTT *iott_value,int filenum,int channum)
{
	int count_tmp;
	int length_tmp;
	int count_position;		//金额字串索引到的当前位置
	int count;				//语音串的计数器
	int count_a;
	int account;			//暂存金额字串中各位的值
	int tmp_allzero;		//后面的值全为零的标志
	int ling_flag;			//是否播'零'语音的标志
	int zero_yuan;			//元部分为0的标志
	int zero_jiao;			//角为0的标志
	int length;				//金额字串的长度
	int point;				//小数点在字串中所在的位置
	int length_integer;		//整数部分的长度
	int length_decimal;		//小数点后的长度

	length=0;
	while(sz_value[length]!=0)
		length++;

	for(point=1;point<=length;point++) {
		if(sz_value[point-1]==46)
			break;
	}

	if(point<=length) {
		length_integer=point-1;
		length_decimal=length-point;
		if(length_decimal>2) {
			length_decimal=2;
			length=point+2;
		}
	}
	else
	{
		length_integer=length;
		length_decimal=0;
	}

	count_position=0;
	count=0;
	ling_flag=1;

	while((count_position<length_integer)&&(count<=JE_LENGTH)) {
		account=sz_value[count_position];
		if(((account == 49)&&(count_position == 0)&&(length_integer%4 == 2))||
				(( account == 48)&&( ling_flag == 1))){
			iott_value[count].io_offset = 0;
			iott_value[count].io_length = 0;
		}
		else
		{
			iott_value[count].io_offset = numberfilewz[account-48].offset;
			iott_value[count].io_length = numberfilewz[account-48].length;
			if( account== 48)
				ling_flag=1;
			else
				ling_flag=0;
		}

		length_tmp=(length_integer-count_position-1)%4+1; 
		count_tmp=1;
		while(count_tmp<length_tmp) {
			if((sz_value[count_position+count_tmp]>48)&&(sz_value[count_position+count_tmp]<=57)) {
				tmp_allzero=0;
				break;
			}
			count_tmp++;
			tmp_allzero=1;
		}
		if((tmp_allzero==1)&&(length_tmp>1)) {
			ling_flag=1;
		}

		if(length_tmp == 1) {
			for(count_tmp=count_position+1;count_tmp<length_integer;count_tmp++) {
				if(( sz_value[count_tmp]>48)&&(sz_value[count_tmp]<=57)) {
					tmp_allzero=0;
					break;
				}
				tmp_allzero=1;
			}
			if(tmp_allzero==1) {
				ling_flag=1;
			}
			else
			{
				ling_flag=0;
			}
		}
		count++;

		switch ((length_integer-count_position)%4) {
		case 0:
			if((account<=48)||(account>57)){
				iott_value[count].io_offset = 0;
				iott_value[count].io_length = 0;
			}
			else
			{
				iott_value[count].io_offset = THOUSAND_OFFSET;
				iott_value[count].io_length = THOUSAND_LENGTH;
			}
			break;
		case 3:
			if((account<=48)||(account>57)){
				iott_value[count].io_offset = 0;
				iott_value[count].io_length = 0;
			}
			else
			{
				iott_value[count].io_offset = HUNDRED_OFFSET;
				iott_value[count].io_length = HUNDRED_LENGTH;
			}
			break;
		case 2: 
			if((account<=48)||(account>57)){
				iott_value[count].io_offset = 0;
				iott_value[count].io_length = 0;
			}
			else
			{
				iott_value[count].io_offset = TEN_OFFSET;
				iott_value[count].io_length = TEN_LENGTH;
			}
			break;
		case 1:
			if((length_integer-count_position) > 8) {
				iott_value[count].io_offset = YI_OFFSET;
				iott_value[count].io_length = YI_LENGTH;
			}
			else if((length_integer-count_position) > 4) {
				iott_value[count].io_offset = MYRIAD_OFFSET;
				iott_value[count].io_length = MYRIAD_LENGTH;
			}
			else
			{
				if(( length_integer == 1)&&( account == 48)) {
					zero_yuan = 1;
					iott_value[count].io_offset = 0;
					iott_value[count].io_length = 0;
				}
				else
				{
					zero_yuan=0;
					iott_value[count].io_offset = YUAN_OFFSET;
					iott_value[count].io_length = YUAN_LENGTH;
				}
			}
			break;
		}
		count++;
		count_position++;
	}

	count_position=point;
	ling_flag=1;

	while ((count_position<length)&&(count<=JE_LENGTH)) {
		account=sz_value[count_position];
		if((account==48)&&(count_position+1<length)) {
			if((sz_value[count_position+1]>48)&&(sz_value[count_position+1]<=57)&&(zero_yuan==0)) {
				ling_flag=0;
			}
			else
				ling_flag=1;
		}
		if((account==48)&&(ling_flag==1)) {
			iott_value[count].io_offset = 0;
			iott_value[count].io_length = 0;
		}
		else
		{
			iott_value[count].io_offset = numberfilewz[account-48].offset;
			iott_value[count].io_length = numberfilewz[account-48].length;
			ling_flag=1;
		}
	
		count++;
		switch (length-count_position) {
		case 2:
			if((account<=48)||(account>57)){
				iott_value[count].io_offset = 0;
				iott_value[count].io_length = 0;
				zero_jiao = 1;
			}
			else
			{
				zero_jiao = 0;
				iott_value[count].io_offset = JIAO_OFFSET;
				iott_value[count].io_length = JIAO_LENGTH;
			}
			break;
		case 1:
			if((account<=48)||(account>57)){
				if((zero_yuan==1)&&(zero_jiao==1)) {
					iott_value[count].io_offset = numberfilewz[0].offset ;
					iott_value[count].io_length = numberfilewz[0].length ;
				}
				else
				{
					iott_value[count].io_offset = 0;
					iott_value[count].io_length = 0;
				}
			}
			else
			{
				iott_value[count].io_offset = FEN_OFFSET;
				iott_value[count].io_length = FEN_LENGTH;
			}
			break;
		}

		count++;
		count_position++;
	}
	
	for(count_tmp=0;count_tmp<count;count_tmp++){
		iott_value[count_tmp].io_type = IO_DEV|IO_LINK;
		iott_value[count_tmp].io_nextp = &iott_value[count_tmp+1];
		iott_value[count_tmp].io_fhandle=szfile[filenum].filehandle;
		iott_value[count_tmp].io_bufp = 0;
	}
	iott_value[count-1].io_type = IO_DEV|IO_EOT;
	iott_value[count-1].io_nextp = NULL;
	
	return(count);
}

⌨️ 快捷键说明

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