亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? bcd.c

?? BC3.1編譯,小交換機計費系統.使用Dos做出如此好的界面,少有.
?? C
字號:
#include <stdio.h>
#include <stdlib.h>

#include <def.inc>

/* ----------------------------------------------------------------------
	FUNCTION:	Translate a string of Compacted BCD format to BCD format.
	CALLED BY:	This is a general-purposed routined.
	INPUT:		*c_bcd	the source buffer for the C-BCD codes.
				max_num	the maxium number of BCD codes wanted to be
						converted. it determines the buffer size.
	OUTPUT:		*bcd	the target buffer for the BCD codes.
	RETURN:		Number of BCD codes been converted.
				When max_num BCDs been converted or come up to a non-BCD code,
				converting stops, and the very number is returned.
				If a non-BCD is reached before max_num BCDs be converted,
				the target BCD buffer *bcd ends with ONE 0x0F.
  ----------------------------------------------------------------------- */
UI cbcd_bcd(UC *bcd, UC *c_bcd, UI max_num)
{
UI  c_bcd_index;     		/* cbcd[] index */
UI  bcd_index;				/* bcd[] index */
UC  tmp_ch;

	if (max_num==0)
		return 0;

	c_bcd_index = 0;
	bcd_index = 0;
	while (TRUE)
	{
		tmp_ch = c_bcd[c_bcd_index];

		if ( tmp_ch < 0xA0 )
		{
			bcd[bcd_index++] = tmp_ch>>4;		/* the higher 4 bits < 9 */
			if ( bcd_index==max_num )
				break;
		}
		else
			break;

		tmp_ch &= 0x0F;
		if ( tmp_ch<0x0A )
		{
			bcd[bcd_index++] = tmp_ch;		/* the lower 4 bits < 9 */
			if ( bcd_index==max_num )
				break;
		}
		else
			break;

		c_bcd_index++;
	}

	if ( bcd_index<max_num )
		bcd[bcd_index] = 0x0F;		/* if not enough bcd code be translate,
										make the end flag: 0x0F. */
	return bcd_index;
}

/* ----------------------------------------------------------------------
	FUNCTION:	Translate a string of BCD format to Compacted BCD format.
	CALLED BY:	This is a general-purposed routined.
	INPUT:		*bcd	the source buffer for the BCD codes.
				max_num	the maxium number of BCD codes wanted to be
						converted. it determines the buffer size.
	OUTPUT:		*c_bcd	the target buffer for the C_BCD codes.
	RETURN:		Number of BCD codes been converted.
				When max_num BCDs been converted or come up to an non-BCD code,
				converting stops, and the very number is returned.
				If a non-BCD is reached before max_num BCDs been converted,
				the target C-BCD buffer *c_bcd ends with ONE 0x0F.
  ----------------------------------------------------------------------- */
UI bcd_cbcd(UC *c_bcd, UC *bcd, UI max_num)
{
UI	loop;
UI  c_bcd_index;

	if (max_num==0)
		return 0;

	for ( loop=0; loop<max_num; loop++ )
	{
		c_bcd_index = loop>>1;

		if ( bcd[loop]<0x0A )
		{
			if ( (c_bcd_index<<1)==loop )		/* loop is even */
				c_bcd[c_bcd_index] = (c_bcd[c_bcd_index]&0x0F) | (bcd[loop]<<4);
			else								/* loop is odd */
				c_bcd[c_bcd_index] = (c_bcd[c_bcd_index]&0xF0) | bcd[loop];
		}
		else
		{
			if ( (c_bcd_index<<1)==loop )
				c_bcd[c_bcd_index] = c_bcd[c_bcd_index] | 0xF0;
			else
				c_bcd[c_bcd_index] = c_bcd[c_bcd_index] | 0x0F;

			return loop;
		}
	}
	return max_num;
}

/* ----------------------------------------------------------------------
	FUNCTION:	Translate a string of BCD format to ASCII format.
	CALLED BY:	This is a general-purposed routined.
	INPUT:		*bcd	the source buffer for the BCD codes.
				max_num	the maxium number of BCD codes wanted to be
						converted. it determines the buffer size.
	OUTPUT:		*str	the target buffer for the string.
	RETURN:		Number of BCD codes been converted. (NOT including the '\0'
				at the string tail).
				No matter why the converting stopped, the string ends with
				ONE '\0'.
				When max_num BCDs been converted or come up to an non-BCD
				code, converting stops.
  ----------------------------------------------------------------------- */
UI bcd_str(UC *str, UC *bcd, UI max_num)
{
UI	loop = 0;

	if (max_num==0)
		return 0;

	while ( loop<max_num && bcd[loop]<0x0A )
	{
		str[loop] = bcd[loop] + '0';
		loop++;
	}
	str[loop] = '\0';
	return loop;
}


/* ----------------------------------------------------------------------
	FUNCTION:	Translate a string of ASCII format to BCD format.
	CALLED BY:	This is a general-purposed routined.
	INPUT:		*str	the source buffer for the digital string.
				max_num	the maxium number of BCD codes wanted to be
						converted. it determines the buffer size.
	OUTPUT:		*bcd	the target buffer for the BCD codes.
	RETURN:		Number of BCD codes been converted.
				When max_num BCDs been converted or come up to an non-BCD
				code, converting stops, and the number of BCDs been
				converted is returned.
				If a non-BCD is reached before max_num BCDs been converted,
				the target BCD buffer *bcd ends with ONE 0x0F.
  ----------------------------------------------------------------------- */
UI str_bcd(UC *bcd, UC *str, UI max_num)
{
UI	loop = 0;

	if (max_num==0)
		return 0;

	while ( loop<max_num && str[loop]>='0' && str[loop]<='9' )
	{
		bcd[loop] = str[loop] - '0';
		loop++;
	}

	if ( loop!=max_num )
		bcd[loop] = 0x0F;	/* the tail mark 0x0F */

	return loop;
}

/* ----------------------------------------------------------------------
	FUNCTION:	Translate a string of Compacted BCD format to ASCII format.
	CALLED BY:	This is a general-purposed routined.
	INPUT:		*c_bcd	the source buffer for the C_BCD codes.
				max_num	the maxium number of BCD codes wanted to be
						converted. it determines the buffer size.
	OUTPUT:		*str	the target buffer for the string.
	RETURN:		Number of BCD codes been converted.
				No matter why the converting stopped, the string ends with
				ONE '\0'.
				When max_num BCDs been converted or come up to an non-BCD
				code, converting stops, and the string length (the number
				of BCDs been converted) is returned (NOT including the '\0'
				at the string tail).
  ----------------------------------------------------------------------- */
UI cbcd_str(UC *str, UC *c_bcd, UI max_num)
{
UI  c_bcd_index;     		/* c_bcd[] index */
UI  str_index;				/* str[] index */
UC  tmp_ch;

	if (max_num==0)
		return 0;

	c_bcd_index = 0;
	str_index = 0;

	while (TRUE)
	{
		tmp_ch = c_bcd[c_bcd_index];

		if ( tmp_ch < 0xA0 )
		{
			str[str_index++] = (tmp_ch>>4) + '0';	/* the higher 4 bits < 9 */
			if ( str_index==max_num )
				break;
		}
		else
			break;

		tmp_ch &= 0x0F;
		if ( tmp_ch<0x0A )
		{
			str[str_index++] = tmp_ch + '0';	/* the lower 4 bits < 9 */
			if ( str_index==max_num )
				break;
		}
		else
			break;

		c_bcd_index++;
	}

	str[str_index] = '\0';		/* make the string's end flag: '\0'. */
	return str_index;
}


/* ----------------------------------------------------------------------
	FUNCTION:	Translate a string of ASCII format to Compacted BCD format.
	CALLED BY:	This is a general-purposed routined.
	INPUT:		*str	the source buffer for the digital string.
				max_num	the maxium number of BCD codes wanted to be
						converted. it determines the buffer size.
	OUTPUT:		*c_bcd	the target buffer for the C-BCD codes.
	RETURN:		Number of BCD codes been converted.
				When max_num BCDs been converted or come up to an non-BCD
				code, converting stops, and the number of BCDs been
				converted is returned.
				If a non-BCD is reached before max_num BCDs been converted,
				the target C-BCD buffer *c_bcd ends with ONE 0x0F.
  ----------------------------------------------------------------------- */
UI  str_cbcd(UC *c_bcd, UC *str, UI max_num)
{
UI	loop;
UI  c_bcd_index;

	if (max_num==0)
		return 0;

	for ( loop=0; loop<max_num; loop++ )
	{
		c_bcd_index = loop>>1;

		if ( str[loop]<='9' && str[loop]>='0' )
		{
			if ( (c_bcd_index<<1)==loop )	/* loop is even */
				c_bcd[c_bcd_index] = (c_bcd[c_bcd_index] & 0x0F)
									 | ( (str[loop]-'0')<<4 );
			else               	            /* loop is odd */
				c_bcd[c_bcd_index] = (c_bcd[c_bcd_index] & 0xF0)
									 | ( str[loop]-'0');
		}
		else
		{
			if ( (c_bcd_index<<1)==loop )
				c_bcd[c_bcd_index] = c_bcd[c_bcd_index] | 0xF0;
			else
				c_bcd[c_bcd_index] = c_bcd[c_bcd_index] | 0x0F;

			return loop;
		}
	}
	return max_num;
}

/* --------------------------------------------------------------------
	FUNCTION:	Convert a bcd string to an unsigned long integer.
	CALLED BY:	This is a general-purposed routine.
	INPUT:      *bcd	the buffer keeping the BCD codes.
				max_num	the num of BCDs wanted to be converted ( <=9 ).
	OUTPUT:		*hex	if converting successful, the HEX value stored here.
	RETURN:		The number of BCDs that been converted.
   ---------------------------------------------------------------------- */
UI bcd_hex(UL *hex, UC *bcd, UI max_num)
{
UL tmp;
UC loop;

	if (max_num==0 || max_num>9)
		return 0;

	loop = 0;
	tmp = 0;
	while (loop<max_num && bcd[loop]<0x0A )
	{
		tmp = (tmp<<3) + (tmp<<1) + bcd[loop];
		loop++;
	}

	if (loop!=0)
		*hex = tmp;
	return loop;
}

/* --------------------------------------------------------------------
	FUNCTION:	Convert an unsigned long integer to a BCD string.
	CALLED BY:	This is a general-purposed routine.
	INPUT:      hex		the HEX value that want to converted to BCD codes.
				max_num	the num of BCDs wanted to be converted.
						it determines the buffer's size.
	OUTPUT:		*bcd	if converting successful, the BCD codes stored here.
	RETURN:		The number of BCDs that been converted.
				If converting stoped before max_num BCDs been converted,
				the target C-BCD buffer *c_bcd ends with ONE 0x0F.
   ---------------------------------------------------------------------- */
UI hex_bcd(UC *bcd, UL hex, UI max_num)
{
UC buf[11];

	if (max_num==0)
		return 0;

	ultoa(hex, buf, 10);
	return str_bcd(bcd, buf, max_num);
}

/* --------------------------------------------------------------------
	FUNCTION:	Convert a Compacted BCD string to an unsigned long integer.
	CALLED BY:	This is a general-purposed routine.
	INPUT:      *c_bcd	the buffer keeping the BCD codes.
				max_num	the num of BCDs wanted to be converted ( <=9 ).
	OUTPUT:		*hex	if converting successful, the HEX value stored here.
	RETURN:		The number of BCDs that been converted.
   ---------------------------------------------------------------------- */
UI cbcd_hex(UL *hex, UC *c_bcd, UI max_num)
{
UL tmp;
UC loop;
UC c_bcd_index;

	if (max_num==0 || max_num>9)
		return 0;

	loop = 0;
	tmp = 0;
	while ( loop < max_num )
	{
		c_bcd_index = loop >> 1;

		if ( (c_bcd_index << 1) == loop )
		{
		    if ( c_bcd[c_bcd_index] < 0xA0 )
		        tmp = (tmp << 3) + (tmp << 1) + (c_bcd[c_bcd_index] >> 4);
                    else
		        break;
		}
		else
		{
		    if ( (c_bcd[c_bcd_index] & 0x0F) < 0x0A )
		        tmp = (tmp << 3) + (tmp << 1) + (c_bcd[c_bcd_index] & 0x0F);
		    else
		        break;
		}
		loop++;
        }
	if (loop!=0)
		*hex = tmp;
	return loop;
}

/* --------------------------------------------------------------------
	FUNCTION:	Convert an unsigned long integer to a Compacted BCD string.
	CALLED BY:	This is a general-purposed routine.
	INPUT:      hex		the HEX value that want to converted to BCD format.
				max_num	the number of BCDs wanted to be converted.
						it determines the buffer's size.
	OUTPUT:		*c_bcd	if converting successful, the BCD codes stored here.
	RETURN:		The number of BCDs that been converted.
				If converting stoped before max_num BCDs been converted,
				the target C-BCD buffer *c_bcd ends with ONE 0x0F.
   ---------------------------------------------------------------------- */
UI hex_cbcd(UC *c_bcd, UL hex, UI max_num)
{
UC buf[11];

	if (max_num==0)
		return 0;

	ultoa(hex, buf, 10);
	return str_cbcd(c_bcd, buf, max_num);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人啪午夜精品网站男同| 香蕉成人伊视频在线观看| 久久国产精品一区二区| 91精品国产综合久久精品图片 | 国产精品初高中害羞小美女文| 国产麻豆日韩欧美久久| 国产精品网站导航| 色老综合老女人久久久| 手机精品视频在线观看| 日韩欧美一区在线| 国产一区在线观看视频| 国产精品天美传媒沈樵| 一本到三区不卡视频| 亚洲动漫第一页| 精品久久人人做人人爰| 国产成人啪免费观看软件| 亚洲欧美一区二区三区孕妇| 欧美日韩国产中文| 国产精一区二区三区| 亚洲人一二三区| 欧美日韩国产色站一区二区三区| 另类专区欧美蜜桃臀第一页| 欧美国产精品中文字幕| 91九色02白丝porn| 精品亚洲欧美一区| 亚洲久草在线视频| 日韩久久久久久| 91麻豆免费观看| 另类人妖一区二区av| 中文字幕一区二区三区在线播放 | 亚洲永久精品大片| 欧美成人video| 91在线精品一区二区| 日韩成人伦理电影在线观看| 久久久精品综合| 欧美久久久久久久久中文字幕| 国产一区二区三区四| 亚洲高清免费在线| 国产精品久久夜| 精品少妇一区二区三区在线播放 | 美女脱光内衣内裤视频久久网站 | 成人av先锋影音| 视频一区二区中文字幕| 国产精品久久久久影院老司| 91精品国产91久久久久久最新毛片| 成人黄色电影在线| 久久99国产精品成人| 亚洲综合激情网| 国产精品家庭影院| 精品成人佐山爱一区二区| 91行情网站电视在线观看高清版| 国产米奇在线777精品观看| 亚洲永久免费视频| 一区二区三区中文字幕精品精品 | 亚洲欧洲日韩一区二区三区| 日韩午夜激情视频| 欧美日韩视频第一区| 99久久免费视频.com| 国产精品一区二区黑丝| 老司机午夜精品| 日日夜夜精品免费视频| 亚洲一区中文日韩| 最新不卡av在线| 国产精品乱码一区二区三区软件| 精品国产乱码久久久久久久久| 在线播放一区二区三区| 欧美日韩免费视频| 欧美视频一区在线| 欧洲一区二区av| 欧洲亚洲精品在线| 欧美午夜在线一二页| 色哟哟一区二区在线观看| av资源网一区| 97精品久久久午夜一区二区三区 | 亚洲天天做日日做天天谢日日欢| 欧美激情在线看| 中文字幕欧美日韩一区| 中文字幕乱码一区二区免费| 久久免费精品国产久精品久久久久| 日韩精品在线一区| 精品日韩欧美在线| 久久婷婷久久一区二区三区| 久久综合999| 中文字幕欧美国产| 一区二区三区在线观看动漫| 亚洲视频一区二区在线观看| 一区二区三区四区五区视频在线观看 | 欧美日韩精品一区二区天天拍小说| 色呦呦国产精品| 欧美性猛交xxxx乱大交退制版| 欧美这里有精品| 日韩一级大片在线| 久久亚区不卡日本| 国产精品剧情在线亚洲| 亚洲图片激情小说| 日韩国产精品久久| 国内精品在线播放| 91丨九色丨蝌蚪富婆spa| 欧美日韩综合在线| 欧美va在线播放| 国产精品女同一区二区三区| 亚洲精品国产无天堂网2021| 亚洲成人一二三| 国产一区二区精品久久91| av一区二区三区黑人| 日本高清不卡视频| 日韩午夜精品视频| 国产精品久久久久久久岛一牛影视| 一区二区三区欧美日韩| 日产欧产美韩系列久久99| 国产精品一线二线三线| 99精品国产一区二区三区不卡| 欧美日韩大陆在线| 久久久久久99精品| 一区二区三区不卡在线观看| 另类小说欧美激情| 91小视频在线免费看| 91精品国产综合久久婷婷香蕉| 欧美激情中文字幕一区二区| 亚洲一区二区在线免费看| 久久精品国产在热久久| 色综合婷婷久久| 欧美精品一区二区在线播放| 亚洲精品亚洲人成人网| 国产一区二区三区免费在线观看| 色一区在线观看| 2017欧美狠狠色| 亚洲午夜在线视频| 成人高清视频免费观看| 欧美一区二区福利在线| 日韩伦理免费电影| 国产成人精品免费在线| 制服丝袜亚洲色图| 亚洲人一二三区| 国产在线视频一区二区三区| 欧美在线一区二区| 国产精品盗摄一区二区三区| 国模套图日韩精品一区二区| 欧美日韩免费不卡视频一区二区三区| 国产亚洲精品久| 麻豆精品新av中文字幕| 在线观看日韩电影| 国产精品久久久久影院亚瑟 | 一区二区三区四区精品在线视频 | 日韩欧美国产不卡| 亚洲国产精品人人做人人爽| a4yy欧美一区二区三区| 久久只精品国产| 九九九久久久精品| 日韩无一区二区| 亚洲成av人影院在线观看网| av亚洲精华国产精华| 久久蜜桃av一区精品变态类天堂| 五月婷婷激情综合网| 欧美午夜理伦三级在线观看| 国产精品美女久久福利网站| 国产一区二区三区免费播放| 91精品国产综合久久久蜜臀图片 | 色综合天天在线| 国产免费久久精品| 国产精品香蕉一区二区三区| 精品日韩一区二区三区| 久久91精品久久久久久秒播| 欧美精品乱人伦久久久久久| 亚洲电影中文字幕在线观看| 色婷婷综合久久久| 亚洲一区在线观看视频| 色综合激情久久| 亚洲国产成人高清精品| 欧洲在线/亚洲| 亚洲成人av福利| 91精品国产91综合久久蜜臀| 石原莉奈在线亚洲二区| 制服丝袜国产精品| 欧美a级理论片| 精品久久久久久亚洲综合网| 久久99精品久久久久| 久久亚洲精品小早川怜子| 国内精品视频666| 男女视频一区二区| 精品国产精品一区二区夜夜嗨| 精品一区二区三区免费观看 | 中文字幕日韩av资源站| 91浏览器打开| 亚洲成人综合视频| 日韩精品综合一本久道在线视频| 国产精选一区二区三区| 国产精品初高中害羞小美女文| 日本精品视频一区二区三区| 夜夜爽夜夜爽精品视频| 欧美日本一道本| 国产一区二区三区免费| 日韩美女啊v在线免费观看| 在线日韩国产精品| 蜜臀av亚洲一区中文字幕| 久久男人中文字幕资源站| 91麻豆国产自产在线观看| 午夜电影一区二区| 久久亚洲影视婷婷| 色av一区二区|