From cf9be9bc4061b9c9d14d26268ddc854f802db50b Mon Sep 17 00:00:00 2001 From: Rei FURUKAWA Date: Sat, 22 Nov 2003 01:20:03 +0000 Subject: [PATCH] =?utf8?q?=E3=82=B9=E3=82=B3=E3=82=A2=E3=81=AB=E3=82=88?= =?utf8?q?=E3=82=8B=E5=88=A4=E5=AE=9A=E3=81=8C=E3=80=81=E3=81=82=E3=81=BE?= =?utf8?q?=E3=82=8A=E6=A9=9F=E8=83=BD=E3=81=97=E3=81=A6=E3=81=84=E3=81=AA?= =?utf8?q?=E3=81=8B=E3=81=A3=E3=81=9F=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3?= =?utf8?q?=20=E7=AC=AC2=E6=B0=B4=E6=BA=96=E6=BC=A2=E5=AD=97=E3=81=AE?= =?utf8?q?=E5=84=AA=E5=85=88=E5=BA=A6=E3=82=92=E3=81=A1=E3=82=87=E3=81=A3?= =?utf8?q?=E3=81=A8=E3=81=A0=E3=81=91=E4=B8=8B=E3=81=92=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- nkf.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/nkf.c b/nkf.c index 457107a..e8880a5 100644 --- a/nkf.c +++ b/nkf.c @@ -1250,7 +1250,8 @@ void set_iconv(f, iconv_func) #endif } -#define SCORE_KANA (1) /* いわゆる半角カナ */ +#define SCORE_L2 (1) /* 第2水準漢字 */ +#define SCORE_KANA (SCORE_L2 << 1) /* いわゆる半角カナ */ #define SCORE_DEPEND (SCORE_KANA << 1) /* 機種依存文字 */ #ifdef SHIFTJIS_CP932 #define SCORE_CP932 (SCORE_DEPEND << 1) /* CP932 による読み換え */ @@ -1271,8 +1272,8 @@ int score_table_A0[] = { }; int score_table_F0[] = { - 0, 0, 0, 0, - 0, SCORE_DEPEND, SCORE_NO_EXIST, SCORE_NO_EXIST, + SCORE_L2, SCORE_L2, SCORE_L2, SCORE_L2, + SCORE_L2, SCORE_DEPEND, SCORE_NO_EXIST, SCORE_NO_EXIST, SCORE_DEPEND, SCORE_DEPEND, SCORE_DEPEND, SCORE_DEPEND, SCORE_DEPEND, SCORE_NO_EXIST, SCORE_NO_EXIST, SCORE_ERROR, }; @@ -1302,18 +1303,19 @@ void code_score(ptr) int c1 = ptr->buf[1]; if (c2 < 0){ set_code_score(ptr, SCORE_ERROR); - }else if ((c2 & 0xf0) == 0xa0){ - set_code_score(ptr, score_table_A0[c2 & 0x0f]); - }else if ((c2 & 0xf0) == 0xf0){ - set_code_score(ptr, score_table_F0[c2 & 0x0f]); }else if (c2 == SSO){ set_code_score(ptr, SCORE_KANA); - } #ifdef UTF8_OUTPUT_ENABLE - else if (!e2w_conv(c2, c1)){ + }else if (!e2w_conv(c2, c1)){ set_code_score(ptr, SCORE_NO_EXIST); - } #endif + }else if ((c2 & 0x70) == 0x20){ + set_code_score(ptr, score_table_A0[c2 & 0x0f]); + }else if ((c2 & 0x70) == 0x70){ + set_code_score(ptr, score_table_F0[c2 & 0x0f]); + }else if ((c2 & 0x70) >= 0x50){ + set_code_score(ptr, SCORE_L2); + } } void status_disable(ptr) @@ -1336,7 +1338,6 @@ void status_clear(ptr) struct input_code *ptr; { ptr->stat = 0; - ptr->score &= SCORE_INIT; ptr->index = 0; } @@ -1679,6 +1680,7 @@ module_connection() } i_getc = std_getc; + i_ungetc = std_ungetc; /* input redicrection */ #ifdef INPUT_OPTION if (cap_f){ @@ -2491,8 +2493,8 @@ e_oconv(c2, c1) output_mode = ISO8859_1; (*o_putc)(c1 | 0x080); } else { - if ((c1<0x20 || 0x7e