From: Rei FURUKAWA Date: Fri, 4 Oct 2002 22:54:24 +0000 (+0000) Subject: 入力文字コードが確定する前に h_conv を抜ける場合の判定精度を上げた X-Git-Tag: nkf-202~13 X-Git-Url: http://git.sourceforge.jp/view?p=nkf%2Fnkf.git;a=commitdiff_plain;h=cb91f12c27ccbb32ec6fc892d3e52a8e1618017d 入力文字コードが確定する前に h_conv を抜ける場合の判定精度を上げた --- diff --git a/nkf.c b/nkf.c index 388251a..2a87ce0 100644 --- a/nkf.c +++ b/nkf.c @@ -109,7 +109,6 @@ static char *Patchlevel = #include #include -#include #if defined(MSDOS) || defined(__OS2__) #include @@ -252,6 +251,7 @@ STATIC int h_conv PROTO((FILE *f,int c2,int c1)); STATIC int push_hold_buf PROTO((int c2)); STATIC void set_iconv PROTO((int f, int (*iconv_func)())); STATIC int s_iconv PROTO((int c2,int c1,int c0)); +STATIC int s2e_conv PROTO((int c2, int c1, int *p2, int *p1)); STATIC int e_iconv PROTO((int c2,int c1,int c0)); #ifdef UTF8_INPUT_ENABLE STATIC int w2e_conv PROTO((int c2,int c1,int c0,int *p2,int *p1)); @@ -277,6 +277,7 @@ STATIC void iso2022jp_check_conv PROTO((int c2,int c1)); STATIC void no_connection PROTO((int c2,int c1)); STATIC int no_connection2 PROTO((int c2,int c1,int c0)); +STATIC int code_score PROTO((int c2,int c1,int s)); STATIC void code_status PROTO((int c)); STATIC void std_putc PROTO((int c)); @@ -370,9 +371,15 @@ STATIC void debug PROTO((char *str)); #endif static int e_stat = 0; +static int e_score = 0; +static int e_buf[2]; static int s_stat = 0; +static int s_score = 0; +static int s_buf[2]; #ifdef UTF8_INPUT_ENABLE static int w_stat = 0; +static int w_score = 0; +static int w_buf[2]; static int utf16_mode = UTF16_INPUT; #else static int w_stat = -1; @@ -786,15 +793,15 @@ struct { {"utf16-input", "W16"}, #endif #ifdef OVERWRITE - {"overwrite", "\0"}, + {"overwrite", ""}, #endif #ifdef CAP_URL_OPTION - {"cap-input", "\0"}, - {"url-input", "\0"}, + {"cap-input", ""}, + {"url-input", ""}, #endif #ifdef CHECK_OPTION - {"no-output", "\0"}, - {"debug", "\0"}, + {"no-output", ""}, + {"debug", ""}, #endif }; @@ -1099,6 +1106,41 @@ void set_iconv(f, iconv_func) #endif } +#define SCORE_DEPEND (1) /* $B5!