~ubuntu-branches/ubuntu/raring/sunpinyin/raring

« back to all changes in this revision

Viewing changes to src/pinyin/shuangpin_data.cpp

  • Committer: Package Import Robot
  • Author(s): YunQiang Su
  • Date: 2012-03-30 15:31:55 UTC
  • mfrom: (1.1.3) (1.2.7 sid)
  • Revision ID: package-import@ubuntu.com-20120330153155-qgls77sogzgtg9zp
Tags: 2.0.3+git20120222-1
* Team upload: git snapshot 20120222.
   - fix breaks if LDFLAGS in environment contains
       multiple words (Closese #646001).
   - rm patches merged to upstream:
       append-os-environ-toenv.patch
       fix-ftbfs-on-sh.patch
       remove-10-candidate-words-limitation.patch
   - refresh disable-lm-dict-compile.patch.
* Bump stardard version to 3.9.3: no modify needed.
* add libsunpinyin3-dbg and python-sunpinyin packages.
* debian/compat to 9, multiarch it.
* rewrite debian/rules with dh 7 format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 
 * 
 
3
 *
4
4
 * Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
5
 
 * 
 
5
 *
6
6
 * The contents of this file are subject to the terms of either the GNU Lesser
7
7
 * General Public License Version 2.1 only ("LGPL") or the Common Development and
8
8
 * Distribution License ("CDDL")(collectively, the "License"). You may not use this
9
9
 * file except in compliance with the License. You can obtain a copy of the CDDL at
10
10
 * http://www.opensource.org/licenses/cddl1.php and a copy of the LGPLv2.1 at
11
 
 * http://www.opensource.org/licenses/lgpl-license.php. See the License for the 
 
11
 * http://www.opensource.org/licenses/lgpl-license.php. See the License for the
12
12
 * specific language governing permissions and limitations under the License. When
13
13
 * distributing the software, include this License Header Notice in each file and
14
14
 * include the full text of the License in the License file as well as the
15
15
 * following notice:
16
 
 * 
 
16
 *
17
17
 * NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
18
18
 * (CDDL)
19
19
 * For Covered Software in this distribution, this License shall be governed by the
21
21
 * Any litigation relating to this License shall be subject to the jurisdiction of
22
22
 * the Federal Courts of the Northern District of California and the state courts
23
23
 * of the State of California, with venue lying in Santa Clara County, California.
24
 
 * 
 
24
 *
25
25
 * Contributor(s):
26
 
 * 
 
26
 *
27
27
 * If you wish your version of this file to be governed by only the CDDL or only
28
28
 * the LGPL Version 2.1, indicate your decision by adding "[Contributor]" elects to
29
29
 * include this software in this distribution under the [CDDL or LGPL Version 2.1]
32
32
 * Version 2.1, or to extend the choice of license to its licensees as provided
33
33
 * above. However, if you add LGPL Version 2.1 code and therefore, elected the LGPL
34
34
 * Version 2 license, then the option applies only if the new code is made subject
35
 
 * to such option by the copyright holder. 
 
35
 * to such option by the copyright holder.
36
36
 */
37
37
 
38
38
#include <stdio.h>
49
49
#define FINAL_NUM   34
50
50
#define ZEROINITIAL_NUM 12
51
51
 
52
 
static const char *initials[INITIAL_NUM] = {"", "", "", "b", "p", "m", "f", "d", "t", "n", "l", 
53
 
    "g", "k", "h", "j", "q", "x", "zh", "ch", "sh", "r", "z", "c", "s", "y", "w", };
 
52
static const char *initials[INITIAL_NUM] =
 
53
{ "", "", "", "b", "p", "m", "f", "d", "t", "n", "l",
 
54
  "g", "k", "h", "j", "q", "x", "zh",
 
55
  "ch", "sh", "r", "z", "c", "s", "y", "w", };
54
56
 
55
 
static const char *finals[FINAL_NUM] = {"", "a", "o", "e", "ai", "ei", "ao",
56
 
    "ou", "an", "en", "ang", "eng", "er", "i", "ia", "ie", "iao", "iu", "ian", "in", "iang", "ing", "u",
57
 
    "ua", "uo", "uai", "ui", "uan", "un", "uang", "ong", "v", "ue", "iong", };
 
57
static const char *finals[FINAL_NUM] = { "", "a", "o", "e", "ai", "ei", "ao",
 
58
                                         "ou", "an", "en", "ang", "eng", "er",
 
59
                                         "i", "ia", "ie", "iao", "iu", "ian",
 
60
                                         "in", "iang", "ing", "u",
 
61
                                         "ua", "uo", "uai", "ui", "uan", "un",
 
62
                                         "uang", "ong", "v", "ue", "iong", };
58
63
 
59
64
 
60
65
//MS2003 shuangpin plan map table
61
 
static const char ms2003_mapinitials[INITIAL_NUM] = {'\0', '\0', 'o', 'b', 'p', 'm', 'f', 'd',
62
 
    't', 'n', 'l', 'g', 'k', 'h', 'j', 'q', 'x', 'v', 'i', 'u', 'r', 'z', 'c', 's',
63
 
    'y', 'w', };
 
66
static const char ms2003_mapinitials[INITIAL_NUM] =
 
67
{ '\0', '\0', 'o', 'b', 'p', 'm', 'f', 'd',
 
68
  't', 'n', 'l', 'g', 'k',
 
69
  'h', 'j', 'q', 'x', 'v', 'i', 'u', 'r', 'z', 'c', 's',
 
70
  'y', 'w', };
64
71
 
65
 
static const char ms2003_mapfinals[FINAL_NUM] = {'\0', 'a', 'o', 'e', 'l', 'z', 'k',
66
 
    'b', 'j', 'f', 'h', 'g', 'r', 'i', 'w', 'x', 'c', 'q', 'm', 'n', 'd', ';', 'u',
67
 
    'w', 'o', 'y', 'v', 'r', 'p', 'd', 's', 'v', 't', 's', };
 
72
static const char ms2003_mapfinals[FINAL_NUM] =
 
73
{ '\0', 'a', 'o', 'e', 'l', 'z', 'k',
 
74
  'b', 'j', 'f', 'h', 'g', 'r',
 
75
  'i', 'w', 'x', 'c', 'q', 'm', 'n', 'd', ';', 'u',
 
76
  'w', 'o', 'y', 'v', 'r', 'p',
 
77
  'd', 's', 'v', 't', 's', };
68
78
 
69
79
static TZeroInitial ms2003_zeroinitials[] = {
70
 
    {"a"   , "oa"},
71
 
    {"ai"  , "ol"},
72
 
    {"an"  , "oj"},
73
 
    {"ang" , "oh"},
74
 
    {"ao"  , "ok"},
75
 
    {"e"   , "oe"},
76
 
    {"ei"  , "oz"},
77
 
    {"en"  , "of"},
78
 
    {"eng" , "og"},
79
 
    {"er"  , "or"},
80
 
    {"o"   , "oo"},
81
 
    {"ou"  , "ob"},
 
80
    { "a", "oa" },
 
81
    { "ai", "ol" },
 
82
    { "an", "oj" },
 
83
    { "ang", "oh" },
 
84
    { "ao", "ok" },
 
85
    { "e", "oe" },
 
86
    { "ei", "oz" },
 
87
    { "en", "of" },
 
88
    { "eng", "og" },
 
89
    { "er", "or" },
 
90
    { "o", "oo" },
 
91
    { "ou", "ob" },
82
92
};
83
93
 
84
94
 
85
95
//ZhiNengABC shuangpin plan map table
86
 
static const char abc_mapinitials[INITIAL_NUM] = {'\0', '\0', 'o', 'b', 'p', 'm', 'f', 'd', 
87
 
    't', 'n', 'l', 'g', 'k', 'h', 'j', 'q', 'x', 'a', 'e', 'v', 'r', 'z', 'c', 's', 
88
 
    'y', 'w', };
 
96
static const char abc_mapinitials[INITIAL_NUM] =
 
97
{ '\0', '\0', 'o', 'b', 'p', 'm', 'f', 'd',
 
98
  't', 'n', 'l', 'g', 'k', 'h',
 
99
  'j', 'q', 'x', 'a', 'e', 'v', 'r', 'z', 'c', 's',
 
100
  'y', 'w', };
89
101
 
90
 
static const char abc_mapfinals[FINAL_NUM] = {'\0', 'a', 'o', 'e', 'l', 'q', 'k',
91
 
    'b', 'j', 'f', 'h', 'g', 'r', 'i', 'd', 'x', 'z', 'r', 'w', 'c', 't', 'y', 'u', 
92
 
    'd', 'o', 'c', 'm', 'p', 'n', 't', 's', 'v', 'm', 's', };
 
102
static const char abc_mapfinals[FINAL_NUM] =
 
103
{ '\0', 'a', 'o', 'e', 'l', 'q', 'k',
 
104
  'b', 'j', 'f', 'h', 'g', 'r',
 
105
  'i', 'd', 'x', 'z', 'r', 'w', 'c', 't', 'y', 'u',
 
106
  'd', 'o', 'c', 'm', 'p', 'n',
 
107
  't', 's', 'v', 'm', 's', };
93
108
 
94
109
static TZeroInitial abc_zeroinitials[] = {
95
 
    {"a"   , "oa"},
96
 
    {"ai"  , "ol"},
97
 
    {"an"  , "oj"},
98
 
    {"ang" , "oh"},
99
 
    {"ao"  , "ok"},
100
 
    {"e"   , "oe"},
101
 
    {"ei"  , "oq"},
102
 
    {"en"  , "of"},
103
 
    {"eng" , "og"},
104
 
    {"er"  , "or"},
105
 
    {"o"   , "oo"},
106
 
    {"ou"  , "ob"},
 
110
    { "a", "oa" },
 
111
    { "ai", "ol" },
 
112
    { "an", "oj" },
 
113
    { "ang", "oh" },
 
114
    { "ao", "ok" },
 
115
    { "e", "oe" },
 
116
    { "ei", "oq" },
 
117
    { "en", "of" },
 
118
    { "eng", "og" },
 
119
    { "er", "or" },
 
120
    { "o", "oo" },
 
121
    { "ou", "ob" },
107
122
};
108
123
 
109
124
//ZiGuang shuangpin plan map table
110
 
static const char ziguang_mapinitials[INITIAL_NUM] = {'\0', '\0', 'o', 'b', 'p', 'm', 'f', 'd', 
111
 
    't', 'n', 'l', 'g', 'k', 'h', 'j', 'q', 'x', 'u', 'a', 'i', 'r', 'z', 'c', 's', 
112
 
    'y', 'w', };
 
125
static const char ziguang_mapinitials[INITIAL_NUM] =
 
126
{ '\0', '\0', 'o', 'b', 'p', 'm', 'f', 'd',
 
127
  't', 'n', 'l', 'g', 'k',
 
128
  'h', 'j', 'q', 'x', 'u', 'a', 'i', 'r', 'z', 'c', 's',
 
129
  'y', 'w', };
113
130
 
114
 
static const char ziguang_mapfinals[FINAL_NUM] = {'\0', 'a', 'o', 'e', 'p', 'k', 'q',
115
 
    'z', 'r', 'w', 's', 't', 'j', 'i', 'x', 'd', 'b', 'j', 'f', 'y', 'g', ';', 'u', 
116
 
    'x', 'o', 'y', 'n', 'l', 'm', 'g', 'h', 'v', 'n', 'h', };
 
131
static const char ziguang_mapfinals[FINAL_NUM] =
 
132
{ '\0', 'a', 'o', 'e', 'p', 'k', 'q',
 
133
  'z', 'r', 'w', 's', 't', 'j',
 
134
  'i', 'x', 'd', 'b', 'j', 'f', 'y', 'g', ';', 'u',
 
135
  'x', 'o', 'y', 'n', 'l', 'm',
 
136
  'g', 'h', 'v', 'n', 'h', };
117
137
 
118
138
static TZeroInitial ziguang_zeroinitials[] = {
119
 
    {"a"   , "oa"},
120
 
    {"ai"  , "op"},
121
 
    {"an"  , "or"},
122
 
    {"ang" , "os"},
123
 
    {"ao"  , "oq"},
124
 
    {"e"   , "oe"},
125
 
    {"ei"  , "ok"},
126
 
    {"en"  , "ow"},
127
 
    {"eng" , "ot"},
128
 
    {"er"  , "oj"},
129
 
    {"o"   , "oo"},
130
 
    {"ou"  , "oz"},
 
139
    { "a", "oa" },
 
140
    { "ai", "op" },
 
141
    { "an", "or" },
 
142
    { "ang", "os" },
 
143
    { "ao", "oq" },
 
144
    { "e", "oe" },
 
145
    { "ei", "ok" },
 
146
    { "en", "ow" },
 
147
    { "eng", "ot" },
 
148
    { "er", "oj" },
 
149
    { "o", "oo" },
 
150
    { "ou", "oz" },
131
151
};
132
152
 
133
153
//PinYinJiaJia shuangpin plan map table
134
 
static const char pyjiajia_mapinitials[INITIAL_NUM] = {'\0', '\0', 'o', 'b', 'p', 'm', 'f', 'd', 
135
 
    't', 'n', 'l', 'g', 'k', 'h', 'j', 'q', 'x', 'v', 'u', 'i', 'r', 'z', 'c', 's', 
136
 
    'y', 'w', };
 
154
static const char pyjiajia_mapinitials[INITIAL_NUM] =
 
155
{ '\0', '\0', 'o', 'b', 'p', 'm', 'f', 'd',
 
156
  't', 'n', 'l', 'g', 'k',
 
157
  'h', 'j', 'q', 'x', 'v', 'u', 'i', 'r', 'z', 'c', 's',
 
158
  'y', 'w', };
137
159
 
138
 
static const char pyjiajia_mapfinals[FINAL_NUM] = {'\0', 'a', 'o', 'e', 's', 'w', 'd',
139
 
    'p', 'f', 'r', 'g', 't', 'q', 'i', 'b', 'm', 'k', 'n', 'j', 'l', 'h', 'q', 'u', 
140
 
    'b', 'o', 'x', 'v', 'c', 'z', 'h', 'y', 'v', 'x', 'y', };
 
160
static const char pyjiajia_mapfinals[FINAL_NUM] =
 
161
{ '\0', 'a', 'o', 'e', 's', 'w', 'd',
 
162
  'p', 'f', 'r', 'g', 't',
 
163
  'q', 'i', 'b', 'm', 'k', 'n', 'j', 'l', 'h', 'q', 'u',
 
164
  'b', 'o', 'x', 'v', 'c',
 
165
  'z', 'h', 'y', 'v', 'x', 'y', };
141
166
 
142
167
static TZeroInitial pyjiajia_zeroinitials[] = {
143
 
    {"a"   , "oa"},
144
 
    {"ai"  , "os"},
145
 
    {"an"  , "of"},
146
 
    {"ang" , "og"},
147
 
    {"ao"  , "od"},
148
 
    {"e"   , "oe"},
149
 
    {"ei"  , "ow"},
150
 
    {"en"  , "or"},
151
 
    {"eng" , "ot"},
152
 
    {"er"  , "oq"},
153
 
    {"o"   , "oo"},
154
 
    {"ou"  , "op"},
 
168
    { "a", "oa" },
 
169
    { "ai", "os" },
 
170
    { "an", "of" },
 
171
    { "ang", "og" },
 
172
    { "ao", "od" },
 
173
    { "e", "oe" },
 
174
    { "ei", "ow" },
 
175
    { "en", "or" },
 
176
    { "eng", "ot" },
 
177
    { "er", "oq" },
 
178
    { "o", "oo" },
 
179
    { "ou", "op" },
155
180
};
156
181
 
157
182
//Ziranma shuangpin plan map table
158
 
static const char ziranma_mapinitials[INITIAL_NUM] = {'a', 'e', 'o', 'b', 'p', 'm', 'f', 'd', 
159
 
    't', 'n', 'l', 'g', 'k', 'h', 'j', 'q', 'x', 'v', 'i', 'u', 'r', 'z', 'c', 's', 
160
 
    'y', 'w', };
 
183
static const char ziranma_mapinitials[INITIAL_NUM] =
 
184
{ 'a', 'e', 'o', 'b', 'p', 'm', 'f', 'd',
 
185
  't', 'n', 'l', 'g', 'k',
 
186
  'h', 'j', 'q', 'x', 'v', 'i', 'u', 'r', 'z', 'c', 's',
 
187
  'y', 'w', };
161
188
 
162
 
static const char ziranma_mapfinals[FINAL_NUM] = {'\0', 'a', 'o', 'e', 'l', 'z', 'k',
163
 
    'b', 'j', 'f', 'h', 'g', '\0', 'i', 'w', 'x', 'c', 'q', 'm', 'n', 'd', 'y', 'u', 
164
 
    'w', 'o', 'y', 'v', 'r', 'p', 'd', 's', 'v', 't', 's', };
 
189
static const char ziranma_mapfinals[FINAL_NUM] =
 
190
{ '\0', 'a', 'o', 'e', 'l', 'z', 'k',
 
191
  'b', 'j', 'f', 'h', 'g',
 
192
  '\0', 'i', 'w', 'x', 'c', 'q', 'm', 'n', 'd', 'y', 'u',
 
193
  'w', 'o', 'y', 'v', 'r', 'p',
 
194
  'd', 's', 'v', 't', 's', };
165
195
 
166
196
static TZeroInitial ziranma_zeroinitials[] = {
167
 
    {"a"   , "aa"},
168
 
    {"ai"  , "ai"},
169
 
    {"an"  , "an"},
170
 
    {"ang" , "ah"},
171
 
    {"ao"  , "ao"},
172
 
    {"e"   , "ee"},
173
 
    {"ei"  , "ei"},
174
 
    {"en"  , "en"},
175
 
    {"eng" , "eg"},
176
 
    {"er"  , "er"},
177
 
    {"o"   , "oo"},
178
 
    {"ou"  , "ou"},
 
197
    { "a", "aa" },
 
198
    { "ai", "ai" },
 
199
    { "an", "an" },
 
200
    { "ang", "ah" },
 
201
    { "ao", "ao" },
 
202
    { "e", "ee" },
 
203
    { "ei", "ei" },
 
204
    { "en", "en" },
 
205
    { "eng", "eg" },
 
206
    { "er", "er" },
 
207
    { "o", "oo" },
 
208
    { "ou", "ou" },
179
209
};
180
210
 
181
211
//Ziranma shuangpin plan map table
182
 
static const char xiaohe_mapinitials[INITIAL_NUM] = {'a', 'e', 'o', 'b', 'p', 'm', 'f', 'd', 
183
 
    't', 'n', 'l', 'g', 'k', 'h', 'j', 'q', 'x', 'v', 'i', 'u', 'r', 'z', 'c', 's', 
184
 
    'y', 'w', };
 
212
static const char xiaohe_mapinitials[INITIAL_NUM] =
 
213
{ 'a', 'e', 'o', 'b', 'p', 'm', 'f', 'd',
 
214
  't', 'n', 'l', 'g', 'k',
 
215
  'h', 'j', 'q', 'x', 'v', 'i', 'u', 'r', 'z', 'c', 's',
 
216
  'y', 'w', };
185
217
 
186
 
static const char xiaohe_mapfinals[FINAL_NUM] = {'\0', 'a', 'o', 'e', 'd', 'w', 'c',
187
 
    'z', 'j', 'f', 'h', 'g', '\0', 'i', 'x', 'p', 'n', 'q', 'm', 'b', 'l', 'k', 'u', 
188
 
    'x', 'o', 'k', 'v', 'r', 'y', 'l', 's', 'v', 't', 's', };
 
218
static const char xiaohe_mapfinals[FINAL_NUM] =
 
219
{ '\0', 'a', 'o', 'e', 'd', 'w', 'c',
 
220
  'z', 'j', 'f', 'h', 'g', '\0',
 
221
  'i', 'x', 'p', 'n', 'q', 'm', 'b', 'l', 'k', 'u',
 
222
  'x', 'o', 'k', 'v', 'r', 'y',
 
223
  'l', 's', 'v', 't', 's', };
189
224
 
190
225
static TZeroInitial xiaohe_zeroinitials[] = {
191
 
    {"a"   , "aa"},
192
 
    {"ai"  , "ai"},
193
 
    {"an"  , "an"},
194
 
    {"ang" , "ah"},
195
 
    {"ao"  , "ao"},
196
 
    {"e"   , "ee"},
197
 
    {"ei"  , "ei"},
198
 
    {"en"  , "en"},
199
 
    {"eng" , "eg"},
200
 
    {"er"  , "er"},
201
 
    {"o"   , "oo"},
202
 
    {"ou"  , "ou"},
 
226
    { "a", "aa" },
 
227
    { "ai", "ai" },
 
228
    { "an", "an" },
 
229
    { "ang", "ah" },
 
230
    { "ao", "ao" },
 
231
    { "e", "ee" },
 
232
    { "ei", "ei" },
 
233
    { "en", "en" },
 
234
    { "eng", "eg" },
 
235
    { "er", "er" },
 
236
    { "o", "oo" },
 
237
    { "ou", "ou" },
203
238
};
204
239
 
205
240
CShuangpinData::CShuangpinData (EShuangpinType shpPlan) : m_shuangpinPlan(NULL)
210
245
 
211
246
CShuangpinData::~CShuangpinData()
212
247
{
213
 
   delete m_shuangpinPlan;
 
248
    delete m_shuangpinPlan;
214
249
}
215
250
 
216
251
TSyllable
217
 
CShuangpinData::encodeSyllable (const char *pinyin)
 
252
CShuangpinData::encodeSyllable(const char *pinyin)
218
253
{
219
 
    std::map<std::string, TSyllable>::iterator iter; 
 
254
    std::map<std::string, TSyllable>::iterator iter;
220
255
    iter = m_codingmap.find(pinyin);
221
256
    if (iter != m_codingmap.end()) {
222
257
        return iter->second;
224
259
    return (TSyllable)0;
225
260
}
226
261
 
227
 
const char * 
228
 
CShuangpinData::decodeSyllable (TSyllable s, const char **i, const char **f)
 
262
const char *
 
263
CShuangpinData::decodeSyllable(TSyllable s, const char **i, const char **f)
229
264
{
230
265
    return NULL;
231
266
}
232
267
 
233
 
int 
 
268
int
234
269
CShuangpinData::getMapString(const char *shpstr, CMappedYin &syls)
235
270
{
236
 
    assert(shpstr!=NULL);
237
 
    assert(m_shuangpinPlan->mapinitials!=NULL);
238
 
    
 
271
    assert(shpstr != NULL);
 
272
    assert(m_shuangpinPlan->mapinitials != NULL);
 
273
 
239
274
    const char *ch = shpstr;
240
 
    int     len = strlen(shpstr);
241
 
    char    buf[32] = "\0";
242
 
    
 
275
    int len = strlen(shpstr);
 
276
    char buf[32] = "\0";
 
277
 
243
278
    syls.clear();
244
279
    switch (len) {
245
280
    case 1:
246
 
        for (int i=0; i<INITIAL_NUM; i++) {
 
281
        for (int i = 0; i < INITIAL_NUM; i++) {
247
282
            if (*ch == m_shuangpinPlan->mapinitials[i]) {
248
283
                syls.push_back(std::string(initials[i]));
249
284
                return 1;
250
 
            }   
 
285
            }
251
286
        }
252
287
        break;
253
288
    case 2:
254
289
        if (m_shuangpinPlan->zeroinitals != NULL) {
255
 
            for (int i=0; i<ZEROINITIAL_NUM; i++) {
256
 
                if ( !strcmp(shpstr, m_shuangpinPlan->zeroinitals[i].mapshp) ) {
257
 
                    syls.push_back(std::string(m_shuangpinPlan->zeroinitals[i].syl));
 
290
            for (int i = 0; i < ZEROINITIAL_NUM; i++) {
 
291
                if (!strcmp(shpstr, m_shuangpinPlan->zeroinitals[i].mapshp)) {
 
292
                    syls.push_back(std::string(m_shuangpinPlan->zeroinitals[i].
 
293
                                               syl));
258
294
                    return 1;
259
295
                }
260
296
            }
261
297
        }
262
 
        
263
 
        for (int i=0; i<INITIAL_NUM; i++) {
 
298
 
 
299
        for (int i = 0; i < INITIAL_NUM; i++) {
264
300
            if (*ch == m_shuangpinPlan->mapinitials[i]) {
265
 
                for (int j=0; j<FINAL_NUM; j++) {
266
 
                    if (*(ch+1) == m_shuangpinPlan->mapfinals[j]) {
 
301
                for (int j = 0; j < FINAL_NUM; j++) {
 
302
                    if (*(ch + 1) == m_shuangpinPlan->mapfinals[j]) {
267
303
                        sprintf(buf, "%s%s", initials[i], finals[j]);
268
 
                        std::map<std::string, TSyllable>::iterator iter; 
 
304
                        std::map<std::string, TSyllable>::iterator iter;
269
305
                        iter = m_codingmap.find(buf);
270
306
                        if (iter != m_codingmap.end()) {
271
307
                            syls.push_back(std::string(buf));
272
308
                        }
273
309
                    }
274
310
                }
275
 
            }   
 
311
            }
276
312
        }
277
313
        break;
278
314
    default:
293
329
}
294
330
 
295
331
 
296
 
void 
 
332
void
297
333
CShuangpinData::_genCodingMap()
298
334
{
299
335
    unsigned len;
300
 
    const TPyTabEntry *pinyin_table = CPinyinData::getPinyinTable (len);
 
336
    const TPyTabEntry *pinyin_table = CPinyinData::getPinyinTable(len);
301
337
 
302
 
    for (int i=0; i<len; ++i) {
303
 
        m_codingmap.insert (
304
 
            CEncodingMap::value_type
305
 
                (pinyin_table[i].pystr, pinyin_table[i].id));
 
338
    for (size_t i = 0; i < len; ++i) {
 
339
        m_codingmap.insert(CEncodingMap::value_type(pinyin_table[i].pystr,
 
340
                                                    pinyin_table[i].id));
306
341
    }
307
342
}
308
343
 
309
 
void 
 
344
void
310
345
CShuangpinData::_genKeyboardMap(EShuangpinType shyType)
311
346
{
312
347
    if (m_shuangpinPlan == NULL) {
342
377
        break;
343
378
    case XIAOHE:
344
379
        m_shuangpinPlan->mapinitials = (char*)xiaohe_mapinitials;
345
 
        m_shuangpinPlan->mapfinals   = (char*)xiaohe_mapfinals;
346
 
        m_shuangpinPlan->zeroinitals =        xiaohe_zeroinitials;
 
380
        m_shuangpinPlan->mapfinals = (char*)xiaohe_mapfinals;
 
381
        m_shuangpinPlan->zeroinitals = xiaohe_zeroinitials;
347
382
        break;
348
383
    default:
349
384
        break;