OSDN Git Service
(root)
/
nkf
/
nkf.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
スコアによる判定が、あまり機能していなかったのを修正
[nkf/nkf.git]
/
nkf.c
diff --git
a/nkf.c
b/nkf.c
index
457107a
..
e8880a5
100644
(file)
--- a/
nkf.c
+++ b/
nkf.c
@@
-1250,7
+1250,8
@@
void set_iconv(f, iconv_func)
#endif
}
#endif
}
-#define SCORE_KANA (1) /*
\e
$B$$$o$f$kH>3Q%+%J
\e
(B */
+#define SCORE_L2 (1) /*
\e
$BBh
\e
(B2
\e
$B?e=`4A;z
\e
(B */
+#define SCORE_KANA (SCORE_L2 << 1) /*
\e
$B$$$o$f$kH>3Q%+%J
\e
(B */
#define SCORE_DEPEND (SCORE_KANA << 1) /*
\e
$B5!<o0MB8J8;z
\e
(B */
#ifdef SHIFTJIS_CP932
#define SCORE_CP932 (SCORE_DEPEND << 1) /* CP932
\e
$B$K$h$kFI$_49$(
\e
(B */
#define SCORE_DEPEND (SCORE_KANA << 1) /*
\e
$B5!<o0MB8J8;z
\e
(B */
#ifdef SHIFTJIS_CP932
#define SCORE_CP932 (SCORE_DEPEND << 1) /* CP932
\e
$B$K$h$kFI$_49$(
\e
(B */
@@
-1271,8
+1272,8
@@
int score_table_A0[] = {
};
int score_table_F0[] = {
};
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,
};
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);
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);
}else if (c2 == SSO){
set_code_score(ptr, SCORE_KANA);
- }
#ifdef UTF8_OUTPUT_ENABLE
#ifdef UTF8_OUTPUT_ENABLE
- else if (!e2w_conv(c2, c1)){
+
}
else if (!e2w_conv(c2, c1)){
set_code_score(ptr, SCORE_NO_EXIST);
set_code_score(ptr, SCORE_NO_EXIST);
- }
#endif
#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)
}
void status_disable(ptr)
@@
-1336,7
+1338,6
@@
void status_clear(ptr)
struct input_code *ptr;
{
ptr->stat = 0;
struct input_code *ptr;
{
ptr->stat = 0;
- ptr->score &= SCORE_INIT;
ptr->index = 0;
}
ptr->index = 0;
}
@@
-1679,6
+1680,7
@@
module_connection()
}
i_getc = std_getc;
}
i_getc = std_getc;
+ i_ungetc = std_ungetc;
/* input redicrection */
#ifdef INPUT_OPTION
if (cap_f){
/* 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 {
output_mode = ISO8859_1;
(*o_putc)(c1 | 0x080);
} else {
- if ((c1<0x2
0
|| 0x7e<c1) ||
- (c2<0x2
0
|| 0x7e<c2)) {
+ if ((c1<0x2
1
|| 0x7e<c1) ||
+ (c2<0x2
1
|| 0x7e<c2)) {
set_iconv(FALSE, 0);
return; /* too late to rescue this char */
}
set_iconv(FALSE, 0);
return; /* too late to rescue this char */
}