Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/* vim:set et ts=4 sts=4:
*
* ibus-pinyin - The Chinese PinYin engine for IBus
*
* Copyright (c) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __TYPES_H_
#define __TYPES_H_
#include <glib.h>
namespace PyZy {
#define PINYIN_ID_VOID (-1)
#define PINYIN_ID_ZERO (0)
#define PINYIN_ID_B (1)
#define PINYIN_ID_C (2)
#define PINYIN_ID_CH (3)
#define PINYIN_ID_D (4)
#define PINYIN_ID_F (5)
#define PINYIN_ID_G (6)
#define PINYIN_ID_H (7)
#define PINYIN_ID_J (8)
#define PINYIN_ID_K (9)
#define PINYIN_ID_L (10)
#define PINYIN_ID_M (11)
#define PINYIN_ID_N (12)
#define PINYIN_ID_P (13)
#define PINYIN_ID_Q (14)
#define PINYIN_ID_R (15)
#define PINYIN_ID_S (16)
#define PINYIN_ID_SH (17)
#define PINYIN_ID_T (18)
#define PINYIN_ID_W (19)
#define PINYIN_ID_X (20)
#define PINYIN_ID_Y (21)
#define PINYIN_ID_Z (22)
#define PINYIN_ID_ZH (23)
#define PINYIN_ID_A (24)
#define PINYIN_ID_AI (25)
#define PINYIN_ID_AN (26)
#define PINYIN_ID_ANG (27)
#define PINYIN_ID_AO (28)
#define PINYIN_ID_E (29)
#define PINYIN_ID_EI (30)
#define PINYIN_ID_EN (31)
#define PINYIN_ID_ENG (32)
#define PINYIN_ID_ER (33)
#define PINYIN_ID_I (34)
#define PINYIN_ID_IA (35)
#define PINYIN_ID_IAN (36)
#define PINYIN_ID_IANG (37)
#define PINYIN_ID_IAO (38)
#define PINYIN_ID_IE (39)
#define PINYIN_ID_IN (40)
#define PINYIN_ID_ING (41)
#define PINYIN_ID_IONG (42)
#define PINYIN_ID_IU (43)
#define PINYIN_ID_O (44)
#define PINYIN_ID_ONG (45)
#define PINYIN_ID_OU (46)
#define PINYIN_ID_U (47)
#define PINYIN_ID_UA (48)
#define PINYIN_ID_UAI (49)
#define PINYIN_ID_UAN (50)
#define PINYIN_ID_UANG (51)
#define PINYIN_ID_UE (52)
#define PINYIN_ID_VE PINYIN_ID_UE
#define PINYIN_ID_UI (53)
#define PINYIN_ID_UN (54)
#define PINYIN_ID_UO (55)
#define PINYIN_ID_V (56)
#define PINYIN_ID_NG PINYIN_ID_VOID
#define PINYIN_INCOMPLETE_PINYIN (1U << 0)
#define PINYIN_CORRECT_GN_TO_NG (1U << 1)
#define PINYIN_CORRECT_MG_TO_NG (1U << 2)
#define PINYIN_CORRECT_IOU_TO_IU (1U << 3)
#define PINYIN_CORRECT_UEI_TO_UI (1U << 4)
#define PINYIN_CORRECT_UEN_TO_UN (1U << 5)
#define PINYIN_CORRECT_UE_TO_VE (1U << 6)
#define PINYIN_CORRECT_V_TO_U (1U << 7)
#define PINYIN_CORRECT_ON_TO_ONG (1U << 8)
#define PINYIN_CORRECT_ALL (0x000001fe)
#define PINYIN_FUZZY_C_CH (1U << 9)
#define PINYIN_FUZZY_CH_C (1U << 10)
#define PINYIN_FUZZY_Z_ZH (1U << 11)
#define PINYIN_FUZZY_ZH_Z (1U << 12)
#define PINYIN_FUZZY_S_SH (1U << 13)
#define PINYIN_FUZZY_SH_S (1U << 14)
#define PINYIN_FUZZY_L_N (1U << 15)
#define PINYIN_FUZZY_N_L (1U << 16)
#define PINYIN_FUZZY_F_H (1U << 17)
#define PINYIN_FUZZY_H_F (1U << 18)
#define PINYIN_FUZZY_L_R (1U << 19)
#define PINYIN_FUZZY_R_L (1U << 20)
#define PINYIN_FUZZY_K_G (1U << 21)
#define PINYIN_FUZZY_G_K (1U << 22)
#define PINYIN_FUZZY_AN_ANG (1U << 23)
#define PINYIN_FUZZY_ANG_AN (1U << 24)
#define PINYIN_FUZZY_EN_ENG (1U << 25)
#define PINYIN_FUZZY_ENG_EN (1U << 26)
#define PINYIN_FUZZY_IN_ING (1U << 27)
#define PINYIN_FUZZY_ING_IN (1U << 28)
#define PINYIN_FUZZY_IAN_IANG PINYIN_FUZZY_AN_ANG
#define PINYIN_FUZZY_IANG_IAN PINYIN_FUZZY_ANG_AN
#define PINYIN_FUZZY_UAN_UANG PINYIN_FUZZY_AN_ANG
#define PINYIN_FUZZY_UANG_UAN PINYIN_FUZZY_ANG_AN
#define PINYIN_FUZZY_ALL (0x1ffffe00)
struct Pinyin {
const gchar *text;
const wchar_t *bopomofo;
const gchar *sheng;
const gchar *yun;
struct {
guint8 sheng;
guint8 yun;
} pinyin_id[3];
const guint len;
const guint flags;
};
#define MAX_UTF8_LEN 6
#define MAX_PHRASE_LEN 16
}; // namespace PyZy
#endif // __TYPES_H_