aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2002-01-15 17:23:29 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2002-01-15 17:23:29 +0000
commit65bc0411a17980179bc4f0008afb58e50a0d16d6 (patch)
tree4ed52b991bfc6735d47ab7819fccba400fb6bc93 /main.c
parent* main.c (fversion): add "external-uri-loader,w3mmailer" (diff)
downloadw3m-65bc0411a17980179bc4f0008afb58e50a0d16d6.tar.gz
w3m-65bc0411a17980179bc4f0008afb58e50a0d16d6.zip
[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 (limited to 'main.c')
-rw-r--r--main.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/main.c b/main.c
index 9cdf538..ee4a5d9 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.58 2002/01/15 16:30:08 ukai Exp $ */
+/* $Id: main.c,v 1.59 2002/01/15 17:23:29 ukai Exp $ */
#define MAINPROGRAM
#include "fm.h"
#include <signal.h>
@@ -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;