0
|
1 /*
|
|
2 * $Id: atojis.c,v 1.3 2001/06/14 18:15:59 ura Exp $
|
|
3 */
|
|
4
|
|
5 /*
|
|
6 * FreeWnn is a network-extensible Kana-to-Kanji conversion system.
|
|
7 * This file is part of FreeWnn.
|
|
8 *
|
|
9 * Copyright Kyoto University Research Institute for Mathematical Sciences
|
|
10 * 1987, 1988, 1989, 1990, 1991, 1992
|
|
11 * Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1999
|
|
12 * Copyright ASTEC, Inc. 1987, 1988, 1989, 1990, 1991, 1992
|
|
13 * Copyright FreeWnn Project 1999, 2000
|
|
14 *
|
|
15 * Maintainer: FreeWnn Project <freewnn@tomo.gr.jp>
|
|
16 *
|
|
17 * This program is free software; you can redistribute it and/or modify
|
|
18 * it under the terms of the GNU General Public License as published by
|
|
19 * the Free Software Foundation; either version 2 of the License, or
|
|
20 * (at your option) any later version.
|
|
21 *
|
|
22 * This program is distributed in the hope that it will be useful,
|
|
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
25 * GNU General Public License for more details.
|
|
26 *
|
|
27 * You should have received a copy of the GNU General Public License
|
|
28 * along with this program; if not, write to the Free Software
|
|
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
30 */
|
|
31
|
|
32 #include "commonhd.h"
|
|
33 #include "de_header.h"
|
|
34 #include "kaiseki.h"
|
|
35
|
|
36 static int keta_4;
|
|
37
|
|
38 static w_char _tatojis[] = {
|
|
39 #ifdef CHINESE
|
|
40 0xa1a1, 0xa3a1, 0xa3a2, 0xa3a3, 0xa1e7, 0xa3a5, 0xa3a6, 0xa3a7,
|
|
41 0xa3a8, 0xa3a9, 0xa3aa, 0xa3ab, 0xa3ac, 0xa3ad, 0xa3ae, 0xa3af,
|
|
42 0xa3b0, 0xa3b1, 0xa3b2, 0xa3b3, 0xa3b4, 0xa3b5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0, 0xa1cf, 0xa1b0, 0xa1b2,
|
|
75 0xa1ae, 0xa3e1, 0xa3e2, 0xa3e3, 0xa3e4, 0xa3e5, 0xa3e6, 0xa3e7,
|
|
76 0xa3e8, 0xa3e9, 0xa3ea, 0xa3eb, 0xa3ec, 0xa3ed, 0xa3ee, 0xa3ef,
|
|
77 0xa3f0, 0xa3f1, 0xa3f2, 0xa3f3, 0xa3f4, 0xa3f5, 0xa3f6, 0xa3f7,
|
|
78 0xa3f8, 0xa3f9, 0xa3fa, 0xa1d0, 0xa1c3, 0xa1d1, 0xa1b1, 0x007f
|
|
79 # endif /* KOREAN */
|
|
80 #endif /* CHINESE */
|
|
81 };
|
|
82
|
|
83
|
|
84 static int
|
|
85 atojis (c)
|
|
86 register w_char c;
|
|
87 {
|
|
88 if (c >= ' ' && c <= (unsigned char) '\376')
|
|
89 c = _tatojis[c - ' '];
|
|
90 return (c);
|
|
91 }
|
|
92
|
|
93 static w_char _tatokan[] = {
|
|
94 #ifdef CHINESE
|
|
95 0xa1f0, 0xd2bb, 0xb6fe, 0xc8fd, 0xcbc4, /* ¡ðÒ»¶þÈýËÄ */
|
|
96 0xcee5, 0xc1f9, 0xc6df, 0xb0cb, 0xbec5 /* ÎåÁùÆ߰˾Š*/
|
|
97 #else
|
|
98 # ifdef KOREAN
|
|
99 0xd6c3, 0xece9, 0xeca3, 0xdfb2, 0xdecc, /* ÖÃìéì£ß²ÞÌ */
|
|
100 0xe7e9, 0xd7bf, 0xf6d2, 0xf8a2, 0xcefa, /* çé׿öÒø¢Îú */
|
|
101 # else /* JAPANESE */
|
|
102 0xa1bb, 0xb0ec, 0xc6f3, 0xbbb0, 0xbbcd, /* ¡»°ìÆó»°»Í */
|
|
103 0xb8de, 0xcfbb, 0xbcb7, 0xc8ac, 0xb6e5 /* ¸ÞÏ»¼·È¬¶å */
|
|
104 # endif /* KOREAN */
|
|
105 #endif /* CHINESE */
|
|
106 };
|
|
107
|
|
108 static w_char _tatokan_o[] = {
|
|
109 #ifdef CHINESE
|
|
110 0xc1e3, 0xd2bc, 0xb7a1, 0xc8fe, 0xcbc1, /* ÁãÒ¼·¡ÈþËÁ */
|
|
111 0xcee9, 0xc2bd, 0xc6e2, 0xb0c6, 0xbec1 /* Îé½Æâ°Æ¾Á */
|
|
112 #else
|
|
113 # ifdef KOREAN
|
|
114 0xd6c3, 0xecec, 0xecc3, 0xdfb3, 0xdecc, /* ÖÃìììÃß³ÞÌ */
|
|
115 0xe7ea, 0xd7bf, 0xf6d2, 0xf8a2, 0xcefa, /* çê׿öÒø¢Îú */
|
|
116 #else /* JAPANESE */
|
|
117 0xceed, 0xb0ed, 0xc6f5, 0xbbb2, 0xbbcd, /* Îí°íÆõ»²»Í */
|
|
118 0xb8e0, 0xcfbb, 0xbcb7, 0xc8ac, 0xb6e5 /* ¸àÏ»¼·È¬¶å */
|
|
119 # endif /* KOREAN */
|
|
120 #endif /* CHINESE */
|
|
121 };
|
|
122
|
|
123 static w_char
|
|
124 atokan (c)
|
|
125 register w_char c;
|
|
126 {
|
|
127 if (c >= '0' && c <= '9')
|
|
128 c = _tatokan[c - '0'];
|
|
129 else if (c >= S_NUM && c <= S_NUM + 9)
|
|
130 c = _tatokan[c - S_NUM];
|
|
131 return (c);
|
|
132 }
|
|
133
|
|
134 static w_char
|
|
135 atokan_o (c)
|
|
136 register w_char c;
|
|
137 {
|
|
138 if (c >= '0' && c <= '9')
|
|
139 c = _tatokan_o[c - '0'];
|
|
140 else if (c >= S_NUM && c <= S_NUM + 9)
|
|
141 c = _tatokan_o[c - S_NUM];
|
|
142 return (c);
|
|
143 }
|
|
144
|
|
145 static w_char _tatoket[] = {
|
|
146 #ifdef CHINESE
|
|
147 0xcaae, 0xb0d9, 0xc7a7, /* Ê®°Ùǧ */
|
|
148 0xcdf2, 0xd2da, 0xd5d7, 0xbea9, /* ÍòÒÚÕ×¾© */
|
|
149 0xdbf2, 0xeff6, 0xf0a6, 0xb9b5, /* Ûòïö(Êã)𦹵 */
|
|
150 0xbda7, 0xd5fd, 0xd4d8, 0xbcab /* ½§ÕýÔؼ« */
|
|
151 /* ºãºÓɳ *//* °¢É®?? *//* ÄÇÓÉËû *//* ²»¿É˼Òé *//* ÎÞÁ¿´óÊý */
|
|
152 #else
|
|
153 # ifdef KOREAN
|
|
154 0xe4a8, 0xdbdd, 0xf4b6, /* ä¨ÛÝô¶ */
|
|
155 0xd8b2, 0xe5e2, 0xf0bc, 0xccc8, /* زåâð¼ÌÈ */
|
|
156 0xfaa7, 0xdff1, 0xe5cd, 0xcfb5, /* ú§ßñåÍϵ */
|
|
157 0xcad5, 0xefe1, 0xeeb0, 0xd0bf, /* ÊÕïáî°Ð¿ */
|
|
158 /* ùöùÁÞÞ ä¹ã¬Ñ¶ Ñáë¦öâ ÜôʦÞÖì¡ ÙíÕáÓÞ⦠*/
|
|
159 # else /* JAPANESE */
|
|
160 0xbdbd, 0xc9b4, 0xc0e9, /* ½½É´Àé */
|
|
161 0xcbfc, 0xb2af, 0xc3fb, 0xb5fe, /* Ëü²¯Ãûµþ */
|
|
162 0xd4b6, 0xd9b3, 0xbef7, 0xb9c2, /* Ô¶Ù³(¤·d126)¾÷¹Â */
|
|
163 0xb4c2, 0xc0b5, 0xbadc, 0xb6cb /* ´ÂÀµºÜ¶Ë */
|
|
164 /* ¹±²Ïº» *//* °¤ÁεÀ *//* Æáͳ¾ *//* ÉÔ²Ä»×µÄ *//* ̵ÎÌÂç¿ô */
|
|
165 # endif /* KOREAN */
|
|
166 #endif /* CHINESE */
|
|
167 };
|
|
168
|
|
169 static w_char _tatoket_o[] = {
|
|
170 #ifdef CHINESE
|
|
171 0xcab0, 0xb0db, 0xc7aa, /* Ê°°ÛǪ */
|
|
172 0xcdf2 /* Íò */
|
|
173 #else
|
|
174 # ifdef KOREAN
|
|
175 0xe3a6, 0xd8e8, 0xf4c6, /* ã¦ØèôÆ */
|
|
176 0xd8bf /* Ø¿ */
|
|
177 # else /* JAPANESE */
|
|
178 0xbda6, 0xeff9, 0xeff4, /* ½¦ïùïô */
|
|
179 0xe8df /* èß */
|
|
180 # endif /* KOREAN */
|
|
181 #endif /* CHINESE */
|
|
182 };
|
|
183
|
|
184 static void
|
|
185 getketa (k, kouho, col)
|
|
186 int k;
|
|
187 w_char kouho[];
|
|
188 int *col;
|
|
189 {
|
|
190 if (k % 4)
|
|
191 {
|
|
192 if (keta_4 != 0)
|
|
193 {
|
|
194 keta_4 = 0;
|
|
195 getketa (k / 4 * 4, kouho, col);
|
|
196 }
|
|
197 kouho[(*col)++] = _tatoket[k % 4 - 1];
|
|
198 }
|
|
199 else if ((k / 4 > 0) && (k / 4 < 13))
|
|
200 {
|
|
201 kouho[(*col)++] = _tatoket[k / 4 + 2];
|
|
202 }
|
|
203 else if (k / 4 == 13)
|
|
204 {
|
|
205 #ifdef CHINESE
|
|
206 kouho[(*col)++] = 0xc9b3; /* ºãºÓɳ */
|
|
207 kouho[(*col)++] = 0xbad3;
|
|
208 kouho[(*col)++] = 0xbae3;
|
|
209 #else
|
|
210 # ifdef KOREAN
|
|
211 kouho[(*col)++] = 0xdede; /* ùöùÁÞÞ */
|
|
212 kouho[(*col)++] = 0xf9c1;
|
|
213 kouho[(*col)++] = 0xf9f6;
|
|
214 # else /* JAPANESE */
|
|
215 kouho[(*col)++] = 0xbabb;
|
|
216 kouho[(*col)++] = 0xb2cf;
|
|
217 kouho[(*col)++] = 0xb9b1; /* ¹±²Ïº» */
|
|
218 # endif /* KOREAN */
|
|
219 #endif /* CHINESE */
|
|
220 }
|
|
221 else if (k / 4 == 14)
|
|
222 {
|
|
223 #ifdef CHINESE
|
|
224 kouho[(*col)++] = 0xecf3; /* °¢É®ìó */
|
|
225 kouho[(*col)++] = 0xc9ae;
|
|
226 kouho[(*col)++] = 0xb0a2;
|
|
227 #else
|
|
228 # ifdef KOREAN
|
|
229 kouho[(*col)++] = 0xd1b6; /* ä¹ã¬Ñ¶ */
|
|
230 kouho[(*col)++] = 0xe3ac;
|
|
231 kouho[(*col)++] = 0xe4b9;
|
|
232 # else /* JAPANESE */
|
|
233 kouho[(*col)++] = 0xb5c0;
|
|
234 kouho[(*col)++] = 0xc1ce;
|
|
235 kouho[(*col)++] = 0xb0a4; /* °¤ÁεÀ */
|
|
236 # endif /* KOREAN */
|
|
237 #endif /* CHINESE */
|
|
238 }
|
|
239 else if (k / 4 == 15)
|
|
240 {
|
|
241 #ifdef CHINESE
|
|
242 kouho[(*col)++] = 0xcbfb; /* ÄÇÓÉËû */
|
|
243 kouho[(*col)++] = 0xd3c9;
|
|
244 kouho[(*col)++] = 0xc4c7;
|
|
245 #else
|
|
246 # ifdef KOREAN
|
|
247 kouho[(*col)++] = 0xf6e2; /* Ñáë¦öâ */
|
|
248 kouho[(*col)++] = 0xeba6;
|
|
249 kouho[(*col)++] = 0xd1e1;
|
|
250 # else /* JAPANESE */
|
|
251 kouho[(*col)++] = 0xc2be;
|
|
252 kouho[(*col)++] = 0xcdb3;
|
|
253 kouho[(*col)++] = 0xc6e1; /* Æáͳ¾ */
|
|
254 # endif /* KOREAN */
|
|
255 #endif /* CHINESE */
|
|
256 }
|
|
257 else if (k / 4 == 16)
|
|
258 {
|
|
259 #ifdef CHINESE
|
|
260 kouho[(*col)++] = 0xd2e5;
|
|
261 kouho[(*col)++] = 0xcbbc;
|
|
262 kouho[(*col)++] = 0xbfc9;
|
|
263 kouho[(*col)++] = 0xb2bb; /* ²»¿É˼Òå */
|
|
264 #else
|
|
265 # ifdef KOREAN
|
|
266 kouho[(*col)++] = 0xeca1; /* ÜôʦÞÖì¡ */
|
|
267 kouho[(*col)++] = 0xded6;
|
|
268 kouho[(*col)++] = 0xcaa6;
|
|
269 kouho[(*col)++] = 0xdcf4;
|
|
270 # else /* JAPANESE */
|
|
271 kouho[(*col)++] = 0xb5c4;
|
|
272 kouho[(*col)++] = 0xbbd7;
|
|
273 kouho[(*col)++] = 0xb2c4;
|
|
274 kouho[(*col)++] = 0xc9d4; /* ÉÔ²Ä»×µÄ */
|
|
275 # endif /* KOREAN */
|
|
276 #endif /* CHINESE */
|
|
277 }
|
|
278 else if (k / 4 == 17)
|
|
279 {
|
|
280 #ifdef CHINESE
|
|
281 kouho[(*col)++] = 0xcafd; /* ÎÞÁ¿´óÊý */
|
|
282 kouho[(*col)++] = 0xb4f3;
|
|
283 kouho[(*col)++] = 0xc1bf;
|
|
284 kouho[(*col)++] = 0xcede;
|
|
285 #else
|
|
286 # ifdef KOREAN
|
|
287 kouho[(*col)++] = 0xe2a6; /* ÙíÕáÓÞ⦠*/
|
|
288 kouho[(*col)++] = 0xd3de;
|
|
289 kouho[(*col)++] = 0xd5e1;
|
|
290 kouho[(*col)++] = 0xd9ed;
|
|
291 # else /* JAPANESE */
|
|
292 kouho[(*col)++] = 0xbff4;
|
|
293 kouho[(*col)++] = 0xc2e7;
|
|
294 kouho[(*col)++] = 0xcecc;
|
|
295 kouho[(*col)++] = 0xccb5; /* ̵ÎÌÂç¿ô */
|
|
296 # endif /* KOREAN */
|
|
297 #endif /* CHINESE */
|
|
298 }
|
|
299 else
|
|
300 {
|
|
301 #ifdef CHINESE
|
|
302 kouho[(*col)++] = 0xa3bf; /* £¿ */
|
|
303 #else
|
|
304 # ifdef KOREAN
|
|
305 kouho[(*col)++] = 0xa3bf; /* £¿ */
|
|
306 # else /* JAPANESE */
|
|
307 kouho[(*col)++] = 0xa1a9; /* ¡© */
|
|
308 # endif /* KOREAN */
|
|
309 #endif /* CHINESE */
|
|
310 }
|
|
311 keta_4 = 0;
|
|
312 }
|
|
313
|
|
314 static void
|
|
315 getketa_o (k, kouho, col)
|
|
316 int k;
|
|
317 w_char kouho[];
|
|
318 int *col;
|
|
319 {
|
|
320 if (k % 4)
|
|
321 {
|
|
322 if (keta_4 != 0)
|
|
323 {
|
|
324 keta_4 = 0;
|
|
325 if (k / 4 == 1)
|
|
326 kouho[(*col)++] = _tatoket_o[3]; /* èß */
|
|
327 else
|
|
328 getketa (k / 4 * 4, kouho, col);
|
|
329 }
|
|
330 kouho[(*col)++] = _tatoket_o[k % 4 - 1];
|
|
331 }
|
|
332 else if (k / 4 == 1)
|
|
333 {
|
|
334 kouho[(*col)++] = _tatoket_o[3]; /* èß */
|
|
335 }
|
|
336 else
|
|
337 {
|
|
338 getketa (k, kouho, col);
|
|
339 }
|
|
340 keta_4 = 0;
|
|
341 }
|
|
342
|
|
343 w_char *
|
|
344 get_giji_knj (j, i, t, kouho)
|
|
345 int j;
|
|
346 int i;
|
|
347 int t;
|
|
348 w_char *kouho;
|
|
349 {
|
|
350 register int k;
|
|
351 w_char revkouho[1000];
|
|
352 int col = 0, keta = 0;
|
|
353
|
|
354 switch (t)
|
|
355 {
|
|
356 case WNN_NUM_ZEN: /* Á´³Ñ¿ô»ú *//* £±£²£³ */
|
|
357 #ifdef CONVERT_from_TOP
|
|
358 for (k = i; k <= j; k++)
|
|
359 {
|
|
360 if (k == i &&
|
|
361 #else
|
|
362 for (k = j; k >= i; k--)
|
|
363 {
|
|
364 if (k == j &&
|
|
365 #endif /* CONVERT_from_TOP */
|
|
366 (isspace (bun[k]) || isjspace (bun[k])))
|
|
367 *kouho++ = bun[k];
|
|
368 else
|
|
369 *kouho++ = atojis (bun[k]);
|
|
370 }
|
|
371 break;
|
|
372 case WNN_ALP_ZEN: /* Á´³Ñ */
|
|
373 case WNN_KIG_JIS:
|
|
374 case WNN_KIG_ASC:
|
|
375 #ifdef CONVERT_from_TOP
|
|
376 for (k = i; k <= j; k++)
|
|
377 #else
|
|
378 for (k = j; k >= i; k--)
|
|
379 #endif /* CONVERT_from_TOP */
|
|
380 *kouho++ = atojis (bun[k]);
|
|
381 break;
|
|
382
|
|
383 case WNN_KATAKANA: /* ¥«¥¿¥«¥Ê */
|
|
384 #ifdef CONVERT_from_TOP
|
|
385 for (k = i; k <= j; k++)
|
|
386 {
|
|
387 #else
|
|
388 for (k = j; k >= i; k--)
|
|
389 {
|
|
390 #endif /* CONVERT_from_TOP */
|
|
391 if ((bun[k] & 0xff00) == 0xa400)
|
|
392 *kouho++ = bun[k] | 0x100;
|
|
393 else
|
|
394 *kouho++ = bun[k];
|
|
395 }
|
|
396 break;
|
|
397
|
|
398 case WNN_NUM_KAN: /* ´Á¿ô»ú *//* °ìÆó»° */
|
|
399 #ifdef CONVERT_from_TOP
|
|
400 for (k = i; k <= j; k++)
|
|
401 #else
|
|
402 for (k = j; k >= i; k--)
|
|
403 #endif /* CONVERT_from_TOP */
|
|
404 *kouho++ = atokan (bun[k]);
|
|
405 break;
|
|
406 case WNN_NUM_HANCAN: /* Ⱦ³Ñ¿ô»ú *//* 1,234 */
|
|
407 #ifdef CONVERT_from_TOP
|
|
408 for (k = j; k >= i; k--)
|
|
409 {
|
|
410 if (k == i &&
|
|
411 #else
|
|
412 for (k = i; k <= j; k++)
|
|
413 {
|
|
414 if (k == j &&
|
|
415 #endif /* CONVERT_from_TOP */
|
|
416 (isspace (bun[k]) || isjspace (bun[k])))
|
|
417 {
|
|
418 revkouho[col++] = bun[k];
|
|
419 break;
|
|
420 }
|
|
421 if ((keta != 0) && (keta % 3 == 0))
|
|
422 revkouho[col++] = ','; /* , */
|
|
423 if (bun[k] >= S_NUM && bun[k] <= S_NUM + 9)
|
|
424 revkouho[col++] = '0' + bun[k] - S_NUM;
|
|
425 else
|
|
426 revkouho[col++] = bun[k];
|
|
427 keta++;
|
|
428 }
|
|
429
|
|
430 while (--col >= 0)
|
|
431 {
|
|
432 *kouho++ = revkouho[col];
|
|
433 }
|
|
434 break;
|
|
435 case WNN_NUM_ZENCAN: /* Á´³Ñ¿ô»ú *//* £±¡¤£²£³£´ */
|
|
436 #ifdef CONVERT_from_TOP
|
|
437 for (k = j; k >= i; k--)
|
|
438 {
|
|
439 if (k == i &&
|
|
440 #else
|
|
441 for (k = i; k <= j; k++)
|
|
442 {
|
|
443 if (k == j &&
|
|
444 #endif /* CONVERT_from_TOP */
|
|
445 (isspace (bun[k]) || isjspace (bun[k])))
|
|
446 {
|
|
447 revkouho[col++] = bun[k];
|
|
448 break;
|
|
449 }
|
|
450 if ((keta != 0) && (keta % 3 == 0))
|
|
451 revkouho[col++] = UJIS_comma; /* ¡¤ */
|
|
452 revkouho[col++] = atojis (bun[k]);
|
|
453 keta++;
|
|
454 }
|
|
455
|
|
456 while (--col >= 0)
|
|
457 {
|
|
458 *kouho++ = revkouho[col];
|
|
459 }
|
|
460 break;
|
|
461 case WNN_NUM_KANSUUJI: /* ´Á¿ô»ú *//* É´Æó½½»° */
|
|
462 keta_4 = 0;
|
|
463 #ifdef CONVERT_from_TOP
|
|
464 for (k = j; k >= i; k--)
|
|
465 {
|
|
466 if (k == i &&
|
|
467 #else
|
|
468 for (k = i; k <= j; k++)
|
|
469 {
|
|
470 if (k == j &&
|
|
471 #endif /* CONVERT_from_TOP */
|
|
472 (isspace (bun[k]) || isjspace (bun[k])))
|
|
473 {
|
|
474 revkouho[col++] = bun[k];
|
|
475 break;
|
|
476 }
|
|
477 if (bun[k] != '0')
|
|
478 {
|
|
479 if (keta != 0)
|
|
480 getketa (keta, revkouho, &col);
|
|
481 if (bun[k] != '1' ||
|
|
482 #ifdef CHINESE
|
|
483 keta % 4 != 1)
|
|
484 #else /* JAPANESE */
|
|
485 keta % 4 == 0 || keta % 4 == 3)
|
|
486 /* °ìÀéÉ´½½°ì */
|
|
487 #endif /* CHINESE */
|
|
488 revkouho[col++] = atokan (bun[k]);
|
|
489 }
|
|
490 else if ((keta != 0) && (keta % 4 == 0))
|
|
491 {
|
|
492 keta_4 = 1;
|
|
493 }
|
|
494 keta++;
|
|
495 }
|
|
496
|
|
497 if (col == 0)
|
|
498 *kouho++ = _tatokan[0];
|
|
499 while (--col >= 0)
|
|
500 {
|
|
501 *kouho++ = revkouho[col];
|
|
502 }
|
|
503 break;
|
|
504 case WNN_NUM_KANOLD: /* ´Á¿ô»ú *//* °íÉ´Æõ½¦»² */
|
|
505 keta_4 = 0;
|
|
506 #ifdef CONVERT_from_TOP
|
|
507 for (k = j; k >= i; k--)
|
|
508 {
|
|
509 if (k == i &&
|
|
510 #else
|
|
511 for (k = i; k <= j; k++)
|
|
512 {
|
|
513 if (k == j &&
|
|
514 #endif /* CONVERT_from_TOP */
|
|
515 (isspace (bun[k]) || isjspace (bun[k])))
|
|
516 {
|
|
517 revkouho[col++] = bun[k];
|
|
518 break;
|
|
519 }
|
|
520 if (bun[k] != '0')
|
|
521 {
|
|
522 if (keta != 0)
|
|
523 getketa_o (keta, revkouho, &col);
|
|
524 if (bun[k] != '1' ||
|
|
525 #ifdef CHINESE
|
|
526 keta % 4 != 1)
|
|
527 #else /* JAPANESE */
|
|
528 keta % 4 == 0 || keta % 4 == 3)
|
|
529 /* °ìÀéÉ´½½°ì */
|
|
530 #endif /* CHINESE */
|
|
531 revkouho[col++] = atokan_o (bun[k]);
|
|
532 }
|
|
533 else if ((keta != 0) && (keta % 4 == 0))
|
|
534 {
|
|
535 keta_4 = 1;
|
|
536 }
|
|
537 keta++;
|
|
538 }
|
|
539
|
|
540 if (col == 0)
|
|
541 *kouho++ = _tatokan_o[0];
|
|
542 while (--col >= 0)
|
|
543 {
|
|
544 *kouho++ = revkouho[col];
|
|
545 }
|
|
546 break;
|
|
547 case WNN_NUM_HAN: /* 123 */
|
|
548 #ifdef CONVERT_from_TOP
|
|
549 for (k = i; k <= j; k++)
|
|
550 {
|
|
551 #else
|
|
552 for (k = j; k >= i; k--)
|
|
553 {
|
|
554 #endif /* CONVERT_from_TOP */
|
|
555 if (bun[k] >= S_NUM && bun[k] <= S_NUM + 9)
|
|
556 *kouho++ = '0' + bun[k] - S_NUM;
|
|
557 else
|
|
558 *kouho++ = bun[k];
|
|
559 }
|
|
560 break;
|
|
561
|
|
562 default: /* ¤Ò¤é¤¬¤Ê */
|
|
563 #ifdef CONVERT_from_TOP
|
|
564 for (k = i; k <= j; k++)
|
|
565 {
|
|
566 #else
|
|
567 for (k = j; k >= i; k--)
|
|
568 {
|
|
569 #endif /* CONVERT_from_TOP */
|
|
570 *kouho++ = bun[k];
|
|
571 }
|
|
572 break;
|
|
573 }
|
|
574 *kouho++ = 0;
|
|
575 return (kouho);
|
|
576 }
|
|
577
|
|
578 void
|
|
579 giji_hindoup (t_jc)
|
|
580 int t_jc;
|
|
581 {
|
|
582 if (t_jc >= 0)
|
|
583 return;
|
|
584 switch (t_jc)
|
|
585 {
|
|
586 case WNN_NUM_HAN:
|
|
587 case WNN_NUM_ZEN:
|
|
588 case WNN_NUM_KAN:
|
|
589 case WNN_NUM_KANSUUJI:
|
|
590 case WNN_NUM_KANOLD:
|
|
591 case WNN_NUM_HANCAN:
|
|
592 case WNN_NUM_ZENCAN:
|
|
593 c_env->giji.number = t_jc;
|
|
594 break;
|
|
595 case WNN_ALP_HAN:
|
|
596 case WNN_ALP_ZEN:
|
|
597 c_env->giji.eisuu = t_jc;
|
|
598 break;
|
|
599 case WNN_KIG_HAN:
|
|
600 case WNN_KIG_JIS:
|
|
601 case WNN_KIG_ASC:
|
|
602 c_env->giji.kigou = t_jc;
|
|
603 break;
|
|
604 default:
|
|
605 return;
|
|
606 }
|
|
607 }
|