commit eb5c5bcbc91796b124a82f3ab200ae773a8d1cb3
parent e4bf5100efbf860c457de0c0beadcd2c21bb8c6c
Author: ukai <ukai>
Date: Tue, 15 Jan 2002 17:23:29 +0000
[w3m-dev 02841] migemo patch
* NEWS: migemo support
* config.h.dist (USE_MIGEMO): added
* configure: add use_migemo
* fm.h (use_migemo): added
* fm.h (migemo_command: added
* main.c (fversion): add "migemo"
* main.c (migemostr): added
* main.c (srchcore): if use_migemo, use migemostr
* rc.c (CMT_USE_MIGEMO): added
* rc.c (CMT_MIGEMO_COMMAND): added
* rc.c (params3): add use_migemo, migemo_command
From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
Diffstat:
7 files changed, 68 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,18 @@
+2002-01-16 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
+
+ * [w3m-dev 02841] migemo patch
+ * NEWS: migemo support
+ * config.h.dist (USE_MIGEMO): added
+ * configure: add use_migemo
+ * fm.h (use_migemo): added
+ * fm.h (migemo_command: added
+ * main.c (fversion): add "migemo"
+ * main.c (migemostr): added
+ * main.c (srchcore): if use_migemo, use migemostr
+ * rc.c (CMT_USE_MIGEMO): added
+ * rc.c (CMT_MIGEMO_COMMAND): added
+ * rc.c (params3): add use_migemo, migemo_command
+
2002-01-16 Fumitoshi UKAI <ukai@debian.or.jp>
* main.c (fversion): add "external-uri-loader,w3mmailer"
diff --git a/NEWS b/NEWS
@@ -1,5 +1,6 @@
w3m 0.3?
+* support migemo (romaji search) [experimental]
* use w3mmail.cgi for mailto: URL
* support external URI loader
* support -dump_extra ftp://
diff --git a/config.h.dist b/config.h.dist
@@ -102,6 +102,7 @@ MODEL=Linux.i686-monster-ja
#define KANJI_SYMBOLS
#define USE_COLOR
#undef USE_ANSI_COLOR
+#undef USE_MIGEMO
#undef EMACS_LIKE_LINEEDIT
#undef VI_PREC_NUM
#undef USE_MARK
diff --git a/configure b/configure
@@ -697,6 +697,8 @@ else
def_param "use_ansi_color" n
fi
+ask_param "Use Migemo (Roma-ji search; Please see http://www.nmn.jp/~hidai/software/w3m/)" use_migemo n
+
# protocols?
ask_param "External URI loader support" use_external_uri_loader y
if [ "$use_external_uri_loader" = y ]; then
@@ -2035,6 +2037,7 @@ $def_lang
$def_kanji_symbols
$def_use_color
$def_use_ansi_color
+$def_use_migemo
$def_emacs_like_lineedit
$def_vi_prec_num
$def_use_mark
diff --git a/fm.h b/fm.h
@@ -776,6 +776,11 @@ global char *DirBufferCommand init("file:///$LIB/dirlist" CGI_EXTENSION);
global int ignore_null_img_alt init(TRUE);
global int FoldTextarea init(FALSE);
+#ifdef USE_MIGEMO
+global int use_migemo init(FALSE);
+global char *migemo_command init("migemoc");
+#endif /* USE_MIGEMO */
+
global struct auth_cookie *Auth_cookie init(NULL);
global char *Local_cookie init(NULL);
#ifdef USE_COOKIE
diff --git a/main.c b/main.c
@@ -153,6 +153,9 @@ fversion(FILE * f)
#ifdef USE_MARK
",mark"
#endif
+#ifdef USE_MIGEMO
+ ",migemo"
+#endif
);
}
@@ -1330,6 +1333,24 @@ rdrwSc(void)
displayBuffer(Currentbuf, B_FORCE_REDRAW);
}
+#ifdef USE_MIGEMO
+/* Migemo: romaji --> kana+kanji in regexp */
+static char *
+migemostr(char *str)
+{
+ FILE *f;
+ Str tmp;
+
+ tmp = Strnew_m_charp(migemo_command, " ", shell_quote(str), NULL);
+ if (!(f = popen(tmp->ptr, "r")))
+ return str;
+ tmp = Strfgets(f);
+ Strchop(tmp);
+ pclose(f);
+ return tmp->ptr;
+}
+#endif /* USE_MIGEMO */
+
/* search by regular expression */
static int
srchcore(char *str, int (*func) (Buffer *, char *))
@@ -1338,7 +1359,11 @@ srchcore(char *str, int (*func) (Buffer *, char *))
volatile int i, result = SR_NOTFOUND;
if (str != NULL && str != SearchString)
- SearchString = str;
+ SearchString =
+#ifdef USE_MIGEMO
+ use_migemo ? migemostr(str) :
+#endif /* USE_MIGEMO */
+ str;
if (SearchString == NULL || *SearchString == '\0')
return SR_NOTFOUND;
diff --git a/rc.c b/rc.c
@@ -168,6 +168,11 @@ static char *config_file = NULL;
#define CMT_FOLLOW_REDIRECTION "従うリダイレクトの回数"
#define CMT_META_REFRESH "meta refresh に対応する"
+#ifdef USE_MIGEMO
+#define CMT_USE_MIGEMO "Migemo(ローマ字検索)を使用する"
+#define CMT_MIGEMO_COMMAND "Migemoコマンド"
+#endif /* USE_MIGEMO */
+
#else /* LANG != JA */
@@ -283,6 +288,12 @@ static char *config_file = NULL;
#endif
#define CMT_FOLLOW_REDIRECTION "Follow this number of redirections"
#define CMT_META_REFRESH "Support meta refresh"
+
+#ifdef USE_MIGEMO
+#define CMT_USE_MIGEMO "Use Migemo (Roma-ji search)"
+#define CMT_MIGEMO_COMMAND "Migemo command"
+#endif /* USE_MIGEMO */
+
#endif /* LANG != JA */
#define PI_TEXT 0
@@ -461,6 +472,12 @@ struct param_ptr params3[] = {
{"wrap_search", P_INT, PI_ONOFF, (void *)&WrapDefault, CMT_WRAP, NULL},
{"ignorecase_search", P_INT, PI_ONOFF, (void *)&IgnoreCase,
CMT_IGNORE_CASE, NULL},
+#ifdef USE_MIGEMO
+ {"use_migemo", P_INT, PI_ONOFF, (void *)&use_migemo, CMT_USE_MIGEMO,
+ NULL},
+ {"migemo_command", P_STRING, PI_TEXT, (void *)&migemo_command,
+ CMT_MIGEMO_COMMAND, NULL},
+#endif /* USE_MIGEMO */
#ifdef USE_MOUSE
{"use_mouse", P_INT, PI_ONOFF, (void *)&use_mouse, CMT_MOUSE, NULL},
{"reverse_mouse", P_INT, PI_ONOFF, (void *)&reverse_mouse,