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

📄 f_numproc.c

📁 本人编写的无线电话程序,给予PIC18C801设计,包括了uCOS的移植以及菜单,自己设计的拼音注入法,完整地一级汉字库,希望对大家有所帮助
💻 C
字号:

#include "includes.h"
#include "file.h"
#pragma romdata EXTRAM
INT8U rom pnumbuf[32];
INT8U rom cnumbuf[16];
#pragma code MYCODE
//RATE_TBL_ITEM Func_numproc(INT8U rom * pnum, INT8U len){
INT8U Func_numproc(INT8U rom * pnum, INT8U len){	
	RATE_TBL	* prt;
	RATE_TBL_ITEM * p;
	INT8U rom * psrc;
	INT8U rom * pdes;
	INT8U tmplen;

	psrc = pnum;
	//Firstly, see if the number is 13xxx or 013xxx
	if(*pnum == '0' && *(pnum+1)== '1' && *(pnum+2)== '3'){
		//If it's "013xxx"...
		if(func_checkhcode(pnum+4) == TRUE){
			//If it's a local mobphone number, we delete the first number--"0"
			psrc++;
			len--;
		}
	}
	else if(*pnum == '1' && *(pnum+1)== '3'){
		//If it's "13xxx"...
		if(func_checkhcode(pnum+3)==FALSE){
			//If it's not local mobphone number, we shall note the user and stop call process
			return(???);
		}
	}
	
	pdes = pnumbuf;
	for(i = 0; i<len; i++){
		*psrc = *pdes;
		psrc++;
		pdes++;
	}
	psrc = pnumbuf;

	//Now we begin to search the rate table...
	//compress the number
	tmplen = app_a2c(psrc, len, cnumbuf);

	p = prt->item;
	pnum = cnumbuf;
	for(i=0; i<prt->len; i++){
		for(j=0;j<tmplen;j++){
			tmp = p->num[j] ^ *pnum;
			if( tmp != 0){
				if(tmp & 0x0f != *pnum ^ 0x0f)
					break;
			}
			pnum++;
		}
		if(j == tmplen) break;
		pnum = cnumbuf;
		p++;
	}
	if(i == prt->len) return(??);
	//Yes, we find one matched...

	//Post the rate table item pointer to the charging task, and then
	//insert several number according to the rate table
	tmplen = app_c2a(p->insertion, 6, cnumbuf);
	pdes = cnumbuf + tmplen;
	//delete several number according to the rate table item

	pnum = psrc;
	if((p->option & 0xff00) == 0) {
		tmplen = (INT8U)(p->option);
		len -= tmplen;
		pnum = psrc + tmplen;
	}
	for(i=0;i<len; i++){
		*pdes = *psrc;
		pdes++;
		psrc++;
	}
	
}

⌨️ 快捷键说明

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