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

📄 b52uni.h

📁 嵌入式系统中文件系统源代码
💻 H
字号:
#ifndef _B52UNI_H
#define _B52UNI_H


#define MSB_START	0xA1	// the MSB of the first big5 char
#define MSB_END		0xF9	// the MSB of the last big5 char
#define LSB_START1	0x40	// the LSB of the first big5 char in the 1st region
#define LSB_END1	0x7E	// the LSB of the last big5 char in the 1st region
#define LSB_START2	0xA1	// the LSB of the first big5 char in the 2nd region
#define LSB_END2	0xFE	// the LSB of the last big5 char in the 2nd region
#define REGION1		(LSB_END1 - LSB_START1 + 1)	// number of entries between 0x40~0x7E
#define REGION2		(LSB_END2 - LSB_START2 + 1)	// number of entries between 0xA1~0xFE
#define ROW		(REGION1 + REGION2)	// number of valid LSB per MSB
#define TOTAL_CHAR	13932

/*************************************************************
Function: getMapIndex
Description:
	calculate the map index from a big5 code
Input:
	msb - the most significant byte of the big5 char
        lsb - the least significant byte of the big5 char
Output:
	the index
	-1 if code error
**************************************************************/
int getMapIndex(unsigned char msb, unsigned char lsb);


/*************************************************************
Function: big5_to_unicode
Description:
	calculate the map index from a big5 code
Input:
	bmsb - the most significant byte of the big5 char
        blsb - the least significant byte of the big5 char
Output:
	umsb - the most significant byte of the unicode char
	ulsb - the least significant byte of the unicode char
	both umsb and ulsb will be 0 in case of error or umapped
	  big5 char
**************************************************************/
void big5_to_unicode(unsigned char bmsb, unsigned char blsb, unsigned char *umsb, unsigned char *ulsb);


/*************************************************************
Function: big5_to_unicode_MSB
Description:
	get the MSB of the unicode translated from a big5 code
Input:
	bmsb - the most significant byte of the big5 char
        blsb - the least significant byte of the big5 char
Output:
	the MSB of the unicode
**************************************************************/
unsigned char big5_to_unicode_MSB(unsigned char bmsb, unsigned char blsb);


/*************************************************************
Function: big5_to_unicode_LSB
Description:
	get the LSB of the unicode translated from a big5 code
Input:
	bmsb - the most significant byte of the big5 char
        blsb - the least significant byte of the big5 char
Output:
	the LSB of the unicode
**************************************************************/
unsigned char big5_to_unicode_LSB(unsigned char bmsb, unsigned char blsb);


/*************************************************************
Function: unicode_to_big5
Description:
	translate unicode to big5
Input:
	umsb - the most significant byte of the unicode char
        ulsb - the least significant byte of the unicode char
Output:
	bmsb - the most significant byte of the big5 char
	blsb - the least significant byte of the big5 char
	both bmsb and blsb will be 0 in case of error or umapped
	  unicode char
**************************************************************/
void unicode_to_big5(unsigned char umsb, unsigned char ulsb, unsigned char *bmsb, unsigned char *blsb);


/*************************************************************
Function: unicode_to_big5_MSB
Description:
	get the MSB of the big5 translated from unicode
Input:
	umsb - the most significant byte of the unicode char
        ulsb - the least significant byte of the unicode char
Output:
	the MSB of the big5
**************************************************************/
unsigned char unicode_to_big5_MSB(unsigned char umsb, unsigned char ulsb);


/*************************************************************
Function: unicode_to_big5_LSB
Description:
	get the LSB of the big5 translated from unicode
Input:
	umsb - the most significant byte of the unicode char
        ulsb - the least significant byte of the unicode char
Output:
	the LSB of the big5
**************************************************************/
unsigned char unicode_to_big5_LSB(unsigned char umsb, unsigned char ulsb);

#endif

⌨️ 快捷键说明

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