#include <string.h>
#include <reg51.h>
//"拼音输入法汉字排列表"
unsigned char code PY_mb_a []={"阿啊"};
unsigned char code PY_mb_ai []={"哎哀唉埃挨皑癌矮蔼艾爱隘碍"};
unsigned char code PY_mb_an []={"安氨鞍俺岸按案胺暗"};
unsigned char code PY_mb_gai []={"该改钙盖溉概"};
unsigned char code PY_mb_gan []={"干甘杆肝柑竿秆赶敢感赣"};
unsigned char code PY_mb_gang []={"冈刚岗纲肛缸钢港杠"};
unsigned char code PY_mb_gao []={"皋羔高膏篙糕搞稿镐告"};
unsigned char code PY_mb_ge []={"戈疙哥胳鸽割搁歌阁革格葛隔个各铬咯"};
unsigned char code PY_mb_jiong []={"炯窘"};
unsigned char code PY_mb_jiu []={"纠究揪九久灸玖韭酒旧臼咎疚厩救就舅"};
unsigned char code PY_mb_ju []={"居拘狙驹疽鞠局桔菊咀沮举矩句巨拒具炬俱剧惧据距锯聚踞"};
unsigned char code PY_mb_lai []={"来莱赖"};
unsigned char code PY_mb_lan []={"兰拦栏婪阑蓝谰澜篮览揽缆懒烂滥"};
unsigned char code PY_mb_lang []={"郎狼廊琅榔朗浪"};
unsigned char code PY_mb_lao []={"捞劳牢老佬姥涝烙酪"};
unsigned char code PY_mb_le []={"乐勒了"};
unsigned char code PY_mb_lei []={"雷镭垒磊蕾儡肋泪类累擂"};
unsigned char code PY_mb_leng []={"棱楞冷"};
unsigned char code PY_mb_li []={"厘梨狸离莉犁漓璃黎篱礼李里哩理鲤力历厉立吏丽利励沥例隶俐荔栗砾粒傈痢"};
unsigned char code PY_mb_lian []={"连帘怜涟莲联廉镰敛脸练炼恋链"};
unsigned char code PY_mb_liang []={"俩良凉梁粮粱两亮谅辆晾量"};
unsigned char code PY_mb_liao []={"潦辽疗聊僚寥廖撩燎镣料撂"};
unsigned char code PY_mb_lie []={"列劣烈猎裂"};
unsigned char code PY_mb_lin []={"邻林临淋琳霖磷鳞凛吝赁拎"};
unsigned char code PY_mb_ling []={"伶灵岭玲凌铃陵羚菱零龄领令另"};
unsigned char code PY_mb_liu []={"溜刘流留琉硫馏榴瘤柳六"};
unsigned char code PY_mb_long []={"龙咙笼聋隆窿陇垄拢"};
unsigned char code PY_mb_lou []={"娄楼搂篓陋漏"};
unsigned char code PY_mb_lu []={"露卢庐芦炉颅卤虏掳鲁陆录赂鹿禄碌路戮潞麓"};
unsigned char code PY_mb_luan []={"孪峦挛滦卵乱"};
unsigned char code PY_mb_lue []={"掠略"};
unsigned char code PY_mb_lun []={"抡仑伦沦纶轮论"};
unsigned char code PY_mb_luo []={"罗萝逻锣箩骡螺裸洛络骆落"};
unsigned char code PY_mb_lv []={"滤驴吕侣旅铝屡缕履律虑率绿氯"};
unsigned char code PY_mb_ma []={"妈麻马玛码蚂骂吗嘛"};
unsigned char code PY_mb_mai []={"埋买迈麦卖脉"};
unsigned char code PY_mb_man []={"蛮馒瞒满曼谩慢漫蔓"};
unsigned char code PY_mb_mang []={"忙芒盲茫莽氓"};
unsigned char code PY_mb_mao []={"猫毛矛茅锚卯铆茂冒贸帽貌"};
unsigned char code PY_mb_me []={"么"};
unsigned char code PY_mb_mei []={"没枚玫眉梅媒煤酶霉每美镁妹昧媚寐"};
unsigned char code PY_mb_men []={"门闷们"};
unsigned char code PY_mb_nao []={"挠恼脑闹淖"};
unsigned char code PY_mb_ne []={"呢"};
unsigned char code PY_mb_nv []={"女"};
unsigned char code PY_mb_o []={"哦"};
unsigned char code PY_mb_ou []={"欧殴鸥呕偶藕沤"};
unsigned char code PY_mb_pie []={"撇瞥"};
unsigned char code PY_mb_pin []={"拼贫频品聘"};
unsigned char code PY_mb_ping []={"乒平评凭坪苹屏瓶萍"};
unsigned char code PY_mb_re []={"惹热"};
unsigned char code PY_mb_ren []={"人仁壬忍刃认任纫妊韧"};
unsigned char code PY_mb_reng []={"扔仍"};
unsigned char code PY_mb_ri []={"日"};
unsigned char code PY_mb_rong []={"戎绒茸荣容溶蓉熔融冗"};
unsigned char code PY_mb_rou []={"柔揉肉"};
unsigned char code PY_mb_zui []={"嘴最罪醉"};
unsigned char code PY_mb_zun []={"尊遵"};
unsigned char code PY_mb_zuo []={"昨左佐作坐座做"};
//================================================================================================
//"拼音输入法查询码表"
unsigned char code PY_index_a[][8]={
{" ",0x00,0x00},
{"i ",0x05,0x00},
{"n ",0x20,0x00},
{"ng ",0x33,0x00},
{"o ",0x3A,0x00}};
unsigned char code PY_index_b[][8]={
{"a ",0x4D,0x00},
{"ai ",0x70,0x00},
{"an ",0x81,0x00},
{"ang ",0xA0,0x00},
{"ao ",0xB9,0x00},
{"ei ",0xDE,0x00},
{"en ",0xFD,0x00},
{"eng",0x08,0x01},
{"i ",0x15,0x01},
{"ian ",0x44,0x01},
{"iao ",0x5D,0x01},
{"ie ",0x66,0x01},
{"in ",0x6F,0x01},
{"ing ",0x7C,0x01},
{"o ",0x8F,0x01},
{"u ",0xB8,0x01}};
unsigned char code PY_index_c[][8]={
{"a ",0xCD,0x01},
{"ai ",0xD0,0x01},
{"an ",0xE7,0x01},
{"ang ",0xF6,0x01},
{"ao ",0x01,0x02},
{"e ",0x0C,0x02},
{"eng ",0x17,0x02},
{"ha ",0x1E,0x02},
{"hai ",0x37,0x02},
{"han ",0x3E,0x02},
{"hang ",0x53,0x02},
{"hao ",0x6C,0x02},
{"he ",0x81,0x02},
{"hen ",0x8E,0x02},
{"heng ",0xA3,0x02},
{"hi ",0xC2,0x02},
{"hong ",0xE1,0x02},
{"hou ",0xEC,0x02},
{"hu ",0x05,0x03},
{"huai ",0x28,0x03},
{"huan ",0x2B,0x03},
{"huang",0x3A,0x03},
{"hui ",0x45,0x03},
{"hun ",0x50,0x03},
{"huo ",0x5F,0x03},
{"i ",0x62,0x03},
{"ong ",0x7B,0x03},
{"ou ",0x88,0x03},
{"u ",0x8B,0x03},
{"uan ",0x94,0x03},
{"ui ",0x9B,0x03},
{"un ",0xAC,0x03},
{"uo ",0xB3,0x03}};
unsigned char code PY_index_d[][8]={
{"a ",0xC0,0x03},
{"ai ",0xCD,0x03},
{"an ",0xE6,0x03},
{"ang ",0x05,0x04},
{"ao ",0x10,0x04},
{"e ",0x29,0x04},
{"eng ",0x30,0x04},
{"i ",0x3F,0x04},
{"ian ",0x64,0x04},
{"iao ",0x85,0x04},
{"ie ",0x96,0x04},
{"ing ",0xA5,0x04},
{"iu ",0xB8,0x04},
{"ong ",0xBB,0x04},
{"ou ",0xD0,0x04},
{"u ",0xE1,0x04},
{"uan ",0xFE,0x04},
{"ui ",0x0B,0x05},
{"un ",0x14,0x05},
{"uo ",0x25,0x05}};
unsigned char code PY_index_e[][8]={
{" ",0x3E,0x05},
{"n ",0x59,0x05},
{"r ",0x5C,0x05}};
unsigned char code PY_index_f[][8]={
{"a ",0x6D,0x05},
{"an ",0x7E,0x05},
{"ang ",0xA1,0x05},
{"ei ",0xB8,0x05},
{"en ",0xD1,0x05},
{"eng ",0xF0,0x05},
{"o ",0x0F,0x06},
{"ou ",0x12,0x06},
{"u ",0x15,0x06}};
unsigned char code PY_index_g[][8]={
{"a ",0x6E,0x06},
{"ai ",0x73,0x06},
{"an ",0x80,0x06},
{"ang ",0x97,0x06},
{"ao ",0xAA,0x06},
{"e ",0xBF,0x06},
{"ei ",0xE2,0x06},
{"en ",0xE5,0x06},
{"eng ",0xEA,0x06},
{"ong ",0xF9,0x06},
{"ou ",0x18,0x07},
{"u ",0x2B,0x07},
{"ua ",0x50,0x07},
{"uai ",0x5D,0x07},
{"uan ",0x64,0x07},
{"uang ",0x7B,0x07},
{"ui ",0x82,0x07},
{"un ",0xA3,0x07},
{"uo ",0xAA,0x07}};
unsigned char code PY_index_h[][8]={
{"a ",0xB7,0x07},
{"ai ",0xBC,0x07},
{"an ",0xCB,0x07},
{"ang ",0xF2,0x07},
{"ao ",0xF9,0x07},
{"e ",0x0C,0x08},
{"ei ",0x2F,0x08},
{"en ",0x34,0x08},
{"eng ",0x3D,0x08},
{"ong ",0x48,0x08},
{"ou ",0x5B,0x08},
{"u ",0x6A,0x08},
{"ua ",0x8F,0x08},
{"uai ",0xA2,0x08},
{"uan ",0xAD,0x08},
{"uang ",0xCA,0x08},
{"ui ",0xE7,0x08},
{"un ",0x12,0x09},
{"uo ",0x1F,0x09}};
unsigned char code PY_index_j[][8]={
{"i ",0x34,0x09},
{"ia ",0xA1,0x09},
{"ian ",0xC6,0x09},
{"iang ",0x15,0x0A},
{"iao ",0x30,0x0A},
{"ie ",0x69,0x0A},
{"in ",0x9C,0x0A},
{"ing ",0xC5,0x0A},
{"iong ",0xF8,0x0A},
{"iu ",0xFD,0x0A},
{"u ",0x20,0x0B},
{"uan ",0x55,0x0B},
{"ue ",0x64,0x0B},
{"un ",0x77,0x0B}};
unsigned char code PY_index_k[][8]={
{"a ",0x8E,0x0B},
{"ai ",0x95,0x0B},
{"an ",0xA0,0x0B},
{"ang ",0xAF,0x0B},
{"ao ",0xBE,0x0B},
{"e ",0xC7,0x0B},
{"en ",0xE6,0x0B},
{"eng ",0xEF,0x0B},
{"ong ",0xF4,0x0B},
{"ou ",0xFD,0x0B},
{"u ",0x06,0x0C},
{"ua ",0x15,0x0C},
{"uai ",0x20,0x0C},
{"uan ",0x29,0x0C},
{"uang ",0x2E,0x0C},
{"ui ",0x3F,0x0C},
{"un ",0x56,0x0C},
{"uo ",0x5F,0x0C}};
unsigned char code PY_index_l[][8]={
{"a ",0x68,0x0C},
{"ai ",0x77,0x0C},
{"an ",0x7E,0x0C},
{"ang ",0x9D,0x0C},
{"ao ",0xAC,0x0C},
{"e ",0xBF,0x0C},
{"ei ",0xC6,0x0C},
{"eng ",0xDD,0x0C},
{"i ",0xE4,0x0C},
{"ian ",0x29,0x0D},
{"iang ",0x46,0x0D},
{"iao ",0x5F,0x0D},
{"ie ",0x78,0x0D},
{"in ",0x83,0x0D},
{"ing ",0x9C,0x0D},
{"iu ",0xB9,0x0D},
{"ong ",0xD0,0x0D},
{"ou ",0xE3,0x0D},
{"u ",0xF0,0x0D},
{"uan ",0x19,0x0E},
{"ue ",0x26,0x0E},
{"un ",0x2B,0x0E},
{"uo ",0x3A,0x0E},
{"v ",0x53,0x0E}};
unsigned char code PY_index_m[][8]={
{"a ",0x70,0x0E},
{"ai ",0x83,0x0E},
{"an ",0x90,0x0E},
{"ang ",0xA3,0x0E},
{"ao ",0xB0,0x0E},
{"e ",0xC9,0x0E},
{"ei ",0xCC,0x0E},
{"en ",0xED,0x0E},
{"eng ",0xF4,0x0E},
{"i ",0x05,0x0F},
{"ian ",0x22,0x0F},
{"iao ",0x35,0x0F},
{"ie ",0x46,0x0F},
{"in ",0x4B,0x0F},
{"ing ",0x58,0x0F},
{"iu ",0x65,0x0F},
{"o ",0x68,0x0F},
{"ou ",0x8D,0x0F},
{"u ",0x94,0x0F}};
unsigned char code PY_index_n[][8]={
{"a ",0xB3,0x0F},
{"ai ",0xC2,0x0F},
{"an ",0xCD,0x0F},
{"ang ",0xD4,0x0F},
{"ao ",0xD7,0x0F},
{"e ",0xE2,0x0F},
{"ei ",0xE5,0x0F},
{"en ",0xEA,0x0F},
{"eng ",0xED,0x0F},
{"i ",0xF0,0x0F},
{"ian ",0x07,0x10},
{"iang ",0x16,0x10},
{"iao ",0x1B,0x10},
{"ie ",0x20,0x10},
{"in ",0x2F,0x10},
{"ing ",0x32,0x10},
{"iu ",0x3F,0x10},
{"ong ",0x48,0x10},
{"u ",0x51,0x10},
{"uan ",0x58,0x10},
{"ue ",0x5B,0x10},
{"uo ",0x60,0x10},
{"v ",0x69,0x10}};
unsigned char code PY_index_o[][8]={
{" ",0x6C,0x10},
{"u ",0x6F,0x10}};
unsigned char code PY_index_p[][8]={
{"a ",0x7E,0x10},
{"ai ",0x8D,0x10},
{"an ",0x9A,0x10},
{"ang ",0xAB,0x10},
{"ao ",0xB6,0x10},
{"ei ",0xC5,0x10},
{"en ",0xD8,0x10},
{"eng ",0xDD,0x10},
{"i ",0xFA,0x10},
{"ian ",0x1F,0x11},
{"iao ",0x28,0x11},
{"ie ",0x31,0x11},
{"in ",0x36,0x11},
{"ing ",0x41,0x11},
{"o ",0x54,0x11},
{"ou ",0x65,0x11},
{"u ",0x68,0x11}};
unsigned char code PY_index_q[][8]={
{"i ",0x87,0x11},
{"ia ",0xD0,0x11},
{"ian ",0xD7,0x11},
{"iang ",0x04,0x12},
{"iao ",0x15,0x12},
{"ie ",0x34,0x12},
{"in ",0x3F,0x12},
{"ing ",0x56,0x12},
{"iong ",0x71,0x12},
{"iu ",0x76,0x12},
{"u ",0x87,0x12},
{"uan ",0xA2,0x12},
{"ue ",0xB9,0x12},
{"un ",0xCA,0x12}};
unsigned char code PY_index_r[][8]={
{"an ",0xCF,0x12},
{"ang ",0xD8,0x12},
{"ao ",0xE3,0x12},
{"e ",0xEA,0x12},
{"en ",0xEF,0x12},
{"eng ",0x04,0x13},
{"i ",0x09,0x13},
{"ong ",0x0C,0x13},
{"ou ",0x21,0x13},
{"u ",0x28,0x13},
{"uan ",0x3D,0x13},
{"ui ",0x42,0x13},
{"un ",0x49,0x13},
{"uo ",0x4E,0x13}};
unsigned char code PY_index_s[][8]={
{"a ",0x53,0x13},
{"ai ",0x5A,0x13},
{"an ",0x63,0x13},
{"ang",0x6C,0x13},
{"ao ",0x73,0x13},
{"e ",0x7C,0x13},
{"en ",0x83,0x13},
{"eng ",0x86,0x13},
{"ha ",0x89,0x13},
{"hai ",0x9C,0x13},
{"han ",0xA1,0x13},
{"hang ",0xC4,0x13},
{"hao ",0xD5,0x13},
{"he ",0xEC,0x13},
{"hen ",0x05,0x14},
{"heng ",0x28,0x14},
{"hi ",0x3F,0x14},
{"hou ",0xA0,0x14},
{"hu ",0xB5,0x14},
{"hua ",0xF8,0x14},
{"huai ",0xFD,0x14},
{"huan ",0x06,0x15},
{"huang",0x0B,0x15},
{"hui ",0x12,0x15},
{"hun ",0x1B,0x15},
{"huo ",0x24,0x15},
{"i ",0x2D,0x15},
{"ong ",0x4C,0x15},
{"ou ",0x5D,0x15},
{"u ",0x66,0x15},
{"uan ",0x7D,0x15},
{"ui ",0x84,0x15},
{"un ",0x9B,0x15},
{"uo ",0xA2,0x15}};
unsigned char code PY_index_t[][8]={
{"a ",0xB3,0x15},
{"ai ",0xC6,0x15},
{"an ",0xD9,0x15},
{"ang ",0xFE,0x15},
{"ao ",0x19,0x16},
{"e ",0x30,0x16},
{"eng ",0x33,0x16},
{"i ",0x3C,0x16},
{"ian ",0x5B,0x16},
{"iao ",0x6C,0x16},
{"ie ",0x79,0x16},
{"ing ",0x80,0x16},
{"ong ",0x95,0x16},
{"ou ",0xB0,0x16},
{"u ",0xB9,0x16},
{"uan ",0xD0,0x16},
{"ui ",0xD5,0x16},
{"un ",0xE2,0x16},
{"uo ",0xEB,0x16}};
unsigned char code PY_index_w[][8]={
{"a ",0x02,0x17},
{"ai ",0x11,0x17},
{"an ",0x16,0x17},
{"ang ",0x39,0x17},
{"ei ",0x4E,0x17},
{"en ",0x91,0x17},
{"eng ",0xA6,0x17},
{"o ",0xAD,0x17},
{"u ",0xC0,0x17}};
unsigned char code PY_index_x[][8]={
{"i ",0xFB,0x17},
{"ia ",0x40,0x18},
{"ian ",0x59,0x18},
{"iang ",0x90,0x18},
{"iao ",0xB9,0x18},
{"ie ",0xDC,0x18},
{"in ",0x05,0x19},
{"ing ",0x1A,0x19},
{"iong ",0x37,0x19},
{"iu ",0x46,0x19},
{"u ",0x5B,0x19},
{"uan ",0x82,0x19},
{"ue ",0x97,0x19},
{"un ",0xA6,0x19}};
unsigned char code PY_index_y[][8]={
{"a ",0xC3,0x19},
{"an ",0xE4,0x19},
{"ang ",0x27,0x1A},
{"ao ",0x4A,0x1A},
{"e ",0x6D,0x1A},
{"i ",0x8C,0x1A},
{"in ",0xF7,0x1A},
{"ing",0x18,0x1B},
{"o ",0x3D,0x1B},
{"ong ",0x40,0x1B},
{"ou ",0x5F,0x1B},
{"u ",0x88,0x1B},
{"uan ",0xE1,0x1B},
{"ue ",0x0A,0x1C},
{"un ",0x1D,0x1C}};
unsigned char code PY_index_z[][8]={
{"a ",0x36,0x1C},
{"ai ",0x3F,0x1C},
{"an ",0x50,0x1C},
{"ang ",0x59,0x1C},
{"ao ",0x60,0x1C},
{"e ",0x7D,0x1C},
{"ei ",0x86,0x1C},
{"en ",0x89,0x1C},
{"eng ",0x8C,0x1C},
{"ha ",0x93,0x1C},
{"hai ",0xAE,0x1C},
{"han ",0xBD,0x1C},
{"hang ",0xE0,0x1C},
{"hao ",0x01,0x1D},
{"he ",0x18,0x1D},
{"hen ",0x2F,0x1D},
{"heng ",0x52,0x1D},
{"hi ",0x6F,0x1D},
{"hong ",0xC6,0x1D},
{"hou ",0xDD,0x1D},
{"hu ",0xFA,0x1D},
{"hua ",0x2F,0x1E},
{"huai ",0x32,0x1E},
{"huan ",0x35,0x1E},
{"huang",0x40,0x1E},
{"hui ",0x51,0x1E},
{"hun ",0x5E,0x1E},
{"huo ",0x63,0x1E},
{"i ",0x78,0x1E},
{"ong ",0x95,0x1E},
{"ou ",0xA4,0x1E},
{"u ",0xAD,0x1E},
{"uan ",0xBE,0x1E},
{"ui ",0xC5,0x1E},
{"un ",0xCE,0x1E},
{"uo ",0xD3,0x1E}};
unsigned char code PY_index_end[][8]={" ",0,0};
//=====================================================================//变量声明
unsigned int code py_mb_begin=(unsigned int)&PY_mb_a[0];
unsigned char code (* code PY_index_pointer[27])[8]={
PY_index_a,PY_index_b,PY_index_c,PY_index_d,PY_index_e,PY_index_f,PY_index_g,PY_index_h,
PY_index_j,PY_index_j,PY_index_k,PY_index_l,PY_index_m,PY_index_n,PY_index_o,PY_index_p,
PY_index_q,PY_index_r,PY_index_s,PY_index_t,PY_index_w,PY_index_w,PY_index_w,PY_index_x,
PY_index_y,PY_index_z,PY_index_end};
// 函数声明
//"拼音输入法杳询函数,input_py为已输入的拼音码,反
//回值为中文的起始地址,当为0时,杳询失败"
unsigned char code * py_ime(unsigned char input_py_val[]);
//主程序
unsigned char code * py_ime(unsigned char input_py_val[])
{
unsigned char code (* xdata p1)[8],(* xdata p2)[8],(* xdata p3)[8];
unsigned char xdata i=1;
if (input_py_val[0]==0) return(0); //"如果输入空字符返回0"
if (input_py_val[0]=='i') return(0);
if (input_py_val[0]=='u') return(0);
if (input_py_val[0]=='v') return(0);
p1=p2=PY_index_pointer[input_py_val[0]-0x61]; //"计算入口树根"
p3=PY_index_pointer[input_py_val[0]-0x60]; //"设置指针界限"
if (p1==0) return(0); //"查询失败返回0"
while (p1<p3) if ((*p1)[0]==input_py_val[1]) {p2=p1;break;} else p1++;
//"查询第二个拼音"
p1=p2;
while (p1<p3) //"阶梯法查询余下拼音"
if (((*p1)[i]==input_py_val[i+1])&&((*p1)[i-1]==input_py_val[i]))
{
p2=p1;
i++;
}
else p1++;
return((unsigned char code *)((*p2)[6]+(*p2)[7]*256+py_mb_begin));
//"返回查询结果首地址"
}
不知道 哪位前辈有时间 给我 大框的讲讲 这个是怎么运行的..看了半天还是没看通..谢谢..(字码查询被删了一部分..全写太大了..) |