ref: 1bea44dc3654c8bb7ab47ebeb5c975734a6aa3f4
author: Romi Hervier <r@sansfontieres.com>
date: Wed Jun 29 11:31:15 EDT 2022
init from postnix
--- /dev/null
+++ b/Kanji
@@ -1,0 +1,4 @@
+#!/bin/rc
+
+pipefile -r ktrans /dev/cons
+rio -i $home/lib/windows </dev/cons
--- /dev/null
+++ b/README.kenji
@@ -1,0 +1,108 @@
+This version of ktrans works with pipefile by Rob Pike, which replaces /dev/kbd of
+2nd Edition Plan 9 by Dennis Ritchie. By this new idea, we can input Japanese
+anytime onto any windows. I included his post to 9fans mailing-list here (pipefile
+file).
+
+This is a distribution as a derived work license of Plan 9, and I included the
+Plan 9 License term here. Please refer to it on the details of this license.
+
+
+Main features are as follows:
+
+1) There is a "local" dictionary file for translation from kana to kanji, which can
+ easily be edited by the user. The default file name is $home/lib/ktrans-jisho.
+ If you want to use another dictionary file, set the KTJISHO environment
+ variable to point to that file. This dictionary comprises many lines of
+ edittable text strings.
+
+2) Capital romaji input is used for words such as verbs or adjectives with okurigana,
+ which follows the idea of the SKK system by Masahiko Sato of Kyoto Univ.
+ (masahiko@kuis.kyoto-u.ac.jp). If you want to get the kanji string (runes)
+ "動かす", which is a verb, you may input "ugoKasu" from the keyboard.
+ Note here the Kasu's k is a capital (important). You will see hiragana
+ runes "うごかす", and then the kanji runes of "動かす", when you type
+ "Shift+Space".
+ If you are satisfied by that translation, continue to input the next word.
+ If you are not pleased with that candidate, hit 'Shift+Space' once more
+ to see more candiates for that hiragana input. When there are no more candidates
+ registered in your dictionary, you will see the initial hiragana input.
+
+3) For Japanese "joshi", a post-positioned short word after a noun, you can use another
+ method that I developed for this work. If you want the kanji string (runes) "私は",
+ then type "watashiHA" from the keyboard. Note that the sound of "wa(ha)" is expressed
+ as capitalized "HA". You will see a hiragana string of "わたしは", and then "私は"
+ after `Shift+Space'.
+
+4) A control sequence of 'ctl-l' is introduced to leave input hiragana runes unchanged.
+ This is occasionally neccessary.
+
+5) A simple leaning mechanism has been implemented for the in-memory hashing
+ dictinary, in which the most recently used kanji runes (candidate) moves to the top
+ of the list of candidates. This is valid only during the session you called ktrans.
+ It is done this way intentionally, because the present learning method is ..well...
+ naive. ^_^ I know this; however, I believe you can solve it by making a good
+ dictionary best fitted to your purposes on your own.
+
+6) 'ctl-x' re-reads the new kana-kanji translation dictionary when you have edited your
+ kana-kanji translation, and want to incorporate it into your current in-memory translation
+ dictionary. The kana-kanji translation dictionary is usually read only once, at the
+ beginning of the ktrans session. I believe this simplification is not a serious constraint,
+ because you can edit the dictionary anytime by co-working with acme and using this ctl-x
+ mechanism.
+
+7) A mode change to kana-input is triggered by 'ctl-n', ctl-k for katakana mode,
+ ctl-g for Greek mode, and ctl-r for Russian mode.
+
+8) As the starting $home/lib/ktrans-jisho, you may re-format the SKK-JISYO.S (66.9KB) of the
+ SKK system, which can be retrieved from ftp.kuis.kyoto-u.ac.jp. The next three lines
+ show the short sed filter to transform from an SKK type dictionary to Plan 9. Before
+ this, you should change the kanji code of the SKK dictionary from ujis(euc) to UTF-8 by
+ the tcs utility, of course.
+ s/\// /g
+ s/ / /g
+ s/ $//g
+ The header items are sorted in a strange order in the original SKK dictionary.
+ This implementation does not care about the order, therefore, you can change it on
+ your own.
+
+9) SKK jisho, such as SKK-JISYO.S, is composed of two parts, okuri-ari and okuri-nashi
+ entries. This greatly depends on the Japanese grammer, and okuri-ari may represent
+ verb/adjective etc., i.e., not noun. These two parts work differently in the original
+ SKK system, however, I did not employ that method; rather, I took a simple approarch
+ as described in (2) and (3). Here, we make no difference between these two parts,
+ and the reason why I left the two-part structure is just to make it easier to read for
+ editting. Of course, you can change it without any side-effects.
+
+10) The essence of this Japanese input method is to convert every one word by one key
+ triggering. This may cause some cumbersome feelings for Nihongo users who are accustomed
+ to, say, Windows. I know this. However, I intended to keep the codes as compact as
+ possible as a first step towards developing a Nihongo input system on Plan 9.
+ Furthermore, I've never seen the latter work perfectly. I think the conversion failed
+ essentially when we see more than, say, five/six candidates for one set of hiragana runes.
+ Finaly, I'd like to add that I have no problem to write long Japanese documents by
+ this version.
+
+11) The translation trigger key has been changed from ^t to Shift+Space, because
+ we experienced butting of the trigger key sequence sometime. For this reason,
+ you have to edit the key-binding table, such as kbtabshift[0x39] in /sys/src/9/pc/kbd.c
+ or keymapshift[0x79] in /sys/src/9/ss/screen.c to assign Shift+Space to '^\'.
+ I use here '^\' as the trigger key. Therefore, you can trigger translation
+ from kana to kanji by Shit+Space or just '^\'.
+
+12) A usage example: If you want to make the Japanese text as below:
+
+ 私は毎日35分以上歩いて、 更に10分電車に乗って学校に通います。
+ 健康の維持にも役だっていますが、 なかなかたのしいものです。
+
+ your keyboard typing stream should be:
+
+ watashiHA[^t]mainichi[^t]35[^l]fun[^t]ijou[^t]aruIte, [^t]saraNI[^t]
+ 10[^l]fun[^t]denshaNI[^t]noTte[^t]gakkouNI[^t]kayoImasu.[^t]
+ kenkouNO[^t]ijiNImo[^t]yakuDAtteimasuga, [^t]nakanaka[^l]tanoshiI[^t]
+ monodesu.[^l]
+
+ where [^t], [^l] indicates 'Shift+Space' and 'ctl-l', respectively.
+
+
+ Kenji Okamoto August 14, 2000
+
--- /dev/null
+++ b/READMEJ.kenji
@@ -1,0 +1,126 @@
+Plan 9がRelase 3になってソースが公開されました。このため、更に多くのユーザがPlan 9を
+使い始める事になると思います。このバージョンになって、Windowシステムが8½からrioに
+変更になり、それにともなって、release 2に含まれていたktransが無くなりました。
+
+そこで、Rob Pikeさんにお願いしたら、pipefileというすばらしいアイデアを考えて戴け
+ました。これはrelease 2でDennis Ritchieさんが提供した/dev/kbdを置き替えるもので、
+このいきさつは、Pikeさんの9fansのlmailing-listへの投稿を同封してありますので、
+そちら(pipefile)を御覧下さい。この方法は何時でもどのウィンドへも日本語を入力出来る
+ので、以前のバージョンの様にウィンド毎にktransを起動する必要がなくなりました。
+pipefileはrioより前に起動される必要がありますので、ここに同封したKanjiという
+スクリプトを各自のlib/profileにrioを起動する替わりに、このKanjiスクリプトを
+起動する様にして下さい。
+
+
+Main features are as follows:
+
+1) There is a "local" dictionary file for translation from kana to kanji, which can
+ easily be edited by the user. The default file name is $home/lib/ktrans-jisho.
+ If you want to use another dictionary file, set the KTJISHO environment
+ variable to point to that file. This dictionary comprises many lines of
+ edittable text strings.
+
+2) Capital romaji input is used for words such as verbs or adjectives with okurigana,
+ which follows the idea of the SKK system by Masahiko Sato of Kyoto Univ.
+ (masahiko@kuis.kyoto-u.ac.jp). If you want to get the kanji string (runes)
+ "動かす", which is a verb, you may input "ugoKasu" from the keyboard.
+ Note here the Kasu's k is a capital (important). You will see hiragana
+ runes "うごかす", and then the kanji runes of "動かす", when you type
+ "Shift+Space".
+ If you are satisfied by that translation, continue to input the next word.
+ If you are not pleased with that candidate, hit 'Shift+Space' once more
+ to see more candiates for that hiragana input. When there are no more candidates
+ registered in your dictionary, you will see the initial hiragana input.
+
+3) For Japanese "joshi", a post-positioned short word after a noun, you can use another
+ method that I developed for this work. If you want the kanji string (runes) "私は",
+ then type "watashiHA" from the keyboard. Note that the sound of "wa(ha)" is expressed
+ as capitalized "HA". You will see a hiragana string of "わたしは", and then "私は"
+ after `Shift+Space'.
+
+4) A control sequence of 'ctl-l' is introduced to leave input hiragana runes unchanged.
+ This is occasionally neccessary.
+
+5) A simple leaning mechanism has been implemented for the in-memory hashing
+ dictinary, in which the most recently used kanji runes (candidate) moves to the top
+ of the list of candidates. This is valid only during the session you called ktrans.
+ It is done this way intentionally, because the present learning method is ..well...
+ naive. ^_^ I know this; however, I believe you can solve it by making a good
+ dictionary best fitted to your purposes on your own.
+
+6) 'ctl-x' re-reads the new kana-kanji translation dictionary when you have edited your
+ kana-kanji translation, and want to incorporate it into your current in-memory translation
+ dictionary. The kana-kanji translation dictionary is usually read only once, at the
+ beginning of the ktrans session. I believe this simplification is not a serious constraint,
+ because you can edit the dictionary anytime by co-working with acme and using this ctl-x
+ mechanism.
+
+7) A mode change to kana-input is triggered by 'ctl-n', ctl-k for katakana mode,
+ ctl-g for Greek mode, and ctl-r for Russian mode.
+
+8) As the starting $home/lib/ktrans-jisho, you may re-format the SKK-JISYO.S (66.9KB) of the
+ SKK system, which can be retrieved from ftp.kuis.kyoto-u.ac.jp. The next three lines
+ show the short sed filter to transform from an SKK type dictionary to Plan 9. Before
+ this, you should change the kanji code of the SKK dictionary from ujis(euc) to UTF-8 by
+ the tcs utility, of course.
+ s/\// /g
+ s/ / /g
+ s/ $//g
+ The header items are sorted in a strange order in the original SKK dictionary.
+ This implementation does not care about the order, therefore, you can change it on
+ your own.
+
+9) SKK jisho, such as SKK-JISYO.S, is composed of two parts, okuri-ari and okuri-nashi
+ entries. This greatly depends on the Japanese grammer, and okuri-ari may represent
+ verb/adjective etc., i.e., not noun. These two parts work differently in the original
+ SKK system, however, I did not employ that method; rather, I took a simple approarch
+ as described in (2) and (3). Here, we make no difference between these two parts,
+ and the reason why I left the two-part structure is just to make it easier to read for
+ editting. Of course, you can change it without any side-effects.
+
+10) The essence of this Japanese input method is to convert every one word by one key
+ triggering. This may cause some cumbersome feelings for Nihongo users who are accustomed
+ to, say, Windows. I know this. However, I intended to keep the codes as compact as
+ possible as a first step towards developing a Nihongo input system on Plan 9.
+ Furthermore, I've never seen the latter work perfectly. I think the conversion failed
+ essentially when we see more than, say, five/six candidates for one set of hiragana runes.
+ Finaly, I'd like to add that I have no problem to write long Japanese documents by
+ this version.
+
+11) The translation trigger key has been changed from ^t to Shift+Space, because
+ we experienced butting of the trigger key sequence sometime. For this reason,
+ you have to edit the key-binding table, such as kbtabshift[0x39] in /sys/src/9/pc/kbd.c
+ or keymapshift[0x79] in /sys/src/9/ss/screen.c to assign Shift+Space to '^\'.
+ I use here '^\' as the trigger key. Therefore, you can trigger translation
+ from kana to kanji by Shit+Space or just '^\'.
+
+12) A usage example: If you want to make the Japanese text as below:
+
+ 私は毎日35分以上歩いて、 更に10分電車に乗って学校に通います。
+ 健康の維持にも役だっていますが、 なかなかたのしいものです。
+
+ your keyboard typing stream should be:
+
+ watashiHA[^t]mainichi[^t]35[^l]fun[^t]ijou[^t]aruIte, [^t]saraNI[^t]
+ 10[^l]fun[^t]denshaNI[^t]noTte[^t]gakkouNI[^t]kayoImasu.[^t]
+ kenkouNO[^t]ijiNImo[^t]yakuDAtteimasuga, [^t]nakanaka[^l]tanoshiI[^t]
+ monodesu.[^l]
+
+ where [^t], [^l] indicates 'Shift+Space' and 'ctl-l', respectively.
+
+
+ Kenji Okamoto August 14, 2000
+
+
+これはRelease 2のPlan 9に含まれていたDennis Ritchieさんのktransを機能強化したもので、
+大阪府立大学の岡本健二が作成いたしました。 疑問、提案等がございましたら、
+okamoto@granite.cias.osakafu-u.ac.jpまで御連絡ください。
+なお, Plan 9そのものにつきましては、
+ http://basalt.cias.osakafu-u.ac.jp/plan9/p9index.html に95年度より
+ささやかなWeb Pageをもっていますので、そちらも参照くださいませ。
+
+なおこのプログラムはPlan 9のderived workとしてのライセンスを持った配布となります。
+Plan 9のLicense fileを同封してありますので、ここに書かれている事を守ってお使い
+下さいませ。
+
+大阪府立大学総合科学部 岡本健二 August 14, 2000
--- /dev/null
+++ b/jisho.c
@@ -1,0 +1,220 @@
+/*
+ * open jisho file, and set the size of this jisho etc
+ * default personal jisho: $home/lib/ktrans-jisho
+ *
+ * Kenji Okamoto August 4, 2000
+ * Osaka Prefecture Univ.
+ * okamoto@granite.cias.osakafu-u.ac.jp
+ */
+
+#include <u.h>
+#include <libc.h>
+#include <bio.h>
+#include "jisho.h"
+
+Dictionary *openQDIC(char *);
+void freeQDIC(Dictionary*);
+KouhoList *getKouhoHash(Dictionary*, char *);
+KouhoList *getKouhoFile(DicList*, char *);
+void selectKouho(KouhoList **, KouhoList*);
+int hashVal(char *);
+void addHash(Hash **, DicList*);
+
+
+
+/*
+ * Open QuickDIC (hashed personal dictionary)
+ * open skk styled ktrans dictinary file, and make its hash table
+ * based on individual header kana strings
+ *
+ * KouhoList
+ * |---------|
+ * Hash |---->kouho---->kouhotop
+ * |-------| |
+ * dic---->dhash---->dicindex---->kanahead
+ * |--------| |--------|
+ * Dictionary DicList
+ *
+ */
+Dictionary *
+openQDIC(char *dicname)
+{
+ Biobuf *f;
+ void *Bbuf;
+ Dictionary *dic;
+ DicList *dicitem; /* for a future extension */
+ char buf[1024], *startstr, *endstr;
+ int i;
+
+ SET(dicitem); /* yes, I know I'm wrong, but... */
+
+ dic = (Dictionary*)malloc(sizeof(Dictionary));
+ /* make room for pointer array (size=HASHSIZE) of hash table */
+ for(i=0; i< HASHSIZE; i++) dic->dhash[i] = 0;
+ dic->dlist = 0; /* for a future extension (more than one dics ^_^ */
+
+ if ((f = Bopen(dicname, OREAD)) == 0)
+ return dic;
+
+ /* make hash table by the dic's header word */
+
+ while(Bbuf = Brdline(f, '\n')) {
+ strncpy(buf, (char *)Bbuf, Blinelen(f));
+
+ if (buf[0] == ';') /* comment line */
+ continue;
+ else {
+ /* get header word from jisho */
+ startstr = buf;
+ if(!(endstr = utfutf(startstr, "\t"))) break;
+ *endstr = '\0';
+ /* dicitem includes each header word from the jisho */
+
+ dicitem = (DicList*)malloc(sizeof(DicList)+(endstr-startstr+1));
+ dicitem->nextitem = 0; /* for a future extension */
+ strcpy(dicitem->kanahead, startstr);
+
+ dicitem->kouho = getKouhoFile(dicitem, endstr); /* read kouho from jisho */
+ addHash(dic->dhash, dicitem);
+ }
+ continue;
+ }
+ dic->dlist = dicitem;
+ Bterm(f);
+ return dic;
+}
+
+/*
+ * free dynamically allocated memory
+ */
+
+void
+freeQDIC(Dictionary *dic)
+{
+ Hash *hash1, *hash2;
+ DicList *dlist, *dlist2;
+ int l;
+
+ for (dlist = dic->dlist;
+ dlist != 0;
+ dlist2 = dlist, dlist = dlist->nextitem, free((void *)dlist2));
+ for (l = 0; l < HASHSIZE; l++) {
+ for (hash1 = dic->dhash[l]; hash1; hash1 = hash2) {
+ if (hash1->next !=0) {
+ hash2 = hash1->next;
+ free((void *)hash1);
+ }else
+ break;
+ }
+ }
+ free((void *)dic);
+}
+
+/*
+ * well known method to make a hash table
+ * I don't know another better method. ^_^
+*/
+int
+hashVal(char *s)
+{
+ int n = 0;
+
+ while (*s) {
+ n += (*s)*(*s);
+ s++;
+ }
+ return n%HASHSIZE;
+}
+
+void
+addHash(Hash **hash, DicList *ditem)
+{
+ Hash *h;
+ int v;
+
+ v = hashVal(ditem->kanahead);
+ h = (Hash*)malloc(sizeof(Hash));
+ h->dicindex = ditem;
+ h->length = strlen(ditem->kanahead);
+ h->next = hash[v];
+ hash[v] = h;
+}
+
+/*
+ * read Kouho list from the jisho file defined by Biobuf descriptor f
+ *
+ * revised for Plan 9 by K.Okamoto
+ */
+KouhoList *
+getKouhoFile(DicList *dicitem, char * endstr)
+
+{
+ char *kouhostart, *kouhoend;
+ KouhoList *kouhoitem, *currntkouhoitem=0, *prevkouhoitem;
+
+ prevkouhoitem = 0;
+ kouhostart = endstr + 1;
+ while((kouhoend = utfutf(kouhostart, " ")) ||
+ (kouhoend = utfutf(kouhostart, "\n"))) {
+ *kouhoend = '\0';
+
+ kouhoitem = (KouhoList*)malloc(sizeof(KouhoList)+(kouhoend-kouhostart+1));
+ kouhoitem->nextkouho = 0;
+ kouhoitem->prevkouho = prevkouhoitem;
+ kouhoitem->dicitem = dicitem;
+ strcpy(kouhoitem->kouhotop, kouhostart);
+ if (prevkouhoitem)
+ prevkouhoitem->nextkouho = kouhoitem;
+ else
+ currntkouhoitem = kouhoitem;
+ prevkouhoitem = kouhoitem;
+ kouhostart = kouhoend + 1;
+ }
+ return currntkouhoitem;
+}
+
+/*
+ * get matched kouho from the hash table of header word of the dic
+ * if found, returns pointer to the first candidate in the hash table.
+ * if not found, returns 0.
+ *
+ * from getCand() in skklib.c by Akinori Ito et al.,(aito@ei5sun.yz.yamagata-u.ac.jp)
+ */
+
+KouhoList *
+getKouhoHash(Dictionary *dic, char *s)
+{
+ int l, v;
+ Hash *h;
+
+ l = strlen(s);
+ v = hashVal(s);
+ for (h = dic->dhash[v]; h != 0; h = h->next) {
+ if (h->length != l ||
+ strcmp(h->dicindex->kanahead, s)) continue;
+ return h->dicindex->kouho; /* return matched kouho */
+ }
+ return 0;
+}
+
+/*
+ *from skklib.c by Akinori Ito et al.,(aito@ei5sun.yz.yamagata-u.ac.jp)
+ * just modified to read easier for present purpose
+ */
+void
+selectKouho(KouhoList **first, KouhoList *current)
+{
+ /* take off currentkouho from the kouholist table */
+ if (current->prevkouho) {
+ current->prevkouho->nextkouho = current->nextkouho;
+ if (current->nextkouho)
+ current->nextkouho->prevkouho = current->prevkouho;
+ current->prevkouho = 0;
+ }
+ /* take place of firstkouho by currentkouho */
+ if (*first != current) {
+ (*first)->prevkouho = current;
+ current->nextkouho = *first;
+ *first = current;
+ }
+}
--- /dev/null
+++ b/jisho.h
@@ -1,0 +1,41 @@
+/*
+ * Kenji Okamoto August 4, 2000
+ * Osaka Prefecture Univ.
+ * okamoto@granite.cias.osakafu-u.ac.jp
+ */
+
+#define HASHSIZE 256
+
+/*
+ * Structure for Dictionary's header word(in Hiragana)
+ */
+typedef struct DicList DicList;
+struct DicList {
+ struct KouhoList *kouho;
+ struct DicList *nextitem; /* for a future extension */
+ char kanahead[1];
+};
+
+/*
+ * Structure for Kouho of each index word in the dictionary
+ */
+typedef struct KouhoList KouhoList;
+struct KouhoList {
+ struct KouhoList *nextkouho;
+ struct KouhoList *prevkouho;
+ struct DicList *dicitem;
+ char kouhotop[1]; /* top of the kouhos */
+} ;
+
+typedef struct Hash Hash;
+struct Hash {
+ DicList *dicindex; /* pointer to a KouhoList and kanahead etc */
+ short length;
+ struct Hash *next;
+};
+
+typedef struct Dictionary Dictionary;
+struct Dictionary {
+ DicList *dlist; /* for a future extension, having more than one dictionaries */
+ Hash *dhash[HASHSIZE];
+};
--- /dev/null
+++ b/ktrans-jisho
@@ -1,0 +1,1292 @@
+;; Medium size dictionary for SKK system
+;; version 8.1 of May 24, 1995.
+;;
+;; Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995
+;; Masahiko Sato (masahiko@sato.riec.tohoku.ac.jp),
+;; Hironobu Takahashi (takahasi@tiny.or.jp),
+;; Masahiro Doteguchi, Miki Inooka,
+;; Yukiyoshi Kameyama, Akihiko Sasaki, Dai Ando, Junichi Okukawa,
+;; Katsushi Sato and Nobuhiro Yamagishi
+;;
+;; This dictionary is free software; you can redistribute it and or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either versions 2, or (at your option)
+;; any later version.
+;;
+;; This dictionary is distributed in the hope that it will be useful
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with SKK, see the file COPYING. If not, write to the Free
+;; Software Foundation Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+;;
+;; re-arranged for ktrans of Plan 9 by Kenji Okamoto
+;; (okamoto@granite.cias.osakafu-u.ac.jp).
+;; Feb. 17, 2000
+;; okuri-ari entries.
+あb 浴
+あe 合 会 逢
+あg 挙 揚 上
+あi 合 会 空 開
+あk 飽 開 明 空
+あo 合
+あr 有 在
+あs 悪
+あt 当 有 挙 合 会 蓬
+あu 合 逢 会
+あw 合 会
+あいs 愛
+あいかわr 相変
+あおi 青
+あおk 青
+あかi 赤
+あかn 赤
+あかr 明
+あきr 明
+あきらm 諦
+あさi 浅
+あさk 浅
+あずk 預
+あせt 焦
+あそb 遊
+あそn 遊
+あたe 与
+あたr 辺 当
+あたt 当 的
+あたたk 暖
+あたたm 暖
+あたらs 新
+あつi 熱 暑 厚
+あつk 厚 熱 暑
+あつk 厚 熱 暑
+あつs 暑
+あつm 集 厚
+あつかe 扱
+あつかi 扱
+あつかo 扱
+あつかt 扱
+あつかu 扱
+あつかw 扱
+あばr 暴
+あぶn 危
+あぶなi 危
+あまe 甘
+あまi 甘
+あまr 余
+あやs 怪
+あやまr 誤 謝
+あやまt 誤 謝
+あゆm 歩
+あらe 洗
+あらi 洗 荒
+あらt 新 洗
+あらu 洗
+あらz 非
+あらいだs 洗い出
+あらかじm 予
+あらそu 争
+あらたm 改
+あらわr 現
+あらわs 現 表
+ありがたi 有難
+ありがとu 有難
+あるi 歩
+あるk 歩
+あわi 淡
+あわr 憐 哀
+あわs 淡
+あんしんs 安心
+いe 言
+いi 言 良
+いk 行 生
+いm 居
+いn 居
+いo 言
+いr 入 居 煎
+いt 言 行 居
+いu 言 云
+いw 言
+いかr 怒
+いかt 怒
+いきおi 勢
+いきぎr 息切
+いくr 幾
+いくt 幾
+いくとおr 幾通
+いそg 急
+いそi 急
+いそがs 忙
+いたi 痛
+いたm 痛 傷 炒
+いたn 痛 傷
+いたr 至 到
+いたs 致
+いたt 至
+いただi 頂 戴
+いただk 頂 戴
+いだi 抱
+いだk 抱
+いちじるs 著
+いちずk 位置付
+いっt 言 行
+いっしょn 一緒
+いとs 愛
+いなm 否
+いのr 祈
+いのt 祈
+いれかe 入れ替
+いわi 祝
+いわu 祝
+うe 飢 植
+うi 浮
+うk 受 浮
+うm 埋 生 産
+うr 売 得
+うt 売 打
+うかがe 伺
+うかがi 伺
+うかがt 伺
+うかがu 窺 伺
+うかがw 伺
+うけつけn 受け付け
+うけつけr 受け付け
+うけとr 受け取 受取
+うけとt 受け取 受取
+うけわたs 受渡
+うごi 動
+うごk 動
+うしなt 失
+うしなu 失
+うしなw 失
+うすi 薄
+うすk 薄
+うすr 薄
+うずm 埋
+うたi 歌
+うたがi 疑
+うたがu 疑
+うたがw 疑
+うったe 訴
+うつr 移
+うつt 移
+うつs 移 映 写
+うつくs 美
+うながs 促
+うばt 奪
+うばu 奪
+うまi 旨 美 甘
+うまk 旨
+うみだs 生み出
+うらm 恨
+うらn 恨
+うらぎr 裏切
+うらなi 占
+うれs 嬉
+えm 得
+えn 得
+えr 得
+えt 得
+えがi 描
+えがk 描
+えらb 選
+えらi 偉
+えらn 選
+えらs 偉
+えんj 演
+えんz 演
+おc 落
+おe 終 追 負
+おi 置 追 負
+おk 起 置
+おo 追
+おp 追
+おr 降 折 居
+おs 押 惜 推
+おt 落 折 負 追
+おu 負 追
+おw 終 追
+おうj 応
+おうz 応
+おおi 多 大
+おおk 大 多
+おおm 多
+おおs 多
+おおt 覆
+おおu 覆
+おおw 覆
+おおくr 御送
+おかs 犯 可笑
+おがm 拝
+おきかe 置き換
+おぎなt 補
+おぎなu 補
+おくr 送 遅 贈
+おくt 送
+おこr 起 怒
+おこs 起
+おこたr 怠
+おこたt 怠
+おこなe 行
+おこなi 行
+おこなo 行
+おこなt 行
+おこなu 行
+おこなw 行
+おさm 収 治 納
+おしe 教
+おそi 遅
+おそk 遅
+おそr 恐
+おそs 遅
+おちこm 落ち込
+おちこn 落ち込
+おちつk 落着
+おとr 劣
+おとs 落
+おとどk 御届
+おどr 踊
+おどろi 驚
+おどろk 驚
+おなj 同
+おねがi お願
+おぼe 覚 憶
+おもe 思
+おもi 思 重 想
+おもk 重
+おもm 重
+おもn 主
+おもs 重
+おもt 思 重 想
+おもu 思 想
+おもw 思
+おもしろi 面白
+おもしろk 面白
+おもしろs 面白
+およb 及
+およg 泳
+おろk 愚
+おわr 終
+おわt 終
+おんよm 音読
+かe 変 替 買 換
+かi 書 買
+かk 書 描 掛 欠 架 賭 駆 懸
+かm 噛
+かn 噛 兼
+かo 買
+かs 貸 加 化 課
+かt 買 勝 掛 刈
+かr 借 苅 刈 枯
+かu 買
+かw 買 替 変 代 換
+かいs 介
+かえr 帰 換
+かえs 返 帰
+かえt 帰 返
+かえりm 省
+かおr 香
+かおだt 顔立
+かおまk 顔負
+かかe 抱
+かかg 掲
+かかr 係
+かかw 関
+かがやi 輝
+かがやk 輝
+かきかe 書換
+かきこm 書込
+かきだs 書出
+かきなおs 書き直
+かきならb 書き並
+かぎr 限
+かぎt 限
+かくr 隠
+かくs 隠
+かくていs 確定
+かこm 囲
+かこn 囲
+かこu 囲
+かさn 重
+かざr 飾
+かざt 飾
+かしこi 賢
+かしこk 賢
+かすm 霞 掠 翳
+かせg 稼
+かぞe 数
+かたi 難 固 堅
+かたk 固
+かたm 固 傾
+かたr 語
+かたt 語
+かたつk 型付
+かたむi 傾
+かなs 悲
+かなu 叶
+かならz 必
+かまe 構
+かまi 構
+かまu 構
+かまw 構
+かよe 通
+かよi 通
+かよo 通
+かよt 通
+かよu 通
+かよw 通
+からm 絡
+からn 絡
+かるi 軽
+かるk 軽
+かるs 軽
+かれr 彼
+かわr 変 代 換
+かわt 変
+かわいg 可愛
+かわいi 可愛
+かわいk 可愛
+かわいr 可愛
+かんj 感
+かんs 関
+かんj 感
+かんz 感
+かんがe 考
+かんしゃs 感謝
+がんせき 岩石
+かんだかi 甲高
+かんちがi 勘違
+かんねんs 観念
+がんばr 頑張
+がんばt 頑張
+きe 消
+きg 気
+きi 聞 聴 効
+きk 聞 聴 効 利
+きm 決 来
+きr 切 着
+きs 記
+きt 来 切 着
+きかe 着換
+きさいs 記載
+きざm 刻
+きずt 傷
+きたn 汚
+きづi 気付
+きづk 気付
+きどr 気取
+きびs 厳
+きもt 気持
+きゅうs 窮
+きょうh 今日
+きよi 清
+きらi 嫌
+きらt 嫌
+きらu 嫌
+きらw 嫌
+きりかえn 切り替え
+きりかえr 切り替え
+きりたt 切り立
+きりはなs 切離
+きわm 極
+きわだt 際立
+きんちょうs 緊張
+ぎゃくじょうs 逆上
+ぎゃくもどr 逆戻
+ぎゃっこうs 逆行
+くe 喰 食
+くi 食 喰 悔
+くm 組
+くn 組
+くr 来 繰 暮
+くt 食 喰
+くu 食 喰
+くw 食 喰
+くぎr 区切
+くぎt 区切
+くずr 崩
+くだk 砕
+くだr 下
+くだs 下
+くだt 下
+くつがえs 覆
+くばr 配
+くばt 配
+くみあw 組合
+くみこm 組込
+くみとr 汲み取
+くもr 曇
+くやm 悔
+くらb 比 較
+くらi 暗
+くらk 暗
+くらs 暮
+くらt 食
+くりあw 繰り合
+くりかえs 繰り返
+くるi 狂
+くるs 苦
+くるt 狂
+くるu 狂
+くわe 加
+くわs 詳
+くわw 加
+けr 蹴
+けs 消 決
+けt 蹴
+けいえいs 経営
+けいこくs 警告
+けずr 削
+けずt 削
+けっs 決
+けんとうs 検討
+げんj 減
+げんz 減
+こe 越
+こg 焦
+こi 濃 来
+こk 濃
+こm 込 混
+こn 込 来 混
+こr 来 懲 凝
+こs 越 漉
+こt 凝
+こu 乞 請
+こy 来
+こうj 高
+こうしょう 鉱床 高尚
+こうぶつ 鉱物 好物
+こうりょs 考慮
+こえt 超
+こおr 凍
+こおt 凍
+こころh 心
+こころm 試
+こごe 凍
+こじs 誇示
+こたe 答 応
+ことn 異
+ことw 断
+ことごとk 尽
+ことなr 異
+ことわr 断
+ことわt 断
+このm 好
+こまk 細
+こまr 困
+こまt 困
+こまc 困
+こもr 籠 隠
+こもt 籠 隠
+ころb 転
+ころg 転
+ころn 転
+ころs 殺
+こわg 怖 恐
+こわi 恐 怖
+こわr 壊
+こわs 壊 恐
+ごぞんj 御存
+さe 冴
+さg 下
+さi 咲 裂 割
+さk 避 咲 裂 割
+さm 覚
+さr 去
+さs 指 差 刺
+さt 去
+さいわi 幸
+さかn 盛
+さかr 盛
+さがs 捜 探
+さきだt 先立
+さぐr 探
+さけb 叫
+さけn 叫
+ささe 支
+さずk 授
+さそi 誘
+さそt 誘
+さそu 誘
+さそw 誘
+さだk 定
+さだm 定
+さっs 察
+さっちs 察知
+さとr 悟
+さとt 悟
+さばk 捌
+さびs 寂 淋
+さみs 淋 寂
+さむi 寒
+さむk 寒
+さむs 寒
+さらn 更
+さらs 晒
+さわg 騒
+さわi 騒
+さわr 触
+さわt 触
+ざいせきs 在籍
+しi 強
+しk 敷
+しm 締 占 閉
+しn 死
+しr 知
+しt 知
+しあg 仕上
+しあわs 幸
+しかk 仕掛
+しかr 叱
+しかt 叱
+しかくi 四角
+しくm 仕組
+しずk 静
+しずm 沈
+しずn 沈
+したs 親
+したがe 従
+したがi 従
+したがt 従
+したがu 順 従
+したがw 従
+したたr 舌足
+しのb 偲 忍
+しのg 凌
+しはらi 支払
+しはらt 支払
+しはらu 支払
+しはらw 支払
+しばr 縛
+しぶi 渋
+しぶt 渋
+しぼr 絞
+しぼt 絞
+しめp 湿
+しめs 示
+しめきr 締切
+しゃべr 喋
+しゃべt 喋
+しょうj 生
+しょうs 称
+しょじs 所持
+しようs 使用
+しらb 調
+しるs 記
+しろi 白
+しろk 白
+しんj 信
+じてんd 時点
+じゅんj 準
+じゅんz 準
+すe 据
+すg 過
+すi 済 吸 空
+すk 好
+すm 済 住 澄
+すn 住 済
+すr 擦 摺 刷
+すt 捨 吸
+すu 吸
+すくi 救
+すくn 少
+すくu 救 巣く 抄 済
+すくw 救
+すぐr 優
+すこs 少
+すごi 凄
+すごk 凄
+すごm 凄
+すごs 凄 過
+すすm 進 勧 薦
+すすn 進
+すずs 涼
+すでn 既
+すなわc 即
+すなわt 即
+すばr 素晴
+すばやi 素早
+すばらs 素晴
+すべr 滑
+すべt 全 滑
+するどi 鋭
+すわr 座
+すわt 座
+ずm 済
+せk 急
+せm 責
+せs 接
+せいちょうs 成長
+せっきんs 接近
+せっしょくs 接触
+せつめいs 説明
+せまi 狭
+せまr 迫
+せまt 迫
+ぜっs 絶
+ぜんk 前
+そe 添
+そi 沿
+そm 初 染
+そt 沿 添
+そだt 育
+そなe 備
+そろe 揃
+そろi 揃
+そろt 揃
+そろu 揃
+ぞんj 存
+ぞんz 存
+たb 食
+たc 立
+たe 耐 絶
+たk 焚
+たm 溜
+たn 他
+たr 足 垂
+たs 足 達
+たt 立 建 断 経
+たいs 対 大
+たおr 倒
+たおs 倒
+たかi 高
+たかk 高
+たかm 高
+たかs 高
+たがi 互
+たしk 確
+たすk 助
+たずn 尋
+たたk 叩
+たたかt 闘 戦
+たたかu 闘
+ただs 但 正
+ただc 直
+ただt 直
+たとe 例
+たおr 倒
+たおr 倒
+たのm 頼
+たのn 頼
+たのs 楽
+たまr 溜
+たまt 溜
+ためn 為
+ためs 試
+たもt 保
+たよr 頼 便
+たよt 頼
+たんn 単
+だs 出
+たいおうs 対応
+だいすk 大好
+だまr 黙
+だまs 騙
+だまt 黙
+ちr 散
+ちいs 小
+ちかi 近
+ちかk 近
+ちかt 誓
+ちかu 誓
+ちかづi 近付
+ちがe 違
+ちがi 違
+ちがt 違
+ちがu 違
+ちがw 違
+ちじm 縮
+ちまよt 血迷
+つg 告 継
+つi 付 着 突 憑 継
+つk 付 着 突 漬 尽 使 点 尾
+つm 詰 積
+つn 積
+つr 連 釣 吊
+つt 突
+ついy 費
+つうj 通
+つうほうs 通報
+つかe 使
+つかi 使 遣
+つかm 捕 掴
+つかo 使
+つかr 疲
+つかt 使
+つかu 使
+つかw 使
+つかさどr 司
+つくr 作 創 造
+つくt 作
+つくろi 繕
+つくろu 繕
+つけくわe 付け加
+つずr 綴
+つたe 伝
+つたt 伝
+つたu 伝
+つたw 伝
+つだi 伝
+つつm 包
+つつしm 慎
+つつしn 謹
+つづi 続
+つづk 続
+つづr 綴
+つとm 勤 務 努
+つなg 繋
+つなi 継
+つねn 常
+つぶs 潰
+つみあげr 積み上げ
+つみあげt 積み上げ
+つめt 冷
+つづr 綴
+つよi 強
+つよk 強
+つらi 辛
+つらn 連
+づk 付
+てr 照
+てあt 手当
+ておくr 手遅
+てがk 手書
+てきs 適
+てごわi 手強
+てちがi 手違
+てつだe 手伝
+てつだi 手伝
+てつだt 手伝
+てつだu 手伝
+てつづk 手続
+てなおs 手直
+てびk 手引
+てまどr 手間取
+でm 出
+でn 出
+でr 出
+でs 出
+でt 出
+でy 出
+であt 出逢
+であu 出逢
+でかk 出掛
+できm 出来
+できn 出来
+できr 出来
+できs 出来
+できt 出来
+できz 出来
+でまわr 出回
+でそろi 出揃
+でそろu 出揃
+でそろt 出揃
+とb 飛 跳
+とe 問
+とi 問 解
+とj 綴 閉
+とk 解 説 溶 融 熔
+とm 止 泊
+とn 飛
+とr 取 撮 捕 採
+とt 取 撮 採
+とu 問
+とw 問
+とj 閉
+といあw 問い合
+とうj 投
+とおi 遠
+とおk 遠
+とおr 通
+とおs 遠 通
+とおt 通
+とおz 遠
+とくn 特
+とくちょうづk 特徴付
+とっしんs 突進
+ととのt 整
+ととのu 整
+とどi 届
+とどk 届
+とどm 留
+となr 隣
+とぼs 乏
+とまt 止
+ともr 燈
+ともなi 伴
+ともなt 伴
+ともなu 伴
+ともなw 伴
+とらe 捕
+とりあe 取り敢
+とりあげn 取り上げ
+とりあげr 取り上げ
+とりあげt 取り上げ
+とりあつかi 取り扱
+とりあつかu 取り扱
+とりあつかw 取り扱
+とりいr 取り入 取入
+とりかこm 取り囲
+とりだs 取出
+とりつk 取付け
+とりのぞi 取り除
+とりはかr 取り計
+とりまk 取り巻
+どおr 通
+どうせきs 同席
+なi 無 鳴 泣
+なk 無 鳴 亡 泣
+なr 慣 鳴 馴 成
+なs 無 成
+なt 鳴 成
+なおr 直 治
+なおs 直
+なおt 治 直
+なかb 半
+ながi 長 永
+ながk 長
+ながm 眺
+ながr 流
+ながs 流 長
+なごr 名残
+なさk 情
+なつやすm 夏休
+なづk 名付
+ななm 斜
+なにげn 何気
+なのr 名乗
+なまk 怠
+なめr 滑
+なやm 悩
+なやn 悩
+ならb 並
+ならi 習
+ならn 並
+ならt 習
+ならu 習
+ならべかw 並べ変
+ならべかe 並べ変
+なりたt 成り立
+にg 逃
+にr 煮 似
+にs 似
+にt 似 煮
+にy 煮
+にあi 似合
+にあt 似合
+にあu 似合
+にあw 似合
+におe 匂
+におi 匂
+におt 匂
+におu 匂
+におw 匂
+にがi 苦
+にぎr 握
+にぎt 握
+にぎw 賑
+にくi 憎 難
+にくs 憎 難
+にごr 濁
+にごs 濁
+になt 担
+になu 担
+にゅうしゅつりょくn 入出力
+にゅうしゅつりょくm 入出力
+にゅうしゅつりょくh 入出力
+ぬi 抜
+ぬk 抜
+ぬr 塗 濡
+ぬt 塗 縫
+ぬすm 盗
+ねr 寝 練
+ねt 寝
+ねがi 願
+ねがt 願
+ねがu 願
+ねびk 値引
+ねむi 眠
+ねむr 眠
+ねむt 眠
+ねらi 狙
+ねらt 狙
+ねらu 狙
+のb 述 伸 延
+のk 退
+のm 飲 呑
+のn 飲
+のr 乗 載
+のs 載 乗
+のt 乗 載
+のk 乗
+のこr 残
+のこs 残
+のこt 残
+のぞi 除 覗
+のぞk 除 覗
+のぞm 望 臨
+のぞn 望
+のぼr 登 昇
+のぼt 登
+はe 生
+はk 掃除
+はn 跳
+はr 張 貼 晴
+はs 発
+はt 果 貼 張
+はu 這
+はj 恥
+はz 恥
+はいr 入
+はいs 排
+はいt 入
+はかr 図 計 測
+はかt 計
+はげm 励
+はげs 激
+はこb 運
+はこn 運
+はしr 走
+はしt 走
+はじm 始 初
+はずs 外
+はたらi 働
+はたらk 働
+はなr 離
+はなs 離 話 放
+はなy 華
+はぶk 省
+はやi 速 早
+はやk 早 速
+はやm 早 速
+はやs 速 早
+はやt 流行
+はらe 払
+はらi 払
+はらo 払
+はらt 払
+はらu 払
+はらw 払
+はりきr 張り切
+はりきt 張り切
+はりだs 張り出
+はりつけn 張り付け
+はりつけr 張り付け
+はるk 遥
+はんs 反
+ばk 化
+ばあいわk 場合分
+ひe 冷
+ひi 引 弾
+ひk 引 弾 挽
+ひt 引
+ひy 冷
+ひかe 控
+ひかr 光
+ひがえr 日帰
+ひきうk 引き受
+ひきずr 引き摺
+ひきだs 引出
+ひくi 低
+ひくk 低
+ひくs 低
+ひさs 久
+ひそn 潜
+ひっこs 引越
+ひとs 等
+ひとt 一
+ひびk 響
+ひやs 冷
+ひょうへんs 豹変
+ひらi 開
+ひらk 開
+ひろg 広
+ひろi 広
+ひろk 広
+ひろu 拾
+ふe 増
+ふi 吹
+ふk 吹
+ふm 踏
+ふn 踏
+ふr 降 振 触
+ふs 付 伏
+ふt 降 振
+ふy 増
+ふかi 深
+ふかk 深
+ふかm 深
+ふくm 含
+ふくn 含
+ふせg 防
+ふせi 防
+ふたt 二
+ふたたb 再
+ふとi 太
+ふとk 太
+ふとs 太
+ふとどk 不届
+ふりこm 振り込
+ふりこn 振り込
+ふるb 古
+ふるe 震
+ふるi 古
+ふるk 古
+ふるm 古
+ふるs 古
+ふるさとh 故郷
+ふるまi 振舞
+ふるまu 振舞
+ぶr 振
+ぶあつi 分厚
+へr 減
+へt 減 経
+へんかんg 変換
+へんにゅうs 編入
+ほr 掘 惣
+ほs 欲
+ほうt 放
+ほこr 誇
+ほそi 細
+ほそk 細
+ほそm 細
+ほそs 細
+ほそながi 細長
+ほとんd 殆
+ほどこs 施
+ほねおr 骨折
+ぼうえいs 防衛
+まc 待
+まi 舞
+まj 交
+まk 負 巻
+まs 増
+まt 待
+まu 舞
+まj 混
+まz 混 先
+まいr 参 詣
+まいt 参 詣
+まかs 任
+まがr 曲
+まぎr 紛
+まさr 優 勝 増さ
+まじw 交
+まずs 貧
+またh 又
+まちがe 間違
+まちがi 間違
+まちがt 間違
+まちがu 間違
+まったk 全
+まどu 惑
+まなb 学
+まなn 学
+まねi 招
+まねk 招
+まもr 守
+まもt 守
+まよe 迷
+まよi 迷
+まよt 迷
+まよu 迷
+まよw 迷
+まるi 丸 円
+まるk 丸 円
+まわr 周 回
+まわs 周 回
+まわt 回
+みe 見
+みk 見
+みm 見
+みn 見 身
+みr 見 観
+みs 見
+みt 見 満 観
+みw 見
+みy 見
+みz 見
+みあt 見当
+みあw 見合
+みいだs 見出
+みおt 見落
+みおとs 見落
+みかk 見掛
+みきr 見切
+みぎまわr 右回
+みこm 見込
+みさだm 見定
+みしr 見知
+みじかi 短
+みじかm 短
+みだr 乱
+みだs 乱
+みちがu 見違
+みちびi 導
+みちびk 導
+みつk 見付
+みつもr 見積
+みとm 認
+みとおs 見通
+みなr 見慣
+みなs 皆
+みなおs 見直
+みにくi 醜
+みのr 実
+みはr 見張
+みはt 見張
+みまi 見舞
+みまもr 見守
+みやすk 見易
+みやぶr 見破
+むi 向
+むk 向
+むかe 迎
+むかi 向
+むくw 報
+むすb 結
+むすn 結
+むずかs 難
+むづかs 難
+めs 召
+めいr 滅入
+めいt 滅入
+めぐm 恵
+めざs 目指
+めずらs 珍
+めだt 目立
+めつk 目付
+もc 持
+もe 燃
+もr 盛 漏
+もt 持 盛
+もy 燃
+もうk 設 儲
+もうs 申
+もうしあg 申し上
+もちi 用
+もちこm 持ち込
+もちこn 持ち込
+もちだs 持出
+もっとm 最 尤
+もっぱr 専
+もとd 基
+もとm 求
+もとz 基
+もどr 戻
+もどs 戻
+もどt 戻
+もよr 最寄
+もらe 貰
+もらi 貰
+もらt 貰
+もらu 貰
+もらw 貰
+やi 焼
+やk 焼
+やm 止 病 已 罷
+やs 痩
+やくたt 役立
+やくだt 役立
+やさs 易 優
+やしなu 養
+やすi 安 易
+やすk 安 易
+やすm 休
+やすn 休
+やすs 安
+やすうr 安売
+やとu 雇
+やぶr 破 敗
+やわらかi 柔らか 軟らか
+やわらかk 柔らか 軟らか
+ゆk 行
+ゆr 揺
+ゆうs 有
+ゆえn 故
+ゆがm 歪
+ゆがn 歪
+ゆずr 譲
+ゆずt 譲
+ゆたk 豊
+ゆだn 委
+ゆるi 緩
+ゆるm 緩
+ゆるk 緩
+ゆるs 許
+よb 呼
+よi 良 酔
+よk 良
+よm 読 呼
+よn 読 呼
+よr 寄 因 依
+よs 寄 良
+よt 酔 寄
+よw 酔
+ようn 様
+ようs 要
+よくばr 欲張
+よごr 汚
+よせがk 寄書
+よびだs 呼出
+よみかk 読み書
+よみこm 読み込 読込
+よみだs 読み出 読出
+よろs 宜
+よろこb 喜 慶
+よろこn 喜
+よわi 弱
+よわk 弱
+よわm 弱
+よわs 弱
+よわt 弱
+よろこb 喜 慶
+よろこb 喜 慶
+ろんj 論
+ろんz 論
+わk 分 湧
+わr 割
+わかi 若
+わかk 若
+わかr 判 解 分
+わかs 若
+わかt 判 解 分
+わきでr 湧き出
+わきでt 湧き出
+わすr 忘
+わずk 僅
+わずらw 煩
+わたr 渡 亙
+わたs 渡
+わたt 渡
+わらe 笑
+わらi 笑
+わらt 笑
+わらu 笑
+わらw 笑
+わりあt 割当
+わりこm 割込
+わりこn 割り込
+わるi 悪
+わるk 悪
+わるs 悪
+;; okuri-nasi entries.
+あ 阿 娃 唖 亜
+あい 愛 哀 相 姶 挨 合
+あいさつ 挨拶
+あいしょう 愛称 相性
+あいじょう 愛情
+あいだ 間
+あいち 愛知
+あいちゃく 愛着
+あいて 相手
+あいぼう 相棒
+あいまい 曖昧
+あいよう 愛用
+あお 青
+あおい 葵 青井
+あおぞら 青空
+あおば 青葉
+あか 赤 垢
+あかご 赤子
--- /dev/null
+++ b/ktrans.h
@@ -1,0 +1,465 @@
+typedef struct Map Map;
+struct Map {
+ char *roma;
+ char *kana;
+ char advance;
+};
+
+
+Map kata[] = {
+ "a", "ア", 1,
+ "-", "ー", 1,
+ "i", "イ", 1,
+ "u", "ウ", 1,
+ "e", "エ", 1,
+ "o", "オ", 1,
+ "ka", "カ", 2,
+ "ga", "ガ", 2,
+ "ki", "キ", 2,
+ "kya", "キャ", 3,
+ "kyu", "キュ", 3,
+ "kyo", "キョ", 3,
+ "gi", "ギ", 2,
+ "gya", "ギャ", 3,
+ "gyu", "ギュ", 3,
+ "gyo", "ギョ", 3,
+ "ku", "ク", 2,
+ "gu", "グ", 2,
+ "ke", "ケ", 2,
+ "ge", "ゲ", 2,
+ "ko", "コ", 2,
+ "go", "ゴ", 2,
+ "sa", "サ", 2,
+ "za", "ザ", 2,
+ "si", "シ", 2,
+ "shi", "シ", 3,
+ "ji", "ジ", 2,
+ "sha", "シャ", 3,
+ "she", "シェ", 3,
+ "shu", "シュ", 3,
+ "je", "ジェ", 2,
+ "sho", "ショ", 3,
+ "syo", "ショ", 3,
+ "ja", "ジャ", 2,
+ "ju", "ジュ", 2,
+ "je", "ジェ", 2,
+ "jo", "ジョ", 2,
+ "su", "ス", 2,
+ "zu", "ズ", 2,
+ "se", "セ", 2,
+ "ze", "ゼ", 2,
+ "so", "ソ", 2,
+ "zo", "ゾ", 2,
+ "ta", "タ", 2,
+ "da", "ダ", 2,
+ "ti", "ティ", 2,
+ "chi", "チ", 3,
+ "zi", "ヂ", 2,
+ "cha", "チャ", 3,
+ "chu", "チュ", 3,
+ "tyu", "チュ", 3,
+ "che", "チェ", 3,
+ "cho", "チョ", 3,
+ "tu", "ツ", 2,
+ "tsu", "ツ", 3,
+ "du", "ヅ", 2,
+ "te", "テ", 2,
+ "de", "デ", 2,
+ "to", "ト", 2,
+ "do", "ド", 2,
+ "na", "ナ", 2,
+ "ni", "ニ", 2,
+ "nya", "ニャ", 3,
+ "nyu", "ニュ", 3,
+ "nyo", "ニョ", 3,
+ "nu", "ヌ", 2,
+ "ne", "ネ", 2,
+ "no", "ノ", 2,
+ "ha", "ハ", 2,
+ "ba", "バ", 2,
+ "pa", "パ", 2,
+ "hi", "ヒ", 2,
+ "hya", "ヒャ", 3,
+ "hyu", "ヒュ", 3,
+ "hyo", "ヒョ", 3,
+ "bi", "ビ", 2,
+ "bya", "ビャ", 3,
+ "byu", "ビュ", 3,
+ "byo", "ビョ", 3,
+ "pi", "ピ", 2,
+ "pya", "ピャ", 3,
+ "pyu", "ピュ", 3,
+ "pyo", "ピョ", 3,
+ "hu", "フ", 2,
+ "fu", "フ", 2,
+ "bu", "ブ", 2,
+ "pu", "プ", 2,
+ "he", "ヘ", 2,
+ "be", "ベ", 2,
+ "pe", "ペ", 2,
+ "ho", "ホ", 2,
+ "bo", "ボ", 2,
+ "po", "ポ", 2,
+ "ma", "マ", 2,
+ "mi", "ミ", 2,
+ "mya", "ミャ", 3,
+ "myu", "ミュ", 3,
+ "myo", "ミョ", 3,
+ "mu", "ム", 2,
+ "me", "メ", 2,
+ "mo", "モ", 2,
+ "ya", "ヤ", 2,
+ "yu", "ユ", 2,
+ "yo", "ヨ", 2,
+ "ra", "ラ", 2,
+ "ri", "リ", 2,
+ "rya", "リャ", 3,
+ "ryu", "リュ", 3,
+ "ryo", "リョ", 3,
+ "ru", "ル", 2,
+ "re", "レ", 2,
+ "ro", "ロ", 2,
+ "wa", "ワ", 2,
+ "wi", "ヰ", 2,
+ "we", "ヱ", 2,
+ "wo", "ヲ", 2,
+ "n", "ン", 1,
+ "xn", "ン", 2,
+ "v", "ヴ", 1,
+ "xa", "ァ", 2,
+ "xi", "ィ", 2,
+ "xe", "ェ", 2,
+ "xo", "ォ", 2,
+ "cc", "ッ", 1,
+ "dd", "ッ", 1,
+ "kk", "ッ", 1,
+ "pp", "ッ", 1,
+ "tt", "ッ", 1,
+ "tch", "ッ", 1,
+ "ss", "ッ", 1,
+ "xn", "ン", 2,
+ "di", "ディ", 2,
+ "fa", "ファ", 2,
+ "fi", "フィ", 2,
+ "fe", "フェ", 2,
+ "fo", "フォ", 2,
+ "va", "ヴァ", 2,
+ "vi", "ヴィ", 2,
+ "ve", "ヴェ", 2,
+ "vo", "ヴォ", 2,
+ ".", "。", 1,
+ ",", "、", 1,
+ 0
+};
+
+Map hira[] = {
+ "a", "あ", 1,
+ "-", "ー", 1,
+ "i", "い", 1,
+ "u", "う", 1,
+ "e", "え", 1,
+ "o", "お", 1,
+ "ka", "か", 2,
+ "ga", "が", 2,
+ "ki", "き", 2,
+ "kya", "きゃ", 3,
+ "kyu", "きゅ", 3,
+ "kyo", "きょ", 3,
+ "gi", "ぎ", 2,
+ "gya", "ぎゃ", 3,
+ "gyu", "ぎゅ", 3,
+ "gyo", "ぎょ", 3,
+ "ku", "く", 2,
+ "gu", "ぐ", 2,
+ "ke", "け", 2,
+ "ge", "げ", 2,
+ "ko", "こ", 2,
+ "go", "ご", 2,
+ "sa", "さ", 2,
+ "za", "ざ", 2,
+ "si", "し", 2,
+ "shi", "し", 3,
+ "sha", "しゃ", 3,
+ "shu", "しゅ", 3,
+ "she", "しぇ", 3,
+ "sho", "しょ", 3,
+ "syo", "しょ", 3,
+ "zi", "ぢ", 2,
+ "ja", "じゃ", 2,
+ "ju", "じゅ", 2,
+ "je", "じぇ", 2,
+ "jo", "じょ", 2,
+ "su", "す", 2,
+ "zu", "ず", 2,
+ "se", "せ", 2,
+ "ze", "ぜ", 2,
+ "so", "そ", 2,
+ "zo", "ぞ", 2,
+ "ta", "た", 2,
+ "da", "だ", 2,
+ "ti", "ち", 2,
+ "chi", "ち", 3,
+ "cha", "ちゃ", 3,
+ "chu", "ちゅ", 3,
+ "tyu", "ちゅ", 3,
+ "cho", "ちょ", 3,
+ "ji", "じ", 2,
+ "tu", "つ", 2,
+ "tsu", "つ", 3,
+ "du", "づ", 2,
+ "te", "て", 2,
+ "de", "で", 2,
+ "to", "と", 2,
+ "do", "ど", 2,
+ "na", "な", 2,
+ "ni", "に", 2,
+ "nya", "にゃ", 3,
+ "nyu", "にゅ", 3,
+ "nyo", "にょ", 3,
+ "nu", "ぬ", 2,
+ "ne", "ね", 2,
+ "no", "の", 2,
+ "ha", "は", 2,
+ "ba", "ば", 2,
+ "va", "ば", 2,
+ "pa", "ぱ", 2,
+ "hi", "ひ", 2,
+ "hya", "ひゃ", 3,
+ "hyu", "ひゅ", 3,
+ "hyo", "ひょ", 3,
+ "bi", "び", 2,
+ "bya", "びゃ", 3,
+ "byu", "びゅ", 3,
+ "byo", "びょ", 3,
+ "vi", "び", 2,
+ "pi", "ぴ", 2,
+ "pya", "ぴゃ", 3,
+ "pyu", "ぴゅ", 3,
+ "pyo", "ぴょ", 3,
+ "hu", "ふ", 2,
+ "fu", "ふ", 2,
+ "bu", "ぶ", 2,
+ "vu", "ぶ", 2,
+ "pu", "ぷ", 2,
+ "he", "へ", 2,
+ "be", "べ", 2,
+ "ve", "べ", 2,
+ "pe", "ぺ", 2,
+ "ho", "ほ", 2,
+ "bo", "ぼ", 2,
+ "vo", "ぼ", 2,
+ "po", "ぽ", 2,
+ "ma", "ま", 2,
+ "mi", "み", 2,
+ "mya", "みゃ", 3,
+ "myu", "みゅ", 3,
+ "myo", "みょ", 3,
+ "mu", "む", 2,
+ "me", "め", 2,
+ "mo", "も", 2,
+ "ya", "や", 2,
+ "yu", "ゆ", 2,
+ "yo", "よ", 2,
+ "ra", "ら", 2,
+ "ri", "り", 2,
+ "rya", "りゃ", 3,
+ "ryu", "りゅ", 3,
+ "ryo", "りょ", 3,
+ "ru", "る", 2,
+ "re", "れ", 2,
+ "ro", "ろ", 2,
+ "wa", "わ", 2,
+ "wi", "ゐ", 2,
+ "we", "ゑ", 2,
+ "wo", "を", 2,
+ "n", "ん", 1,
+ "xn", "ん", 2,
+ "v", "\x80", 1,
+ "xa", "ぁ", 2,
+ "xi", "ぃ", 2,
+ "xu", "ぅ", 2,
+ "xe", "ぇ", 2,
+ "xo", "ぉ", 2,
+ "cc", "っ", 1,
+ "dd", "っ", 1,
+ "kk", "っ", 1,
+ "pp", "っ", 1,
+ "tt", "っ", 1,
+ "ss", "っ", 1,
+ ".", "。", 1,
+ ",", "、", 1,
+ 0,
+};
+
+Map cyril[] = {
+ "YO", "Ё", 2,
+ "Yo", "Ё", 2,
+ "A", "А", 1,
+ "B", "Б", 1,
+ "V", "В", 1,
+ "G", "Г", 1,
+ "D", "Д", 1,
+ "Ye", "Е", 1,
+ "YE", "Е", 2,
+ "E", "Е", 1,
+ "Zh", "Ж", 2,
+ "ZH", "Ж", 2,
+ "Z", "З", 1,
+ "I", "И", 1,
+ "J", "Й", 1,
+ "K", "К", 1,
+ "L", "Л", 1,
+ "M", "М", 1,
+ "N", "Н", 1,
+ "O", "О", 1,
+ "P", "П", 1,
+ "R", "Р", 1,
+ "S", "С", 1,
+ "T", "Т", 1,
+ "U", "У", 1,
+ "F", "Ф", 1,
+ "Kh", "Х", 2,
+ "KH", "Х", 2,
+ "X", "Х", 1,
+ "Ts", "Ц", 2,
+ "TS", "Ц", 2,
+ "Ch", "Ч", 2,
+ "CH", "Ч", 2,
+ "Sh", "Ш", 2,
+ "SH", "Ш", 2,
+ "Shch", "Щ", 4,
+ "SHCH", "Щ", 4,
+ "''", "ъ", 2,
+ "Y", "Ы", 1,
+ "'", "ь", 1,
+ "EH", "Э", 2,
+ "Eh", "Э", 2,
+ "Yu", "Ю", 2,
+ "YU", "Ю", 2,
+ "Ya", "Я", 2,
+ "YA", "Я", 2,
+ "a", "а", 1,
+ "b", "б", 1,
+ "v", "в", 1,
+ "g", "г", 1,
+ "d", "д", 1,
+ "ye", "е", 2,
+ "e", "е", 1,
+ "zh", "ж", 2,
+ "z", "з", 1,
+ "i", "и", 1,
+ "j", "й", 1,
+ "k", "к", 1,
+ "l", "л", 1,
+ "m", "м", 1,
+ "n", "н", 1,
+ "o", "о", 1,
+ "p", "п", 1,
+ "r", "р", 1,
+ "s", "с", 1,
+ "t", "т", 1,
+ "u", "у", 1,
+ "f", "ф", 1,
+ "kh", "х", 2,
+ "x", "х", 1,
+ "ts", "ц", 2,
+ "ch", "ч", 2,
+ "sh", "ш", 2,
+ "shch", "щ", 4,
+ "''", "ъ", 2,
+ "y", "ы", 1,
+ "'", "ь", 1,
+ "eh", "э", 2,
+ "yu", "ю", 2,
+ "ya", "я", 2,
+ "yo", "ё", 2,
+ 0,
+};
+
+Map greek[] = {
+ "A", "Α", 1,
+ "'A", "Ά", 2,
+ "B", "Β", 1,
+ "G", "Γ", 1,
+ "D", "Δ", 1,
+ "E", "Ε", 1,
+ "'E", "Έ", 2,
+ "Z", "Ζ", 1,
+ "E!", "Η", 2,
+ "'E!", "Έ", 3,
+ "TH", "Θ", 2,
+ "Th", "Θ", 2,
+ "I", "Ι", 1,
+ "'I", "Ί", 2,
+ "K", "Κ", 1,
+ "L", "Λ", 1,
+ "M", "Μ", 1,
+ "N", "Ν", 1,
+ "KS", "Ξ", 2,
+ "Ks", "Ξ", 2,
+ "O", "Ο", 1,
+ "'O", "Ό", 2,
+ "P", "Π", 1,
+ "R", "Ρ", 1,
+ "S", "Σ", 1,
+ "T", "Τ", 1,
+ "U", "Υ", 1,
+ "'U", "Ύ", 2,
+ "F", "Φ", 1,
+ "CH", "Χ", 2,
+ "Ch", "Χ", 2,
+ "PS", "Ψ", 2,
+ "Ps", "Ψ", 2,
+ "O!", "Ω", 2,
+ "W", "Ω", 1,
+ "'O!", "Ώ", 3,
+ "'W", "Ώ", 2,
+ "a", "α", 1,
+ "'a", "ά", 2,
+ "b", "β", 1,
+ "v", "β", 1,
+ "g", "γ", 1,
+ "d", "δ", 1,
+ "e", "ε", 1,
+ "'e", "έ", 2,
+ "z", "ζ", 1,
+ "e!", "η", 2,
+ "'e!", "ή", 3,
+ "ii", "η", 2,
+ "'ii", "ή", 3,
+ "h", "η", 1,
+ "'h", "ή", 2,
+ "th", "θ", 2,
+ "i", "ι", 1,
+ "'i", "ί", 2,
+ "k", "κ", 1,
+ "l", "λ", 1,
+ "m", "μ", 1,
+ "n", "ν", 1,
+ "ks", "ξ", 2,
+ "x", "ξ", 1,
+ "o", "ο", 1,
+ "'o", "ό", 2,
+ "p", "π", 1,
+ "r", "ρ", 1,
+ "s ", "ς", 1,
+ "s.", "ς", 1,
+ "s,", "ς", 1,
+ "s\n", "ς", 1,
+ "s", "σ", 1,
+ "t", "τ", 1,
+ "u", "υ", 1,
+ "'u", "ΰ", 2,
+ "y", "υ", 1,
+ "'y", "ΰ", 2,
+ "f", "φ", 1,
+ "ch", "χ", 2,
+ "ps", "ψ", 2,
+ "o!", "ω", 2,
+ "w", "ω", 1,
+ "'o!", "ώ", 3,
+ "'w", "ώ", 2,
+ 0
+};
+
+/* you can add other Map data here */
--- /dev/null
+++ b/ktrans.man
@@ -1,0 +1,92 @@
+.TH KTRANS 1
+.SH NAME
+ktrans \- language transliterator
+.SH SYNOPSIS
+.B ktrans
+.SH DESCRIPTION
+The
+.I ktrans
+program works with pipefile(1) which pipes all the input from the keyboard to ktrans,
+and ktrans itself transliterate typed letter sequnces intto characters in languages that
+do not use the Latin character set, and pipes the result to
+.B /dev/cons.
+The language is selected by typing a control character:
+.TP
+.B ctl-e
+return to default English mode (no transliteration).
+.TP
+.B ctl-n
+Japanese hiragana:
+interpret lower-case letters as a Hepburn representation
+of hiragana.
+In this mode, typing
+.TP
+.B Shift+Space
+looks up the last `word' in a hiragana-kanji dictionary
+and replaces it.
+Subsequent Shift+Space characters cycle through the possibilities.
+A word is the longest immediately preceding
+unbroken string of hiragana characters.
+.TP
+.B ctl-l
+If you want to put the hiragana not converted, you can type.
+.TP
+.B ctl-x
+Read kana-kanji conversion dictionary once more, and renews it. This will be
+convenient when you updated kana-kanji conversion dictionary on such acme
+editor.In default, the kana-kanji conversion dictionary is read once at beginning and
+to make a hashed table, which will be arranged so that the last selected candidate will
+be the first candidate for later search.
+
+.TP
+.B ctl-k
+Japanese katakana.
+.TP
+.B ctl-r
+Russian: interpret letters as Cyrillic;
+the transliteration is mostly phonetic, with
+.B '
+for
+.IR myagkij-znak
+(ь),
+.B ''
+for
+.I tverdyj-znak
+(ъ)
+.I yo
+for ё,
+.B j
+for
+.IR i-kratkaya
+(й).
+.TP
+.B ctl-g
+Greek.
+.PP
+.SH FILES
+.B /bin/pipefile /rc/bin/Kanji
+.SH SOURCE
+.B /sys/src/cmd/ktrans
+.SH "SEE ALSO"
+.IR rio(1)
+.IR pipefile(1)
+.SH EXAMPLE
+If you want to make the Japanese text as below:
+
+私は毎日35分以上歩いて、 更に10分電車に乗って学校に通います。
+ 健康の維持にも役だっていますが、 なかなかたのしいものです。
+
+your keyboard typing stream may be:
+
+watashiHA[^t]mainichi[^t]35[^l]fun[^t]ijou[^t]aruIte,
+[^t]saraNI[^t]10[^l]fun[^t]denshaNI[^t]noTte[^t]gakkouNI
+[^t]kayoImasu.[^t]kenkouNO[^t]ijiNImo[^t]yakuDAtteimasuga,
+[^t]nakanaka[^l]tanoshiI[^t]monodesu.[^l]
+
+where [^t], [^l] indicates 'Shift+Space' and 'ctl-l', respectively. See README.kenji
+for the details of this Japanese input method.
+.SH BUGS
+.PP
+There is no way to generate the control characters literally.
+At the most beggining of a new line, you have to begin with ctl-L
+for successful kana-kanji conversion.
--- /dev/null
+++ b/license
@@ -1,0 +1,622 @@
+
+LUCENT TECHNOLOGIES INC.
+PLAN 9 OPEN SOURCE LICENSE AGREEMENT
+
+PLEASE READ THIS AGREEMENT (INCLUDING THE EXHIBITS) CAREFULLY BEFORE
+PROCEEDING. BY CLICKING ON THE "ACCEPT" BUTTON, OR BY DOWNLOADING,
+INSTALLING, USING, COPYING, MODIFYING OR DISTRIBUTING THE SOFTWARE OR
+DERIVATIVE WORKS THEREOF, YOU ARE CONSENTING TO BE BOUND BY THIS
+AGREEMENT. IF YOU DO NOT AGREE TO ALL OF THE TERMS OF THIS AGREEMENT,
+CLICK ON THE "DO NOT ACCEPT" BUTTON AND THE INSTALLATION/DOWNLOAD
+PROCESS WILL NOT CONTINUE.
+
+1. DEFINITIONS
+
+1.1 "Agreement" means this Lucent Technologies Inc. Plan 9 Open Source
+License Agreement (including Exhibits).
+1.2 "Contributor(s)" means any individual or legal entity that creates
+or contributes to a Modification of the Original Software.
+1.3 "Licensee" means an individual or a legal entity entering into and
+exercising rights under this Agreement. For the purposes hereunder,
+Licensee includes any entity that controls, is controlled by, or is
+under common control with Licensee. For purposes of this definition,
+"control" means (i) the power, direct or indirect, to cause the
+direction or management of such entity, whether by contract or
+otherwise; or (ii) ownership of fifty percent (50%) or more of the
+controlling shares or beneficial ownership of such entity. Licensee
+is also referred to herein as "You" with "Your" as the possessive.
+1.4 "Licensed Software" means the Original Software, Modifications, or
+any combination of the Original Software and Modifications.
+1.5 "Lucent" means Lucent Technologies Inc., a Delaware corporation
+having an office at 600 Mountain Ave., Murray Hill, NJ 07974, its
+related companies and/or affiliates.
+1.6 "Modification(s)" means any addition, deletion, change, or
+improvement to the Original Software or prior Modifications thereto.
+Modifications do not include additions to the Original Software or
+prior Modifications which (i) are separate modules of software which
+may be distributed in conjunction with Licensed Software; or (ii) are
+not derivative works of the Licensed Software itself.
+1.7 "Object Code" means machine executable software code.
+1.8 "Original Contributor" means Lucent and its Licensors, collectively.
+1.9 "Original Software" means the Plan 9 Software, in both Source Code
+form and Object Code form, and any associated documentation, as
+furnished under this Agreement.
+1.10 "Plan 9 Software" means a network operating system designed for
+research into distributed services, applications and software
+development.
+1.11 "Recipient" means any individual or legal entity receiving the
+Licensed Software under this Agreement, including all Contributors, or
+receiving the Licensed Software under another license agreement as
+authorized herein.
+1.12 "Source Code" means human readable software code.
+
+2.0 GRANT OF RIGHTS
+2.1 Subject to the terms of this Agreement and to third party
+intellectual property claims, Lucent grants to Licensee, a
+royalty-free, nonexclusive, non-transferable, worldwide license to
+use, reproduce, modify, execute, display, perform, distribute and
+sublicense, the Original Software (with or without Modifications) in
+Source Code form and/or Object Code form for commercial and/or
+non-commercial purposes. This grant includes a nonexclusive and
+non-transferable license under any patents which Lucent has a right to
+license and which, but for this license, are unavoidably and
+necessarily infringed by the execution of the inherent functionality
+of the Original Software in the form furnished under this Agreement.
+Nothing in this Agreement shall be construed as conferring in any way
+(by implication, estoppel or otherwise) any license or right under any
+existing or future patent claim which is directed to a combination of
+the functionality of the Original Software with the functionality of
+any other software programs, or a combination of hardware systems
+other than the combination of the Original Software and the hardware
+or firmware into which the Original Software is loaded. Distribution
+of Licensed Software to third parties pursuant to this grant shall be
+subject to the same terms and conditions as set forth in this
+Agreement, and may, at Your option, include a reasonable charge for
+the cost of any media. You may also, at Your option, charge for any
+other software, product or service that includes or incorporates the
+Original Software as a part thereof.
+
+2.2 No right is granted to Licensee to create derivative works of or
+to redistribute (other than with the Original Software or a derivative
+thereof) the screen imprinter fonts identified in subdirectory
+/lib/font/bit/lucida and printer fonts (Lucida Sans Unicode, Lucida
+Sans Italic, Lucida Sans Demibold, Lucida Typewriter, Lucida Sans
+Typewriter83), identified in subdirectory /sys/lib/postscript/font.
+
+2.3 Exhibit A contains additional terms and conditions relating to the
+printer fonts identified in subdirectory /sys/lib/ghostscript/font.
+In the case of any conflict between the provisions of the body of this
+Agreement and Exhibit A regarding such printer fonts, the provisions
+of Exhibit A shall control.
+
+2.4 The Original Software licensed herein contains material copyrights
+by the Original Contributor, including but not limited to Lucent, B&H
+Inc., and Y&Y Inc. No rights are granted with respect to Original
+Software except as expressly provided herein.
+
+
+3.0 DISTRIBUTION OBLIGATIONS
+
+3.1 Modifications which You create or to which You contribute are
+governed by the terms of this Agreement and must be made available
+under the terms this Agreement in at least the same form as the Source
+Code version of Original Software furnished hereunder. Any
+distribution by You of the Source Code version of Licensed Software
+must be made under the terms of this Agreement or any future version
+of this Agreement under Section 11.0, and You must include a copy of
+this Agreement with each and every copy of such Source Code version of
+Licensed Software which You distribute. You may not offer or impose
+any terms on any such Source Code version of Licensed Software that
+alters or restricts the terms of the applicable version of this
+Agreement or the Recipients' rights and obligations hereunder.
+3.2 You must cause all Licensed Software to which You contribute, i.e.
+Your Modifications, to contain a clear identification, e.g., a
+separate file, documenting the changes made by You and identifying You
+as the Contributor that reasonably allows subsequent Recipients to
+identify the originator of the Modification. To the extent You create
+at least one Modification, You may add Your name as a Contributor to
+the requisite notice described in Section 3.3.
+3.3 With respect to Your distribution of Licensed Software (or any
+portion thereof), You must include the following information in a
+conspicuous location governing such distribution (e.g., a separate
+file) and on all copies of any Source Code version of Licensed
+Software You distribute:
+ "The contents herein includes software initially developed by Lucent
+ Technologies Inc. and others, and is subject to the terms of the
+ Lucent Technologies Inc. Plan 9 Open Source License Agreement. A copy
+ of the Plan 9 open Source License Agreement is available at:
+ http://plan9.bell-labs.com/plan9dist/download.html or by contacting
+ Lucent Technologies at http: //www.lucent.com. All software
+ distributed under such Agreement is distributed on an "AS IS" basis,
+ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ Lucent Technologies Inc. Plan 9 Open Source License Agreement for the
+ specific language governing all rights, obligations and limitations
+ under such Agreement. Portions of the software developed by Lucent
+ Technologies Inc. and others are Copyright (2000. All rights
+ reserved.
+ Contributor(s):___________________________"
+3.4 You may distribute Licensed Software in Object Code form using
+this Agreement, or under a license of Your choice provided that You
+are in compliance with this Agreement and Your license: (a) complies
+with the terms and conditions of this Agreement; (b) does not limit or
+alter the Recipient's rights and obligations in the Source Code
+version of the Licensed Software set forth in this Agreement; (c)
+states that the Source Code version of the Licensed Software is
+available from You, and describes how to it may be obtained by
+Recipient; (d) effectively disclaims on behalf of Original Contributor
+and all Contributors all warranties and conditions, express or
+implied, including warranties or conditions of title or
+non-infringement, and implied warranties or conditions of
+merchantability and fitness for a particular purpose; (e) effectively
+excludes on behalf of Original Contributor and all Contributors all
+liability for damages, including direct, indirect, special,
+incidental, and consequential damages; and (f) clearly states that any
+terms which differ from this Agreement are offered by You alone, not
+by Original Contributor or any other Contributor. You hereby agree to
+indemnify Original Contributor or any other Contributor for any
+liability incurred by Original Contributor or any other Contributor as
+result of any such differing terms You offer in Your license.
+3.5 You may not use the names "Lucent Technologies", "Bell Labs" or
+any other name associated with Lucent or any Lucent trademark for any
+purposes other than as specifically provided in this Section 3.0.
+3.6 You must include all of the original copyright, labels or other
+notices on the Licensed Software on any copies of the Licensed
+Software which You make; and include with the distribution of any
+Modifications You create a copy (or an offer to provide such a copy at
+no charge) of the Licensed Software, on the same terms as set forth in
+this Agreement.
+3.7 While this Agreement contemplates the commercial use and
+distribution of Licensed Software, commercial distributors of software
+may, for a variety of reasons, accept certain responsibilities with
+respect to customers, licensees, business partners and the like. As
+such, if You or any Contributor include Licensed Software in a
+commercial offering ("Commercial Contributor"), such Commercial
+Contributor agrees to defend and indemnify Original Contributor and
+all other Contributors (collectively "Indemnified Contributors")
+against any liability, losses, damages and costs arising from claims,
+lawsuits and other legal actions brought by any third party against
+the Indemnified Contributors to the extent caused by the acts or
+omissions of such Commercial Contributor in connection with its use or
+distribution of Licensed Software in a commercial offering of any
+kind.
+
+4.0 MODIFICATIONS
+You agree to provide the Original Contributor, at its request, with a
+copy of the complete Source Code version, Object Code version and
+related documentation for Modifications created or contributed to by
+You if used for any purpose. Original Contributor and/or other
+Contributors shall have unrestricted, nonexclusive, worldwide,
+perpetual, royalty-free rights, to use, reproduce, modify, display,
+perform, sublicense and distribute Your Modifications, and to grant
+third parties the right to do so, including without limitation as a
+part of or with the Licensed Software; and Original Contributor and/or
+other Contributors shall have the right to license or to otherwise
+transfer to third parties Your Modifications without notice,
+obligation or recourse to You. You grant to Original Contributor,
+Contributors and their respective licensees all rights and licenses
+(including patents) as are necessary to incorporate the Modifications
+created or contributed by You into the Licensed Software and to use,
+distribute or otherwise exploit such Licensed Software without payment
+or accounting to You.
+
+5.0 TITLE
+Title, ownership rights, and intellectual property rights in the
+Original Software shall remain in the Original Contributor. Original
+Contributor and/or the other Contributors reserve all rights not
+expressly granted to You, and no other licenses are granted or
+implied. The Licensed Software is protected by copyright laws and
+treaties.
+
+6.0 TERMINATION
+6.1 The licenses and rights granted under this Agreement shall
+terminate automatically if (i) You fail to comply with all of the
+terms and conditions herein; or (ii) You initiate or participate in
+any intellectual property action against Original Contributor and/or
+another Contributor.
+
+6.2 The rights and obligations of the parties hereto which by their
+nature would continue beyond termination of this Agreement shall
+survive and continue after any such termination of this Agreement.
+
+6.3 Upon termination for any reason, You must destroy all copies of
+the Licensed Software in Your possession. All sublicenses of Licensed
+Software which were validly granted by You to third parties under this
+Agreement shall survive such termination.
+
+7.0 DISCLAIMER OF WARRANTY
+
+YOU UNDERSTAND AND ACKNOWLEDGE THAT, TO THE FULLEST EXTENT PERMITTED
+BY LAW, THE LICENSED SOFTWARE IS LICENSED UNDER THIS AGREEMENT FREE OF
+CHARGE ON AN "AS IS" BASIS WITH ALL FAULTS, LATENT AND PATENT AND
+WITHOUT ANY WARRANTY OF ANY TYPE. ORIGINAL CONTRIBUTOR AND THE OTHER
+CONTRIBUTORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESSED OR
+IMPLIED. BY WAY OF EXAMPLE, BUT NOT OF LIMITATION, ORIGINAL
+CONTRIBUTOR AND THE OTHER CONTRIBUTORS MAKE NO REPRESENTATIONS OF
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR THAT THE USE OF
+THE LICENSED SOFTWARE WILL NOT INFRINGE ANY PATENT OR OTHER
+INTELLECTUAL PROPERTY RIGHT OF ANY THIRD PARTY AND IT SHALL BE THE
+SOLE RESPONSIBILITY OF YOU TO MAKE SUCH DETERMINATION AS IS NECESSARY
+WITH RESPECT TO THE ACQUISITION OF LICENSES UNDER PATENTS OR OTHER
+INTELLECTUAL PROPERTY RIGHTS OF THIRD PARTIES. ORIGINAL CONTRIBUTOR
+AND THE OTHER CONTRIBUTORS DO NOT WARRANT THAT THE FUNCTIONS OF THE
+LICENSED SOFTWARE WILL MEET YOUR REQUIREMENTS OR THAT LICENSED
+SOFTWARE OPERATION WILL BE ERROR-FREE OR UNINTERRUPTED. YOU ASSUME
+THE RISK OF ANY AND ALL DAMAGE OR LOSS FROM USE, OR INABILITY TO USE,
+THE LICENSED SOFTWARE. ORIGINAL CONTRIBUTOR AND THE OTHER
+CONTRIBUTORS BEAR NO RESPONSIBILITY FOR CORRECTING THE LICENSED
+SOFTWARE, SUPPLYING ASSISTANCE FOR FIXING, OR FOR COMMUNICATING KNOWN
+ERRORS TO YOU PERTAINING TO THE LICENSED SOFTWARE FURNISHED HEREUNDER.
+
+ORIGINAL CONTRIBUTOR AND THE OTHER CONTRIBUTORS SHALL NOT BE HELD TO
+ANY LIABILITY WITH RESPECT TO ANY PATENT INFRINGEMENT OR ANY OTHER
+CLAIM MADE BY YOU OR ANY THIRD PARTY ON ACCOUNT OF, OR ARISING FROM
+THE USE OF, THE LICENSED SOFTWARE PROVIDED HEREUNDER.
+
+SOME STATES DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO THE
+ABOVE EXCLUSION MAY NOT APPLY TO YOU. YOU MAY ALSO HAVE OTHER RIGHTS
+THAT VARY FROM JURISDICTION TO JURISDICTION.
+
+8.0 LIMITATION OF LIABILITY
+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, TORT, CONTRACT, OR
+OTHERWISE, SHALL ORIGINAL CONTRIBUTOR AND/OR THE OTHER CONTRIBUTORS BE
+LIABLE TO YOU OR ANY OTHER THIRD PARTY FOR DAMAGES OF ANY KIND
+INCLUDING, BUT NOT LIMITED TO, ANY DIRECT, INDIRECT, SPECIAL,
+INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER WHATSOEVER
+INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF THE ORIGINAL CONTRIBUTOR AND/OR
+ANY OTHER CONTRIBUTORS SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF
+SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. FURTHERMORE, SOME
+JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL
+OR CONSEQUENTIAL DAMAGES, SO THIS LIMITATION AND EXCLUSION MAY NOT
+APPLY TO YOU. TO THE EXTENT THAT ANY EXCLUSION OF DAMAGES ABOVE IS NOT
+VALID, YOU AGREE THAT IN NO EVENT WILL ORIGINAL CONTRIBUTOR'S AND ALL
+OTHER CONTRIBUTORS' TOTAL LIABILITY UNDER OR RELATED TO THIS AGREEMENT
+EXCEED ONE THOUSAND DOLLARS ($1000.00 US).
+
+9.0 EXPORT CONTROL
+You acknowledge that the Licensed Software hereunder is "unrestricted
+encryption source code" as the term is defined under the United States
+Export Administration Regulations and is subject to export control
+under such laws and regulations. You agree that, if you export or
+re-export the Licensed Software or any modifications to it, You are
+responsible for compliance with the United States Export
+Administration Regulations and hereby indemnify the Original
+Contributor and all other Contributors for any liability incurred as a
+result.
+
+10.0 U.S. GOVERNMENT RIGHTS
+You may only acquire the Licensed Software on behalf of, or for
+delivery to, any part of the United States Government, if the Licensed
+Software is treated as commercial computer software and licensed to
+the Government under the terms and conditions of this Agreement,
+pursuant to the policies stated in 48 C.F.R. Section 12.212 (October
+1995) or 48 C.F.R. Section 227.7202 (June 1995), as applicable.
+
+11.0 LICENSE VERSIONS
+LUCENT, at its sole discretion, may from time to time publish a
+revised and/or new version of this Agreement (each such revised or new
+version shall carry a distinguishing version number) which shall
+govern all copies of Licensed Software downloaded after the posting of
+such revised or new version of this Agreement.
+
+12.0 MISCELLANEOUS
+This Agreement sets forth the entire agreement and understanding
+between the parties as to the subject matter hereof and merges all
+prior discussions between them. This Agreement shall be governed by
+the laws of the State of New York, USA, excluding its conflict of law
+provisions. The application of the United Nations Convention of
+Contracts for the International Sale of Goods is expressly excluded.
+YOUR DOWNLOAD, INSTALLATION AND USE, MODIFICATION OR DISTRIBUTION OF
+THE LICENSED SOFTWARE IS EXPRESSLY MADE CONDITIONAL ON YOUR ASSENT TO
+THE TERMS SET FORTH HEREIN. You further agree and acknowledge that by
+clicking on the "ACCEPT" button below, You shall have manifested
+acceptance to enter into this Agreement and shall be deemed to have
+manually signed and executed this Agreement making this an enforceable
+Agreement between the parties. If any provision of this Agreement is
+held to be unenforceable, such provision shall be reformed only to the
+extent necessary to make it enforceable.
+
+
+
+
+
+EXHIBIT A - GNU GENERAL PUBLIC LICENSE
+
+
+GNU GENERAL PUBLIC LICENSE
+
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
+Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute
+verbatim copies of this license document, but changing it is not
+allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom
+to share and change it. By contrast, the GNU General Public License
+is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on,
+we want its recipients to know that what they have is not the
+original, so that any problems introduced by others will not reflect
+on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at
+all.
+
+The precise terms and conditions for copying, distribution and
+modification follow.
+
+GNU GENERAL PUBLIC LICENSE
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a
+notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the Program
+(independent of having been made by running the Program). Whether
+that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a
+fee.
+
+2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+a) You must cause the modified files to carry prominent notices
+stating that you changed the files and the date of any change.
+
+b) You must cause any work that you distribute or publish, that in
+whole or in part contains or is derived from the Program or any part
+thereof, to be licensed as a whole at no charge to all third parties
+under the terms of this License.
+
+c) If the modified program normally reads commands interactively when
+run, you must cause it, when started running for such interactive use
+in the most ordinary way, to print or display an announcement
+including an appropriate copyright notice and a notice that there is
+no warranty (or else, saying that you provide a warranty) and that
+users may redistribute the program under these conditions, and telling
+the user how to view a copy of this License. (Exception: if the
+Program itself is interactive but does not normally print such an
+announcement, your work based on the Program is not required to print
+an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+a) Accompany it with the complete corresponding machine-readable
+source code, which must be distributed under the terms of Sections 1
+and 2 above on a medium customarily used for software interchange; or,
+
+b) Accompany it with a written offer, valid for at least three years,
+to give any third party, for a charge no more than your cost of
+physically performing source distribution, a complete machine-readable
+copy of the corresponding source code, to be distributed under the
+terms of Sections 1 and 2 above on a medium customarily used for
+software interchange; or,
+
+c) Accompany it with the information you received as to the offer to
+distribute corresponding source code. (This alternative is allowed
+only for noncommercial distribution and only if you received the
+program in object code or executable form with such an offer, in
+accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new
+versions of the General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Program does not specify a
+version number of this License, you may choose any version ever
+published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the
+author to ask for permission. For software which is copyrighted by
+the Free Software Foundation, write to the Free Software Foundation;
+we sometimes make exceptions for this. Our decision will be guided by
+the two goals of preserving the free status of all derivatives of our
+free software and of promoting the sharing and reuse of software
+generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+
+
+YOU ACKNOWLEDGE THAT YOU HAVE READ THIS AGREEMENT (INCLUDING THE
+EXHIBITS) AND UNDERSTAND IT, AND THAT BY CLICKING ON THE "ACCEPT"
+BUTTON BELOW AND INSTALLING/DOWNLOADING THE SOFTWARE YOU ACCEPT AND
+AGREE TO BE BOUND BY THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+
+Plan 9 Open Source License - Version 1.0 - 06/03/00 1
+
--- /dev/null
+++ b/main.c
@@ -1,0 +1,429 @@
+/*
+ * Mostly based on the original source codes of Plan 9 release 2
+ * distribution.
+ * by Kenji Okamoto, August 4 2000
+ * Osaka Prefecture Univ.
+ * okamoto@granite.cias.osakafu-u.ac.jp
+ */
+
+#include <u.h>
+#include <libc.h>
+#include <stdio.h>
+#include "ktrans.h"
+#include "jisho.h"
+
+#define LSIZE 256
+
+Rune lbuf[LSIZE]; /* hiragana buffer for key input written by send() */
+Map *table = hira; /* default language conversion table */
+uchar okurigana[LSIZE]; /* buffer for okurigana */
+char okuri = 0; /* buffer/flag for capital input char */
+int in, out;
+int llen, olen, joshi = 0;
+int natural = 1; /* not Japanese but English mode */
+
+int changelang(int);
+int dotrans(Dictionary*);
+int noter(void *, char *);
+int nrune(char *);
+void send(uchar *, int);
+Map *match(uchar *p, int *nc, Map *table);
+
+extern Dictionary *openQDIC(char *);
+extern KouhoList *getKouhoHash(Dictionary*, char *);
+extern KouhoList *getKouhoFile(DicList*, char *);
+extern void freeQDIC(Dictionary*);
+extern void selectKouho(KouhoList **, KouhoList*);
+
+
+void
+main(int argc, char **argv)
+{
+
+ uchar *bp, *ep, buf[128];
+ Map *mp;
+ int nchar, wantmore;
+ int n, c;
+ char jishoname[64], *dicname;
+ Dictionary *jisho;
+
+ USED(argc);
+ USED(argv);
+
+ dicname = getenv("KTJISHO");
+ if(!dicname)
+ dicname = strcat(getenv("home"), "/lib/ktrans-jisho");
+ strcpy(jishoname, dicname);
+ jisho = openQDIC(jishoname);
+
+ in = _IO_stream[0].fd;
+ out = _IO_stream[1].fd;
+
+ if (rfork(RFPROC))
+ exits(0); /* parent process will die */
+
+
+ atnotify(noter, 1);
+
+ bp = ep = buf; /* bp = base point of input string */
+ /* ep = end point of input string */
+ /* buf = unsigned buffer array */
+ wantmore = 0;
+ for (;;) { /* key board input loop */
+ getmore:
+ if (bp>=ep || wantmore) {
+ if (wantmore==0)
+ bp = ep = buf; /* clear all */
+ n = read(in, ep, &buf[sizeof(buf)]-ep); /* read from stdin */
+ if (n<=0)
+ exits("");
+ ep += n; /* ep => end point of input string */
+ *ep = '\0';
+ }
+ while (bp<ep) { /* there are input data */
+ if (table == hira && natural != 1 && (*bp>'A' && *bp<='Z') && ep-bp<2
+ && !strchr("EIOU", *bp)) {
+ wantmore = 1;
+ goto getmore;
+ }
+ if (!fullrune((char *)bp, ep-bp)) { /* not enough length of input */
+ wantmore = 1;
+ goto getmore;
+ }
+ wantmore = 0;
+
+ if (*bp=='') { /* ^x read ktrans-jisho once more */
+ freeQDIC(jisho);
+ jisho = openQDIC(jishoname);
+ llen = 0;
+ olen = okuri = joshi = 0;
+ wantmore=0;
+ bp=ep=buf;
+ continue;
+ }
+
+ if (*bp=='') { /* Shift+Space (start translate comannd) */
+ c = dotrans(jisho);
+ if (c)
+ *bp = c; /* pointer to translated rune */
+ else
+ bp++;
+ continue;
+ }
+ if (*bp=='') { /* ^l (no translate comannd) */
+ bp++;
+ llen = 0;
+ olen = okuri = joshi = 0;
+ continue;
+ }
+ if (changelang(*bp)) { /* change language mode OK */
+ bp++;
+ olen = okuri = joshi = 0;
+ continue;
+ }
+ if (natural || *bp<=' ' || *bp>='{') { /* English mode but not ascii */
+ Rune r;
+ int rlen = chartorune(&r, (char *)bp);
+ send(bp, rlen); /* write bp to /dev/cons */
+ bp += rlen;
+ continue;
+ }
+ if (table == hira && (*bp >= 'A' && *bp <= 'Z') && (*(bp+1) < 'A'
+ || *(bp+1) > 'Z')) {
+ *bp = okuri = tolower(*bp);
+ joshi = olen = 0;
+ } else if (table == hira && (*bp >= 'A' && *bp <= 'Z') &&
+ (*(bp+1) >= 'A' && *(bp+1) <= 'Z')) {
+ *bp = okuri = tolower(*bp);
+ *(bp+1) = tolower(*(bp+1));
+ joshi = 1;
+ olen = 0;
+ }
+
+/* BUG! we have to hit ^l at every beginning of the new line... sorry
+ if (table == hira && *bp == '\n') {
+ Rune r;
+ int rlen = chartorune(&r, (char *)bp);
+ send(bp, rlen);
+ bp++;
+ olen = okuri = joshi = 0;
+ continue;
+ }
+*/
+ mp = match(bp, &nchar, table);
+ if (mp == 0) {
+ if (nchar>0) { /* match, longer possible */
+ wantmore++;
+ break;
+ }
+ send(bp++, 1); /* alphabet in kana mode */
+ } else {
+ send((uchar*)mp->kana, strlen(mp->kana));
+ bp += nchar;
+ }
+ }
+ }
+}
+
+int
+noter(void *x, char *note)
+{
+ USED(x);
+ if (strcmp(note, "interrupt")==0)
+ return 1;
+ else
+ return 0;
+}
+
+int
+min(int a, int b)
+{
+ return a<b? a: b;
+}
+
+/*
+ *send UTF string (p) with length (n) to stdout
+ * and write rune (r) in global lbuf[] buffer
+ * or okurigana[] buffer if okuri (verb or joshi) mode
+ */
+
+void
+send(uchar *p, int n)
+{
+ Rune r;
+ uchar *ep;
+
+ if (write(out, (char *)p, n) != n) /* write to stdout */
+ exits("");
+
+ if (llen>LSIZE-64) {
+ memmove((char*)lbuf, (char*)lbuf+64, 64*sizeof(Rune));
+ llen -= 64;
+ }
+ if (table!=hira || natural)
+ return;
+ ep = p+n;
+ if(okuri) {
+ while (olen<LSIZE && p<ep) okurigana[olen++] = *p++;
+ }
+ else {
+ while (llen<LSIZE && p<ep) {
+ p += chartorune(&r, (char*)p);
+ if (r=='\b') { /* handle backspace */
+ if (llen>0)
+ llen--;
+ continue;
+ }
+ if (r==0x80) /* ignore view key */
+ continue;
+/*
+ if (r<0x3041 || r>0x309e) { reset if out of hiragana range
+ llen = 0; we use this for okuri-ari entries
+ continue;
+ }
+*/
+ lbuf[llen++] = r;
+ }
+ }
+
+}
+
+/*
+ * Romaji to Hiragana/Katakana conversion
+ * romaji shoud be input as small letter
+ * returns the matched address in table, hira, kata etc.
+ * nc: nubmer of character(return value)
+ */
+
+Map *
+match(uchar *p, int *nc, Map *table)
+{
+ register Map *longp = 0, *kp;
+ static char last;
+ int longest = 0;
+
+ *nc = -1;
+ for (kp=table; kp->roma; kp++) {
+ if (*p == *kp->roma) {
+ int lr = strlen(kp->roma);
+ int len = min(lr, strlen((char *)p));
+ if (strncmp(kp->roma, (char *)p, len)==0) {
+ if (len<lr) {
+ *nc = 1;
+ return 0;
+ }
+ if (len>longest) {
+ longest = len;
+ longp = kp;
+ }
+ }
+ }
+ }
+ if (longp) {
+ last = longp->roma[longest-1];
+ *nc = longp->advance;
+ }
+ return(longp);
+}
+
+int
+changelang(int c)
+{
+ if (c=='') { /* ^k (Japanese Katakana input mode) */
+ natural = 0;
+ table = kata;
+ llen = 0;
+ return 1;
+ }
+
+ if (c=='') { /* ^n (Japanese hiragana mode ) */
+ natural = 0;
+ llen = 0;
+ table = hira;
+ return 1;
+ }
+
+ if (c=='') { /* ^e (English mode) */
+ natural = 1;
+ llen = 0;
+ return 1;
+ }
+
+ if (c=='') { /* ^r (Russian mode) */
+ natural = 0;
+ table = cyril;
+ llen = 0;
+ return 1;
+ }
+ if (c=='') { /* ^g (Greek mode ) */
+ natural = 0;
+ table = greek;
+ llen = 0;
+ return 1;
+ }
+ return 0;
+
+}
+
+/*
+ * write translated kanji runes to stdout
+ * and returns last charcter if it's not Shift+Space.
+ * if the last is Shift+Space, proceed translation to next kouho
+ */
+
+int
+dotrans(Dictionary *dic)
+{
+ Rune *res, r[1];
+ char v[1024], *p, tbuf[64], hirabuf[64];
+ int j, lastlen, nokouho = 0;
+ char ch;
+ KouhoList *fstkouho, *currentkouho;
+
+ if (llen==0)
+ return 0; /* not use kanji transform function */
+ if (okuri && joshi != 1) {
+ lbuf[llen++] = (Rune)okuri;
+ lbuf[llen] = 0;
+ }else
+ lbuf[llen] = 0;
+ okurigana[olen] = 0;
+
+/*
+ * search the mached index to the key word from the dict hash table , and
+ * returns a pointer to the matched kouho if success,
+ * or returns 0 if failed.
+*/
+
+ res = lbuf;
+ for (j=0; *res != L'\0'; j += runetochar(v+j, res++));
+ v[j++] = '\0';
+ strcpy(tbuf, v);
+ strcpy(hirabuf, v); /* to remeber the initial hiragana input */
+ if (okuri && joshi != 1) hirabuf[strlen(hirabuf) - 1] = '\0'; /* verb mode */
+ if(!(fstkouho = getKouhoHash(dic, v))) { /* not found */
+ llen = olen = okuri = joshi = 0;
+ okurigana[0] = 0;
+ return 0;
+ }
+
+ currentkouho = fstkouho;
+ for(;;) {
+ p = currentkouho->kouhotop; /* p to the head of kanji kouho array */
+ lastlen = nrune(tbuf); /* number of rune chars */
+ if (okuri && joshi != 1) /* verb mode */
+ for (j=0; j<lastlen-1; j++)
+ write(out, "\b", 1); /* clear hiragana input */
+ else
+ for (j=0; j<lastlen; j++)
+ write(out, "\b", 1); /* clear hiragana input */
+ if (okuri) {
+ lastlen = nrune((char *)okurigana);
+ for (j=0; j<lastlen; j++) write(out, "\b", 1);
+ }
+ write(out, p, strlen(p)); /* write kanji to stdout */
+ if (okuri) write(out, (char *)okurigana, olen);
+
+ if (read(in, &ch, 1)<=0) /* read from stdin */
+ exits(0);
+
+ if (ch == '') { /* if next input is Shift+Space, once more */
+ if(currentkouho->nextkouho != 0) { /* have next kouho */
+ nokouho = 0;
+ strcpy(tbuf, p);
+ currentkouho = currentkouho->nextkouho;
+ if (okuri && joshi != 1) { /* verb mode */
+ for (j=0; j<nrune(tbuf); j++)
+ write(out, "\b", 1);
+ }
+ continue;
+ } else { /* the last kouho */
+ if (okuri) {
+ lastlen = nrune((char *)okurigana);
+ for (j=0; j<lastlen; j++)
+ write(out, "\b", 1);
+ }
+ for (j=0, lastlen=0; *p != 0; p += j) {
+ j = chartorune(r, p);
+ lastlen++;
+ }
+ for (j=0; j<lastlen; j++)
+ write(out, "\b", 1);
+ if(hirabuf[0])
+ write(out, hirabuf, strlen(hirabuf));
+ if(okurigana[0])
+ write(out, (char *)okurigana, olen);
+ olen = okuri = joshi = 0;
+ okurigana[0] = 0;
+ nokouho = 1;
+ break;
+ }
+ }
+ else {
+ if(!nokouho) /* learn the previous use of the kouho */
+ selectKouho(&(fstkouho->dicitem->kouho), currentkouho);
+ olen = okuri = joshi = 0;
+ okurigana[0] = 0;
+ break;
+ }
+ }
+ llen = 0;
+ return ch;
+}
+
+/*
+ * returns number of characters in the pointed Rune
+ */
+
+int
+nrune(char *p)
+{
+ int n = 0;
+ Rune r;
+
+ while (*p) {
+ p += chartorune(&r, p);
+ n++;
+ }
+ return n;
+}
--- /dev/null
+++ b/main.c.cinap
@@ -1,0 +1,467 @@
+/*
+ * Mostly based on the original source codes of Plan 9 release 2
+ * distribution.
+ * by Kenji Okamoto, August 4 2000
+ * Osaka Prefecture Univ.
+ * okamoto@granite.cias.osakafu-u.ac.jp
+ */
+
+#include <u.h>
+#include <libc.h>
+#include <bio.h>
+#include "ktrans.h"
+#include "jisho.h"
+
+#define LSIZE 256
+
+Rune lbuf[LSIZE]; /* hiragana buffer for key input written by send() */
+Map *table = hira; /* default language conversion table */
+uchar okurigana[LSIZE]; /* buffer for okurigana */
+char okuri = 0; /* buffer/flag for capital input char */
+int in, out;
+int llen, olen, joshi = 0;
+int natural = 1; /* not Japanese but English mode */
+
+int changelang(int);
+int dotrans(Dictionary*);
+int nrune(char *);
+void send(uchar *, int);
+Map *match(uchar *p, int *nc, Map *table);
+
+extern Dictionary *openQDIC(char *);
+extern KouhoList *getKouhoHash(Dictionary*, char *);
+extern KouhoList *getKouhoFile(DicList*, char *);
+extern void freeQDIC(Dictionary*);
+extern void selectKouho(KouhoList **, KouhoList*);
+
+void
+kbdopen(void)
+{
+ int n, kinfd, koutfd, fd[2];
+ char buf[128];
+ int kbd;
+
+ kbd = 1;
+ if((kinfd = open("/dev/kbd", OREAD)) < 0){
+ kbd = 0;
+ if((kinfd = open("/dev/cons", OREAD)) < 0)
+ sysfatal("open kbd: %r");
+ }
+ if(bind("#|", "/n/temp", MREPL) < 0)
+ sysfatal("bind /n/temp: %r");
+ if((koutfd = open("/n/temp/data1", OWRITE)) < 0)
+ sysfatal("open kbd pipe: %r");
+ if(bind("/n/temp/data", kbd? "/dev/kbd": "/dev/cons", MREPL) < 0)
+ sysfatal("bind kbd pipe: %r");
+ unmount(nil, "/n/temp");
+ if(!kbd){
+ in = kinfd;
+ out = koutfd;
+ return;
+ }
+ if(pipe(fd) < 0)
+ sysfatal("pipe: %r");
+ if(fork()){
+ in = out = fd[0];
+ close(fd[1]);
+ close(kinfd);
+ close(koutfd);
+ return;
+ }
+ close(fd[0]);
+ if(fork()){
+ Biobuf b;
+ long r;
+
+ Binit(&b, fd[1], OREAD);
+ while((r = Bgetrune(&b)) >= 0){
+ n = snprint(buf, sizeof(buf), "c%C", (Rune)r)+1;
+ write(koutfd, buf, n); /* pass on result */
+ }
+ } else {
+ while((n = read(kinfd, buf, sizeof(buf))) > 0){
+ buf[n-1] = 0;
+ if(n < 2 || buf[0] != 'c')
+ write(koutfd, buf, n); /* pass on */
+ else
+ write(fd[1], buf+1, n-2); /* to translator */
+ }
+ }
+ exits(0);
+}
+
+void
+main(int argc, char **argv)
+{
+
+ uchar *bp, *ep, buf[128];
+ Map *mp;
+ int nchar, wantmore;
+ int n, c;
+ char jishoname[64], *dicname;
+ Dictionary *jisho;
+
+ USED(argc);
+ USED(argv);
+
+ dicname = getenv("KTJISHO");
+ if(!dicname)
+ dicname = strcat(getenv("home"), "/lib/ktrans-jisho");
+ strcpy(jishoname, dicname);
+ jisho = openQDIC(jishoname);
+
+ kbdopen();
+ if(fork())
+ exits(0); /* parent process will exit */
+
+ bp = ep = buf; /* bp = base point of input string */
+ /* ep = end point of input string */
+ /* buf = unsigned buffer array */
+ wantmore = 0;
+ for (;;) { /* key board input loop */
+ getmore:
+ if (bp>=ep || wantmore) {
+ if (wantmore==0)
+ bp = ep = buf; /* clear all */
+ n = read(in, ep, &buf[sizeof(buf)]-ep); /* read from stdin */
+ if (n<=0)
+ exits("");
+ ep += n; /* ep => end point of input string */
+ *ep = '\0';
+ }
+ while (bp<ep) { /* there are input data */
+ if (table == hira && natural != 1 && (*bp>'A' && *bp<='Z') && ep-bp<2
+ && !strchr("EIOU", *bp)) {
+ wantmore = 1;
+ goto getmore;
+ }
+ if (!fullrune((char *)bp, ep-bp)) { /* not enough length of input */
+ wantmore = 1;
+ goto getmore;
+ }
+ wantmore = 0;
+
+ if (*bp=='') { /* ^x read ktrans-jisho once more */
+ freeQDIC(jisho);
+ jisho = openQDIC(jishoname);
+ llen = 0;
+ olen = okuri = joshi = 0;
+ wantmore=0;
+ bp=ep=buf;
+ continue;
+ }
+
+ if (*bp=='') { /* Shift+Space (start translate comannd) */
+ c = dotrans(jisho);
+ if (c)
+ *bp = c; /* pointer to translated rune */
+ else
+ bp++;
+ continue;
+ }
+ if (*bp=='') { /* ^l (no translate comannd) */
+ bp++;
+ llen = 0;
+ olen = okuri = joshi = 0;
+ continue;
+ }
+ if (changelang(*bp)) { /* change language mode OK */
+ bp++;
+ olen = okuri = joshi = 0;
+ continue;
+ }
+ if (natural || *bp<=' ' || *bp>='{') { /* English mode but not ascii */
+ Rune r;
+ int rlen = chartorune(&r, (char *)bp);
+ send(bp, rlen); /* write bp to /dev/cons */
+ bp += rlen;
+ continue;
+ }
+ if (table == hira && (*bp >= 'A' && *bp <= 'Z') && (*(bp+1) < 'A'
+ || *(bp+1) > 'Z')) {
+ *bp = okuri = tolower(*bp);
+ joshi = olen = 0;
+ } else if (table == hira && (*bp >= 'A' && *bp <= 'Z') &&
+ (*(bp+1) >= 'A' && *(bp+1) <= 'Z')) {
+ *bp = okuri = tolower(*bp);
+ *(bp+1) = tolower(*(bp+1));
+ joshi = 1;
+ olen = 0;
+ }
+
+/* BUG! we have to hit ^l at every beginning of the new line... sorry
+ if (table == hira && *bp == '\n') {
+ Rune r;
+ int rlen = chartorune(&r, (char *)bp);
+ send(bp, rlen);
+ bp++;
+ olen = okuri = joshi = 0;
+ continue;
+ }
+*/
+ mp = match(bp, &nchar, table);
+ if (mp == 0) {
+ if (nchar>0) { /* match, longer possible */
+ wantmore++;
+ break;
+ }
+ send(bp++, 1); /* alphabet in kana mode */
+ } else {
+ send((uchar*)mp->kana, strlen(mp->kana));
+ bp += nchar;
+ }
+ }
+ }
+}
+
+int
+min(int a, int b)
+{
+ return a<b? a: b;
+}
+
+/*
+ *send UTF string (p) with length (n) to stdout
+ * and write rune (r) in global lbuf[] buffer
+ * or okurigana[] buffer if okuri (verb or joshi) mode
+ */
+
+void
+send(uchar *p, int n)
+{
+ Rune r;
+ uchar *ep;
+
+ if (write(out, (char *)p, n) != n) /* write to stdout */
+ exits("");
+
+ if (llen>LSIZE-64) {
+ memmove((char*)lbuf, (char*)lbuf+64, 64*sizeof(Rune));
+ llen -= 64;
+ }
+ if (table!=hira || natural)
+ return;
+ ep = p+n;
+ if(okuri) {
+ while (olen<LSIZE && p<ep) okurigana[olen++] = *p++;
+ }
+ else {
+ while (llen<LSIZE && p<ep) {
+ p += chartorune(&r, (char*)p);
+ if (r=='\b') { /* handle backspace */
+ if (llen>0)
+ llen--;
+ continue;
+ }
+ if (r==0x80) /* ignore view key */
+ continue;
+/*
+ if (r<0x3041 || r>0x309e) { reset if out of hiragana range
+ llen = 0; we use this for okuri-ari entries
+ continue;
+ }
+*/
+ lbuf[llen++] = r;
+ }
+ }
+
+}
+
+/*
+ * Romaji to Hiragana/Katakana conversion
+ * romaji shoud be input as small letter
+ * returns the matched address in table, hira, kata etc.
+ * nc: nubmer of character(return value)
+ */
+
+Map *
+match(uchar *p, int *nc, Map *table)
+{
+ register Map *longp = 0, *kp;
+ static char last;
+ int longest = 0;
+
+ *nc = -1;
+ for (kp=table; kp->roma; kp++) {
+ if (*p == *kp->roma) {
+ int lr = strlen(kp->roma);
+ int len = min(lr, strlen((char *)p));
+ if (strncmp(kp->roma, (char *)p, len)==0) {
+ if (len<lr) {
+ *nc = 1;
+ return 0;
+ }
+ if (len>longest) {
+ longest = len;
+ longp = kp;
+ }
+ }
+ }
+ }
+ if (longp) {
+ last = longp->roma[longest-1];
+ *nc = longp->advance;
+ }
+ return(longp);
+}
+
+int
+changelang(int c)
+{
+ if (c=='') { /* ^k (Japanese Katakana input mode) */
+ natural = 0;
+ table = kata;
+ llen = 0;
+ return 1;
+ }
+
+ if (c=='') { /* ^n (Japanese hiragana mode ) */
+ natural = 0;
+ llen = 0;
+ table = hira;
+ return 1;
+ }
+
+ if (c=='') { /* ^e (English mode) */
+ natural = 1;
+ llen = 0;
+ return 1;
+ }
+
+ if (c=='') { /* ^r (Russian mode) */
+ natural = 0;
+ table = cyril;
+ llen = 0;
+ return 1;
+ }
+ if (c=='') { /* ^g (Greek mode ) */
+ natural = 0;
+ table = greek;
+ llen = 0;
+ return 1;
+ }
+ return 0;
+
+}
+
+/*
+ * write translated kanji runes to stdout
+ * and returns last charcter if it's not Shift+Space.
+ * if the last is Shift+Space, proceed translation to next kouho
+ */
+
+int
+dotrans(Dictionary *dic)
+{
+ Rune *res, r[1];
+ char v[1024], *p, tbuf[64], hirabuf[64];
+ int j, lastlen, nokouho = 0;
+ char ch;
+ KouhoList *fstkouho, *currentkouho;
+
+ if (llen==0)
+ return 0; /* not use kanji transform function */
+ if (okuri && joshi != 1) {
+ lbuf[llen++] = (Rune)okuri;
+ lbuf[llen] = 0;
+ }else
+ lbuf[llen] = 0;
+ okurigana[olen] = 0;
+
+/*
+ * search the mached index to the key word from the dict hash table , and
+ * returns a pointer to the matched kouho if success,
+ * or returns 0 if failed.
+*/
+
+ res = lbuf;
+ for (j=0; *res != L'\0'; j += runetochar(v+j, res++));
+ v[j] = '\0';
+ strcpy(tbuf, v);
+ strcpy(hirabuf, v); /* to remeber the initial hiragana input */
+ if (okuri && joshi != 1) hirabuf[strlen(hirabuf) - 1] = '\0'; /* verb mode */
+ if(!(fstkouho = getKouhoHash(dic, v))) { /* not found */
+ llen = olen = okuri = joshi = 0;
+ okurigana[0] = 0;
+ return 0;
+ }
+
+ currentkouho = fstkouho;
+ for(;;) {
+ p = currentkouho->kouhotop; /* p to the head of kanji kouho array */
+ lastlen = nrune(tbuf); /* number of rune chars */
+ if (okuri && joshi != 1) /* verb mode */
+ for (j=0; j<lastlen-1; j++)
+ write(out, "\b", 1); /* clear hiragana input */
+ else
+ for (j=0; j<lastlen; j++)
+ write(out, "\b", 1); /* clear hiragana input */
+ if (okuri) {
+ lastlen = nrune((char *)okurigana);
+ for (j=0; j<lastlen; j++) write(out, "\b", 1);
+ }
+ write(out, p, strlen(p)); /* write kanji to stdout */
+ if (okuri) write(out, (char *)okurigana, olen);
+
+ if (read(in, &ch, 1)<=0) /* read from stdin */
+ exits(0);
+
+ if (ch == '') { /* if next input is Shift+Space, once more */
+ if(currentkouho->nextkouho != 0) { /* have next kouho */
+ nokouho = 0;
+ strcpy(tbuf, p);
+ currentkouho = currentkouho->nextkouho;
+ if (okuri && joshi != 1) { /* verb mode */
+ for (j=0; j<nrune(tbuf); j++)
+ write(out, "\b", 1);
+ }
+ continue;
+ } else { /* the last kouho */
+ if (okuri) {
+ lastlen = nrune((char *)okurigana);
+ for (j=0; j<lastlen; j++)
+ write(out, "\b", 1);
+ }
+ for (lastlen=0; *p != 0; p += j) {
+ j = chartorune(r, p);
+ lastlen++;
+ }
+ for (j=0; j<lastlen; j++)
+ write(out, "\b", 1);
+ if(hirabuf[0])
+ write(out, hirabuf, strlen(hirabuf));
+ if(okurigana[0])
+ write(out, (char *)okurigana, olen);
+ olen = okuri = joshi = 0;
+ okurigana[0] = 0;
+ break;
+ }
+ }
+ else {
+ if(!nokouho) /* learn the previous use of the kouho */
+ selectKouho(&(fstkouho->dicitem->kouho), currentkouho);
+ olen = okuri = joshi = 0;
+ okurigana[0] = 0;
+ break;
+ }
+ }
+ llen = 0;
+ return ch;
+}
+
+/*
+ * returns number of characters in the pointed Rune
+ */
+
+int
+nrune(char *p)
+{
+ int n = 0;
+ Rune r;
+
+ while (*p) {
+ p += chartorune(&r, p);
+ n++;
+ }
+ return n;
+}
--- /dev/null
+++ b/mkfile
@@ -1,0 +1,22 @@
+</$objtype/mkfile
+
+TARG=ktrans
+
+OFILES=main.$O jisho.$O
+
+HFILES=jisho.h ktrans.h
+
+BIN=/$objtype/bin
+
+</sys/src/cmd/mkone
+
+installfull: install
+ mkdir /sys/src/cmd/ktrans
+ dircp ./ /sys/src/cmd/ktrans
+ cp ktrans.man /sys/man/1/ktrans
+ echo 'Notice: For a user to use ktrans they must have $home/lib/ktrans-jisho copied from /sys/src/cmd/ktrans!'
+
+uninstall:
+ rm /sys/man/1/ktrans
+ rm -r /sys/src/cmd/ktrans
+ rm /$objtype/bin/ktrans
--- /dev/null
+++ b/pipefile.c
@@ -1,0 +1,84 @@
+#include <u.h>
+#include <libc.h>
+
+#define TEMP "/n/temp"
+
+void
+usage(void)
+{
+ fprint(2, "usage: pipefile [-r command] [-w command] file\n");
+ exits("usage");
+}
+
+void
+connect(char *cmd, int fd0, int fd1)
+{
+ switch(rfork(RFPROC|RFFDG|RFREND|RFNOWAIT)){
+ case -1:
+ sysfatal("fork %s: %r", cmd);
+ break;
+ default:
+ return;
+ case 0:
+ if(fd0 != 0)
+ dup(fd0, 0);
+ if(fd1 != 1)
+ dup(fd1, 1);
+ execl("/bin/rc", "rc", "-c", cmd, nil);
+ sysfatal("exec %s: %r", cmd);
+ break;
+ }
+}
+
+void
+main(int argc, char *argv[])
+{
+ char *file;
+ char *rcmd, *wcmd;
+ int fd0, fd1, ifd0, ifd1;
+
+ rcmd = wcmd = nil;
+ ARGBEGIN{
+ case 'r':
+ rcmd = EARGF(usage());
+ break;
+ case 'w':
+ wcmd = EARGF(usage());
+ break;
+ default:
+ usage();
+ }ARGEND
+
+ if(argc!=1 || (rcmd==nil && wcmd==nil))
+ usage();
+ if(rcmd == nil)
+ rcmd = "/bin/cat";
+ if(wcmd == nil)
+ wcmd = "/bin/cat";
+
+ file = argv[0];
+ ifd0 = open(file, OREAD);
+ if(ifd0 < 0)
+ sysfatal("open %s: %r", file);
+ ifd1 = open(file, OWRITE);
+ if(ifd1 < 0)
+ sysfatal("open %s: %r", file);
+
+ if(bind("#|", TEMP, MREPL) < 0)
+ sysfatal("bind pipe %s: %r", TEMP);
+ if(bind(TEMP "/data", file, MREPL) < 0)
+ sysfatal("bind %s %s: %r", TEMP "/data", file);
+
+ fd0 = open(TEMP "/data1", OREAD);
+ if(fd0 < 0)
+ sysfatal("open %s: %r", TEMP "/data1");
+ connect(wcmd, fd0, ifd1);
+ fd1 = open(TEMP "/data1", OWRITE);
+ if(fd1 < 0)
+ sysfatal("open %s: %r", TEMP "/data1");
+ connect(rcmd, ifd0, fd1);
+ unmount(nil, TEMP);
+ exits(nil);
+}
+
+
--- /dev/null
+++ b/pipekbd.c
@@ -1,0 +1,67 @@
+#include <u.h>
+#include <libc.h>
+#include <bio.h>
+
+void
+main(int argc, char *argv[])
+{
+ int n, kinfd, koutfd, fd[2];
+ char buf[128];
+ int kbd;
+
+ kbd = 1;
+ if((kinfd = open("/dev/kbd", OREAD)) < 0){
+ kbd = 0;
+ if((kinfd = open("/dev/cons", OREAD)) < 0)
+ sysfatal("open kbd: %r");
+ }
+ if(bind("#|", "/n/temp", MREPL) < 0)
+ sysfatal("bind /n/temp: %r");
+ if((koutfd = open("/n/temp/data1", OWRITE)) < 0)
+ sysfatal("open kbd pipe: %r");
+ if(bind("/n/temp/data", kbd? "/dev/kbd": "/dev/cons", MREPL) < 0)
+ sysfatal("bind kbd pipe: %r");
+ unmount(nil, "/n/temp");
+ if(fork())
+ exits(nil); /* parent exits */
+ if(!kbd){
+ dup(kinfd, 0);
+ dup(koutfd, 1);
+ Run:
+ close(kinfd);
+ close(koutfd);
+ if(argv[1][0] != '/' || strncmp(argv[1], "./", 2) != 0 || strncmp(argv[1], "../", 3) != 0)
+ argv[1] = smprint("/bin/%s", argv[1]);
+ exec(argv[1], argv+1);
+ sysfatal("exec: %r");
+ }
+ if(pipe(fd) < 0)
+ sysfatal("pipe: %r");
+ if(fork()){
+ dup(fd[0], 0);
+ dup(fd[0], 1);
+ close(fd[0]);
+ close(fd[1]);
+ goto Run;
+ }
+ close(fd[0]);
+ if(fork()){
+ Biobuf b;
+ long r;
+
+ Binit(&b, fd[1], OREAD);
+ while((r = Bgetrune(&b)) >= 0){
+ n = snprint(buf, sizeof(buf), "c%C", (Rune)r)+1;
+ write(koutfd, buf, n); /* pass on result */
+ }
+ } else {
+ while((n = read(kinfd, buf, sizeof(buf))) > 0){
+ buf[n-1] = 0;
+ if(n < 2 || buf[0] != 'c')
+ write(koutfd, buf, n); /* pass on */
+ else
+ write(fd[1], buf+1, n-2); /* to translator */
+ }
+ }
+ exits(nil);
+}