📄 pytable.h
字号:
#define KB_ERROR 1
#define KB_OK 0
typedef struct py_record
{ char yinjie[8];
char first_hz[4];
int count;
} py_record_t;
struct
{ int volume;
py_record_t *node;
} pytable[26];
int init_pytable();
int remv_pytable();
char * lookup_pytable(char *slable);
int init_pytable()
// initial PINYIN look_up_table
{
pytable[ 0].volume= 5; // a
pytable[ 1].volume=16; // b
pytable[ 2].volume=33; // c
pytable[ 3].volume=20; // d
pytable[ 4].volume= 3; // e
pytable[ 5].volume= 9; // f
pytable[ 6].volume=19; // g
pytable[ 7].volume=19; // h
pytable[ 8].volume= 0; // i
pytable[ 9].volume=14; // j
pytable[10].volume=17; // k
pytable[11].volume=24; // l
pytable[12].volume=19; // m
pytable[13].volume=23; // n
pytable[14].volume= 2; // o
pytable[15].volume=17; // p
pytable[16].volume=14; // q
pytable[17].volume=14; // r
pytable[18].volume=34; // s
pytable[19].volume=19; // t
pytable[20].volume= 0; // u
pytable[21].volume= 0; // v
pytable[22].volume= 9; // w
pytable[23].volume=14; // x
pytable[24].volume=15; // y
pytable[25].volume=36; // z
int i,nodesize;
for(i=0;i<26;i++)
{ nodesize=pytable[i].volume*sizeof(py_record_t);
pytable[i].node=(py_record_t *)malloc(nodesize);
if (pytable[i].node==NULL) return KB_ERROR;
memset(pytable[i].node,0,nodesize);
}
// a
strcpy(pytable[0].node[0].yinjie,"a");
strcpy(pytable[0].node[0].first_hz,"啊");
pytable[0].node[0].count=2;
strcpy(pytable[0].node[1].yinjie,"ai");
strcpy(pytable[0].node[1].first_hz,"埃");
pytable[0].node[1].count=13;
strcpy(pytable[0].node[2].yinjie,"an");
strcpy(pytable[0].node[2].first_hz,"鞍");
pytable[0].node[2].count=9;
strcpy(pytable[0].node[3].yinjie,"ang");
strcpy(pytable[0].node[3].first_hz,"肮");
pytable[0].node[3].count=3;
strcpy(pytable[0].node[4].yinjie,"ao");
strcpy(pytable[0].node[4].first_hz,"凹");
pytable[0].node[4].count=9;
// b
strcpy(pytable[1].node[0].yinjie,"ba");
strcpy(pytable[1].node[0].first_hz,"芭");
pytable[1].node[0].count=18;
strcpy(pytable[1].node[1].yinjie,"bai");
strcpy(pytable[1].node[1].first_hz,"白");
pytable[1].node[1].count=8;
strcpy(pytable[1].node[2].yinjie,"ban");
strcpy(pytable[1].node[2].first_hz,"斑");
pytable[1].node[2].count=15;
strcpy(pytable[1].node[3].yinjie,"bang");
strcpy(pytable[1].node[3].first_hz,"邦");
pytable[1].node[3].count=12;
strcpy(pytable[1].node[4].yinjie,"bao");
strcpy(pytable[1].node[4].first_hz,"苞");
pytable[1].node[4].count=17;
strcpy(pytable[1].node[5].yinjie,"bei");
strcpy(pytable[1].node[5].first_hz,"杯");
pytable[1].node[5].count=15;
strcpy(pytable[1].node[6].yinjie,"ben");
strcpy(pytable[1].node[6].first_hz,"奔");
pytable[1].node[6].count=4;
strcpy(pytable[1].node[7].yinjie,"beng");
strcpy(pytable[1].node[7].first_hz,"崩");
pytable[1].node[7].count=6;
strcpy(pytable[1].node[8].yinjie,"bi");
strcpy(pytable[1].node[8].first_hz,"逼");
pytable[1].node[8].count=24;
strcpy(pytable[1].node[9].yinjie,"bian");
strcpy(pytable[1].node[9].first_hz,"鞭");
pytable[1].node[9].count=12;
strcpy(pytable[1].node[10].yinjie,"biao");
strcpy(pytable[1].node[10].first_hz,"标");
pytable[1].node[10].count=4;
strcpy(pytable[1].node[11].yinjie,"bie");
strcpy(pytable[1].node[11].first_hz,"鳖");
pytable[1].node[11].count=4;
strcpy(pytable[1].node[12].yinjie,"bin");
strcpy(pytable[1].node[12].first_hz,"彬");
pytable[1].node[12].count=6;
strcpy(pytable[1].node[13].yinjie,"bing");
strcpy(pytable[1].node[13].first_hz,"兵");
pytable[1].node[13].count=9;
strcpy(pytable[1].node[14].yinjie,"bo");
strcpy(pytable[1].node[14].first_hz,"玻");
pytable[1].node[14].count=19;
strcpy(pytable[1].node[15].yinjie,"bu");
strcpy(pytable[1].node[15].first_hz,"捕");
pytable[1].node[15].count=11;
// c
strcpy(pytable[2].node[0].yinjie,"ca");
strcpy(pytable[2].node[0].first_hz,"擦");
pytable[2].node[0].count=1;
strcpy(pytable[2].node[1].yinjie,"cai");
strcpy(pytable[2].node[1].first_hz,"猜");
pytable[2].node[1].count=11;
strcpy(pytable[2].node[2].yinjie,"can");
strcpy(pytable[2].node[2].first_hz,"餐");
pytable[2].node[2].count=7;
strcpy(pytable[2].node[3].yinjie,"cang");
strcpy(pytable[2].node[3].first_hz,"苍");
pytable[2].node[3].count=5;
strcpy(pytable[2].node[4].yinjie,"cao");
strcpy(pytable[2].node[4].first_hz,"操");
pytable[2].node[4].count=5;
strcpy(pytable[2].node[5].yinjie,"ce");
strcpy(pytable[2].node[5].first_hz,"厕");
pytable[2].node[5].count=5;
strcpy(pytable[2].node[6].yinjie,"ceng");
strcpy(pytable[2].node[6].first_hz,"层");
pytable[2].node[6].count=2;
strcpy(pytable[2].node[7].yinjie,"cha");
strcpy(pytable[2].node[7].first_hz,"插");
pytable[2].node[7].count=11;
strcpy(pytable[2].node[8].yinjie,"chai");
strcpy(pytable[2].node[8].first_hz,"拆");
pytable[2].node[8].count=3;
strcpy(pytable[2].node[9].yinjie,"chan");
strcpy(pytable[2].node[9].first_hz,"搀");
pytable[2].node[9].count=10;
strcpy(pytable[2].node[10].yinjie,"chang");
strcpy(pytable[2].node[10].first_hz,"昌");
pytable[2].node[10].count=13;
strcpy(pytable[2].node[11].yinjie,"chao");
strcpy(pytable[2].node[11].first_hz,"超");
pytable[2].node[11].count=9;
strcpy(pytable[2].node[12].yinjie,"che");
strcpy(pytable[2].node[12].first_hz,"车");
pytable[2].node[12].count=6;
strcpy(pytable[2].node[13].yinjie,"chen");
strcpy(pytable[2].node[13].first_hz,"郴");
pytable[2].node[13].count=10;
strcpy(pytable[2].node[14].yinjie,"cheng");
strcpy(pytable[2].node[14].first_hz,"撑");
pytable[2].node[14].count=15;
strcpy(pytable[2].node[15].yinjie,"chi");
strcpy(pytable[2].node[15].first_hz,"吃");
pytable[2].node[15].count=16;
strcpy(pytable[2].node[16].yinjie,"chong");
strcpy(pytable[2].node[16].first_hz,"充");
pytable[2].node[16].count=5;
strcpy(pytable[2].node[17].yinjie,"chou");
strcpy(pytable[2].node[17].first_hz,"抽");
pytable[2].node[17].count=12;
strcpy(pytable[2].node[18].yinjie,"chu");
strcpy(pytable[2].node[18].first_hz,"初");
pytable[2].node[18].count=16;
strcpy(pytable[2].node[19].yinjie,"chuai");
strcpy(pytable[2].node[19].first_hz,"揣");
pytable[2].node[19].count=1;
strcpy(pytable[2].node[20].yinjie,"chuan");
strcpy(pytable[2].node[20].first_hz,"川");
pytable[2].node[20].count=7;
strcpy(pytable[2].node[21].yinjie,"chuang");
strcpy(pytable[2].node[21].first_hz,"疮");
pytable[2].node[21].count=6;
strcpy(pytable[2].node[22].yinjie,"chui");
strcpy(pytable[2].node[22].first_hz,"吹");
pytable[2].node[22].count=5;
strcpy(pytable[2].node[23].yinjie,"chun");
strcpy(pytable[2].node[23].first_hz,"春");
pytable[2].node[23].count=7;
strcpy(pytable[2].node[24].yinjie,"chuo");
strcpy(pytable[2].node[24].first_hz,"戳");
pytable[2].node[24].count=2;
strcpy(pytable[2].node[25].yinjie,"ci");
strcpy(pytable[2].node[25].first_hz,"疵");
pytable[2].node[25].count=12;
strcpy(pytable[2].node[26].yinjie,"cong");
strcpy(pytable[2].node[26].first_hz,"聪");
pytable[2].node[26].count=6;
strcpy(pytable[2].node[27].yinjie,"cou");
strcpy(pytable[2].node[27].first_hz,"凑");
pytable[2].node[27].count=1;
strcpy(pytable[2].node[28].yinjie,"cu");
strcpy(pytable[2].node[28].first_hz,"粗");
pytable[2].node[28].count=4;
strcpy(pytable[2].node[29].yinjie,"cuan");
strcpy(pytable[2].node[29].first_hz,"蹿");
pytable[2].node[29].count=3;
strcpy(pytable[2].node[30].yinjie,"cui");
strcpy(pytable[2].node[30].first_hz,"摧");
pytable[2].node[30].count=8;
strcpy(pytable[2].node[31].yinjie,"cun");
strcpy(pytable[2].node[31].first_hz,"村");
pytable[2].node[31].count=3;
strcpy(pytable[2].node[32].yinjie,"cuo");
strcpy(pytable[2].node[32].first_hz,"磋");
pytable[2].node[32].count=6;
// d
strcpy(pytable[3].node[0].yinjie,"da");
strcpy(pytable[3].node[0].first_hz,"搭");
pytable[3].node[0].count=6;
strcpy(pytable[3].node[1].yinjie,"dai");
strcpy(pytable[3].node[1].first_hz,"呆");
pytable[3].node[1].count=12;
strcpy(pytable[3].node[2].yinjie,"dan");
strcpy(pytable[3].node[2].first_hz,"耽");
pytable[3].node[2].count=15;
strcpy(pytable[3].node[3].yinjie,"dang");
strcpy(pytable[3].node[3].first_hz,"当");
pytable[3].node[3].count=5;
strcpy(pytable[3].node[4].yinjie,"dao");
strcpy(pytable[3].node[4].first_hz,"刀");
pytable[3].node[4].count=12;
strcpy(pytable[3].node[5].yinjie,"de");
strcpy(pytable[3].node[5].first_hz,"德");
pytable[3].node[5].count=3;
strcpy(pytable[3].node[6].yinjie,"deng");
strcpy(pytable[3].node[6].first_hz,"蹬");
pytable[3].node[6].count=7;
strcpy(pytable[3].node[7].yinjie,"di");
strcpy(pytable[3].node[7].first_hz,"堤");
pytable[3].node[7].count=19;
strcpy(pytable[3].node[8].yinjie,"dian");
strcpy(pytable[3].node[8].first_hz,"颠");
pytable[3].node[8].count=16;
strcpy(pytable[3].node[9].yinjie,"diao");
strcpy(pytable[3].node[9].first_hz,"碉");
pytable[3].node[9].count=9;
strcpy(pytable[3].node[10].yinjie,"die");
strcpy(pytable[3].node[10].first_hz,"跌");
pytable[3].node[10].count=7;
strcpy(pytable[3].node[11].yinjie,"ding");
strcpy(pytable[3].node[11].first_hz,"丁");
pytable[3].node[11].count=9;
strcpy(pytable[3].node[12].yinjie,"diu");
strcpy(pytable[3].node[12].first_hz,"丢");
pytable[3].node[12].count=1;
strcpy(pytable[3].node[13].yinjie,"dong");
strcpy(pytable[3].node[13].first_hz,"东");
pytable[3].node[13].count=10;
strcpy(pytable[3].node[14].yinjie,"dou");
strcpy(pytable[3].node[14].first_hz,"兜");
pytable[3].node[14].count=7;
strcpy(pytable[3].node[15].yinjie,"du");
strcpy(pytable[3].node[15].first_hz,"都");
pytable[3].node[15].count=15;
strcpy(pytable[3].node[16].yinjie,"duan");
strcpy(pytable[3].node[16].first_hz,"端");
pytable[3].node[16].count=6;
strcpy(pytable[3].node[17].yinjie,"dui");
strcpy(pytable[3].node[17].first_hz,"堆");
pytable[3].node[17].count=4;
strcpy(pytable[3].node[18].yinjie,"dun");
strcpy(pytable[3].node[18].first_hz,"墩");
pytable[3].node[18].count=9;
strcpy(pytable[3].node[19].yinjie,"duo");
strcpy(pytable[3].node[19].first_hz,"掇");
pytable[3].node[19].count=12;
// e
strcpy(pytable[4].node[0].yinjie,"e");
strcpy(pytable[4].node[0].first_hz,"蛾");
pytable[4].node[0].count=13;
strcpy(pytable[4].node[1].yinjie,"en");
strcpy(pytable[4].node[1].first_hz,"恩");
pytable[4].node[1].count=1;
strcpy(pytable[4].node[2].yinjie,"er");
strcpy(pytable[4].node[2].first_hz,"而");
pytable[4].node[2].count=8;
// f
strcpy(pytable[5].node[0].yinjie,"fa");
strcpy(pytable[5].node[0].first_hz,"发");
pytable[5].node[0].count=8;
strcpy(pytable[5].node[1].yinjie,"fan");
strcpy(pytable[5].node[1].first_hz,"藩");
pytable[5].node[1].count=17;
strcpy(pytable[5].node[2].yinjie,"fang");
strcpy(pytable[5].node[2].first_hz,"坊");
pytable[5].node[2].count=11;
strcpy(pytable[5].node[3].yinjie,"fei");
strcpy(pytable[5].node[3].first_hz,"菲");
pytable[5].node[3].count=12;
strcpy(pytable[5].node[4].yinjie,"fen");
strcpy(pytable[5].node[4].first_hz,"芬");
pytable[5].node[4].count=15;
strcpy(pytable[5].node[5].yinjie,"feng");
strcpy(pytable[5].node[5].first_hz,"丰");
pytable[5].node[5].count=15;
strcpy(pytable[5].node[6].yinjie,"fo");
strcpy(pytable[5].node[6].first_hz,"佛");
pytable[5].node[6].count=1;
strcpy(pytable[5].node[7].yinjie,"fou");
strcpy(pytable[5].node[7].first_hz,"否");
pytable[5].node[7].count=1;
strcpy(pytable[5].node[8].yinjie,"fu");
strcpy(pytable[5].node[8].first_hz,"夫");
pytable[5].node[8].count=45;
// g
strcpy(pytable[6].node[0].yinjie,"ga");
strcpy(pytable[6].node[0].first_hz,"噶");
pytable[6].node[0].count=2;
strcpy(pytable[6].node[1].yinjie,"gai");
strcpy(pytable[6].node[1].first_hz,"该");
pytable[6].node[1].count=6;
strcpy(pytable[6].node[2].yinjie,"gan");
strcpy(pytable[6].node[2].first_hz,"干");
pytable[6].node[2].count=11;
strcpy(pytable[6].node[3].yinjie,"gang");
strcpy(pytable[6].node[3].first_hz,"冈");
pytable[6].node[3].count=9;
strcpy(pytable[6].node[4].yinjie,"gao");
strcpy(pytable[6].node[4].first_hz,"篙");
pytable[6].node[4].count=10;
strcpy(pytable[6].node[5].yinjie,"ge");
strcpy(pytable[6].node[5].first_hz,"哥");
pytable[6].node[5].count=17;
strcpy(pytable[6].node[6].yinjie,"gei");
strcpy(pytable[6].node[6].first_hz,"给");
pytable[6].node[6].count=1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -