Lines 44-49
Link Here
|
44 |
#include <cstdio> |
44 |
#include <cstdio> |
45 |
|
45 |
|
46 |
#include "hunspell.hxx" |
46 |
#include "hunspell.hxx" |
|
|
47 |
#include "csutil.hxx" |
47 |
|
48 |
|
48 |
#ifndef W32 |
49 |
#ifndef W32 |
49 |
using namespace std; |
50 |
using namespace std; |
Lines 53-59
Link Here
|
53 |
{ |
54 |
{ |
54 |
encoding = NULL; |
55 |
encoding = NULL; |
55 |
csconv = NULL; |
56 |
csconv = NULL; |
56 |
utfconv = NULL; |
|
|
57 |
utf8 = 0; |
57 |
utf8 = 0; |
58 |
complexprefixes = 0; |
58 |
complexprefixes = 0; |
59 |
|
59 |
|
Lines 71-77
Link Here
|
71 |
csconv = get_current_cs(encoding); |
71 |
csconv = get_current_cs(encoding); |
72 |
langnum = pAMgr->get_langnum(); |
72 |
langnum = pAMgr->get_langnum(); |
73 |
utf8 = pAMgr->get_utf8(); |
73 |
utf8 = pAMgr->get_utf8(); |
74 |
utfconv = pAMgr->get_utf_conv(); |
|
|
75 |
complexprefixes = pAMgr->get_complexprefixes(); |
74 |
complexprefixes = pAMgr->get_complexprefixes(); |
76 |
wordbreak = pAMgr->get_breaktable(); |
75 |
wordbreak = pAMgr->get_breaktable(); |
77 |
|
76 |
|
Lines 156-168
Link Here
|
156 |
*nc -= *pabbrev; |
155 |
*nc -= *pabbrev; |
157 |
for (int i = 0; i < *nc; i++) { |
156 |
for (int i = 0; i < *nc; i++) { |
158 |
idx = (dest_utf[i].h << 8) + dest_utf[i].l; |
157 |
idx = (dest_utf[i].h << 8) + dest_utf[i].l; |
159 |
if (idx != utfconv[idx].clower) ncap++; |
158 |
if (idx != unicodetolower(idx)) ncap++; |
160 |
if (utfconv[idx].cupper == utfconv[idx].clower) nneutral++; |
159 |
if (unicodetoupper(idx) == unicodetolower(idx)) nneutral++; |
161 |
} |
160 |
} |
162 |
u16_u8(dest, MAXWORDUTF8LEN, dest_utf, *nc); |
161 |
u16_u8(dest, MAXWORDUTF8LEN, dest_utf, *nc); |
163 |
if (ncap) { |
162 |
if (ncap) { |
164 |
idx = (dest_utf[0].h << 8) + dest_utf[0].l; |
163 |
idx = (dest_utf[0].h << 8) + dest_utf[0].l; |
165 |
firstcap = (idx != utfconv[idx].clower); |
164 |
firstcap = (idx != unicodetolower(idx)); |
166 |
} |
165 |
} |
167 |
} |
166 |
} |
168 |
|
167 |
|
Lines 228-240
Link Here
|
228 |
nc = u8_u16(t, MAXWORDLEN, src); |
227 |
nc = u8_u16(t, MAXWORDLEN, src); |
229 |
for (int i = 0; i < nc; i++) { |
228 |
for (int i = 0; i < nc; i++) { |
230 |
idx = (t[i].h << 8) + t[i].l; |
229 |
idx = (t[i].h << 8) + t[i].l; |
231 |
if (idx != utfconv[idx].clower) ncap++; |
230 |
if (idx != unicodetolower(idx)) ncap++; |
232 |
if (utfconv[idx].cupper == utfconv[idx].clower) nneutral++; |
231 |
if (unicodetoupper(idx) == unicodetolower(idx)) nneutral++; |
233 |
} |
232 |
} |
234 |
u16_u8(dest, MAXWORDUTF8LEN, t, nc); |
233 |
u16_u8(dest, MAXWORDUTF8LEN, t, nc); |
235 |
if (ncap) { |
234 |
if (ncap) { |
236 |
idx = (t[0].h << 8) + t[0].l; |
235 |
idx = (t[0].h << 8) + t[0].l; |
237 |
firstcap = (idx != utfconv[idx].clower); |
236 |
firstcap = (idx != unicodetolower(idx)); |
238 |
} |
237 |
} |
239 |
} |
238 |
} |
240 |
|
239 |
|
Lines 262-270
Link Here
|
262 |
unsigned short idx; |
261 |
unsigned short idx; |
263 |
for (int i = 0; i < nc; i++) { |
262 |
for (int i = 0; i < nc; i++) { |
264 |
idx = (u[i].h << 8) + u[i].l; |
263 |
idx = (u[i].h << 8) + u[i].l; |
265 |
if (idx != utfconv[idx].cupper) { |
264 |
if (idx != unicodetoupper(idx)) { |
266 |
u[i].h = (unsigned char) (utfconv[idx].cupper >> 8); |
265 |
u[i].h = (unsigned char) (unicodetoupper(idx) >> 8); |
267 |
u[i].l = (unsigned char) (utfconv[idx].cupper & 0x00FF); |
266 |
u[i].l = (unsigned char) (unicodetoupper(idx) & 0x00FF); |
268 |
} |
267 |
} |
269 |
} |
268 |
} |
270 |
u16_u8(p, MAXWORDUTF8LEN, u, nc); |
269 |
u16_u8(p, MAXWORDUTF8LEN, u, nc); |
Lines 282-290
Link Here
|
282 |
unsigned short idx; |
281 |
unsigned short idx; |
283 |
for (int i = 0; i < nc; i++) { |
282 |
for (int i = 0; i < nc; i++) { |
284 |
idx = (u[i].h << 8) + u[i].l; |
283 |
idx = (u[i].h << 8) + u[i].l; |
285 |
if (idx != utfconv[idx].cupper) { |
284 |
if (idx != unicodetoupper(idx)) { |
286 |
u[i].h = (unsigned char) (utfconv[idx].cupper >> 8); |
285 |
u[i].h = (unsigned char) (unicodetoupper(idx) >> 8); |
287 |
u[i].l = (unsigned char) (utfconv[idx].cupper & 0x00FF); |
286 |
u[i].l = (unsigned char) (unicodetoupper(idx) & 0x00FF); |
288 |
} |
287 |
} |
289 |
} |
288 |
} |
290 |
u16_u8(p, MAXWORDUTF8LEN, u, nc); |
289 |
u16_u8(p, MAXWORDUTF8LEN, u, nc); |
Lines 313-321
Link Here
|
313 |
unsigned short idx; |
312 |
unsigned short idx; |
314 |
for (int i = 0; i < nc; i++) { |
313 |
for (int i = 0; i < nc; i++) { |
315 |
idx = (u[i].h << 8) + u[i].l; |
314 |
idx = (u[i].h << 8) + u[i].l; |
316 |
if (idx != utfconv[idx].clower) { |
315 |
if (idx != unicodetolower(idx)) { |
317 |
u[i].h = (unsigned char) (utfconv[idx].clower >> 8); |
316 |
u[i].h = (unsigned char) (unicodetolower(idx) >> 8); |
318 |
u[i].l = (unsigned char) (utfconv[idx].clower & 0x00FF); |
317 |
u[i].l = (unsigned char) (unicodetolower(idx) & 0x00FF); |
319 |
} |
318 |
} |
320 |
} |
319 |
} |
321 |
u16_u8(p, MAXWORDUTF8LEN, u, nc); |
320 |
u16_u8(p, MAXWORDUTF8LEN, u, nc); |
Lines 1145-1151
Link Here
|
1145 |
int len; |
1144 |
int len; |
1146 |
w_char u[MAXWORDLEN]; |
1145 |
w_char u[MAXWORDLEN]; |
1147 |
len = u8_u16(u, MAXWORDLEN, p); |
1146 |
len = u8_u16(u, MAXWORDLEN, p); |
1148 |
unsigned short i = utfconv[(u[0].h << 8) + u[0].l].cupper; |
1147 |
unsigned short i = unicodetoupper((u[0].h << 8) + u[0].l); |
1149 |
u[0].h = (unsigned char) (i >> 8); |
1148 |
u[0].h = (unsigned char) (i >> 8); |
1150 |
u[0].l = (unsigned char) (i & 0x00FF); |
1149 |
u[0].l = (unsigned char) (i & 0x00FF); |
1151 |
u16_u8(p, MAXWORDUTF8LEN, u, len); |
1150 |
u16_u8(p, MAXWORDUTF8LEN, u, len); |
Lines 1157-1163
Link Here
|
1157 |
if (!utf8) { |
1156 |
if (!utf8) { |
1158 |
if (*p != '\0') *p = csconv[((unsigned char)*p)].cupper; |
1157 |
if (*p != '\0') *p = csconv[((unsigned char)*p)].cupper; |
1159 |
} else if (nc > 0) { |
1158 |
} else if (nc > 0) { |
1160 |
unsigned short i = utfconv[(u[0].h << 8) + u[0].l].cupper; |
1159 |
unsigned short i = unicodetoupper((u[0].h << 8) + u[0].l); |
1161 |
u[0].h = (unsigned char) (i >> 8); |
1160 |
u[0].h = (unsigned char) (i >> 8); |
1162 |
u[0].l = (unsigned char) (i & 0x00FF); |
1161 |
u[0].l = (unsigned char) (i & 0x00FF); |
1163 |
u16_u8(p, MAXWORDUTF8LEN, u, nc); |
1162 |
u16_u8(p, MAXWORDUTF8LEN, u, nc); |
Lines 1171-1177
Link Here
|
1171 |
if (!utf8) { |
1170 |
if (!utf8) { |
1172 |
if (*p != '\0') *p = csconv[((unsigned char)*p)].clower; |
1171 |
if (*p != '\0') *p = csconv[((unsigned char)*p)].clower; |
1173 |
} else if (nc > 0) { |
1172 |
} else if (nc > 0) { |
1174 |
unsigned short i = utfconv[(u[0].h << 8) + u[0].l].clower; |
1173 |
unsigned short i = unicodetolower((u[0].h << 8) + u[0].l); |
1175 |
u[0].h = (unsigned char) (i >> 8); |
1174 |
u[0].h = (unsigned char) (i >> 8); |
1176 |
u[0].l = (unsigned char) (i & 0x00FF); |
1175 |
u[0].l = (unsigned char) (i & 0x00FF); |
1177 |
u16_u8(p, MAXWORDUTF8LEN, u, nc); |
1176 |
u16_u8(p, MAXWORDUTF8LEN, u, nc); |
Lines 1183-1193
Link Here
|
1183 |
struct cs_info * Hunspell::get_csconv() |
1182 |
struct cs_info * Hunspell::get_csconv() |
1184 |
{ |
1183 |
{ |
1185 |
return csconv; |
1184 |
return csconv; |
1186 |
} |
|
|
1187 |
|
1188 |
struct unicode_info2 * Hunspell::get_utf_conv() |
1189 |
{ |
1190 |
return utfconv; |
1191 |
} |
1185 |
} |
1192 |
|
1186 |
|
1193 |
int Hunspell::put_word(const char * word) |
1187 |
int Hunspell::put_word(const char * word) |