This is the third patch for "kinput", kana-kanji conversion front-end program in X11R4 contrib/clients. You should specify '-p0' option to 'patch' command to apply this correctly. % cd R4src/contrib/clients/kinput % patch -p0 < thisfile % make % make install fixed problems: o -rv (reverse video mode) doesn't work. o some dictionaries can't be saved. (but since kinput can't add new words to dictionaries, that's not a real problem) new features: o if invalid arguments are specified, print usage. o following two new functions can be used in ccdef files. convert-or-space for using space key to convert kana text into kanji text. fix-or-cr for using return key to fix converted text. Makoto Ishisone Software Research Associates, Inc. ishisone@sra.co.jp diff -c -r ../../old/kinput/Func.c ./Func.c *** ../../old/kinput/Func.c Tue Jun 5 11:07:01 1990 --- ./Func.c Tue Sep 18 17:08:58 1990 *************** *** 1,4 **** ! /* $Id: Func.c,v 3.2 89/10/27 16:57:29 ishisone Rel $ */ /* * Copyright (c) 1989 Software Research Associates, Inc. * --- 1,4 ---- ! /* $Id: Func.c,v 3.3 90/09/18 16:19:04 ishisone Rel $ */ /* * Copyright (c) 1989 Software Research Associates, Inc. * *************** *** 134,139 **** --- 134,152 ---- UpdateHint(w) = REDRAW; } + static void + fix_cr(w) + KanjiInputWidget w; + { + jcConvBuf *jcbuf = JCBUF; + + if (jcbuf->nClause == 0) { + carriageret(w); + } else { + fix(w); + } + } + /* * クリア */ *************** *** 175,180 **** --- 188,207 ---- warn(jcConvert(jcbuf, 0, 0, 1)); ccContextClear(CCBUF); UpdateHint(w) = REDRAW; + } + + static void + convert_sp(w) + KanjiInputWidget w; + { + jcConvBuf *jcbuf = JCBUF; + + if (jcbuf->nClause == 0) { + insChar(' ', (caddr_t)w); + fix(w); + } else { + convert(w); + } } static void diff -c -r ../../old/kinput/KanjiInput.c ./KanjiInput.c *** ../../old/kinput/KanjiInput.c Tue Jun 5 11:07:11 1990 --- ./KanjiInput.c Tue Sep 18 17:09:08 1990 *************** *** 21,27 **** */ #ifndef lint ! static char *rcsid = "$Header: /private/usr/mmb/ishisone/job/x11/kinput/RCS/KanjiInput.c,v 3.1 89/10/03 13:41:22 ishisone Rel $"; #endif #include --- 21,27 ---- */ #ifndef lint ! static char *rcsid = "$Header: /private/usr/mmb/ishisone/job/x11/kinput/RCS/KanjiInput.c,v 3.3 90/09/18 16:33:16 ishisone Rel $"; #endif #include *************** *** 113,119 **** {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), XtOffset(KanjiInputWidget, core.width), XtRString, "400"}, {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), ! XtOffset(KanjiInputWidget, kinput.foreground), XtRString, "Black"}, /* New resources for KanjiInput */ {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), --- 113,119 ---- {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), XtOffset(KanjiInputWidget, core.width), XtRString, "400"}, {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), ! XtOffset(KanjiInputWidget, kinput.foreground), XtRString, XtDefaultForeground}, /* New resources for KanjiInput */ {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), *************** *** 322,327 **** --- 322,328 ---- static char *fepfunctbl[] = { "convert", + "convert-or-space", "convert-s", "unconvert", "next", *************** *** 343,348 **** --- 344,350 ---- "shrink-noconv-s", "fix", "fix2", + "fix-or-cr", "to-hankaku", "to-zenkaku", "to-hiragana", *************** *** 361,366 **** --- 363,369 ---- #define FTSIZE (sizeof(fepfunctbl) / sizeof(char *)) static void convert(); + static void convert_sp(); static void convert_small(); static void unconvert(); static void select_next(); *************** *** 396,401 **** --- 399,405 ---- static void shrink_clause2(); static void shrink_clause2_small(); static void fix(); + static void fix_cr(); static void hankaku(); static void zenkaku(); static void hiragana(); *************** *** 413,418 **** --- 417,423 ---- static void (*func_normal[])() = { /* convert */ convert, + /* convert-or-space */ convert_sp, /* convert-s */ convert_small, /* unconvert */ unconvert, /* next */ select_next, *************** *** 434,439 **** --- 439,445 ---- /* shrink-noconv-s */ shrink_clause2_small, /* fix */ fix, /* fix2 */ fix, + /* fix-or-cr */ fix_cr, /* to-hankaku */ hankaku, /* to-zenkaku */ zenkaku, /* to-hiragana */ hiragana, *************** *** 452,457 **** --- 458,464 ---- static void (*func_selection[])() = { /* convert */ selection_forward, + /* convert-or-space */ selection_forward, /* convert-s */ selection_forward, /* unconvert */ beep, /* next */ selection_next, *************** *** 473,478 **** --- 480,486 ---- /* shrink-noconv-s */ shrink_clause2_small, /* fix */ fix, /* fix2 */ fix, + /* fix-or-cr */ selection_select, /* to-hankaku */ hankaku, /* to-zenkaku */ zenkaku, /* to-hiragana */ hiragana, *************** *** 491,496 **** --- 499,505 ---- static void (*func_symbol[])() = { /* convert */ beep, + /* convert-or-space */ beep, /* convert-s */ beep, /* unconvert */ beep, /* next */ symbol_next, *************** *** 512,517 **** --- 521,527 ---- /* shrink-noconv-s */ beep, /* fix */ fix, /* fix2 */ fix, + /* fix-or-cr */ symbol_select, /* to-hankaku */ beep, /* to-zenkaku */ beep, /* to-hiragana */ beep, Common subdirectories: ../../old/kinput/cconv and ./cconv Common subdirectories: ../../old/kinput/jclib and ./jclib diff -c -r ../../old/kinput/kinput.c ./kinput.c *** ../../old/kinput/kinput.c Tue Jun 5 11:07:22 1990 --- ./kinput.c Tue Sep 18 17:09:18 1990 *************** *** 23,29 **** */ #ifndef lint ! static char *rcsid = "$Header: /private/usr/mmb/ishisone/job/x11/kinput/RCS/kinput.c,v 3.4 90/06/05 11:04:06 ishisone Exp $"; #endif #include --- 23,29 ---- */ #ifndef lint ! static char *rcsid = "$Header: /private/usr/mmb/ishisone/job/x11/kinput/RCS/kinput.c,v 3.5 90/09/18 16:29:04 ishisone Exp $"; #endif #include *************** *** 110,115 **** --- 110,116 ---- static void endProc(Widget, caddr_t); static void fatalError(char *); static int dicConfirm(Widget, int, char *); + static void usage(void); #else static ConvClient *findConverter(); static ConvClient *getFreeConverter(); *************** *** 128,133 **** --- 129,135 ---- static void endProc(); static void fatalError(); static int dicConfirm(); + static void usage(); #endif /* translation table for toplevel widget */ *************** *** 162,167 **** --- 164,175 ---- toplevel = XtInitialize("main", "Kinput", options, XtNumber(options), &ac,av); + if (ac > 1) { + for (i = 1; i < ac; i++) { + fprintf(stderr, "unknown argument: %s¥n", av[i]); + } + usage(); + } disp = XtDisplay(toplevel); XtAddActions(actions, XtNumber(actions)); *************** *** 742,747 **** --- 750,781 ---- /* for saving dictionary/frequency-file */ XtDestroyWidget(toplevel); exit(0); + } + + static void + usage() + { + char *p; + static char *syntaxtable[] = { + "-jserver ", "specifies jserver host", + "-ccdef ", "specifies character conversion def. file", + "-wnnenvname ", "specifies Wnn environment name", + "-wnnenvrc ", "specifies Wnn environment file", + "-nlines ", "specifies number of lines", + "-font ", "ASCII font to be used", + "-kanjifont ", "KANJI font to be used", + "-background ", "specifies background color", + "-foreground ", "specifies foreground color", + "-geometry ", "specifies geometry", + "-rv", "reverse video mode", + "-display ", "specifies display", + NULL, NULL, + }; + + for (p = syntaxtable; *p != NULL; p += 2) { + fprintf(stderr, "%-30s %s¥n", *p, *(p + 1)); + } + exit(1); } #ifdef DEBUG Common subdirectories: ../../old/kinput/xlocal and ./xlocal Common subdirectories: ../../old/kinput/cconv/ccdef and ./cconv/ccdef diff -c -r ../../old/kinput/jclib/jclib.c ./jclib/jclib.c *** ../../old/kinput/jclib/jclib.c Tue Jun 5 11:07:06 1990 --- ./jclib/jclib.c Tue Sep 18 17:09:03 1990 *************** *** 1,6 **** /* * jclib -- かな漢字変換用ライブラリ (Wnn Version4.0 対応版) ! * version 4.1 * ishisone@sra.co.jp */ --- 1,6 ---- /* * jclib -- かな漢字変換用ライブラリ (Wnn Version4.0 対応版) ! * version 4.2 * ishisone@sra.co.jp */ *************** *** 144,149 **** --- 144,154 ---- * ver 4.1 90/06/04 * クライアント側にある辞書・頻度ファイルのセーブができないという * 重大なバグを修正 + * ver 4.2 90/06/15 + * 辞書が登録可能かどうかの判定が間違っていて、逆変換可能辞書の + * セーブができないというまたまた重大なバグを修正 + * 今のところ kinput/wterm とも単語登録機能がついてないので + * 実害はなかったが */ /* *************** *** 416,422 **** */ #ifndef lint ! static char *rcsid = "$Header: /private/usr/mmb/ishisone/src/jclib/RCS/jclib.c,v 4.1 90/06/04 10:54:29 ishisone Exp $"; #endif #ifdef DEBUG --- 421,427 ---- */ #ifndef lint ! static char *rcsid = "$Header: /private/usr/mmb/ishisone/src/jclib/RCS/jclib.c,v 4.2 90/06/15 11:16:17 ishisone Exp $"; #endif #ifdef DEBUG *************** *** 2306,2312 **** diclist = (WNN_DIC_INFO *)jsbuf.buf; for (i = 0; i < ndic; i++) { /* 登録可能形式でない辞書をセーブする必要はないだろう */ ! if (diclist->type == WNN_UD_DICT && diclist->body >= 0) { /* 辞書本体のセーブ */ if (diclist->localf) { (void)js_file_write(env, diclist->body, --- 2311,2317 ---- diclist = (WNN_DIC_INFO *)jsbuf.buf; for (i = 0; i < ndic; i++) { /* 登録可能形式でない辞書をセーブする必要はないだろう */ ! if (diclist->rw == WNN_DIC_RW && diclist->body >= 0) { /* 辞書本体のセーブ */ if (diclist->localf) { (void)js_file_write(env, diclist->body,