From 65bc0411a17980179bc4f0008afb58e50a0d16d6 Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Tue, 15 Jan 2002 17:23:29 +0000 Subject: [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 --- main.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'main.c') 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 @@ -152,6 +152,9 @@ fversion(FILE * f) #endif #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; -- cgit v1.2.3