From: akr Date: Sat, 27 Jan 2001 18:45:24 +0000 (+0000) Subject: egg4r000 X-Git-Tag: egg4r000 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=987321355d887006c6429ef7868873182f21ff3c;p=elisp%2Ftamago.git egg4r000 --- 987321355d887006c6429ef7868873182f21ff3c diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..d72efb7 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,31 @@ +KAWABATA, Taichi + Menudiag improvement. + +MORIOKA Tomohiko + Use of custom. + +NIIBE Yutaka + Design a part of ITS programming. + Wrote ITS: + its.el + its/hira.el + Wrote tamago.el, menudiag.el, tamago-cnv.el, tamago-comm.el, + and tamago-mlh.el. + Wrote backend conversion engine interface: + SJ3: tamago-lib/sj3.el, tamago-lib/sj3rpc.el, + WNN: tamago-lib/wnn.el, and tamago-lib/wnnrpc.el. + +KATAYAMA Yoshio + Design ITS programming. + Wrote its/hangul.el, its/erpin.el, its/pinyin.el, + its/thai.el, and its/zhuyin.el. + +Satoru Tomura + Designer/Implementor/Maintainer of EGG through V3.0. + Discussion/Design around ITS. + Suggestion around how to write code in LISP. + +Hisashi Miyashita + Wrote CCL routines in tamago-com.el. + + diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..4fcbdbb --- /dev/null +++ b/ChangeLog @@ -0,0 +1,2311 @@ +1998-07-12 NIIBE Yutaka + + * egg-mlh.el (mlh-space-bar-backward-henkan): Don't test against + egg-conversion-backend-alist. + + * egg/wnn.el (wnn-fini-lang): Reneme from wnn-fini. + (wnn-fini): New implementation calling wnn-fini-lang. + + (wnn-close): Call wnn-fini-lang. + (wnn-dictionary-save): Ditto. + + * egg/canna.el (canna-fini): Delete LANG argument. + * egg/sj3.el (sj3-fini): Ditto. + + * egg-cnv.el (egg-set-conversion-backend): Removed. + + * egg/sj3.el (sj3-start-conversion): Signal error on non-supported + language. + * egg/canna.el (canna-start-conversion): Likewise. + * egg/wnn.el (wnn-start-conversion): Likewise. + + * egg-cnv.el (egg-convert-region): Add handler for + lang-not-supported. + + * egg/wnn.el (egg-activate-wnn): load wnnrpc here conditionally. + * egg/sj3.el: Likewise. + * egg/canna.el: Likewise. + + * egg.el (egg-support-languages, egg-set-support-languages): Removed. + (egg-mode): Don't call egg-set-conversion-backend. + * egg/{canna.el, wnn.el, sj3.el}: Don't call egg-support-languages. + + * egg-cnv.el (egg-set-current-backend): Removed. + (egg-initialize-backend, egg-start-conversion, + egg-start-reverse-conversion): Don't call egg-set-current-backend. + (egg-conversion-backend-null): Rename from *-other-languages. + (egg-conversion-backend-alist): Removed. + (egg-conversion-backend): Not buffer local. + (egg-finalize-backend-alist): Removed. + +1998-07-10 NIIBE Yutaka + + * egg-cnv.el (egg-start-conversion-failure-hook): New Variable. + (egg-start-conversion-failure-fallback): New Function. + (egg-convert-region): Handle error and hook on failure. + + * egg/sj3.el (sj3-open): Remove bogus setq-s of sj3-sys-dict-list, + sj3-user-dict-list. + + * egg-mlh.el (mlh-space-bar-backward-henkan): Don't emit message + "converting...", as it may flush out error message. + + * egg/sj3rpc.el ("egg-com", "egg/sj3"): Require on compilation. + (sj3rpc-open): Failure when version is different. + +1998-07-03 KATAYAMA Yoshio + + * its/erpin.el, its/hangul.el, its/hankata.el, its/hira.el, + its/jeonkak.el, its/kata.el, its/pinyin.el, its/quanjiao.el, + its/thai.el, its/zenkaku.el: Updated using new its-*. + + * its.el (define-its-state-machine): Rewritten. + (define-its-compiled-map): Deleted. + (define-its-state-machine-append): Rewritten. + (its-defrule): Rewritten. + (its-defrule*): Rewritten. + (its-parent-states): New Variable. + (its-goto-state): Remove 2nd optional argument INITIAL-STATE. + (its-set-interim-terminal-state): New Function. + (its-make-next-state): Remove 2nd argument KEYSEQ. + +1998-07-01 NIIBE Yutaka + + * egg-mlh.el (mlh-hira-to-kata): Removed. Doesn't work any more. + (mlh-katakana): Use japanese-katakana-region. + + * egg-cnv.el (egg-conversion-map): Add again mapping for "/". + +1998-06-27 KATAYAMA Yoshio + + * egg-cnv.el (egg-abort-conversion): Bug fix. + +1998-06-27 NIIBE Yutaka + + * egg/wnn.el (wnn-dictionary-specification-list): Don' specify + for gerodic/g-jinmei. + Suggested by SAKAI Kiyotaka . + +1998-06-26 KATAYAMA Yoshio + + * its.el (its-cancel-input): Bug fix. + +1998-06-26 SAKAI Kiyotaka + + * egg-cnv.el (egg-conversion-mode, egg-help-command): New + functions for help string. + * its.el (its-mode, its-mode-help-command): Likewise. + +1998-06-26 KATAYAMA Yoshio + + * egg-cnv.el (egg-convert-region): Bug fix. + * egg.el (egg-default-language): Don't use string. + + * its/hankata.el (its-han-kata-enable-double-n, and others): + Variable name change (-han-) to distingush kata.el. + + * its/erpin.el (its-erpin-tw-enable-quanjioao-alphabet, + its-erpin-cn-enable-quanjioao-alphabet): + See its-enable-fullwidth-alphabet. + * its/kata.el (its-kata-enable-zenkaku-alphabet): Likewise. + * its/pinyin.el (its-pinyin-cn-enable-quanjioao-alphabet): Likewise. + * its/zenkaku.el (its-zenkaku-down-map): Likewise. + + * its/erpin.el (its-erpin-tw-map): Bug fix for "\\", "{", "}", and + "/". + * its/pinyin.el (its-pinyin-cn-map): Ditto. + * its/quanjiao.el (its-quanjiao-down-tw-map): Ditto. + * its/zhuyin.el (its-zhuyin-cn-enable-quanjioao-alphabet): Ditto. + + * its/hira.el (its-hira-enable-zenkaku-alphabet): Follow changes + of its.el. + * its/ascii.el (its-up-map, its-down-map): Ditto. + * its/jeonkak.el (its-jeonkak-up-map): Ditto. + + * its/hira.el (its-hira-enable-zenkaku-alphabet): + See its-enable-fullwidth-alphabet. + + * egg/wnn.el (wnn-save-dictionaries): Rewritten. + + * egg/canna.el (egg-edep): Required. + (canna-support-languages): Use symbol. + * egg/sj3.el (egg-edep): Likewise. + + * egg/wnn.el (egg-edep): Likewise. + * egg/wnnrpc.el: Use symbol. + + * menudiag.el (menudiag-mode-map): Bug fix for boundary conditions. + (menudiag-make-selection-list): Bug fix in case of many items. + + (menudiag-forward-item, menudiag-backward-item, + menudiag-goto-line): Change so that it wraps. + + * its.el (egg-edep): Required. + (its-keydef): Require unconditioanlly. + (its-mode-map): Don't call its-define-select-keys here. + (its-mode-map): Use of symbol as keymap. + (its-fence-invisible): New variable. + (its-put-cursor): Don't call its-define-select-keys. + (its-setup-fence-mode): invisible handling and its-define-select-keys. + (its-keyseq-acceptable-p): if (CDR SYL) is number, return NIL. + (define-its-state-machine): Introduce its-temporaly-map. + (define-its-state-machine-append): Likewise. + + (its-goto-state): Use symbol as keymap, not directly. + + (its-set-part-1,its-set-part-2): New function. + (its-delete-backward-within-SYL): Conditionalize. + + * egg.el (egg-edep): Required. + (egg-mode): Add remove-hook call. + Supply NIL as first argument to egg-set-conversion-backend. + make-local-hook for input-method-activate-hook. + (egg-set-face): Add optional argument OBJECT. + (egg-redraw-face): Bind inhibit-point-motion-hooks. + + * egg.el (set-buffer-multibyte): Move to egg-edep.el. + + * egg-mlh.el (mlh-space-bar-backward-henkan): Use assq. + + * egg-com.el (egg-zhuyin-syllable): compatibility change. + (encode-fixed-euc-china-region): Removed maxlen. + + Really Needed? -- gN. + * egg-com.el (egg-pinyin-syllable): Check exact match. + (egg-zhuyin-syllable): Likewise. + + * egg-cnv.el (egg-edep): Required. + (its-keydef): Not required. + (egg-conversion-map): Don't call its-define-select-keys here. + Fset it to use symbol instead of the map directly. + + (egg-get-bunsetsu-info): Add new optional argument for getting + property. + (egg-start-conversion-other-languages): set egg-conversion-backend. + (egg-set-current-backend): Use assq instead of assoc. + (egg-get-conversion-face): Likewise. + (egg-conversion-invisible): New variable. + (egg-convert-region): Change for open/close delimiter. + (egg-chinese-sisheng-regexp): New function. + (egg-separate-languages): Use egg-chinese-sisheng-regexp, + use symbol for language specifier (instead of string). + + (egg-charset-to-language): Use symbol for language specifier + (instead of string). + (egg-next-chinese-lang): Likewise. + + (egg-next-part-lang): Change the arguments. + + (egg-make-bunsetsu): New function changing egg-insert-bunsetsu. + + (egg-separate-characters): compatibility changes. + + (egg-conversion-wrap-select): New Variable. + + (egg-next-candidate): Can wrap around. + + (egg-decide-before-point): Rewritten. + (egg-abort-conversion): Back to previous one. + (egg-select-candidate): Use egg-make-bunsetsu. + + * egg-edep.el: New File for handling differences between Emacs version. + * its/thai.el: New File. + * its/hangul.el: Updated. + +1998-06-26 NIIBE Yutaka + + * Makefile (install): Don't touch .emacs and leim-list.el + directly. User should do it by her hand. + Reported by SAKAI Kiyotaka + +1998-06-25 NIIBE Yutaka + + * egg/canna.el (canna-dictionary-specification): "user" instead of + ("user"). Should chnage canna-filename later. + Reported by Akio Morita . + +1998-04-02 NIIBE Yutaka + + * egg-com.el (comm-unpack-u16-string): Call string-as-multibyte. + (comm-unpack-mb-string): Likewise. + + * egg.el (set-buffer-multibyte): Function for Emacs 20.2. + + * egg/wnn.el (wnn-open): Call set-buffer-multibyte. + * egg/sj3.el (sj3-open): Ditto. + * egg/canna.el (canna-open): Ditto. + +1998-04-02 KATAYAMA Yoshio + + Implement hilight. + * egg.el (egg-mark-list, egg-suppress-marking): New Variables. + (egg-set-face, egg-mark-modification, egg-redraw-face): New + Functions. + * its.el (its-buffer-ins/del-SYL): Call egg-set-face. + (its-setup-yanked-portion): Likewise. + * egg-cnv.el (egg-insert-bunsetsu): Call egg-set-face. + + * egg.el (egg-mode): set default backend. + * egg-mlh.el (mlh-space-bar-backward-henkan): activate input + method. + +1998-04-02 NIIBE Yutaka + + * egg-cnv.el (egg-decide-bunsetsu): Undo changes of 03-16. + (egg-abort-conversion): Call egg-end-conversion. + (egg-decide-before-point): Call egg-end-conversion widh ABORT=NIL. + +1998-03-16 NIIBE Yutaka + + CANNA Support. + * egg/canna.el, egg/cannarpc.el: New file. + * Makefile (SRCS): Added. + + * egg-cnv.el (egg-end-conversion): Add argument ABORT. + + * egg/wnn.el (wnn-end-conversion): Follow the change of + EGG-END-CONVERSION. + * egg/sj3.el (sj3-end-conversion): Likewise. + +1998-03-15 NIIBE Yutaka + + * Makefile: Add dependencies for its-keydef.elc. + * egg/sj3rpc.el (sj3-open): Don't support list of hosts. + * its.el (its-exit-mode, its-kick-convert-region): Bug fix. Call + its-input-end and its-put-cursor. + (its-exit-mode-off-input-method): Removed. + +1998-03-14 KATAYAMA Yoshio + + * docomp.el (its-keydef): Undo the changes of 03-09. its.el + is fixed. + + * egg-cnv.el (egg-current-language): New valiable. + (egg-bunsetsu-info): Separate bunsetsu-info and lunguage. + (egg-conversion-backend-other-languages + egg-init-other-languages + egg-start-conversion-other-languages + egg-get-bunsetsu-converted-other-languages + egg-get-bunsetsu-source-other-languages + egg-list-candidates-other-languages + egg-get-number-of-candidates-other-languages + egg-get-current-candidate-number-other-languages + egg-get-all-candidates-other-languages + egg-decide-candidate-other-languages + egg-change-bunsetsu-length-other-languages + egg-end-conversion-other-languages + egg-fini-other-languages): New valiable and functions for + handling unknown language. + (egg-set-current-backend): Set egg-conversion-backend-other-languages + when backend for specified language isn't found. + (egg-start-reverse-conversion): New function for reverse conversion. + (egg-set-conversion-backend-internal): Removed. + (egg-set-conversion-backend): Args are changed. + (egg-get-conversion-face): New function for different face for + every language. + (egg-convert-region): Make converting text read-only. Handle + unknown laguages and backend opening error. Rename its-lang to + egg-lang. + (egg-separate-languages): Argument use-context is added to + utilize context when called by its-yank. Rename its-lang to + egg-lang Improve speed. + (egg-charset-to-language): Renamed from egg-char-to-language. + (egg-next-part-lang egg-next-chinese-lang): Rename its-lang to + egg-lang. + (egg-conversion-map): Unbind C-\ and /. Bind C-X RET XXX to + its-select-XXX. + (egg-insert-bunsetsu): Make conversion text read-only. Separate + bunsetsu-info and conversion-backend. + (egg-insert-bunsetsu-list): Remove redundant variables. + (egg-beginning-of-conversion-buffer): New function. + (egg-end-of-conversion-buffer): New function. + (egg-enlarge-bunsetsu): Handle read-only text. + (egg-next-candidate): Handle read-only text. Bug on no candidate + bunsetsu is fiexed. + (egg-reconvert-bunsetsu-internal egg-reverse-convert-bunsetu + egg-reconvert-bunsetsu): New functions for reverse conversion and + re-conversion. + (egg-decide-before-point egg-abort-conversion): Handle read-only + text. Bug on pinyin and zhuyin mixed conversion is fixed. Allow + long fence. + (egg-select-candidate): Handle read-only text. Bug on no candidate + bunsetsu is fiexed. + + * egg-com.el: Change coding-system from internal to iso-2022-7bit. + + * egg-mlh.el (mlh-space-bar-backward-henkan): Disable temporally + mode selection. + + * egg.el (egg-mode): Set cureent lang to conversion backend. + (egg-set-mode-line-title): Renamed to its-set-mode-line-title + and moved to its.el. + (egg-check-language): Removed. + + * egg/sj3.el (sj3-server-port): Change from defconst to defver for + user customization. + (sj3-open sj3-get-environment): Try opening alternate servers. + (sj3-start-conversion): Make second argument LANGUAGE optional. + (egg-activate-sj3): Parameters of egg-set-conversion-backend is + changed. + + * egg/sj3rpc.el (sj3rpc-error-message): New constant (Not yet + completed). + (sj3rpc-get-error-message): Check range of errno to avoid + args-out-ou-range error. + + * egg/wnn.el (wnn-jport wnn-cport wnn-tport wnn-kport): New + variables for user customization. + (wnn-server-info-list wnn-server-port): Type of fourth element + is changed from integer to symbol. + (wnn-start-reverse-conversion): New function. + (wnn-open wnn-get-environment): Try opening alternate servers. + (egg-activate-wnn): Parameters of egg-set-conversion-backend is + changed. + + * its-keydef.el (its-current-language): Moved to its.el. + (its-make-select-func): Remove language check (egg-check-language). + Add temporally mode selection. + (its-do-list-make-select-func): Binding of zhuyin-tw is changed to + `C' because conflicting zenkaku-upcase. + + * its.el (its-current-select-func its-previous-select-func): New + variables for temporally mode selection. + (its-keydef requiring): Use eval-when to avoid error on using + compiled file. + (its-get-fence-face): New function for different face for + every language. + (its-put-cursor its-setup-fence-mode): Make fence read-only. + (its-start): Remove force-mode-line-update calling. + (its-restart): Add optional argument set-prop. + (its-self-insert-char its-backward-SYL its-forward-SYL + its-delete-SYL its-delete-backward-SYL its-exit-mode + its-delete-backward-SYL-by-keystroke its-transpose-chars + its-kick-convert-region its-end-of-input-buffer): Handle read-only + fence. + (its-state-machine): Accept special actions to handle temporally + mode selection. + (its-buffer-ins/del-SYL its-ins/del-SYL-batch): Handle read-only + fence. Property its-lang is renamed to egg-lang. + (its-get-next-state its-make-next-state): Add type check to avoid + wrong-type-argument error. + (its-keyseq-acceptable-p): Save informations of its-map to avoid + confusing on temporally mode selection. + (its-defrule-select-mode-temporally): New macro. + (its-kill-line its-cancel-input): New function. + (its-delete-backward-within-SYL): Bind its-current-language to + avoid confusing when undo is done beyond language change. + (its-yank its-yank-pop its-setup-yanked-portion): New functions. + (its-exit-mode-internal): Reset temporally selected mode. Allow + long fence. + (its-kick-convert-region-or-self-insert): New function. + (its-translate-region): Remove text properties completly. + (its-set-mode-line-title): Moved from egg.el and renamed. + (its-select-mode-temporally its-select-previous-mode): New functions + for temporally mode selection. + + * leim-list-egg.el: Secondary argument for egg-activate-sj3/wnn + is no longer needed. + + * its/hira.el: Remove the rule for "~" which destroies the rules + with its-hankaku-escape. + + * its/pinyin.el: Implement its-pinyin-cn-enable-quanjioao-alphabet + and its-pinyin-tw-enable-quanjioao-alphabet. + + * its/hangul.el: Implement its-hangul-enable-quanjioao-alphabet. + + * its/ascii.el: New file. + * its/erpin.el: New file. + * its/hankata.el: New file. + * its/jeonkak.el: New file. + * its/kata.el: New file. + * its/quanjiao.el: New file. + * its/zenkaku.el: New file. + * its/zhuyin.el: New file. + +1998-03-14 NIIBE Yutaka + + * egg/sj3rpc.el (sj3rpc-close): New function. + + * egg/sj3.el (sj3bunsetsu-[sg]et-kugiri-changed): Rename from + sj3bunsetsu-get-stdy-down. + (sj3-end-conversion): Implement CLSTDY. + (sj3-fini): Implemented. + +1998-03-10 NIIBE Yutaka + + * egg/sj3.el (sj3-end-conversion): Implement bunsetsu study. + CLSTDY not yet. + + * egg/sj3rpc.el (sj3rpc-get-bunsetsu-candidates-sub): Bug fix. + Always add hiragana and katakana candidates. + (sj3-const: CLSTDY, CLSTDY_EUC): Renamed from END and END_EUC + according to "sj3cmd.h" of SJ3 distribution. + (sj3rpc-bunsetsu-stdy, sj3rpc-kugiri-stdy): New functions. + + * egg-com.el (comm-format-u8-vector): New substitution. + (comm-format): New format 'v'. + +1998-03-09 NIIBE Yutaka + + * docomp.el (its-keydef): Require its-keydef when compile. + Not so good. Just a work around. + (its-mode-map): Undo the changes of 03-04. + +1998-03-09 KATAYAMA Yoshio + + * its.el (its-translate-region): Make it command. + (its-translate-region-internal): Make it function. + +1998-03-04 NIIBE Yutaka + + * its.el (its-define-select-keys of its-mode-map): Comment it out. + * its-keydef.el (its-make-select-func): Add eval-when to compile this. + + * egg-cnv.el (egg-decide-bunsetsu): Deleted. + * its.el (its-restart): Call its-setup-fence-mode with no argument. + + * its.el (its-keyseq-acceptable-p): Bug fix. + +1998-03-03 KATAYAMA Yoshio + + *its.el (its-get-keyseq-syl): Compensate when DSYL has back. + (its-DSYL-with-back-p): New function. Return t when DSYL has back. + (its-concrete-DSYL-p): New function. Return t when DSYL is cons + form which means input is not continued after DSYL was created. + (its-make-concrete-DSYL): New function. + (its-self-insert-char): Make DSYL to ``concrete-DSYL'' if cursor + is t which means input is not continued. + (its-input): Test input key is whether acceptable or not when + its-barf-on-invalid-keyseq is non-nil. + (its-input-to-vsyl): Set cursor status, not just returning it. + (its-state-machine its-state-machine-keyseq): Make sure to issue + ``DSYL-with-back'' when syllable is decided by the rule with back. + ``test mode'' is added. + (its-keyseq-acceptable-p): New function. + (its-forward-SYL): The args order of put-text-property was wrong. + (its-delete-backward-SYL-by-keystroke): New function. + (its-delete-backward-within-SYL): ``delete-by-keystroke'' mode + did not work when syllable is decided by the rule with back. + Deletion limit is extended to outside of SYL (meaning of + ``within-SYL'' is changed to ``deletion starts within SYL). + (its-transpose-chars): Fixed up. + (its-in-fence-p): Confuse at openning fence. + +1998-02-25 KATAYAMA Yoshio + + * its.el (its-put-cursor): Enable its-map change in fence mode. + + * its-keydef.el (its-make-select-func): Same as above. + +1998-02-25 KATAYAMA Yoshio + + * its.el (its-set-cursor-status): New function. + (its-setup-fence-mode): New function. + (its-insert-fence-open its-insert-fence-close): Deleted. + (its-start, its-restart, its-self-insert-char): Avoid fence + destruction on its-barf. + (its-input-to-vsyl, its-state-machine, its-state-machine-keyseq, + its-buffer-ins/del-SYL, its-ins/del-SYL-batch): Update cursor + status on updating syllables. + (its-input-error): New function to realize doc-string of + its-barf-on-invalid-keyseq. + + * egg.el (egg-mode): Don't use egg-mode-line-title which cause + wrong-type-argument at isearch. Bind its-select-XXX to key only + when modefull is select. + + * egg-mlh.el (mlh-hangul, mlh-zhongwen, mlh-zhongwen-tw): Same + as above. + + * its-keydef.el (its-make-select-func): Same as above. + + * leim-list-egg.el: Same as above. + +1998-02-24 KATAYAMA Yoshio + + * its.el (its-state-machine-keyseq): Remove binding + its-barf-on-invalid-keyseq to nil. + (its-ins/del-SYL-batch): Avoide altering its-XXX-map. + (its-translate-region-internal): its-translation-result's data + type is changed to string. + + * egg-cnv.el (egg-convert-region): Gather contiguous same + language part. + +1998-02-21 KATAYAMA Yoshio + + * its.el (its-ins/del-SYL-batch): Set its-lang property. + (its-translate-region): Remove its-lang property from translated + text. + (its-translate-region-internal): New function. Retain its-lang + property on translated text. + + * egg-mlh.el (mlh-space-bar-backward-henkan): Force base language + to Japanese. + + (mlh-hangul mlh-zhongwen-tw mlh-zhongwen): New functions for + conversion functions. + +1998-02-20 KATAYAMA Yoshio + + * its.el (its-restart): New function. + (its-insert-fence-open, its-insert-fence-close): New function. + (its-start): Rewritten. Use its-insert-fence-open and + its-insert-fence-close. + (its-exit-mode-internal): Leave its-syl property. + (its-exit-mode-internal): Delete the property in this case. + (its-keydef): Require it. + + * its-keydef.el: Provide the feature. + + * egg-cnv.el (egg-convert-region): Add egg-source property to save + the source string. + (egg-conversion-map, \C-c): New keybind. + (egg-get-previous-bunsetsu): Bug fix. + (egg-decide-before-point): New implementation. + (egg-exit-conversion): Use gg-decide-before-point. + (egg-abort-conversion): New command. + +1998-02-20 NIIBE Yutaka + + * Makefile (SRCS), Egg.prj: Remove euc-china.el. + * egg-com.el: Include egg-china.el. + * egg-china.el: Removed. + +1998-02-18 NIIBE Yutaka + + * Egg.prj: Use PRCS. + + * Makefile (SRCS): Rename euc-cn.el to euc-china.el + * egg-mlh.el (mlh-space-bar-backward-henkan): Put "Japanese" + language property for text. + +1998-02-18 KATAYAMA Yoshio + + * euc-china.el: Rename from euc-cn.el. Update. + + * egg.el (egg-mode): Bug fix. Call get-exit-conversion. + * leim-list-egg.el ("japanese-egg-wnn", "japanese-egg-sj3"): + Use new definition (with language argument). + * egg/wnn.el (egg-activate-wnn): + * egg/sj3.el (egg-activate-sj3): + +1998-02-17 NIIBE Yutaka + + * Makefile (SRCS): Add its/pinyin.el, its/hangul.el and + its-keydef.el. + + * egg-com.el (ccl-encode-fixed-euc-kr): Fixed the name. + +1998-02-17 KATAYAMA Yoshio + + * its-keydef.el: New file. + * its/hangul.el, its/pinyin.el: New version. + + * egg/wnnrpc.el (load-library "egg/wnn"): Comment it out. + (wnnrpc-get-error-message): Support multiple languages. + (wnnrpc-call-with-environment): Chinese support. + + * egg/wnn.el (wnn-support-languages): New const. + (): Add , , and . + (wnnenv-get-server-type, wnnenv-get-dictionary-set, + wnnenv-get-reverse-flag): New substs. + (wnnenv-get-daibunsetsu-info, wnnenv-set-daibunsetsu-info): Changed. + (wnn-server): Removed. + (wnn-jserver, wnn-cserver, wnn-tserver, wnn-kserver): New custom. + (wnn-server-info-list): New const. + (wnn-get-server-info): New function. + (wnn-server-locale, wnn-server-type, wnn-server-port, + wnn-server-stream-name, wnn-server-buffer-name, + wnn-server-coding-system, wnn-server-hostname): New substs. + (wnn-start-conversion): Add new arguments. + (wnn-uniq-candidates): Initialize 'n'. + (wnn-change-bunsetsu-length): Simplefied. + (wnn-change-bunsetsu-length): Call renbunsetsu-conversion, + instead. + (wnn-fini, wnn-comm-sentinel): back to 971009 version. + (wnn-jserver-port): Removed. + (wnn-open): Argument change. Support languages. + + (wnn-dictionary-specification): Removed. + (wnn-dictionary-specification-list): New variable. + (wnn-get-dic-spec, wnn-dic-spec-dic-set, wnn-dic-spec-reverse, + wnn-dic-spec-name, wnn-dic-spec-param, wnn-dic-spec-fuzokugo, + wnn-dic-spec-dic-list): New substs. + (wnn-get-environment): Rewrite. + (wnn-create-environment): Rewrite. + + (egg-activate-wnn): Support languages. + + * egg/sj3rpc.el (load-library "egg/sj3"): Don't load it. + + * egg/sj3.el (sj3-support-languages): New const. + (sj3-start-conversion, sj3-fini): Add lang. + (sj3-change-bunsetsu-length): Simplified. + (egg-activate-sj3): Support language. + + * its/hira.el (its/hira): Packagefy. (?) + (its-hira-map): Add language spec. Move here the escape keys + ("Z", "~"). + + * leim-list-egg.el ("chinese-gb-egg-wnn-py", "chinese-gb-egg-wnn-zy", + "chinese-cns-egg-wnn-py", "chinese-cns-egg-wnn-zy", + "korean-egg-wnn"): New input methods. + + * its.el (its-current-language): New Local Variables. + : Change the structure. Add . + (its-get-language): New substitution. + (its-set-indicator): Removed. + (its-get-indicator, its-get-start-state): New implementation. + (its-reset-start-state): Removed. + (its-buffer-ins/del-SYL): Add new properties, its-map and its-lang. + (its-exit-mode-internal): Change for its-map and its-lang. + (its-in-fence-p): New function. + + ("its-keydef.el"): Load it. + + (its-select-map-menu): Removed. + (its-select-map-from-menu): Removed. + (its-select-hiragana, its-select-katakana, its-select-downcase, + its-select-upcase, its-select-zenkaku-downcase, + its-select-zenkaku-upcase, its-select-map, its-zenkaku-escape, + its-hankaku-escape): Removed. + + (define-its-state-machine): Rewrite. + (define-its-compiled-map): New macro. + (its-define-state-machine): Removed. + + (its-forward-SYL): Cleanup. + + (its-beginning-of-input-buffer): Fix. + (its-end-of-input-buffer): Likewise. + + * egg-com.el (egg-fixed-euc, egg-mb-euc): New Local Variables. + (ccl-decode-fixed-euc-kr, ccl-encode-fixed-euc-kr): New CCLs. + (fixed-euc-kr): New coding system. + (comm-format-mb-string, comm-format-u16-string): Support EUC-KR. + (comm-unpack-u16-string, comm-unpack-mb-string): Likewise. + + * egg-cnv.el (egg-get-bunsetsu-info): New function. + (egg-conversion-backend-alist, egg-finalize-backend-alist): + New Variables. + Make egg-conversion-backend buffer local. + (egg-set-current-backend): New function. + (egg-initialize-backend): Call egg-set-current-backend. + (egg-start-conversion): Add new argument LANGUAGE. + (egg-finalize-backend): Finalize for all backend(s). + (egg-set-conversion-backend-internal): New Macro. + (egg-convert-region): Support multiple languages in the region. + (egg-separate-languages, egg-char-to-language, egg-next-part-lang, + egg-next-chinese-lang): New functions. + (egg-insert-bunsetsu-list): Change the meaning of last argument. + (egg-shrink-bunsetsu): Simplified. Just call egg-enlarge-bunsetsu. + (egg-enlarge-bunsetsu): Support shrink. + + (egg-decide-bunsetsu, egg-next-candidate, egg-select-candidate): + Use egg-get-bunsetsu-info. + + (egg-insert-bunsetsu): The property now includes + egg-conversion-backend. + + * egg.el: Don't load its/hira and don't set its-current-map. + + * egg.el (egg-default-language, egg-support-languages): New Variables. + (egg-last-method-name, egg-mode-line-title): New Local Variables. + (egg-set-mode-line-title, egg-check-language): New functions. + (egg-set-support-languages): New function. + (egg-mode): Final processing: call its-exit-mode, call + egg-exit-conversion. + Changing the arguments, remember last input method. + + Bug fix. Don't set its-hira-period and its-hira-comma. + +1998-02-17 KAWABATA, Taichi + + * menudiag.el (menudiag-mode-map): New binds for new commands. + (menudiag-beginning-of-items, menudiag-end-of-items): New commands. + (menudiag-make-menu-formatted-string): Bug fix. Use + menudiag-item-num-to-char. + (menudiag-goto-item): Rewrite. Better user interface. + (menudiag-char-to-item-num, menudiag-item-num-to-char): New + functions. + +1998-02-07 MORIOKA Tomohiko + + * leim-list-egg.el: Delete autoload setting for `egg-mode'. + Delete input method registration for "japanese-egg". + + * egg.el: Comment out setting for Wnn. + + * leim-list-egg.el: Add autoload setting for + `egg-activate-{wnn|sj3}'. + + * egg/sj3.el (egg-activate-sj3): Add DOC-string. + + * egg/sj3.el (egg-activate-sj3): New function. + Require egg. + Load egg/sj3rpc.el. + + * egg/wnn.el (egg-activate-wnn): New function. + Require egg. + Load egg/wnnrpc.el. + +1998-02-07 MORIOKA Tomohiko + + * leim-list-egg.el (japanese-egg-wnn): New input method. + (japanese-egg-sj3): New input method. + +1997-11-20 MORIOKA Tomohiko + + * leim-list-egg.el: Rename `egg-ja' -> `japanese-egg'. + +1997-11-20 MORIOKA Tomohiko + + * egg/wnn.el (wnn): New group. + (wnn-server): Use `defcustom'. + (wnn-usr-dic-dir): Use `defcustom'. + + * egg.el (egg): New group. + +1997-11-20 MORIOKA Tomohiko + + * menudiag.el (menudiag-mode-map): Swap binding for left and + right. + + * egg.el (egg-toroku-region): `wnn-get-environment' requires + dictionary-specification. + + * leim-list-egg.el: add autoload setting for egg-mode. + +1997-11-03 KATAYAMA Yoshio + + * euc-cn.el: New file. Original name was yincoding.el. + Adopted by NIIBE Yutaka . + +1997-11-03 NIIBE Yutaka + + * its.el (its-start): Add INVISIBLE property if ITS-FENCE-FACE. + * egg-cnv.el (egg-decide-before-point): Ditto. + Based on patch by Kenichi HANDA . + + Once, I thought that we need many environments which correspond to + outstanding CONVERSION buffre. However, I've learned that WNN4 + protocol is completely independent. It's no use to maintain each + environment. Share the one environment. + * egg/wnn.el (wnn-environments): Removed. + (wnn-environment): New variable. + (wnn-comm-sentinel): Follow the change. Let users know the close. + (wnn-fini): Likewise. + + : Remove the member . + (wnnenv-create): Follow the structure change. + (wnn-end-conversion): Likewise. + (wnnenv-get-in-use-flag, wnnenv-set-in-use-flag): Removed. + (wnn-find-env-not-in-use): Removed. + (wnn-get-environment): Use wnn-environment instead of wnn-environments. + Take one argument. + + * egg-cnv.el (egg-decide-before-point): Signal error on first SYL. + Reported by KATAYAMA Yoshio . Changes of 1997-09-07 + was not enough. + Set-marker M to NIL after PUT-TEXT-PROPERTY. + + Because the name of identifier begins egg-*, change the file names. + * tamago: Rename from tamago. + * egg.el, egg-mlh.el, egg-com.el, egg-cnv.el: Rename from tamago-*.el + * Makefile: Follow the changes. + +1997-10-05 NIIBE Yutaka + + * tamago/wnn.el (wnn-uniq-candidates): Add new argument BUNSETSU. + Call WNN-BUNSETSU-SET-ZENKOUHO-POS, WNN-BUNSETSU-SET-ZENKOUHO in + this function. Handle the case where BUNSETSU is not the first + element of BUNSETSU-LIST. + (wnn-list-candidates): Use new API of WNN-UNIQ-CANDIDATES. + + * tamago-cnv.el (egg-next-candidate): Handle the case where + EGG-LIST-CANDIDATES returns non zero value. + +1997-10-04 NIIBE Yutaka + + * Makefile (install): Install to SITEDIR. + +1997-09-26 NIIBE Yutaka + + * its/hira.el (its-hira-enable-zenkaku-alphabet): New variable. + (its-hira-map): Use it. + +1997-09-19 NIIBE Yutaka + + Arrange for LEIM. Use tamago/ subdirectory. + * tamago/: Rename from tamago-lib. + +1997-09-18 NIIBE Yutaka + + * tamago-cnv.el (egg-select-candidate): menu-select --> + menudiag-select. + * tamago.el (egg-toroku-region, egg-hinshi-select): Likewise. + + * tamago-cnv.el (egg-exit-conversion): Run hook of + input-method-after-insert-chunk-hook. + * its.el (its-exit-mode-internal): Ditto. + + * tamago-mlh.el (mlh-comma-period-style): Deleted. + + * its/, tamago-lib/: New directory. + * its/: Move its-*.el files here. + * tamago-lib/: Move sj3.el, sj3rpc.el, wnn.el and wnnrpc.el here. + + * tamago-com.el: Rename from comm.el. + * tamago-mlh.el: Rename from mlh.el. + * tamago-cnv.el: Rename from convert.el. + + * menudiag.el: Rename from menu.el. + (Throughout): Rename menu-* to menudiag-*. + +1997-09-07 NIIBE Yutaka + + * egg.el (egg-insert-after-hook, egg-exit-hook): Removed. + (egg-sai-henkan-start, egg-sai-henkan-end, egg-old-bunsetu-suu): + Removed. + + * wnn.el (WNN-const): New macro. + (wnn-start-conversion, wnn-open-dictionary, wnn-open-frequency, + wnn-set-dictionary-sub, wnn-update-frequency): Use it. + + * wnnrpc.el (wnn-const): New macro. + Throughout: Use wnn-const. + + * convert.el (egg-decide-before-point): Bug fix. Handle the case + where all bunsetsu are decided. + Reported by KATAYAMA Yoshio . + + * convert.el (egg-exit-conversion): Call egg-end-conversion at end. + (egg-decide-before-point): Ditto. + + * wnn.el (wnn-environments): Change the structure of enviromnents. + (wnn-fini): Handle errors. + (wnn-open): Set sentinel. Delete buffer on failure. + (wnn-comm-sentinel): New function. + (wnn-find-env-not-in-use): Return nil when not found. + + (wnn-create-environment): Take username as argument. + (wnn-get-environment): Follow the change. + + (wnnenv-create): Remove useless serial no. + (wnnenv-get-in-use-flag, wnnenv-set-in-use-flag): Follow the change. + (wnnenv-get-daibunsetsu-info, wnnenv-set-daibunsetsu-info): Likewise. + (wnn-create-environment, wnn-get-environment): Likewise. + +1997-09-04 NIIBE Yutaka + + * its.el (its-state-machine-keyseq): Bug fix. Handle VSYL. + + * sj3.el, sj3rpc.el: New files. + + * comm.el (comm-call-with-proc, comm-call-with-proc-1): New macros. + * wnnrpc.el (wnnrpc-call-with-proc, wnnrpc-call-with-proc-1): Deleted. + Throughout: Use comm-call-with-proc and comm-call-with-proc-1. + +1997-09-03 NIIBE Yutaka + + * wnnrpc.el (wnnrpc-call-with-proc-1): Bug fix. let --> progn. + + * convert.el (egg-conversion-backend): Initail value is NIL. + + * wnn.el (wnn-conversion-backend): New constant. + + * comm.el (comm-format,comm-unpack): Support multibyte string. + (comm-format-mb-string): New substitution. + (comm-unpack-mb-string): New substitution. + + * wnn.el (wnn-fini): Handle the case where wnn-environments is nil. + Reported by Hisashi Miyashita . + +1997-09-03 Hiroshi Ogata + + * mlh.el (mlh-zenkaku): Use new API of Emacs-20, + japanese-zenkaku-region. + +1997-09-02 NIIBE Yutaka + + * egg.el (egg-toroku-region): New function. + + * wnn.el (wnn-list-dictionaries): New function. + (wnnenv-get-proc): New function. + + * wnnrpc.el (wnndic-get-id, wnndic-get-comment, wnndic-get-dictname): + New substitution. + (wnnrpc-get-writable-dictionary-id-list): Rename from + wnnrpc-get-writable-dictionary-list. + +1997-09-01 NIIBE Yutaka + + * convert.el (egg-decide-bunsetsu): New function. + (egg-decide-before-point): New command. + (egg-exit-conversion): Use egg-decide-bunsetsu. + + * its.el (its-start): Divide the fence buffer into two parts and + make them intangible, so that point goes appropriate position. + (its-put-cursor): The cursor belongs to part-2. + (its-buffer-ins/del-SYL): The new SYL belongs to part-1. + (its-exit-mode-internal): Remove the property on exit. + (its-beginning-of-input-buffer): Make SYLs have property of "part 2". + (its-backward-SYL): Likewise. + (its-forward-SYL): Make SYLs have property of "part 1". + (its-end-of-input-buffer): Likewise. + + (its-input-end): Delete useless argument. + (its-beginning-of-input-buffer, its-exit-mode, + its-exit-mode-off-input-method, its-kick-convert-region, + its-end-of-input-buffer, its-backward-SYL, its-forward-SYL, + its-delete-SYL): Follow the change. + +1997-08-31 NIIBE Yutaka + + For egg-mode, don't use minor mode, override local map instead. + For its-mode and egg-conversion-mode, don't use minor mode, + instead use local-map of text property. + + Although overriding local map is not good, using local-map of + property is natural thing. Besides, point-left/point-entered + don't work as I expected (yet). + + * egg.el (egg-mode: variable): Removed. + * egg.el (egg-modefull-map, egg-modeless-map): Make them functions. + Generate overriding local map. + * egg.el (egg-mode): use overriding local map. + + * its.el, convert.el: Undo changes of 1997-08-28 for minor mode + and local map of text properties. + + * its.el (its-exit-mode-off-input-method): New function. + +1997-08-29 NIIBE Yutaka + + Let Undo work correctly. + * its.el (its-self-insert-char): Delete/Insert cursor. + + * its.el (its-put-cursor): Remove useless first argument. + (its-start, its-beginning-of-input-buffer, its-end-of-input-buffer, + its-backward-SYL, its-forward-SYL, its-delete-SYL, its-delete-SYL, + its-delete-backward-SYL-internal, its-delete-backward-within-SYL): + Follow the change. + +1997-08-28 KATAYAMA Yoshio + + * its-erpin.el: New file. + * its-pinyin.el: New file. + * its-zhuyin.el: New file. + +1997-08-28 NIIBE Yutaka + + * its.el (its-exit-mode-no-egg): Removed. + (its-exit-mode-internal): Remove first argument. + (its-kick-convert-region, its-delete-SYL, + its-delete-backward-SYL-internal, its-delete-backward-within-SYL): + Follow the change. + + Don't use local map of text properties, instead use minor mode. + * convert.el (egg-conversion-mode): New minor mode. + (egg-conversion-left, egg-conversion-enter): New functions. + (egg-insert-bunsetsu): remove local-map, add point-entered and + point-left properties. + (egg-exit-conversion): Likewise. + (egg-exit-conversion): Exit minor mode. + + * its.el (its-put-cursor): remove local-map, add point-entered and + point-left properties. + (its-enter, its-left): New functions. + (its-mode): New variable. New minor mode. + +1997-08-27 NIIBE Yutaka + + * convert.el (egg-exit-conversion-no-egg): Removed. + (egg-exit-conversion): No argument, no egg-mode. + + * convert.el (egg-convert-region): No egg-flag. + * its.el (its-exit-mode-internal): Follow it. + * mlh.el (mlh-space-bar-backward-henkan): Ditto. + +1997-08-26 NIIBE Yutaka + + * wnn.el (wnn-change-bunsetsu-length): Don't use magic #3. + + * convert.el (egg-insert-bunsetsu-list): Add optional argument + CONTIN. + +1997-08-25 NIIBE Yutaka + + * convert.el (egg-insert-bunsetsu): Include seperator. Add + intangible property to bunsetsu. + (egg-insert-bunsetsu-list): Follow the change. + (egg-backward-bunsetsu, egg-forward-bunsetsu, + egg-select-candidate, egg-next-candidate, + egg-shrink-bunsetsu, egg-enlarge-bunsetsu, + egg-exit-conversion): Ditto. + + * mlh.el (mlh-space-bar-backward-henkan): Call egg-convert-region + with last argument t. Turn of egg-mode. + +1997-08-24 NIIBE Yutaka + + * its.el (its-exit-mode-internal): Inactivate input method. + + * wnn.el (wnn-end-conversion): Change the interface. + (wnn-update-frequency): Follow the change. + * convert.el (egg-exit-conversion): Follow the change. + + * wnn.el (wnn-start-conversion): Change the return value interface. + * convert.el (egg-convert-region): Follow the change. + + * wnn.el (wnnenv-get-bunsetsu-pos, wnnenv-set-bunsetsu-pos): Removed. + (wnn-get-bunsetsu-source-afterwards): Removed. + (wnn-get-number-of-bunsetsu, wnn-get-bunsetsu-info): Removed. + (wnnenv-get-bunsetsu-list, wnnenv-set-bunsetsu-list): Removed. + (wnn-start-conversion): Don't call wnnenv-set-bunsetsu-list. + (wnn-end-conversion): Ditto. + +1997-08-23 NIIBE Yutaka + + * convert.el (egg-change-bunsetsu-length): Change the interface. + (egg-shrink-bunsetsu,egg-enlarge-bunsetsu): Follow it. + + (egg-source-maxlen-from-here): Removed. + (egg-get-previous-bunsetsu): New function. + (egg-select-candidate, egg-shrink-bunsetsu, egg-enlarge-bunsetsu, + egg-next-candidate): Use egg-get-previous-bunsetsu. + +1997-08-20 NIIBE Yutaka + + * egg.el (minor-mode-alist): Don't show " EGG" in mode line. + (egg-mode): Use input method indicator instead. + +1997-07-20 NIIBE Yutaka + + * convert.el (egg-next-candidate): Rename from egg-next-conversion. + (egg-previous-candidate): Rename from egg-previous-conversion. + (egg-select-candidate): Follow the change of new interface. + (egg-source-maxlen-from-here): Likewise. + +1997-07-19 NIIBE Yutaka + + * wnn.el (wnn-start-conversion): Change the interface. Return ENV + and the list of bunsetsu. Fix the documentation string too. + * convert.el (egg-convert-region): Follow the change. + (egg-insert-converted-result): Change the argument. + (egg-insert-bunsetsu-list): Rename from egg-insert-converted-result. + (egg-insert-bunsetsu): New function. + (egg-get-number-of-bunsetsu,egg-get-bunsetsu-info): Removed. + (egg-backward-bunsetsu): Don't use bunsetsu-pos. + + * wnn.el (wnn-get-bunsetsu-converted): Change the interface. Take + BUNSETSU as the argument instead of ENV and POS. + * convert.el (egg-get-bunsetsu-converted): Follow the change. + + * wnn.el (wnn-bunsetsu-create): Take ENV as the first argument. + (wnn-list-candidates): Dont take ENV. + (wnn-bunsetsu-get-env): New substitution. + + * wnnrpc.el (wnnrpc-receive-sho-bunsetsu-list-sub): Take the argument + for ENV, and use it for the argument of wnn-bunsetsu-create. + (wnnrpc-receive-sho-bunsetsu-list): Take ENV as the first argument. + (wnnrpc-renbunsetsu-conversion): Follow the change. + +1997-07-17 NIIBE Yutaka + + * convert.el (egg-decide-candidate): Change the interface. + Take the argument bunsetsu-info instead of conversion-engine. + + * wnn.el (wnn-get-candidate): Deleted. + + * convert.el (egg-get-all-candidates): Change the interface. + Take an argument bunsetsu-info instead of conversion-engine. + (egg-select-candidate): Follow the change. + + * convert.el (egg-set-bunsetsu-pos,egg-get-bunsetsu-pos): Deleted. + (egg-list-candidates,egg-get-current-candidate-number): New stub. + * wnn.el (wnn-bunsetsu-create): Add new member zenkouho-pos. + (wnn-bunsetsu-get-zenkouho-pos,wnn-bunsetsu-set-zenkouho-pos): New + functions. + (wnn-list-candidates,wnn-get-current-candidate-number): New functions. + (wnn-set-bunsetsu-pos,wnn-get-bunsetsu-pos): Deleted. + + * convert.el (egg-get-number-of-candidates): Change the interface. + Take an argument bunsetsu-info instead of conversion-engine. + (egg-next-conversion,egg-select-candidate): Follow the change. + * wnn.el (wnn-get-number-of-candidates): Follow the change. + + * wnn.el (wnn-get-bunsetsu-source-afterwards): New function. + (wnn-change-bunsetsu-length): Use it. + + * convert.el (egg-get-bunsetsu-source): Change the interface. + Take an argument bunsetsu-info instead of conversion-engine. + (egg-enlarge-bunsetsu,egg-shrink-bunsetsu,egg-source-maxlen-from-here): + Follow the change. + * wnn.el (wnn-get-bunsetsu-source): Follow the change. + + Put bunsetsu information on text property. + * wnn.el (wnn-get-bunsetsu-info): New function. + + * convert.el (egg-insert-converted-result): Put it on text property. + (egg-conversion-backend): Add new interface + wnn-get-bunsetsu-info. + (egg-get-bunsetsu-info): New stub. + +1997-07-17 KATAYAMA Yoshio + + * its.el (its-state-machine-keyseq, its-state-machine): Handle + end-of-input correctly when going backward. + +1997-07-16 NIIBE Yutaka + + * wnn.el (wnn-create-directory): Bug fix. Really make directory. + +1997-07-15 NIIBE Yutaka + + * its-hangul.el (its-define-hangul): Use its-defrule-otherwise. + +1997-07-15 KATAYAMA Yoshio + + * its-hangul.el: Updated. + +1997-06-19 NIIBE Yutaka + + * its-hira.el: its-hira-hankaku-escape --> its-hankaku-escape. + its-hira-zenkaku-escape --> its-zenkaku-escape. + +1997-06-14 NIIBE Yutaka + + * its.el: Change the data structure of so + that it can encourage sharing same structure and it can use same + structure of SYL. + (its-ins/del-SYL-batch): Follow the change of data structure. + (its-define-otherwise): Change the argument. + (its-defrule-otherwise): New function. + (its-eob-keyexpr, its-eob-back, its-make-class+back, + its-make-otherwise): New substitutions. + +1997-06-13 NIIBE Yutaka + + * its-kana.el: New file. Taken from its/kanainput.el of Mule-2.3. + + * its-hira.el: Use `define-its-state-machine'. + + * its.el (its-zenkaku-escape, its-hankaku-escape): Make them + defconst. + (define-its-state-machine, define-its-state-machine-append): New + macro. + +1997-06-13 NIIBE Yutaka + + * its-hira.el ("n'"): Added. + +1997-06-12 NIIBE Yutaka + + its-zenkaku-escape and its-hankaku-escape are also used in hangul. + * its.el (its-zenkaku-escape, its-hankaku-escape): Moved to here + and rename them. + * its-hira.el (its-hira-hankaku-escape, its-hira-zenkaku-escape): + Removed. + + * its.el (its-read-current-its-string): Removed. There's the + function `read-multilingual-string' already. + +1997-06-12 KATAYAMA Yoshio + + * its-hangul.el: New file. + +1997-06-10 NIIBE Yutaka + + Miscellaneous cosmetic changes. + * comm.el: New file. Move communication related funcitons from + wnnrpc.el. + (comm-format-u32c, and others): Rename from wnnrpc-*. + * wnnrpc.el (Throughout): Follow the rename. + + * wnn.el (wnnenv-get-in-use-flag): Rename from wnn-e-get-in-use. + (wnnenv-set-in-use-flag): Rename from wnn-e-set-in-use. + (Others): Rename from wnn-e-*. + (wnn-bunsetsu-*): Rename from wnnrpc-b-*, and moved from wnnrpc.el. + + * convert.el (egg-exit-conversion): Call egg-do-auto-fill. + + * its.el (its-translate-region): Bug fix. End of input. + (its-state-machine): Bug fix. Generate error if + its-barf-on-invalid-keyseq. + (its-exit-mode-internal): Call egg-do-auto-fill. + + * wnnrpc.el (ccl-decode-fixed-euc-jp): Bug fix for ASCII. + + * mlh.el (mlh-space-bar-backward-henkan): Call egg-do-auto-fill. + + * egg.el: Comment out definition of C-\ in global-map. + +1997-06-09 NIIBE Yutaka + + * its.el (its-kick-convert-region): Rename from its-convert-region. + (its-mode-map): Follow the change. + + (its-make-next-state): Use list instead of cons. + + (its-get-kst/t): Make it substitution. + (its-set-kst, its-get-keyseq, its-set-keyseq, its-kst-p, + its-get-output, its-set-output, its-get-keyseq-syl): Likewise. + (its-new-state, its-new-map, its-get-indicator, its-set-indicator, + its-get-start-state, its-reset-start-state): Likewise. + + (its-get-next-state): Use assq instead of assoc. + + (its-goto-state): Tune up. + +1997-06-08 NIIBE Yutaka + + * mlh.el: Merge mlh-nihongo.el. + * mlh-nihongo.el: Removed. + + * its-hira.el: Moved from its/hira.el. Move comments to HISTORY. + (its-hira-enable-double-n, its-hira-period, its-hira-comma, + its-hira-open-bracket, its-hira-close-bracket, + its-hira-horizontal): New variables. + Use the variables to define the state-machine. + + Implement non-interactive translation in ITS. + * its.el (its-translate-region): New function. + (its-latest-SYL): New Variable. + (its-state-machine-keyseq): Use it. + (its-update-latest-SYL): New function. + (its-buffer-ins/del-SYL): Use it. + (its-translation-result): New variable. + (its-ins/del-SYL-batch): New function. + (its-enable-double-n-syntax, its-use-kuten-for-period, + its-use-touten-for-comma, its-zenkaku-escape, its-hankaku-escape): + Removed. + + Use ITS, delete mlh's own implementation of automata. + * mlh.el (mlh-start-state, mlh-set-of-chars, mlh-start-state-sym, + mlh-set-of-chars-sym, mlh-define-automata, mlh-end-of-definition, + mlh-defrule, mlh-next-state, mlh-roma-kana-backward): Removed. + (mlh-cause-error-when-unknown-romaji-sequence): Removed. + (mlh-atoi): Removed. + (mlh-white-space, mlh-zenkaku-white): Use string-to-int. + * mlh-nihongo.el (mlh-hira-start-state, mlh-hira-chars, and all + rules of definition which defines the automaton): Removed. + (mlh-kanji-with-henkan-region-function): Use its-translate-region. + (mlh-hiragana, mlh-katakana): Likewise. + + Fix of CCL. + * wnnrpc.el (ccl-decode-fixed-euc-jp): Bug fix for jisx0212. + Add missing parens. + + Speed up of unpacking. + * wnnrpc.el (wnnrpc-following-char-or-wait): Tune up. + (wnnrpc-following+forward-char): New function. + (wnnrpc-unpack-u32c, wnnrpc-unpack-u32, wnnrpc-unpack-u16, + wnnrpc-unpack-u8): Use it. + (wnnrpc-accept-process-output): New function. + (wnnrpc-unpack-u16-string, wnnrpc-unpack-u8-string, + wnnrpc-unpack-bytes): Use it. Use search-forward. + (wnnrpc-unpack-u16-string): Use decode-coding-region. + +1997-06-07 NIIBE Yutaka + + * wnn.el (wnn-get-all-candidates): New function. + (wnn-set-bunsetsu-pos): Return 0 (instead of -1). + + * convert.el (egg-get-candidate): Removed. + (egg-get-all-candidates): New entry function. + (egg-conversion-backend): Entry for egg-get-all-candidates. + (egg-select-candidate): New function. + (egg-conversion-map): Bind "\M-s" and egg-select-candidate. + +1997-06-05 NIIBE Yutaka + + * bushu.el: Renamed from busyu.el. + (bushu-break-string, etc): Renamed from busyu*. + + * menu.el: Completely rewritten. + +1997-06-03 NIIBE Yutaka + + * its.el (its-reset-start-state): Bug fix. Delete a CDR. + + Implement "class of key" transition. + Change the structure of , the last member is + instead of . + * its.el (its-kst-p): Rename from its-ksa-p. + (its-get-next-state): Follow the change of the data structure. + (its-state-machine): Likewise. + (its-make-next-state): Likewise. + (its-set-kst): New function. + (its-get-otherwise): New function. + (its-otherwise-match): New function. + (its-define-otherwise-terminate-here): Removed. + (its-define-otherwise): New function. + (its-defrule*): Use its-define-otherwise. + + * its/hira.el (n): Use its-define-otherwise. + +1997-06-02 NIIBE Yutaka + + * wnnrpc.el (wnnrpc-receive-sho-bunsetsu-list-sub, + wnnrpc-receive-sho-bunsetsu-list-sub-2): Splited from + wnnrpc-receive-sho-bunsetsu-list. + (wnnrpc-receive-dai-bunsetsu-list): New function. + (wnnrpc-daibunsetsu-conversion, wnnrpc-get-daibunsetsu-candidate): + New function. + +1997-06-01 NIIBE Yutaka + + * wnnrpc.el (ccl-decode-fixed-euc-jp): Clean it up. + (wnnrpc-file-attribute): Rename from wnnrpc-stat-file. + (wnnrpc-get-dictionary-list-with-environment): Rename from + wnnrpc-get-dictionary-list-with-environment. + + Implement RPC more. + * wnnrpc.el (wnnrpc-who, wnnrpc-get-env-list, wnnrpc-kill, + wnnrpc-delete-dictionary, wnnrpc-set-flag-on-dictionary, + wnnrpc-get-dictionary-list, wnnrpc-delete-word, + wnnrpc-receive-word, wnnrpc-search-word, + wnnrpc-search-word-in-dictionary, wnnrpc-get-word-info, + wnnrpc-set-comment-on-word, wnnrpc-get-dictionary-info, + wnnrpc-set-file-comment, wnnrpc-hinshi-name, + wnnrpc-set-file-password, wnnrpc-set-hinshi-table): New functions. + +1997-05-31 NIIBE Yutaka + + * wnnrpc.el (wnnrpc-format-u32c, wnnrpc-unpack-u32c): New + substitutions. Support 32-bit number represented in cons cell of + a pair of 16-bit integer. + (wnnrpc-format, wnnrpc-unpack): Handle u32c (U). + + (wnnrpc-format-bytes, wnnrpc-unpack-bytes): New substitutions. + Support byte stream end with 255(-1). + (wnnrpc-format, wnnrpc-unpack): Handle bytes (B). + + (wnnrpc-local-file-loaded): New function. + (wnnrpc-call-with-proc-1): New macro. Assume the buffer is the one + of process. + +1997-05-29 NIIBE Yutaka + + * wnnrpc.el (wnnrpc-get-conversion-parameters, wnnrpc-file-loaded, + wnnrpc-write-file, wnnrpc-get-fuzokugo-file, wnnrpc-get-file-list, + wnnrpc-get-file-list-with-env, wnnrpc-stat-file, + wnnrpc-get-file-info): New functions. + wnnrpc-receive-file-list): New subst. + +1997-05-29 Kenichi Handa + + * wnnrpc.el (ccl-decode-fixed-euc-jp): Tune it up. + +1997-05-29 Hisashi Miyashita + + * wnnrpc.el (fixed-euc-jp, ccl-decode-fixed-euc-jp, + ccl-encode-fixed-euc): New private coding system. Encode/decode + CCL for it. + +1997-05-27 NIIBE Yutaka + + * wnnrpc.el (wnnrpc-tanbunsetsu-conversion): Change the argument. + (wnnrpc-get-bunsetsu-candidates): Likewise. + (wnnrpc-renbunsetsu-conversion): Likewise. + + * wnn.el (wnn-change-bunsetsu-length): Follow the change. + (wnn-set-bunsetsu-pos): Likewise. + (wnn-change-bunsetsu-length, wnn-start-conversion): Likewise. + +1997-05-25 NIIBE Yutaka + + * wnnrpc.el (wnnrpc-add-word, wnnrpc-get-dictionary-list, + wnnrpc-receive-dictionary-list, wnnrpc-get-writable-dictionary-list, + wnnrpc-get-hinshi-list, wnnrpc-hinshi-number): New functions. + (wnnrpc-unpack-u16-string): Bug fix for the case of ASCII string. + + * wnn.el (wnn-dictionary-specification): Add dictionaries of + gerodic and ones of WNN consortium. + + Implement a false path. + * wnnrpc.el (wnnrpc-renbunsetsu-conversion): Generate an error on + failure. + (wnnrpc-get-bunsetsu-candidates): Ditto. + (wnnrpc-tanbunsetsu-conversion): Ditto. + + Implement a false path. Error recovery. + * wnn.el (wnn-create-directory, wnn-open-dictionary, + wnn-open-frequency, wnn-query-del/create-frequency): New function. + (wnn-set-dictionary-sub): New function. + +1997-05-24 NIIBE Yutaka + + * wnnrpc.el (wnnrpc-version, wnnrpc-access, wnnrpc-mkdir, + wnnrpc-create-dictionary, wnnrpc-create-frequency, + wnnrpc-discard-file, wnnrpc-remove-file): New functions. + (wnnrpc-test-result-and-get-error): New subst. + + Implement a false path from wnnrpc-set-fuzokugo-file. + * wnnrpc.el (wnnrpc-set-fuzokugo-file): Return negate-encoded + error code on failure. + * wnn.el (wnn-create-environment): Generate an error message. + + Implement a false path from wnnrpc-open-file. + * wnnrpc.el (wnnrpc-open-file): Change the interface. Return + negate-encoded error code on failure. + * wnn.el (wnn-open-file): New function. + (wnn-create-environment): Handle return value, and generate + an error message for wnnrpc-set-fuzokugo-file on failure. + (wnn-set-dictionary): Handle return value. + +1997-05-17 NIIBE Yutaka + + * wnnrpc.el (wnnrpc-error-message): Error strings taken from + Wnn-4.2 distribution. + (wnnrpc-errono): Removed. + + Implement a false path from wnnrpc-open. + * wnnrpc.el (wnnrpc-open): Change the interface. Return NIL on + success, error code on failure. + * wnn.el (wnn-open): Delete process and buffer. + Generate an error on failure. + (wnn-get-environment): Follow the change (none). + (wnn-start-conversion): Follow the change (none). + * convert.el (egg-convert-region): Follow the change. Call + delete-region after egg-start-conversion. + + Implement a false path from wnnrpc-connect. + * wnnrpc.el (wnnrpc-connect): Change the interface. Return + negate-encoded error code on failure. + * wnn.el (wnn-create-environment): Generate an error on failure. + (wnn-get-environment): Follow the change. On failure, don't + register the environment to wnn-environments. + +1997-05-16 NIIBE Yutaka + + Dynamically allocate environment arbitrarily. + * wnn.el (wnn-create-environment): Change the structure of ENV. + (wnn-e-get-in-use, wnn-e-set-in-use): New subst. + (wnn-end-conversion): Call wnn-e-set-in-use. + (wnn-get-environment, wnn-find-env-not-in-use): New function. + (wnn-start-conversion): Call wnn-get-environment. + + * wnn.el (wnn-fini): Implemented. + +1997-05-15 NIIBE Yutaka + + * convert.el (egg-start-conversion): Change the interface. + (egg-convert-region): Follow the change. + (egg-open-if-not): Removed. + * wnn.el (wnn-start-conversion): Follow the change. + + * wnn.el (wnn-environment-list): Removed. + (wnn-environment-serial): Removed. + (wnn-connect-and-init): Removed. + (wnn-environments): New variable which holds all environments. + +1997-05-15 NIIBE Yutaka + + * wnn.el (wnn-change-bunsetsu-length): Bug fix. Last argument to + wnnrpc-b-set-freq-down is list of bunsetsu. + + * mlh.el (mlh-do-spacing): Emacs 20 related changes. + Use category-set-mnemonics, and char-category-set. + According to suggestion by Kenichi Handa . + +1997-05-15 MORIOKA Tomohiko + + * wnn.el (wnn-usr-dic-dir): New variable. + (wnn-filename): Use wnn-usr-dic-dir. + + * its.el (its-defrule): New argument `enable-overwrite'. + +1997-05-14 NIIBE Yutaka + + * convert.el (egg-exit-conversion-unread-char): Use newer variable + unread-command-events, as unread-command-char is obsolete. + (egg-shrink-bunsetsu, egg-source-maxlen-from-here, + egg-enlarge-bunsetsu, egg-next-conversion, egg-exit-conversion, + egg-exit-conversion, egg-insert-converted-result): New property + EGG-CONVERSION-ENGINE, which specifis backend. + + (egg-start-conversion, egg-get-number-of-bunsetsu, + egg-get-bunsetsu-converted, egg-set-bunsetsu-pos, + egg-get-bunsetsu-pos, egg-get-number-of-candidates, + egg-get-candidate, egg-decide-candidate, + egg-change-bunsetsu-length, egg-get-bunsetsu-source, + egg-end-conversion): Change the interface, new argument c. + * wnn.el (wnn-start-conversion, wnn-get-number-of-bunsetsu, + wnn-get-bunsetsu-converted, wnn-set-bunsetsu-pos, + wnn-get-bunsetsu-pos, wnn-get-number-of-candidates, + wnn-get-candidate, wnn-decide-candidate, + wnn-change-bunsetsu-length, wnn-get-bunsetsu-source, + wnn-end-conversion): Likewise. + + * convert.el (egg-open-if-not): Change the interface. Return + conversion backend. + + * wnnrpc.el (wnnrpc-following-char-or-wait, wnnrpc-unpack-u32, + wnnrpc-unpack-u16, wnnrpc-unpack-u8, wnnrpc-unpack-u16-string, + wnnrpc-unpack-u8-string): Change the interface to avoid + compilation warnings. + (wnnrpc-unpack): Use new interface. + + * wnn.el (wnn-open): Change the name of WNN buffer as debug has + been done. + +1997-05-11 NIIBE Yutaka + + * wnnrpc.el (wnnrpc-following-char-or-wait): Rename from + wnn-following-char-or-wait. + (wnnrpc-following-char-or-wait): Declare with DEFUN instead of + DEFSUBST. + +1997-05-10 NIIBE Yutaka + + * Throughout: Use JUNET coding system for file format. + + * mlh.el: Move some comments to HISTORY. + (mlh-version): Removed. + Remove all autoload entries. + (henkan-region-function): Removed. + (member): Don't need any more. + + * mlh-nihongo.el: Renamed from nihongo.el. + + * mlh.el (mlh-space-bar-backward-henkan): call egg-convert-region + directly. + (mlh-space-bar-backward-henkan): Fix for Emacs 20. + Don't call egg:do-auto-fill. + (mlh-backward-henkan): Use set-marker-insertion-type. + (mlh-do-spacing): Char-category. + + * mlh.el, nihongo.el: Taken from mlh-1.002 distribution. + +1997-05-07 NIIBE Yutaka + + * convert.el (egg-update-frequency): Removed. + (egg-conversion-backend): Remove entry for update-frequency. + + * wnn.el (wnn-dictionary-specification): Change parameters + according to suggestion by Tomoko Yoshida in mule-jp@etl.go.jp. + Original had been taken from wnn-4.2. + +1997-05-06 NIIBE Yutaka + + * convert.el (egg-next-conversion): Bug fix. It's max+ instead of n. + +1997-05-05 NIIBE Yutaka + + * wnnfns.c (Fwnn_get_bunsetsu_converted): Rename from + get-converted-bunsetsu. + (Fwnn_get_bunsetsu_source): Ditto. + * convert.el (egg-get-bunsetsu-converted): Ditto. + (egg-get-bunsetsu-source): Ditto. + + * wnn.el (wnn-create-environment): New file which mimics API of + wnnfns.c. + +1997-04-29 NIIBE Yutaka + + * wnnrpc.el: New file which implements Remote Procedure Calls of WNN. + +1997-04-16 NIIBE Yutaka + + * its/kanainput.el (normal-pair): Use its-defrule*. + + * its.el (its-defrule*): Rewritten. + + * its/hira.el ("n"): Alternative implementation using 'otherwise'. + + * its.el (its-processing-map): Removed. + (its-register-map): Rename from its-set-map. + (its-register-map): Remove first argumet NAME. + (its-defrule): Remove last optional argument END. + (its-define-otherwise-terminate-here): New function. + (its-goto-state): New function. + (its-defrule, its-defoutput): Use its-goto-state. + +1997-04-12 NIIBE Yutaka + + * its.el: Enhance meaning of ITS state machine. Now, + includes representation of "ANY of key stroke" (-2). + (its-defrule): New feature end=='otherwise. + (its-defrule*): New function. + (its-state-machine): Implement otherwise-terminate-before-this-key. + + * its/kanainput.el (its-k-zenkaku-escape, its-k-hankaku-escape, + its-k-symbols-escape): Add prefix its-. Let them defconst. + "W": Move the definition beginning to avoid error. + +1997-03-26 NIIBE Yutaka + + * convert.el (egg-next-conversion): -1 goes to end of bunsetsu. + +1997-03-25 NIIBE Yutaka + + * egg.el (egg-mode-on, egg-input-mode, egg-in-fence-mode): Deleted. + (egg-fence-face-on, egg-fence-face-off): Deleted. + (egg-region-start, egg-region-end): Deleted. + +1997-03-24 NIIBE Yutaka + + * its/hira.el ("n"): Add "z" and "?" for prefetch char of "n". + + Implement conversion mode. + * convert.el: New file. + +1997-03-23 NIIBE Yutaka + + * its.el (its-mode-map): As "\C-g" is used in global-map, use + "\C-]" instead (for its-cancel-input). + +1997-03-22 NIIBE Yutaka + + Introduce new scheme to specify server. + * wnnfns.c (Qjserver, Qcserver, Qtserver, Qkserver): Removed. + (Vwnn_server_type): Integer variable. + (wnn_get_server_type): Renamed from wnn_check_server_type. + (charset_wnn_server_type): Renamed from lc_wnn_server_type. + + Introduce new scheme to specify uniqueness. + * wnnfns.c (Qwnn_no_uniq, Qwnn_uniq, Qwnn_uniq_kanji): Removed. + (Vwnn_uniqueness_specifier): Integer variable. Renamed from + wnn_uniq_level. + +1997-03-21 NIIBE Yutaka + + Cosmetic changes. + * wnnfnc.c (Throughout): Change Lisp function name to follow the + format of wnn-VERB-OBJECT. + Use XFASTINT instead of XINT, if appropriate. + + * wnnfns.c (Fwnn_fuzokugo_set): Merged with wnn-set-fuzokugo of + wnn-egg.el. + + * wnn-egg.el (wnn-set-fuzokugo): Deleted. + + * wnnfns.c (Fwnn_dict_add): Merged with wnn-add-dict of wnn-egg.el. + * wnn-egg.el (wnn-add-dict): Deleted. + + * wnn-egg-msg.el (wnn-msg-get): Renamed from egg-msg-get. + (wnn-message-alist): Renamed from egg-message-alist. + Use defconst. + + * wnnfns.c (wnn_check_server_type): Renemed from + check_wnn_server_type. + + * wnn-egg-msg.el (egg-error): Deleted. Not useful enough. + * wnn-egg.el (Throughout): Replace egg-error by error. + + * egg.el (egg-sai-henkan-start, egg-sai-henkan-end, + egg-old-bunsetu-suu): Moved from wnn-egg.el. + + * wnn-egg.el (Throughout): Change variable name and function name. + Added wnn- prefix, egg- prefix. + * wnn-egg.el: Delete historical defaliases. Only support + wnn-set-[cjk]server-hostname. + + * wnn6.el: New file. Discriminate Wnn6 related functions. + * eggrc-wnn6: New file. Discriminate Wnn6 related setting. + + * egg-fence.el: Removed. + +1997-03-20 NIIBE Yutaka + + Distingush continuation of egg-mode and turn off of egg-mode. + * its.el (its-mode-map): Bind "\C-\\" to its-exit-mode-no-egg. + (its-exit-mode-internal): New argument egg-mode-flag. + (its-exit-mode-no-egg): New Function. + + Rethink about keymap. Once, the intention of egg-mode-map has + been to override ALL of the keymap. That's so selfish, and not + friendly to other parts of Emacs. This implementation intend to + be more friendly with other keymaps. + * its.el (its-mode-map): Remove definition of "\C-c" for + its-cancel-input, as C-c has special meaning in Emacs. We should + not re-define it. + Remove definition of "\C-q" for its-select-previous-map. + Remove definition of "\C-_" for egg-jis-code-input. + Remove definition of "\C-w", "\C-@", [?\C-\ ] for + egg-henkan-fence-region. + + Implement START/CURSOR/END scheme. + * its.el (its-input-to-vsyl): New function. + (its-beginning-of-input-buffer): New function. + (its-end-of-input-buffer): New function. + (its-backward-SYL): New function. + (its-forward-SYL): New function. + (its-delete-SYL): New function. + (its-delete-backward-SYL): New function. + (its-delete-backward-SYL-internal): New function. + (its-delete-backward-within-SYL): New function. + (its-delete-by-keystroke): New Variable. + (its-exit-mode): New function. + (its-exit-mode-internal): New function. + + * its.el (its-standard-map-list, its-find, its-next-map, + its-previous-map): Deleted. + (its-get-indicator): Delete duplicated definition. Leave one which + takes argument. + (its-input): Rename from its-input-subsubsub. + + * egg.el (egg-mode-map): Don't include SPACE. + + Introduce CURSOR. + * its.el (its-state-machine): Add new argument EMIT. Return CURSOR. + (its-state-machine-keyseq): Likewise. + (its-input-subsubsub): Return CURSOR. + (its-input-subsub): Deleted. + (its-DSYL-p): Deleted. + (its-buffer-insert-SYL-list): Deleted. + (its-buffer-ins/del-SYL): New function. + (its-input-end): Change the argument to P of point, and return VOID. + + Change structure of . is normal . + (its-new-map): Follow the change of structure. + (its-get-indicator, its-set-indicator, its-reset-start-state): + Likewise. + (its-reset-start-state): Renamed from its-reset-start. + + Don't use , but introduce new scheme of SYL property. + (its-change-t-to-nil, its-nil-index, its-bytes-between, + its-delete-between, its-move-nil--->, its-move-nil-<--, + its-move-nil-<--sub, its-move-nil-to-last, its-move-nil-to-first): + Deleted. + +1997-03-19 NIIBE Yutaka + + * its.el: Change the structure of DSYL. Same as . + (its-input-subsub): Follow the change of structure. + (its-make-DSYL): Deleted. + (its-get-keyseq-cooked): New function. + + Swap the meaning of T/NIL of . + + Delete the structure of . + (its-new-input-buffer): Deleted. + (its-input-subsub): Remove the argument SYLP. + (its-input, its-input-sub, its-init-text-properties): Deleted. + + Introduce START, END and CURSOR. + +1997-03-19 NIIBE Yutaka + + Global-map should be used, for key sequence not defined by + its-mode-map and/or egg-mode-map. Don't mask other maps. + * its.el (its-mode-esc-map): Deleted. + (its-mode-map): Include define-key of the esc-map here. + * egg.el (egg-mode-esc-map): Deleted. + (egg-mode-map): Include define-key of the esc-map here. + +1997-03-18 NIIBE Yutaka + + * its.el (its-input): Rename from its-input-input-buffer. + (its-state-machine): Handle END of input (key == -1). + + ITS minor mode deleted. It's implemented by local-map of text + properties. + (its-mode): Remove the variable. + (its-mode): Remove the function. + + * its.el (): Change the order of list. + (car sylp) is last entry of the list. + (its-input-buffer): Deleted. It's now a member of text + properties. + (): Change the structure. Start state should have "" for keyseq. + (its-get-start-state): Follow chage of the structure. + (its-reset-start, its-set-indicator, its-get-indicator): Likewise. + (its-new-state, its-new-map): Split from its-new-state/map. + (its-make-map): Deleted. + +1997-03-17 NIIBE Yutaka + + * its.el (its-buffer-insert-SYL-list): Use insert-and-inherit to + inherit properties. + (its-fence-overlay): Removed. Don't use overlay, as it has no + information in undo-list. + +1997-03-16 NIIBE Yutaka + + * its/hira.el ("n"): Use new feature END. + ("ppy", "bby", "ddy", "jjy", "zzy", "ggy", "lly", "rry", "hhy", + "cch", "tts", "tty", "ssh", "ssy", "kky"): its-defoutput. + + * its.el (its-defrule): Add argument END. + (its-buffer-delete-SYL): Bug fix. Use length instead of string-width. + +1997-03-15 NIIBE Yutaka + + * its.el (its-input-input-buffer): Implement the case of DSYL. + +1997-03-14 NIIBE Yutaka + + * its.el (its-buffer-delete-SYL): Handle the case of NIL. + + * its/hira.el: Implement "kka" and others. Implemlement "N". + (digit-characters, symbol-characters, downcase-alphabets, + upcase-alphabets): Delete useless defvar-s. + +1997-03-14 NIIBE Yutaka + + * its/hira.el ("roma-kana"): Follow change of implementation of + state machine. + + Correct the abuse of the word "MODE". It seems that it's direct + influence of "mode" in Emacs, but it's not mode at all. + * its.el (its-map-alist): Renamed from its-mode-alist. + (its-get-map): Renamed from its-get-mode-map. + (its-set-map): Renamed from its-set-mode-map. + (its-define-state-machine): Renamed from its-define-mode. + (its-select-map-menu): Renamed from its-select-mode-menu. + (its-select-map-from-menu): Renamed from its-select-mode-from-menu. + (its-standard-map-list): Renamed from its-standard-modes. + (its-next-map): Renamed from its-next-mode. + (its-previous-map): Renamed from its-previous-mode. + (its-select-map): Renamed from its-select-mode. + (its-get-indicator): Renamed from its-get-mode-indicator. + + (its-select-map-from-menu): As it's not mode, don't need offer hooks. + (its-next-map): Likewise. + (its-previous-map): Likewise. + (its-select-map): Likewise. + + Change the implementation of its-mode-alist. Name is in now. + * its.el (its-get-mode-map): Just do assoc. + (its-set-mode-map): Simplified. + + * its.el (its-get-indicator): Renamed from its-map-indicator. + (its-set-indicator): Renamed from its-map-set-indicator. + (its-get-start-state): Renamed from its-map-start. + (its-new-state): Change the argunents. + (its-map-set-start): Removed. + (its-reset-start): New function. + + Remove old implemantation of translator. + * its.el (its-resize, its-maps, its-actions, its-inputs, + its-level, its-maxlevel, its-char-from-buff, its-interactive): + Removed. + (its-make-action, its-reset-maps, its-current-map, + its-previous-map, its-level, its-enter-newlevel, its-reset-input, + its-flush-input-before-point, its-peek-char, its-read-char): + Removed. + (its-push-char, its-ordinal-charp, its-delete-charp): Removed. + (its-translate-region): Removed. + (its-buff-s, its-buff-e): Removed. + (its-state-terminalp): Removed. + + Remove selection of candidates in map, it's questionable to + implement this feature with SYL. Might rethink in future. + (its-make-menu-from-map-result, its-make-alist-from-map-result): + Removed. + (its-make-menu-from-map, its-make-menu-from-map*): Removed. + (its-make-alist-from-map, its-make-alist-from-map*): Removed. + (its-completing-read): Removed. + (its-minibuffer-local-must-match-map, + its-minibuffer-local-completion-map): Removed. + (its-minibuffer-completion-help, car-string-lessp, + its-temp-echo-area-contents): Removed. + + Implement SYL-based state machine. + * its.el (its-input-buffer, its-barf-on-invalid-keyseq): New variables. + (its-new-input-buffer): New function. + (its-self-insert-char): New command. + (its-initial-ISYL, its-make-DSYL, its-make-VSYL, + its-input-input-buffer, its-input-input-buffer-sub, + its-state-machine, its-state-machine-keyseq, + its-buffer-delete-SYL, its-buffer-insert-SYL-list, + its-get-next-state, its-get-ksa/b, its-get-keyseq, its-ksa-p, + its-get-output): New function. + (its-get-KAS): Removed. + (its-get-state, its-get-action, its-set-action): Removed. + (its-make-KAS, its-get-KAS): Removed. + + * its.el (its-defrule-sub): Merged into its-defrule. + +1997-03-13 NIIBE Yutaka + + * its.el: (its-define-mode): Change the arguments. + * its/zhuyin.el ("zhuyin"): Follow the changes of its-define-mode. + * its/zenkaku.el ("zenkaku-downcase"): Likewise. + * its/pinyin.el ("PinYin"): Likewise. + * its/kata.el ("roma-kata"): Likewise. + * its/kanainput.el ("kanainput"): Likewise. + * its/hira.el ("roma-kana"): Likewise. + * its/hankaku.el ("downcase"): Likewise. + * its/hangul.el ("hangul"): Likewise. + * its/han-kata.el ("roma-han-kata"): Likewise. + + * its.el (its-action-output, its-action-next, its-get-next-map, + its-set-next-map): Removed. + (its-make-next-state): New function. + (its-make-state): Removed. + + * its.el (its-defrule-sub): Renamed from `its-defrule**'. + + * wnnfns.h: New file. Macros for WNN6 are defined here. + * wnn6fns.c: New file. Moved from wnnfns.c for WNN6 specific + functions. + +1997-03-12 NIIBE Yutaka + + * wnnfns.c: cosmetic changes (indentation, commenting-out-style, + and compare to Qnil, etc). + Get rid of "register" qualifier. + +1997-03-05 NIIBE Yutaka + + * its.el (its-define-mode): Change internal structure. Completely + rewritten. + (its-make-map): Function to make map. + (its-make-state): New function. Make new state. + (its-make-KAS): New function. Make Key-Action-State triad. + (its-state-terminalp): New function. True when the state is + terminal. + (its-map-indicator, its-map-set-indicator,): Changed. + (its-map-terminalp, its-map-incrementalp, + its-map-set-incrementalp, its-map-alist, its-map-set-alist, + its-map-action, its-map-set-action): Removed. + + (its-defrule-verbose): Deleted. Seems debug purpose variable. + + (its-make-map): Removed . It was useless space eater. + (its-map-indicator, its-map-set-indicator, its-map-alist, + its-map-set-alist, its-map-action, its-map-set-action): Follow the + change. + (its-define-mode): Likewise. + (its-defrule**): Change the argument. Delete STATE. + (its-defrule): Likewise. + (its-map-state, its-map-set-state): Removed. + + : Changed the structure. Introduce , which + is t on hangul-map, zhuyin-map, and kanainput-map. + (its-define-mode): Change the arguments. INDICATOR and RESET is + always required. Add new argument INCREMENTALP. + * its/kanainput.el ("kanainput"): Use new API of its-define-mode. + * its/hangul.el ("hangul"): Likewise. + * its/zhuyin.el ("zhuyin"): Likewise. + * its.el (its-make-terminal-state-sofar): Removed. + (its-default-make-terminal-state): Removed. + (its-make-terminal-state): Removed + (its-make-non-terminal-state): Removed. Not used. + (its-map-incrementalp, its-map-set-incrementalp): New functions. + +1997-03-04 NIIBE Yutaka + + * its.el (its-defrule-conditional, its-defrule-conditional*): + Removed. Evaluating cond clause at runtime is stupid. Rules + should be determined at compile time, not at run time. + (its-get-action): Simplified. It's always standard. + (its-make-terminal-state-sofar): Likewise. + (its-make-action): Renamed from its-make-standard-action. + (its-standard-actionp): Removed. No use. + (its-translate-region): Simplified. + + (its-map-topmap-p): Removed. No use. + + (its-simple-actionp, its-collect-simple-action): Removed. No use. + + (its-insert-output-string, its-display-status-string): Removed. + It seemd these variables is to debug ITS itself. + (its-translate-region): Simplified. + + * its/hira.el (".", ",", "n", "nn"): Rules should be determined at + compile time. + * its/han-kata.el: Likewise. + * its/kata.el: Likewise. + + * its.el (its-make-standard-action): Simplified. + (its-make-standard-action): Remove alternative output. + (its-standard-actionp): Simplified. + (its-action-next): Simplified. + (its-select-alternative-output-menu): Removed. Not used at all. + (its-select-alternative-output): Ditto. + + * its/han-kata.el, its/zenkaku.el, its/kata.el, its/kanainput.el, + its/hira.el, its/hankaku.el: Add (require cl). + + * its.el (its-enable-double-n-syntax, its-use-kuten-for-period, + its-use-touten-for-comma, its-zenkaku-escape, its-hankaku-escape): + Declare here. Add prefix `its-'. ): + + (its-defrule, its-defrule*): Remove MAP argument. + Merged into its-defrule. + +1997-03-04 NIIBE Yutaka + + * its.el (its-completing-input-menu): Removed. Not used. + (its-completing-input): Ditto. + (its-translate-region): Remove (null action) clause. It's identical + to 't' case. + + (its-map-supers): Deleted. + (its-map-set-supers): Ditto. + (its-get-next-map-locally): Deleted. + + (its-define-mode): Remove supers. + (its-make-map): Likewise. + + (its-simulate-input): sref -> aref. add char-bytes -> +1. + (its-defrule**): Likewise. + + (its-flush-input-before-point): Delete useless save-excursion. + (its-push-char): Likewise. + (its-translate-region): Likewise. + + * its/zhuyin.el (its-make-terminal-state): + * its/kanainput.el (its-make-terminal-state): + * its/hangul.el (its-make-terminal-state): + Use its-make-terminal-state-sofar. + + * its/kanainput.el (its-make-terminal-state-kanainput): Removed. + + * its.el (its-make-terminal-state-sofar): Renamed. + (was: its-make-terminal-state-hangul) + + * its/han-kata.el (its-select-hankaku-katakana): Renamed. + (was: its:select-hankaku-katakana). + + * its.el (its-map-topmap-p, its-map-supers, its-map-set-supers, + its-map-terminalp, its-map-state, its-map-set-state, + its-map-indicator, its-map-set-indicator, its-map-action, + its-map-set-action, its-map-alist, its-map-set-alist, + its-get-action, its-action-output, its-action-next, + its-get-next-map, its-get-next-map-locally, its-set-next-map, + its-collect-simple-action, its-read-current-its-string, + its-make-map): Add prefix 'its-'. + + * its.el (its-defrule-select-mode-temporally): Deleted. + (its-select-mode-temporally): Deleted. + (its-select-previous-mode): Deleted. + + * its/hira.el ("q", "Q"): Removed. + + * its.el (its-defrule**): Don't call coerce-internal-string. + (map-state-string): Removed. + (its-default-make-standard-non-terminal-state): Don't call + map-state-string. + + * egg.el (characterp, coerce-internal-string, coerce-string): Removed. + + * its.el (its-insert-char): Deleted. + (its-internal-mode-alist): Removed. + (its-set-mode-map, its-define-mode): Remove internalp. + (its-set-mode-indicator): Removed. + + * egg-fence.el (egg-fence-self-insert-command): Add prefix 'egg-'. + + * its.el (fence-self-insert-command): Move to egg-fence.el. + + * egg-fence.el (egg-exit-fence-mode): Renamed (egg-fence-exit-mode). + (egg-enter-fence-mode-and-self-insert): Deleted. + + * egg.el (egg-quit-egg-mode): Deleted. + + * egg-misc.el (egg-fence-toggle-egg-mode): Add prefix 'egg-'. + (egg-fence-toggle-egg-mode): beep -> ding. + (global-map): bind C-\ to egg-enter-fence-mode. + +1997-03-02 NIIBE Yutaka + + * egg-henkan.el: New file. + + Use new API (egg-get-bunsetu-kanji, egg-get-bunsetu-yomi, + egg-is-dai-bunsetu, bunsetu-suu, egg-hindo-update, + egg-get-bunsetu-end). + + * wnn-egg.el: Move egg-henkan-* to egg-henkan.el. + + * wnn-egg.el (egg-startup-file-search-path): Remove current + directory. + (egg-open-wnn): Renamed from EGG-open-wnn. + (bunsetu-suu): New function. + (egg-get-bunsetu-kanji, egg-get-bunsetu-yomi): New function. + (egg-is-dai-bunsetu): New function. + (egg-hindo-update): New function. + (egg-get-bunsetu-end): New function. + + (egg-henkan-region, egg-gyaku-henkan-region, + egg-henkan-region-internal, egg-henkan-paragraph, + egg-gyaku-henkan-paragraph, egg-henkan-sentence, + egg-gyaku-henkan-sentence, egg-henkan-word, egg-gyaku-henkan-word, + egg-henkan-insert-kouho, egg-henkan-kakutei, + egg-henkan-kakutei-first-char, egg-henkan-kakutei-before-point, + egg-sai-henkan, egg-henkan-goto-bunsetu, + egg-henkan-forward-bunsetu, egg-henkan-backward-bunsetu, + egg-henkan-first-bunsetu, egg-henkan-last-bunsetu, + egg-henkan-hiragana, egg-henkan-katakana, egg-henkan-next-kouho, + egg-henkan-next-kouho-dai, egg-henkan-next-kouho-sho, + egg-henkan-previous-kouho, egg-henkan-previous-kouho-dai, + egg-henkan-previous-kouho-sho, egg-henkan-goto-kouho, + egg-henkan-bunsetu-chijime-dai, egg-henkan-bunsetu-chijime-sho, + egg-henkan-bunsetu-nobasi-dai, egg-henkan-saishou-bunsetu, + egg-henkan-saichou-bunsetu, egg-bunsetu-length-henko, + egg-henkan-quit, egg-henkan-select-kouho, + egg-henkan-select-kouho-dai, egg-henkan-select-kouho-sho, + egg-henkan-word-off, egg-henkan-kakutei-and-self-insert, + egg-henkan-mode-map, egg-henkan-mode-esc-prefix, + egg-henkan-help-command, egg-henkan-inspect-bunsetu): + Add prefix `egg-'. + + (egg-henkan-mode-in-use): Deleted. + (set-egg-henkan-mode-format): Deleted. Don't need. + + (disconnect-wnn): Let it be normal function, instead of command. + (close-wnn): Ditto. + + (set-jserver-host-name, set-kserver-host-name, + set-cserver-host-name): Use defalias. + + (close-wnn): Take an argument of wnn-server-type. + (wnn-egg-kill-emacs-function, set-wnn-host-name, + set-cwnn-host-name, set-kwnn-host-name): Likewise. + + * egg.el (egg-global-map-backup): Deleted. + (egg-local-map-backup): Deleted. + (egg-insert-after-hook): it's global variable, nod buffer-local. + + * egg-fence.el (egg-henkan-fence-region, egg-enter-fence-mode, + egg-fence-katakana, egg-fence-hiragana, egg-fence-hankaku, + egg-fence-zenkaku, egg-fence-backward-char, + egg-fence-forward-char, egg-fence-beginning-of-line, + egg-fence-end-of-line, egg-fence-transpose-chars, + egg-fence-delete-char, egg-fence-backward-delete-char, + egg-fence-kill-line, egg-fence-exit-mode, egg-fence-cancel-input, + egg-fence-mode-help-command): Add Prefix `egg-'. + + (egg-fence-mode-map): Remove binding to eval-expression (C-z). + + (egg-self-insert-non-undo-count): Removed. + (egg-self-insert-command): Removed. + + (egg-fence-backward-char, egg-fence-forward-char, + egg-fence-transpose-chars, egg-fence-delete-char, + egg-fence-backward-delete-char): beep -> ding. + wnn-egg.el (egg-henkan-select-kouho): Likewise. + +1997-02-27 NIIBE Yutaka + + * wnn-egg.el (push-end, push-end-internal): Removed. + + * its.el (dolist): Removed. It's in CL package. + (for-each, for-each*): Removed. + + * egg-keymap.el: Removed. I guess noone use it. + + * egg-jsymbol.el (*-alist): Declare by defconst. + + * egg-misc.el (toggle-egg-mode): Removed. + + * All files: Change the identifier XXX:YYYY --> XXX-YYYY, + and *YYY* ---> YYY. + + * egg-fence.el (enter-fence-mode): Use new API for marker + insertion `set-marker-insertion-type'. + * its.el (its-*buff-e*): Likewise. + + * egg-jsymbol.el: lc-jp --> (charset-id 'japanese-jisx0208) + lc-jp2 --> (charset-id 'japanese-jisx0212). + +1997-02-26 NIIBE Yutaka + + * egg-fence.el (egg:fence-mode-map): Renamed from fence-mode-map. + (egg:fence-mode-esc-prefix): Renamed from egg:fence-mode-esc-map. + (henkan-fence-region-or-single-space): Removed. + + * egg-misc.el (toggle-egg-mode): mc-flag + -> enable-multibyte-characters. + + * its.el (read-current-its-string): New function. Moved from + wnn-egg-misc.el. + (In meny functions): beep --> ding. + + * egg-misc.el (read-hiragana-string): Removed. + (read-kanji-string): Removed. + (egg:special-symbol-input): Renamed from special-symbol-input. + (egg:special-symbol-input-point): Renamed from + special-symbol-input-point. + (si:*global-map*): Remeved. + Removed 'Changes on Global map'. + (its-mode-map): Renamed from mule-keymap. + + * wnn-egg.el (henkan-region-internal): Use new API for undo. + (henkan-kakutei): Likewise. + (henkan-kakutei-first-char): Likewise. + (henkan-kakutei-before-point): Likewise. + (sai-henkan): Likewise. + * egg.el (egg:quit-egg-mode): Likewise. + + * egg-fence.el (egg:*fence-open*, egg:*fence-close*, + egg:*fence-face*): Let them be declared by defvar. + (egg:*fence-open-in-cont*, egg:*fence-close-in-cont*, + egg:*fence-face-in-cont*): Likewise. + + (set-egg-fence-mode-format): Removed. Useless. Don't need to be + interactive. + (set-egg-fence-mode-format-in-cont): Removed. + (egg:*face-alist*): Removed. + + * wnn-egg-misc.el (its:select-mode, its:select-mode-from-menu, + its:next-mode, its:previous-mode): + Removed (Merged into its.el). + + * its.el (its:select-mode, its:select-mode-from-menu, + its:next-mode, its:previous-mode): Call hook of + `its:select-mode-hook'. + + * diced.el: Removed. This depends on wnn. Functions are moved to + wnn-egg-dict.el. + + * wnn-egg-dict.el (remove-regexp-in-string): Removed. + (toroku-region): Don't call `remove-regexp-in-string'. Removing + invalid sequence (TAB?) automatically is not good idea. It should + notify user. Currently, just don't remove. + + * busyu.el (busyu-table): defconst instead of defvar. + (busyu-kaku-alist): defconst instead of defvar. + + * its.el (egg:member): Removed. Not used. + + * wnn-egg-msg.el (*egg-message-alist*): Include asking string in + register-notify and remove-notify. Should also change Korean and + Chinese. + + * egg.el: Removed "Tamago Notification System". + It is useless, as we have *Messages* buffer in GNU Emacs 19. + + * diced.el (diced-execute): Don't use `notify' but `message'. + (set-dict-comment): Likewise. + * its.el (its-defrule**): Likewise. + * wnn-egg-dict.el (egg:toroku-word): Likewise. + * wnn-egg-msg.el (egg:error): Likewise. + * wnn-egg.el (set-wnn-param): Likewise. + (EGG:open-wnn): Likewise. + (close-wnn): Likewise. + (henkan-word-off): Likewise. + (henkan-inspect-bunsetu): Likewise. + + * diced.el (diced-execute): Don't use `notify-yes-or-no-p' but use + plain `yes-or-no-p' and format. + * wnn-egg-dict.el (egg:toroku-word): Likewise. + + * egg.el (notify-yes-or-no-p-internal): IIDESUKA is not good. + it should get the message through egg:get-msg. Currently, use + "OK?". + (notify-y-or-n-p-internal): Likewise. + + * wnn-egg.el: Split into wnn-egg-dict.el, wnn-egg-misc.el, and + wnn-egg-msg.el. + (many functions): remove commented out line of + (open-wnn-if-disconnected). + + * egg.el: Split into egg.el, egg-fence.el, egg-misc.el, + jis-input.el, and modeline.el. + + * wnn-egg.el (egg-default-startup-file): change to eggrc-wnn from + eggrc. + (henkan-region-internal): Use new API for marker insertion + `set-marker-insertion-type'. + +1997-02-13 NIIBE Yutaka + + * menu.el (menu:select-from-menu): Rewritten. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9e1a711 --- /dev/null +++ b/Makefile @@ -0,0 +1,144 @@ +# Makefile --- Makefile of EGG V4.0 + +# Copyright (C) 1999, 2000 Free Software Foundation, Inc +# Author: NIIBE Yutaka +# TOMURA Satoru +# Maintaner: Satoru Tomura + +#--------------------------------------- +# (1) make +# ;; compile *.el files and make leim-list.el +# (2) make install-system +# ;; install files into ${INSDIR} and ${LEIMDIR} +# (3) make install-user +# ;; install your initialization files at your home directory +#------------------------------------------------ +# Configuration parameters +#------------------------------------------------ +# Emacs initialization file at your home directory + DOTEMACS= ${HOME}/.emacs +# egg initialization file at your home directory + STARTUP = .eggrc + EGGRC = ${HOME}/${START} +# emacs you use + EMACS = /usr/local/bin/emacs +# Egg does not depend on the emacs version (We hope...) + INSDIR = /usr/local/share/emacs/site-lisp/egg +# The directory where there is leim-list.el in it. + LEIMDIR = /usr/local/share/emacs/20.4/leim +# Programs + INSTALL = /usr/sbin/install + CP = /bin/cp + MV = /bin/mv + RM = /bin/rm + MKDIR = /usr/bin/mkdir +#------------------------------------------------ + + +DEPS = -l ./docomp.el +BATCHFLAGS = -batch -q -no-site-file + +.SUFFIXES: .el .elc + +ETCS = Makefile docomp.el eggrc leim-list-egg.el egg-dotemacs \ + AUTHORS ChangeLog README TODO PROBLEMS + +SRCS = menudiag.el its.el egg-edep.el \ + its/ascii.el \ + its/bixing.el \ + its/erpin.el \ + its/hankata.el \ + its/hira.el \ + its/jeonkak.el \ + its/pinyin.el \ + its/hangul.el \ + its/kata.el \ + its/thai.el \ + its/quanjiao.el \ + its/zenkaku.el \ + its/zhuyin.el \ + its-keydef.el \ + egg-mlh.el egg-cnv.el egg-com.el \ + egg.el \ + egg/cannarpc.el egg/canna.el \ + egg/sj3rpc.el egg/sj3.el \ + egg/wnnrpc.el egg/wnn.el + +ELCS = ${SRCS:.el=.elc} + +DIST = ${ETCS} ${SRCS} + +.el.elc: + ${EMACS} ${BATCHFLAGS} ${DEPS} -f batch-byte-compile $< + +all: ${ELCS} leim-list.el + +leim-list.el: leim-list-egg.el + @if (grep ";;; leim-list-egg.el" \ + ${LEIMDIR}/leim-list.el 2>&1) >/dev/null; then \ + echo Egg setup already exists in ${LEIMDIR}/leim-list.el; \ + cat ${LEIMDIR}/leim-list.el >leim-list.el; \ + else \ + cat ${LEIMDIR}/leim-list.el leim-list-egg.el >leim-list.el; \ + fi + +clean: + ${RM} -f ${ELCS} leim-list.el + +install: install-system + +install-system: all + if [ ! -d ${INSDIR} ]; then mkdir -p ${INSDIR}; fi + tar cf - ${SRCS} ${ELCS} | (cd ${INSDIR} && tar xvf -) + ${CP} leim-list.el ${INSDIR} + +uninstall-system: + if [ -d ${INSDIR} ]; then \ + ${RM} -rf ${INSDIR}; \ + fi + + +install-user: dotemacs ${EGGRC} + +dotemacs: egg-dotemacs + @if (grep "^;;; Emacs/Egg Configuration" \ + $(DOTEMACS) 2>&1) >/dev/null; then \ + echo Emacs/Egg setup already exists in $(DOTEMACS); \ + else \ + cat egg-dotemacs >> ${DOTEMACS} ; \ + echo "(setq egg-startup-file \"${STARTUP}\")" >>${DOTEMACS} ; \ + echo "Added Emacs/Egg setup to $(DOTEMACS)"; \ + fi + +${EGGRC}: eggrc + $(CP) eggrc ${EGGRC} + +# DEPENDENCIES +egg/sj3rpc.elc: egg-com.elc egg/sj3.elc +egg/wnnrpc.elc: egg-com.elc egg/wnn.elc + +egg.elc its/ascii.elc its/erpin.elc its/hankata.elc \ + its/hira.elc its/jeonkak.elc its/pinyin.elc \ + its/hangul.elc its/kata.elc its/quanjiao.elc \ + its/zenkaku.elc its/zhuyin.elc: its-keydef.elc + +distclean: + rm -f ${ELCS} leim-list.el *~ + +### Source code maintainance +DATE=$(shell date "+%y%m%d") + +dist: distclean + rm -rf ../egg-${DATE} + mkdir ../egg-${DATE} + tar -c -f - ${DIST} | tar Cxf ../egg-${DATE} - + (cd ../egg-${DATE}; \ + sed "/^### Source code maintainance/,\$$d" Makefile.dist; \ + mv -f Makefile.dist Makefile) + (cd ..; tar cvzf egg-${DATE}.tar.gz egg-${DATE}) + +working-ss: distclean + rm -rf ../egg-snap-${DATE} + mkdir ../egg-snap-${DATE} + tar -c -f - . | tar Cxf ../egg-snap-${DATE} - + (cd ..; tar cvzf egg-snap-${DATE}.tar.gz egg-snap-${DATE}) diff --git a/PROBLEMS b/PROBLEMS new file mode 100644 index 0000000..fc620bb --- /dev/null +++ b/PROBLEMS @@ -0,0 +1,6 @@ +* describe-bindings + +* C-k (egg-decide-before-point) + +* HIRAGANA & KATAKANA candidates + diff --git a/README b/README new file mode 100644 index 0000000..9d47a40 --- /dev/null +++ b/README @@ -0,0 +1,13 @@ + + EGG Versio 4.0 --- Code name "Tamagotchy" + + NIIBE Yutaka + +We've started this project with the code of EGG V3.0 in the beginning. +However, we chose to rewrite whole of them, while referring the design +and interface of EGG V3.0. + +In original version of EGG (to V3.0), it seems for me that there's no +copyright notice. But it has been widely distributed on the Internet +under the licence of GPL: + diff --git a/TODO b/TODO new file mode 100644 index 0000000..6e4572d --- /dev/null +++ b/TODO @@ -0,0 +1,77 @@ +backend assoc-list +toroku-region + +(1) Use customize. +(2) Implement user entries which were defined in EGG V3. +(3) Packaging +(4) Modeless Framework +(5) LEIM +(7) Portability (Implementation) + Event/Char/Integer is different. +(8) Quail Integration + +Something like egg-use-backend, its-use-package + +MENU: + Incrementally generate . + Provide programming interface of the data structure . + +MLH: + Rewrite & clean up. + +Emacs/Quail Interface: + Restrict switching language + Synchronize backend/frontend language + +ITS: + Kill, yank, delete with kill-ring in INPUT-BUFFER. + Editing within a VSYL. + transpose-chars + Use of macro/subst. + + Implement following functions. + its-cancel-input + its-mode-help-command + its-kill-line + its-hiragana (input-buffer) + its-katakana + its-hankaku + its-zenkaku + + its-read-current-its-string + + overwrite-mode, fill, vi emulator + + The way of customizing its-mode-map. + + Help-command + + muhenkan + +EGG/ITS: + Katakana input support. + Kanainput support. + Chinese/Korean support. + map change --> server select. + Consider about API + +CONVERT: + Semantics of open and close + + decide-first-char + + Consistency with other commands (delete, yank...) + + Help command + +WNN: + Support Wnn6 when it becomes Free Software. + +WNNRPC: + Chinese/Korean support. + +BUG: + convert.el + + |xxxxxxx| + ^---- when cursor comes on this fence-end. diff --git a/docomp.el b/docomp.el new file mode 100644 index 0000000..7a423c3 --- /dev/null +++ b/docomp.el @@ -0,0 +1,44 @@ +;;; docomp.el --- compile Egg files + +;; Copyright (C) 1999, 2000 Free Software Foundation, Inc + +;; Author: NIIBE Yutaka + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;;; Code: + + +(setq load-path (append (list (expand-file-name "./") ) + load-path)) + +(setq max-specpdl-size (* 10 max-specpdl-size) + max-lisp-eval-depth (* 10 max-lisp-eval-depth)) + +(load "bytecomp" t t nil) +(setq byte-compile-warnings '(obsolete redefine callargs); free-vars unresolved + byte-optimize t + ) + +(require 'cl) diff --git a/egg-cnv.el b/egg-cnv.el new file mode 100644 index 0000000..f790937 --- /dev/null +++ b/egg-cnv.el @@ -0,0 +1,1155 @@ +;;; egg-cnv.el --- Conversion Backend in Egg Input Method Architecture + +;; Copyright (C) 1999,2000 PFU LIMITED + +;; Author: NIIBE Yutaka +;; KATAYAMA Yoshio + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + + +;;; Code: + +(require 'egg-edep) + +(defgroup egg-conv nil + "Conversion backend Interface of Tamagotchy" + :group 'egg) + +(defcustom egg-conversion-wrap-select nil + "*Candidate selection wraps around to first candidate, if non-NIL. +Otherwise stop at the last candidate." + :group 'egg-conv :type 'boolean) + +(defcustom egg-conversion-auto-candidate-menu 0 + "*Automatically enter the candidate selectionmenu mode at N times +next/previous-candidate, if positive number N." + :group 'egg-conv :type 'integer) + +(defcustom egg-conversion-fence-invisible nil + "*Make fence marks invisible, if non-NIL." + :group 'egg-conv :type 'boolean) + +(defcustom egg-conversion-fence-open "|" + "*String of conversion fence start mark. (should not be null string)" + :group 'egg-conv :type '(string :valid-regexp ".+")) + +(defcustom egg-conversion-fence-close "|" + "*String of conversion fence end mark. (should not be null string)" + :group 'egg-conv :type '(string :valid-regexp ".+")) + +(defcustom egg-conversion-face nil + "*Face (or alist of languages and faces) of text in conversion fences." + :group 'egg-conv + :type '(choice face + (repeat :tag "Language-Face alist" + (cons :tag "Language-Face" + (choice :tag "Language" + (const Japanese) + (const Chinese-GB) + (const Chinese-CNS) + (const Korean) + (const :tag "Default" t) + (symbol :tag "Other")) + face)))) + +(defcustom egg-conversion-major-separator " " + "*Major clause seperator" + :group 'egg-conv :type 'string) + +(defcustom egg-conversion-minor-separator "-" + "*Minor clause seperator" + :group 'egg-conv :type 'string) + +(defcustom egg-startup-file ".eggrc" + "*Egg startup file name." + :group 'egg-conv :type 'string) + +(defcustom egg-startup-file-search-path '("~") + "*List of directories to search for egg-startup-file (default .eggrc)." + :group 'egg-conv :type '(repeat string)) + +(egg-add-message + '((nil + (no-rcfile "no egg-startup-file on %S") + (rcfile-error "error occured in egg-startup-file") + (candidate "candidates:") + (register-str "Chinese character:") + (register-yomi "word registration ``%s'' pronunciation:") + (registered "dictionary entry ``%s''(%s: %s) is registerd at %s")) + (Japanese + (no-rcfile "%S $B>e$K(B egg-startup-file $B$,$"$j$^$;$s(B") + (rcfile-error "egg-startup-file $B$G%(%i!<$,$"$j$^$7$?(B") + (candidate "$B8uJd(B:") + (register-str "$B4A;z(B:") + (register-yomi "$B<-=qEPO?!X(B%s$B!Y(B $BFI$_(B:") + (registered "$B<-=q9`L\!X(B%s$B!Y(B(%s: %s)$B$r(B %s $B$KEPO?$7$^$7$?(B")) + (Chinese-GB + (no-rcfile "$ATZ(B %S $AIOC;SP(B egg-startup-file") + (rcfile-error "$ATZ6AH!(B egg-startup-file $AJ1#,SP3v4m7"IzAK(B") + (candidate "$A:r29(B:") + (register-str "$A::WV(B:") + (register-yomi "$A4G5d5GBx@>4O4Y(B") + (rcfile-error "egg-startup-file $(C?!(B $(C?!7/0!(B $(C9_;}G_@>4O4Y(B") + (candidate "$(CHD:8(B:") + (register-str "$(CGQ@Z(B:") + (register-yomi "$(C;g@|5n7O!:(B%s$(C!;(B $(C569}(B:") + (registered "$(C;g@|GW8q!:(B%s$(C!;(B(%s: %s)$(C@;(B %s$(C?!(B $(C5n7OG_@>4O4Y(B")))) + +;; +;; ::= ( ( ( ... )... )... ) +;; ::= ( ... ) +;; ::= +;; ::= symbol +;; + +(defvar egg-conversion-backend-alist nil) +(make-variable-buffer-local 'egg-conversion-backend-alist) +(put 'egg-conversion-backend-alist 'permanent-local t) + +(defun egg-set-conversion-backend (backend-alist &optional force) + (let (pair lang backend-set) + (while backend-alist + (setq lang (caar backend-alist) + backend-set (cdar backend-alist) + backend-alist (cdr backend-alist) + pair (assq lang egg-conversion-backend-alist)) + (cond + ((null pair) + (setq egg-conversion-backend-alist + (cons (cons lang backend-set) egg-conversion-backend-alist))) + (force + (setcdr pair backend-set)))))) + +(defun egg-get-conversion-backend (language n use-default) + (let (backend) + (cond ((null n) (setq n 0)) + ((null (integerp n)) (setq n 1))) + (setq backend (nth (1+ n) (assq language egg-conversion-backend-alist))) + (if backend + (and backend (cons 0 (mapcar 'copy-sequence backend))) + (and use-default (cons 0 egg-default-conversion-backend))))) + +(defsubst egg-default-conversion-backend-p (backend) + (eq (cdr backend) egg-default-conversion-backend)) + +(defsubst egg-get-current-backend (backend) + (car (nth (car backend) (cdr backend)))) + +(defsubst egg-get-reconvert-backend (backend &optional n) + (cond ((null n) (setq n 0)) + ((null (integerp n)) (setq n 1))) + (nth (1+ n) (nth (car backend) (cdr backend)))) + +(defmacro egg-bunsetsu-info () ''intangible) + +(defsubst egg-get-bunsetsu-info (p &optional object) + (get-text-property p (egg-bunsetsu-info) object)) + +(defsubst egg-get-backend (p &optional object) + (get-text-property p 'egg-backend object)) + +(defsubst egg-get-language (p &optional object) + (get-text-property p 'egg-lang object)) + +(defsubst egg-get-bunsetsu-last (p &optional object) + (get-text-property p 'egg-bunsetsu-last object)) + +(defsubst egg-get-major-continue (p &optional object) + (get-text-property p 'egg-major-continue object)) + +(defsubst egg-get-char-size (p &optional object) + (get-text-property p 'egg-char-size object)) + +;; ::= ( . ) + +(defsubst egg-bunsetsu-create (backend info) + (cons backend info)) + +(defsubst egg-bunsetsu-get-backend (bunsetsu) + (car bunsetsu)) +(defsubst egg-bunsetsu-set-backend (bunsetsu backend) + (setcar bunsetsu backend)) + +(defsubst egg-bunsetsu-get-info (bunsetsu) + (cdr bunsetsu)) +(defsubst egg-bunsetsu-set-info (bunsetsu info) + (setcdr bunsetsu info)) + +(defvar egg-finalize-backend-list nil) + +(defun egg-set-finalize-backend (func-list) + (mapcar (lambda (func) + (if (and func + (null (memq func egg-finalize-backend-list))) + (setq egg-finalize-backend-list + (cons func egg-finalize-backend-list)))) + func-list)) + +(defmacro egg-define-backend-functions (list) + (cons 'progn + (mapcar + (lambda (def) + (let* ((func (car def)) + (args (nth 1 def)) + (backend (car args))) + (cond ((eq backend 'bunsetsu) + (setq backend `(egg-bunsetsu-get-backend ,backend))) + ((eq backend 'bunsetsu-list) + (setq backend `(egg-bunsetsu-get-backend (car ,backend))))) + `(defun ,func ,args + (let ((func (get ,backend ',func))) + (and func + (funcall func ,@args)))))) + list))) + +(egg-define-backend-functions + ((egg-start-conversion (backend source-string context)) + (egg-get-bunsetsu-source (bunsetsu)) + (egg-get-bunsetsu-converted (bunsetsu)) + (egg-get-source-language (bunsetsu)) + (egg-get-converted-language (bunsetsu)) + (egg-major-bunsetsu-continue-p (bunsetsu)) + (egg-list-candidates (bunsetsu-list prev-b next-b major)) + (egg-decide-candidate (bunsetsu-list candidate-pos prev-b next-b)) + (egg-change-bunsetsu-length (bunsetsu-list prev-b next-b length major)) + (egg-bunsetsu-combinable-p (bunsetsu next-b)) + (egg-end-conversion (bunsetsu-list abort)) + (egg-word-inspection (bunsetsu)) + (egg-word-registration (backend source converted)))) + +(defun egg-finalize-backend () + (run-hooks 'egg-finalize-backend-list)) + +(setplist 'egg-conversion-backend-noconv + '(egg-start-conversion egg-start-conversion-noconv + egg-get-bunsetsu-source egg-get-bunsetsu-source-noconv + egg-get-bunsetsu-converted egg-get-bunsetsu-converted-noconv + egg-get-source-language egg-get-source-language-noconv + egg-get-converted-language egg-get-converted-language-noconv + egg-end-conversion egg-end-conversion-noconv)) + +(defun egg-start-conversion-noconv (backend yomi-string context) + (let ((string (copy-sequence yomi-string)) + (language (egg-get-language 0 yomi-string))) + (set-text-properties 0 (length string) nil string) + (list (egg-bunsetsu-create backend (vector string language))))) + +(defun egg-get-bunsetsu-source-noconv (bunsetsu) + (aref (egg-bunsetsu-get-info bunsetsu) 0)) +(defun egg-get-bunsetsu-converted-noconv (bunsetsu) + (aref (egg-bunsetsu-get-info bunsetsu) 0)) +(defun egg-get-source-language-noconv (bunsetsu) + (aref (egg-bunsetsu-get-info bunsetsu) 1)) +(defun egg-get-converted-language-noconv (bunsetsu) + (aref (egg-bunsetsu-get-info bunsetsu) 1)) +(defun egg-end-conversion-noconv (bunsetsu-list abort) + nil) + +(defconst egg-default-conversion-backend '((egg-conversion-backend-noconv))) + +(defun egg-convert-region (start end &optional context nth-backend) + (interactive "r\ni\nP") + (let ((source (buffer-substring start end)) + backend backend-source-list converted converted-list + lang len s success abort) + (if (>= start end) + ;; nothing to do + nil + (delete-region start end) + (let ((inhibit-read-only t)) + (its-define-select-keys egg-conversion-map) + (goto-char start) + (setq s (copy-sequence egg-conversion-fence-open) + len (length s) + start (+ start len) + end (+ end len)) + (set-text-properties 0 len (list 'read-only t + 'egg-start t + 'egg-source source) + s) + (if context + (put-text-property 0 len 'egg-context context s)) + (if egg-conversion-fence-invisible + (put-text-property 0 len 'invisible t s)) + (insert s) + (setq s (copy-sequence egg-conversion-fence-close) + len (length s)) + (set-text-properties 0 len '(read-only t rear-nonsticky t egg-end t) s) + (if egg-conversion-fence-invisible + (put-text-property 0 len 'invisible t s)) + (insert s) + (goto-char start) + (insert source) + (goto-char start) + (setq source (copy-sequence source)) + (egg-separate-languages source) + (setq backend-source-list (egg-assign-backend source nth-backend)) + (while (and (null abort) backend-source-list) + (setq backend (car (car backend-source-list)) + lang (nth 1 (car backend-source-list)) + source (nth 2 (car backend-source-list)) + backend-source-list (cdr backend-source-list)) + (condition-case error + (progn + (setq converted (egg-start-conversion + (egg-get-current-backend backend) + source context)) + (if (null converted) + (egg-error "no conversion result")) + (setq converted-list (nconc converted-list + (list (cons backend converted))) + context 'continued) + (or (egg-default-conversion-backend-p backend) + (setq success t))) + ((egg-error quit) + (cond + ((null (or success + (delq t (mapcar (lambda (s) + (egg-default-conversion-backend-p + (cdr (car s)))) + backend-source-list)))) + (message "egg %s backend: %s" + (if (cdr lang) lang (car lang)) + (nth (if (eq (car error) 'quit) 0 1) error)) + (ding) + (setq abort t)) + ((condition-case err + (y-or-n-p + (format "egg %s backend %s: continue? " + lang (nth (if (eq (car error) 'quit) 0 1) error))) + ((error quit) nil)) + (setq backend (egg-get-conversion-backend nil 0 t) + converted (egg-start-conversion + (egg-get-current-backend backend) + source context) + converted-list (nconc converted-list + (list (cons backend converted))) + context 'continued)) + (t + (setq abort t)))))) + (delete-region start end) + (while converted-list + (egg-insert-bunsetsu-list (caar converted-list) (cdar converted-list) + (or (null (cdr converted-list)) 'continue)) + (setq converted-list (cdr converted-list))) + (goto-char start) + (cond (abort + (egg-abort-conversion)) + ((null success) + (egg-exit-conversion))))))) + +(defun egg-separate-languages (str &optional last-lang) + (let (lang last-chinese + (len (length str)) i j l) + ;; 1st pass -- mark undefined Chinese part + (if (or (eq last-lang 'Chinese-GB) (eq last-lang 'Chinese-CNS)) + (setq last-chinese last-lang)) + (setq i 0) + (while (< i len) + (setq j (egg-next-single-property-change i 'egg-lang str len)) + (if (null (egg-get-language i str)) + (progn + (setq c (egg-string-to-char-at str i) + cset (char-charset c)) + (cond + ((eq cset 'chinese-sisheng) + (egg-string-match-charset 'chinese-sisheng str i) + (setq l (match-end 0) + j (min j l) + lang 'Chinese)) + ((setq l (egg-chinese-syllable str i)) + (setq j (+ i l) + lang 'Chinese)) + ((eq cset 'ascii) + (if (eq (string-match "[\0-\177\240-\377]+" str (1+ i)) (1+ i)) + (setq j (match-end 0)) + (setq j (1+ i))) + (if (and (< j len) + (eq (char-charset (egg-string-to-char-at str j)) + 'chinese-sisheng)) + (setq j (max (1+ i) (- j 6)))) + (setq lang nil)) + ((eq cset 'composition) + (setq j (+ i (egg-char-bytes c)) + lang (egg-charset-to-language + (char-charset + (car (decompose-composite-char c 'list)))))) + (t + (egg-string-match-charset cset str i) + (setq j (match-end 0) + lang (egg-charset-to-language cset)))) + (if lang + (put-text-property i j 'egg-lang lang str)))) + (setq i j)) + ;; 2nd pass -- set language property + (setq i 0) + (while (< i len) + (setq lang (egg-get-language i str)) + (cond + ((null lang) + (setq lang (or last-lang + (egg-next-part-lang str i)))) + ((equal lang 'Chinese) + (setq lang (or last-chinese + (egg-next-chinese-lang str i))))) + (setq last-lang lang) + (if (or (eq lang 'Chinese-GB) (eq lang 'Chinese-CNS)) + (setq last-chinese lang)) + (setq j i + i (egg-next-single-property-change i 'egg-lang str len)) + (set-text-properties j i (list 'egg-lang lang) str)))) + +;;; Should think again the interface to language-info-alist +(defun egg-charset-to-language (charset) + (let ((list language-info-alist)) + (while (and list + (null (memq charset (assq 'charset (car list))))) + (setq list (cdr list))) + (if list + (intern (car (car list)))))) + +(defun egg-next-part-lang (str pos) + (let ((lang (get-text-property + (egg-next-single-property-change pos 'egg-lang str (length str)) + 'egg-lang str))) + (if (eq lang 'Chinese) + (egg-next-chinese-lang str pos) + (or lang + its-current-language + egg-default-language)))) + +(defun egg-next-chinese-lang (str pos) + (let ((len (length str)) lang) + (while (and (< pos len) (null lang)) + (setq pos (egg-next-single-property-change pos 'egg-lang str len) + lang (egg-get-language pos str)) + (if (null (or (eq lang 'Chinese-GB) + (eq lang 'Chinese-CNS))) + (setq lang nil))) + (cond + (lang lang) + ((eq its-current-language 'Chinese-GB) 'Chinese-GB) + ((eq its-current-language 'Chinese-CNS) 'Chinese-CNS) + ((eq egg-default-language 'Chinese-GB) 'Chinese-GB) + ((eq egg-default-language 'Chinese-CNS) 'Chinese-CNS) + (t 'Chinese-GB)))) + +;; +;; return value ::= ( ( ( ... ) )... ) +;; +(defun egg-assign-backend (source n) + (let ((len (length source)) + (i 0) + j s lang backend retval) + (while (< i len) + (setq j (egg-next-single-property-change i 'egg-lang source len) + s (substring source i j) + lang (egg-get-language 0 s) + backend (egg-get-conversion-backend lang n t)) + (set-text-properties 0 (- j i) (list 'egg-lang lang) s) + (setq retval (nconc retval (list (list backend (list lang) s))) + i j)) + (prog1 + retval + (while retval + (if (or (egg-default-conversion-backend-p (car (car retval))) + (null (equal (car (car retval)) (car (nth 1 retval))))) + (setq retval (cdr retval)) + (nconc (nth 1 (car retval)) (nth 1 (nth 1 retval))) + (setcar (nthcdr 2 (car retval)) + (concat (nth 2 (car retval)) (nth 2 (nth 1 retval)))) + (setcdr retval (cddr retval))))))) + +(defun egg-search-file (filename path) + (let (file) + (if (file-name-directory filename) + (setq file (substitute-in-file-name (expand-file-name filename)) + file (and (file-readable-p file) file)) + (while (and (null file) path) + (if (stringp (car path)) + (setq file (substitute-in-file-name + (expand-file-name filename (car path))) + file (and (file-exists-p file) file))) + (setq path (cdr path))) + file))) + +(defvar egg-default-startup-file "eggrc" + "Egg startup file name (system default)") + +(defun egg-load-startup-file (backend lang) + (let ((eggrc (or (egg-search-file egg-startup-file + egg-startup-file-search-path) + (egg-search-file egg-default-startup-file load-path)))) + (if eggrc + (condition-case error + (let ((egg-backend-type backend) (egg-language lang)) + (load-file eggrc)) + (error + (message "%s: %s" (car error) + (mapconcat (lambda (s) (format "%S" s)) (cdr error) ", ")) + (egg-error 'rcfile-error)) + (quit + (egg-error 'rcfile-error))) + (egg-error 'no-rcfile egg-startup-file-search-path)))) + +(defun egg-get-conversion-face (lang) + (if (null (consp egg-conversion-face)) + egg-conversion-face + (cdr (or (assq lang egg-conversion-face) + (assq t egg-conversion-face))))) + +(defvar egg-conversion-map + (let ((map (make-sparse-keymap)) + (i 33)) + (while (< i 127) + (define-key map (vector i) 'egg-exit-conversion-unread-char) + (setq i (1+ i))) + (define-key map "\C-@" 'egg-decide-first-char) + (define-key map [?\C-\ ] 'egg-decide-first-char) + (define-key map "\C-a" 'egg-beginning-of-conversion-buffer) + (define-key map "\C-b" 'egg-backward-bunsetsu) + (define-key map "\C-c" 'egg-abort-conversion) + (define-key map "\C-e" 'egg-end-of-conversion-buffer) + (define-key map "\C-f" 'egg-forward-bunsetsu) + (define-key map "\C-h" 'egg-help-command) + (define-key map "\C-i" 'egg-shrink-bunsetsu-major) + (define-key map "\C-k" 'egg-decide-before-point) +;; (define-key map "\C-l" 'egg-exit-conversion) ; Don't override C-L + (define-key map "\C-m" 'egg-exit-conversion) + (define-key map "\C-n" 'egg-next-candidate-major) + (define-key map "\C-o" 'egg-enlarge-bunsetsu-major) + (define-key map "\C-p" 'egg-previous-candidate-major) + (define-key map "\C-r" 'egg-reconvert-bunsetsu) + (define-key map "\C-t" 'egg-toroku-bunsetsu) + (define-key map "\C-v" 'egg-inspect-bunsetsu) + (define-key map "\M-i" 'egg-shrink-bunsetsu-minor) + (define-key map "\M-n" 'egg-next-candidate-minor) + (define-key map "\M-o" 'egg-enlarge-bunsetsu-minor) + (define-key map "\M-p" 'egg-previous-candidate-minor) + (define-key map "\M-r" 'egg-reconvert-bunsetsu-from-source) + (define-key map "\M-s" 'egg-select-candidate-major) + (define-key map "\M-v" 'egg-toggle-inspect-mode) + (define-key map "\M-z" 'egg-select-candidate-minor) + (define-key map "\e\C-s" 'egg-select-candidate-list-all-major) + (define-key map "\e\C-z" 'egg-select-candidate-list-all-minor) + (define-key map [return] 'egg-exit-conversion) + (define-key map [right] 'egg-forward-bunsetsu) + (define-key map [left] 'egg-backward-bunsetsu) + (define-key map " " 'egg-next-candidate) + (define-key map "/" 'egg-exit-conversion) + map) + "Keymap for EGG Conversion mode.") + +(fset 'egg-conversion-map egg-conversion-map) + +(defun egg-exit-conversion-unread-char () + (interactive) + (setq unread-command-events (list last-command-event) + this-command 'egg-use-context) + (setq egg-context (egg-exit-conversion))) + +(defun egg-make-bunsetsu (backend bunsetsu last) + (let* ((converted (copy-sequence (egg-get-bunsetsu-converted bunsetsu))) + (language (egg-get-converted-language bunsetsu)) + (continue (and (null last) (egg-major-bunsetsu-continue-p bunsetsu))) + (face (egg-get-conversion-face language)) + len len1) + (setq len1 (length converted)) + (or (eq last t) + (setq converted (concat converted + (if continue + egg-conversion-minor-separator + egg-conversion-major-separator)))) + (setq len (length converted)) + (set-text-properties 0 len + (list 'read-only t + (egg-bunsetsu-info) bunsetsu + 'egg-backend backend + 'egg-lang language + 'egg-bunsetsu-last last + 'egg-major-continue continue + 'local-map 'egg-conversion-map) + converted) + (if face + (egg-set-face 0 len1 face converted)) + converted)) + +(defun egg-insert-bunsetsu-list (backend bunsetsu-list &optional last) + (let ((len (length bunsetsu-list))) + (insert + (mapconcat + (lambda (b) + (setq len (1- len)) + (egg-make-bunsetsu backend b (and (= len 0) last))) + bunsetsu-list "")))) + +(defun egg-beginning-of-conversion-buffer (n) + (interactive "p") + (cond + ((<= n 0) + (egg-end-of-conversion-buffer 1)) + ((null (get-text-property (1- (point)) 'egg-start)) + (goto-char (previous-single-property-change (point) 'egg-start))))) + +(defun egg-end-of-conversion-buffer(n) + (interactive "p") + (cond + ((<= n 0) + (egg-beginning-of-conversion-buffer 1)) + (t + (goto-char (next-single-property-change (point) 'egg-end)) + (backward-char)))) + +(defun egg-backward-bunsetsu (n) + (interactive "p") + (while (and (> n 0) + (null (get-text-property (1- (point)) 'egg-start))) + (backward-char) + (setq n (1- n))) + (if (> n 0) + (signal 'beginning-of-buffer nil))) + +(defun egg-forward-bunsetsu (n) + (interactive "p") + (while (and (>= n 0) + (null (get-text-property (point) 'egg-end))) + (forward-char) + (setq n (1- n))) + (backward-char) + (if (>= n 0) + (signal 'end-of-buffer nil))) + +(defun egg-get-bunsetsu-tail (b) + (nth (1- (length b)) b)) + +(defun egg-previous-bunsetsu-point (p &optional n obj lim) + (or n (setq n 1)) + (while (> n 0) + (setq p (previous-single-property-change p (egg-bunsetsu-info) obj lim) + n (1- n))) + p) + +(defun egg-next-bunsetsu-point (p &optional n obj lim) + (or n (setq n 1)) + (while (> n 0) + (setq p (egg-next-single-property-change p (egg-bunsetsu-info) obj lim) + n (1- n))) + p) + +(defun egg-get-previous-bunsetsu (p) + (and (null (egg-get-bunsetsu-last (1- p))) + (egg-get-bunsetsu-info (1- p)))) + +(defun egg-get-previous-major-bunsetsu (p) + (let ((p (point)) + (prev (egg-get-previous-bunsetsu p)) + bunsetsu) + (while prev + (setq bunsetsu (cons prev bunsetsu) + p (egg-previous-bunsetsu-point p) + prev (and (egg-get-major-continue (1- p)) + (egg-get-bunsetsu-info (1- p))))) + bunsetsu)) + +(defun egg-get-next-bunsetsu (p) + (and (null (egg-get-bunsetsu-last p)) + (egg-get-bunsetsu-info (egg-next-bunsetsu-point p)))) + +(defun egg-get-major-bunsetsu (p) + (let ((next (egg-get-bunsetsu-info p)) + bunsetsu) + (while next + (setq bunsetsu (cons next bunsetsu) + p (egg-next-bunsetsu-point p) + next (and (egg-get-major-continue (1- p)) + (egg-get-bunsetsu-info p)))) + (nreverse bunsetsu))) + +(defsubst egg-get-major-bunsetsu-source (list) + (mapconcat (lambda (b) (egg-get-bunsetsu-source b)) list "")) + +(defvar egg-inspect-mode nil + "*Display clause information on candidate selection, if non-NIL.") + +(defun egg-toggle-inspect-mode () + (interactive) + (if (setq egg-inspect-mode (not egg-inspect-mode)) + (egg-inspect-bunsetsu t))) + +(defun egg-inspect-bunsetsu (&optional quiet) + (interactive) + (or (egg-word-inspection (egg-get-bunsetsu-info (point))) + quiet + (beep))) + +(defvar egg-candidate-selection-info nil) +(make-variable-buffer-local 'egg-candidate-selection-info) + +(defvar egg-candidate-selection-major t) +(make-variable-buffer-local 'egg-candidate-selection-major) + +(defsubst egg-set-candsel-info (b prev-b next-b major) + (setq egg-candidate-selection-info (list b prev-b next-b major))) + +(defsubst egg-candsel-last-bunsetsu () (car egg-candidate-selection-info)) +(defsubst egg-candsel-last-prev-b () (nth 1 egg-candidate-selection-info)) +(defsubst egg-candsel-last-next-b () (nth 2 egg-candidate-selection-info)) +(defsubst egg-candsel-last-major () (nth 3 egg-candidate-selection-info)) + +(defun egg-major-bunsetsu-head-p (head bunsetsu) + (while (and head (eq (car head) (car bunsetsu))) + (setq head (cdr head) + bunsetsu (cdr bunsetsu))) + (null head)) + +(defun egg-major-bunsetsu-tail-p (tail bunsetsu) + (egg-major-bunsetsu-head-p + tail (nthcdr (- (length bunsetsu) (length tail)) bunsetsu))) + +(defun egg-get-candsel-target-major () + (let ((bunsetsu (egg-get-major-bunsetsu (point))) + next-b prev-b next) + (setq prev-b (egg-get-previous-major-bunsetsu (point)) + next (egg-next-bunsetsu-point (point) (length bunsetsu))) + (cond + ((and (egg-candsel-last-major) + (egg-major-bunsetsu-tail-p (egg-candsel-last-prev-b) prev-b) + (egg-major-bunsetsu-head-p (append (egg-candsel-last-bunsetsu) + (egg-candsel-last-next-b)) + bunsetsu)) + (setq bunsetsu (egg-candsel-last-bunsetsu) + prev-b (egg-candsel-last-prev-b) + next-b (egg-candsel-last-next-b)) + (setq next (egg-next-bunsetsu-point (point) (length bunsetsu)))) + ((null (egg-get-bunsetsu-last (1- next))) + (setq next-b (egg-get-major-bunsetsu next)))) + (setq egg-candidate-selection-major t) + (list bunsetsu prev-b next-b next t))) + +(defun egg-get-candsel-target-minor () + (let* ((bunsetsu (list (egg-get-bunsetsu-info (point)))) + (prev-b (egg-get-previous-bunsetsu (point))) + (next-b (egg-get-next-bunsetsu (point)))) + (and prev-b (setq prev-b (list prev-b))) + (and next-b (setq next-b (list next-b))) + (setq egg-candidate-selection-major nil) + (list bunsetsu prev-b next-b (egg-next-bunsetsu-point (point)) nil))) + +(defun egg-insert-new-bunsetsu (b prev-b next-b next end) + (let ((backend (egg-get-backend (point))) + start last) + (setq start (egg-previous-bunsetsu-point (point) (length prev-b))) + (setq end (or end (egg-next-bunsetsu-point next (length next-b)))) + (setq last (egg-get-bunsetsu-last (1- end))) + (delete-region start end) + (egg-insert-bunsetsu-list backend (append prev-b (append b next-b)) last) + (goto-char (egg-next-bunsetsu-point start (length prev-b))) + (if egg-inspect-mode + (egg-inspect-bunsetsu t)))) + +(defun egg-next-candidate (n) + (interactive "p") + (if egg-candidate-selection-major + (egg-next-candidate-major n) + (egg-next-candidate-minor n))) + +(defun egg-next-candidate-major (n) + (interactive "p") + (apply 'egg-next-candidate-internal n (egg-get-candsel-target-major))) + +(defun egg-next-candidate-minor (n) + (interactive "p") + (apply 'egg-next-candidate-internal n (egg-get-candsel-target-minor))) + +(defun egg-previous-candidate (n) + (interactive "p") + (if egg-candidate-selection-major + (egg-previous-candidate-major n) + (egg-previous-candidate-minor n))) + +(defun egg-previous-candidate-major (n) + (interactive "p") + (apply 'egg-next-candidate-internal (- n) (egg-get-candsel-target-major))) + +(defun egg-previous-candidate-minor (n) + (interactive "p") + (apply 'egg-next-candidate-internal (- n) (egg-get-candsel-target-minor))) + +(defvar egg-candidate-select-counter 1) + +(defun egg-next-candidate-internal (n b prev-b next-b next major) + (if (eq last-command (if major 'egg-candidate-major 'egg-candidate-minor)) + (setq egg-candidate-select-counter (1+ egg-candidate-select-counter)) + (setq egg-candidate-select-counter 1)) + (if (= egg-candidate-select-counter egg-conversion-auto-candidate-menu) + (egg-select-candidate-internal nil b prev-b next-b next major) + (setq this-command (if major 'egg-candidate-major 'egg-candidate-minor)) + (let ((inhibit-read-only t) + candidates nitem i beep) + (setq candidates (egg-list-candidates b prev-b next-b major)) + (if (null candidates) + (setq beep t) + (setq i (+ n (car candidates)) + nitem (length (cdr candidates))) + (cond + ((< i 0) ; go backward as if it is ring + (while (< i 0) + (setq i (+ i nitem)))) + ((< i nitem)) ; OK + (egg-conversion-wrap-select ; go backward as if it is ring + (while (>= i nitem) + (setq i (- i nitem)))) + (t ; don't go forward + (setq i (1- nitem) + beep t))) + (setq b (egg-decide-candidate b i prev-b next-b) + prev-b (nth 1 b) + next-b (nth 2 b) + b (car b)) + (egg-set-candsel-info b prev-b next-b major) + (egg-insert-new-bunsetsu b prev-b next-b next nil)) + (if beep + (ding))))) + +(defun egg-numbering-item (list) + (let ((n -1)) + (mapcar (lambda (item) (cons item (setq n (1+ n)))) list))) + +(defun egg-select-candidate-major () + (interactive) + (apply 'egg-select-candidate-internal nil (egg-get-candsel-target-major))) + +(defun egg-select-candidate-minor () + (interactive) + (apply 'egg-select-candidate-internal nil (egg-get-candsel-target-minor))) + +(defun egg-select-candidate-list-all-major () + (interactive) + (apply 'egg-select-candidate-internal t (egg-get-candsel-target-major))) + +(defun egg-select-candidate-list-all-minor () + (interactive) + (apply 'egg-select-candidate-internal t (egg-get-candsel-target-minor))) + +(defun egg-select-candidate-internal (all b prev-b next-b next major) + (let ((inhibit-read-only t) + (prompt (egg-get-message 'candidate)) + candidates item-list new i) + (setq candidates (egg-list-candidates b prev-b next-b major)) + (if (null candidates) + (ding) + (setq all (and all '(menudiag-list-all)) + item-list (egg-numbering-item (cdr candidates)) + i (menudiag-select (list 'menu prompt item-list) + (cons (nth (car candidates) item-list) all)) + new (egg-decide-candidate b i prev-b next-b) + prev-b (nth 1 new) + next-b (nth 2 new) + new (car new)) + (egg-set-candsel-info new prev-b next-b major) + (egg-insert-new-bunsetsu new prev-b next-b next nil)))) + +(defun egg-separate-characters (str) + (let* ((v (egg-string-to-vector str)) + (len (length v)) + (i 0) (j 0) m n (nchar 0)) + (while (< i len) + (if (setq n (egg-chinese-syllable str j)) + (setq m (egg-chars-in-period str j n)) + (setq m 1 n (egg-char-bytes (aref v i)))) + (put-text-property j (+ j n) 'egg-char-size n str) + (setq nchar (1+ nchar) i (+ i m) j (+ j n))) + nchar)) + +(defun egg-enlarge-bunsetsu-major (n) + (interactive "p") + (egg-enlarge-bunsetsu-internal n t)) + +(defun egg-enlarge-bunsetsu-minor (n) + (interactive "p") + (egg-enlarge-bunsetsu-internal n nil)) + +(defun egg-shrink-bunsetsu-major (n) + (interactive "p") + (egg-enlarge-bunsetsu-internal (- n) t)) + +(defun egg-shrink-bunsetsu-minor (n) + (interactive "p") + (egg-enlarge-bunsetsu-internal (- n) nil)) + +(defun egg-enlarge-bunsetsu-internal (n major) + (let ((inhibit-read-only t) + b prev-b next-b s1 s1len s2 s2len nchar i last next end beep) + (if major + (setq b (egg-get-major-bunsetsu (point)) + prev-b (egg-get-previous-major-bunsetsu (point))) + (setq b (list (egg-get-bunsetsu-info (point))) + prev-b (egg-get-previous-bunsetsu (point)) + prev-b (and prev-b (list prev-b)))) + (setq end (egg-next-bunsetsu-point (point) (length b)) + last (egg-get-bunsetsu-last (1- end))) + (while (null last) + (setq next-b (cons (egg-get-bunsetsu-info end) next-b) + last (egg-get-bunsetsu-last end) + end (egg-next-bunsetsu-point end))) + (setq next-b (nreverse next-b) + s1 (egg-get-major-bunsetsu-source b) + s2 (concat s1 (egg-get-major-bunsetsu-source next-b)) + s1len (egg-separate-characters s1) + s2len (egg-separate-characters s2) + n (+ n s1len)) + (cond + ((<= n 0) + (setq beep t nchar (and (/= s1len 1) (egg-get-char-size 0 s1)))) + ((> n s2len) + (setq beep t nchar (and (/= s2len 0) (length s2)))) + (t + (setq nchar 0) + (while (> n 0) + (setq nchar (+ nchar (egg-get-char-size nchar s2)) + n (1- n))))) + (if nchar + (progn + (setq next-b (nconc b next-b) + i (length (egg-get-bunsetsu-source (car next-b)))) + (while (< i nchar) + (setq next-b (cdr next-b) + i (+ i (length (egg-get-bunsetsu-source (car next-b)))))) + (setq next-b (prog1 (cdr next-b) (setcdr next-b nil)) + next (egg-next-bunsetsu-point (point) (length b)) + b (egg-change-bunsetsu-length b prev-b next-b nchar major)) + (if (null b) + (setq beep t) + (setq prev-b (nth 1 b) + next-b (nth 2 b) + b (car b)) + (egg-insert-new-bunsetsu b prev-b next-b next (and next-b end))))) + (if beep + (ding)))) + +(defun egg-reconvert-bunsetsu (n) + (interactive "P") + (egg-reconvert-bunsetsu-internal n 'egg-get-bunsetsu-converted)) + +(defun egg-reconvert-bunsetsu-from-source (n) + (interactive "P") + (egg-reconvert-bunsetsu-internal n 'egg-get-bunsetsu-source)) + +(defun egg-reconvert-bunsetsu-internal (n func) + (let* ((inhibit-read-only t) + (backend (egg-get-backend (point))) + (source (funcall func (egg-get-bunsetsu-info (point)))) + (reconv-backend (egg-get-reconvert-backend backend n)) + (p (point)) + (last (egg-get-bunsetsu-last (point))) + new prev-b next-b) + (if (or (null reconv-backend) + (null (setq new (egg-start-conversion reconv-backend source nil)))) + (ding) + (delete-region p (egg-next-bunsetsu-point p)) + (setq next-b (egg-get-bunsetsu-info (point))) + (if (and (equal (egg-get-backend p) backend) + (eq (egg-bunsetsu-get-backend next-b) + (egg-bunsetsu-get-backend (car new))) + (egg-bunsetsu-combinable-p (egg-get-bunsetsu-tail new) next-b)) + (setq last nil) + (setq last (or (eq last t) 'continue))) + (egg-insert-bunsetsu-list backend new last) + (goto-char p) + (setq prev-b (egg-get-bunsetsu-info (1- p))) + (if prev-b + (progn + (if (and (equal (egg-get-backend (1- p)) backend) + (eq (egg-bunsetsu-get-backend prev-b) + (egg-bunsetsu-get-backend (car new))) + (egg-bunsetsu-combinable-p prev-b (car new))) + (setq last nil) + (setq last (or (eq last t) 'continue))) + (setq backend (egg-get-backend (1- p))) + (delete-region (egg-previous-bunsetsu-point p) p) + (egg-insert-bunsetsu-list backend (list prev-b) last)))))) + +(defun egg-decide-before-point () + (interactive) + (let* ((inhibit-read-only t) + (start (if (get-text-property (1- (point)) 'egg-start) + (point) + (previous-single-property-change (point) 'egg-start))) + (end (if (get-text-property (point) 'egg-end) + (point) + (next-single-property-change (point) 'egg-end))) + (decided (buffer-substring start (point))) + (undecided (buffer-substring (point) end)) + i len bunsetsu source context) + (delete-region + (previous-single-property-change start 'egg-start nil (point-min)) + (next-single-property-change end 'egg-end nil (point-max))) + (setq i 0 + len (length decided)) + (while (< i len) + (setq bunsetsu (nconc bunsetsu (list (egg-get-bunsetsu-info i decided))) + i (egg-next-bunsetsu-point i 1 decided len)) + (if (or (= i len) + (egg-get-bunsetsu-last (1- i) decided)) + (progn + (apply 'insert (mapcar + (lambda (b) (egg-get-bunsetsu-converted b)) + bunsetsu)) + (setq context (cons (cons (egg-bunsetsu-get-backend (car bunsetsu)) + (egg-end-conversion bunsetsu nil)) + context) + bunsetsu nil)))) + (setq len (length undecided)) + (if (= len 0) + (progn + (egg-do-auto-fill) + (run-hooks 'input-method-after-insert-chunk-hook) + context) + (setq i 0) + (while (< i len) + (setq bunsetsu (egg-get-bunsetsu-info i undecided) + source (cons (egg-get-bunsetsu-source bunsetsu) + source)) + (put-text-property 0 (length (car source)) + 'egg-lang + (egg-get-source-language bunsetsu) + (car source)) + (setq i (egg-next-bunsetsu-point i 1 undecided len))) + (its-restart (apply 'concat (nreverse source)) t t context)))) + +(defun egg-decide-first-char () + (interactive) + (let* ((inhibit-read-only t) + (start (if (get-text-property (1- (point)) 'egg-start) + (point) + (previous-single-property-change (point) 'egg-start))) + (end (if (get-text-property (point) 'egg-end) + (point) + (next-single-property-change (point) 'egg-end))) + (bunsetsu (egg-get-bunsetsu-info start))) + (delete-region + (previous-single-property-change start 'egg-start nil (point-min)) + (next-single-property-change end 'egg-end nil (point-max))) + (egg-end-conversion (list bunsetsu) nil) + (insert (egg-string-to-char-at (egg-get-bunsetsu-converted bunsetsu) 0)))) + +(defun egg-exit-conversion () + (interactive) + (if (egg-get-bunsetsu-info (point)) + (progn + (goto-char (next-single-property-change (point) 'egg-end)) + (egg-decide-before-point)))) + +(defun egg-abort-conversion () + (interactive) + (let ((inhibit-read-only t) + source context) + (goto-char (previous-single-property-change + (if (get-text-property (1- (point)) 'egg-start) + (point) + (previous-single-property-change (point) 'egg-start)) + 'egg-start nil (point-min))) + (setq source (get-text-property (point) 'egg-source) + context (get-text-property (point) 'egg-context)) + (delete-region (point) (next-single-property-change + (next-single-property-change (point) 'egg-end) + 'egg-end nil (point-max))) + (its-restart source nil nil context))) + +(defun egg-toroku-bunsetsu () + (interactive) + (let* ((p (point)) + (lang (egg-get-source-language (egg-get-bunsetsu-info p))) + (egg-mode-hook (or (cdr (assq lang its-select-func-alist)) + (cdr (assq lang its-select-func-default-alist)))) + (s "") + bunsetsu str yomi last) + (while (null last) + (setq bunsetsu (egg-get-bunsetsu-info p) + str (concat str (egg-get-bunsetsu-converted bunsetsu)) + yomi (concat yomi (egg-get-bunsetsu-source bunsetsu)) + last (egg-get-bunsetsu-last p) + p (egg-next-bunsetsu-point p))) + (while (equal s "") + (setq s (read-multilingual-string (egg-get-message 'register-str) + str egg-last-method-name)) + (and (equal s "") (ding))) + (egg-toroku-string s nil yomi lang (egg-bunsetsu-get-backend bunsetsu)))) + +(defun egg-toroku-region (start end &optional nth-backend) + (interactive "r\nP") + (egg-toroku-string (buffer-substring start end) nil nil nil nil nth-backend)) + +(defun egg-toroku-string (str &optional yomi guess lang backend nth-backend) + (let (egg-mode-hook result) + (if (= (length str) 0) + (egg-error "Egg word registration: null string")) + (egg-separate-languages str lang) + (setq lang (egg-get-language 0 str) + egg-mode-hook (or (cdr (assq lang its-select-func-alist)) + (cdr (assq lang its-select-func-default-alist)))) + (or yomi (setq yomi "")) + (while (equal yomi "") + (setq yomi (read-multilingual-string + (format (egg-get-message 'register-yomi) str) + guess egg-last-method-name)) + (and (equal yomi "") (ding))) + (egg-separate-languages yomi lang) + (if (null backend) + (progn + (setq backend (egg-assign-backend str nth-backend)) + (if (cdr backend) + (egg-error "Egg word registration: cannot decide backend")) + (setq backend (egg-get-current-backend (caar backend))))) + (setq result (egg-word-registration backend str yomi)) + (if result + (apply 'message (egg-get-message 'registered) str yomi result) + (beep)))) + +(defun egg-conversion-mode () + "\\{egg-conversion-map}" + ;; dummy function to get docstring + ) + +(defun egg-help-command () + "Display documentation for EGG Conversion mode." + (interactive) + (with-output-to-temp-buffer "*Help*" + (princ "EGG Conversion mode:\n") + (princ (documentation 'egg-conversion-mode)) + (help-setup-xref (cons #'help-xref-mode (current-buffer)) (interactive-p)))) + +(provide 'egg-cnv) +;;; egg-cnv.el ends here. diff --git a/egg-com.el b/egg-com.el new file mode 100644 index 0000000..d36e5f6 --- /dev/null +++ b/egg-com.el @@ -0,0 +1,900 @@ +;;; egg-com.el --- Communication Routines in Egg Input Method Architecture + +;; Copyright (C) 1999, 2000 Free Software Foundation, Inc + +;; Author: Hisashi Miyashita +;; NIIBE Yutaka +;; KATAYAMA Yoshio ; Korean, Chinese support. + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;;; Code: + + +(require 'egg-edep) + +(defvar egg-fixed-euc '(fixed-euc-jp)) +(make-variable-buffer-local 'egg-fixed-euc) +(put 'egg-fixed-euc 'permanent-local t) + +(defvar egg-mb-euc 'euc-japan) +(make-variable-buffer-local 'egg-mb-euc) +(put 'egg-mb-euc 'permanent-local t) + +;; Japanese + +(eval-and-compile +(define-ccl-program ccl-decode-fixed-euc-jp + `(2 + ((r2 = ,(charset-id 'japanese-jisx0208)) + (r3 = ,(charset-id 'japanese-jisx0212)) + (r4 = ,(charset-id 'katakana-jisx0201)) + (read r0) + (loop + (read r1) + (if (r0 < ?\x80) + ((r0 = r1) + (if (r1 < ?\x80) + (write-read-repeat r0)) + (write r4) + (write-read-repeat r0)) + ((if (r1 > ?\x80) + ((write r2 r0) + (r0 = r1) + (write-read-repeat r0)) + ((write r3 r0) + (r0 = (r1 | ?\x80)) + (write-read-repeat r0))))))))) + +(define-ccl-program ccl-encode-fixed-euc-jp + `(2 + ((read r0) + (loop + (if (r0 == ,(charset-id 'latin-jisx0201)) ; Unify + ((read r0) + (r0 &= ?\x7f))) + (if (r0 < ?\x80) ;G0 + ((write 0) + (write-read-repeat r0))) + (r6 = (r0 == ,(charset-id 'japanese-jisx0208))) + (r6 |= (r0 == ,(charset-id 'japanese-jisx0208-1978))) + (if r6 ;G1 + ((read r0) + (write r0) + (read r0) + (write-read-repeat r0))) + (if (r0 == ,(charset-id 'katakana-jisx0201)) ;G2 + ((read r0) + (write 0) + (write-read-repeat r0))) + (if (r0 == ,(charset-id 'japanese-jisx0212)) ;G3 + ((read r0) + (write r0) + (read r0) + (r0 &= ?\x7f) + (write-read-repeat r0))) + (read r0) + (repeat))))) +) + +(make-coding-system 'fixed-euc-jp 4 ?W "Coding System for fixed EUC Japanese" + (cons ccl-decode-fixed-euc-jp ccl-encode-fixed-euc-jp)) + +;; Korean + +(eval-and-compile +(define-ccl-program ccl-decode-fixed-euc-kr + `(2 + ((r2 = ,(charset-id 'korean-ksc5601)) + (read r0) + (loop + (read r1) + (if (r0 < ?\x80) + (r0 = r1 & ?\x7f) + ((write r2 r0) + (r0 = r1 | ?\x80))) + (write-read-repeat r0))))) + +(define-ccl-program ccl-encode-fixed-euc-kr + `(2 + ((read r0) + (loop + (if (r0 < ?\x80) + ((write 0) + (write-read-repeat r0))) + (if (r0 == ,(charset-id 'korean-ksc5601)) + ((read r0) + (write r0) + (read r0) + (write-read-repeat r0))) + (read r0) + (repeat))))) +) + +(make-coding-system 'fixed-euc-kr 4 ?W "Coding System for fixed EUC Korean" + (cons ccl-decode-fixed-euc-kr ccl-encode-fixed-euc-kr)) + +;; Chinese +(defconst egg-pinyin-shengmu + '(("" . 0) ("B" . 1) ("C" . 2) ("Ch" . 3) ("D" . 4) + ("F" . 5) ("G" . 6) ("H" . 7) ("J" . 8) ("K" . 9) + ("L" . 10) ("M" . 11) ("N" . 12) ("P" . 13) ("Q" . 14) + ("R" . 15) ("S" . 16) ("Sh" . 17) ("T" . 18) ("W" . 19) + ("X" . 20) ("Y" . 21) ("Z" . 22) ("Zh" . 23))) + +(defconst egg-pinyin-yunmu + '(("(0@(B" 0 0) ("(0@(B" 0 1) ("(0@(B" 0 3) ("(0@(B" 0 5) ("(0@(B" 0 7) + ("a(0@(B" 1 0) ("(0!@(B" 1 1) ("(0"@(B" 1 3) ("(0#@(B" 1 5) ("(0$@(B" 1 7) + ("ai(0@(B" 2 0) ("(0!(Bi(0@(B" 2 1) ("(0"(Bi(0@(B" 2 3) ("(0#(Bi(0@(B" 2 5) ("(0$(Bi(0@(B" 2 7) + ("an(0@(B" 3 0) ("(0!(Bn(0@(B" 3 1) ("(0"(Bn(0@(B" 3 3) ("(0#(Bn(0@(B" 3 5) ("(0$(Bn(0@(B" 3 7) + ("ang(0@(B" 4 0) ("(0!(Bng(0@(B" 4 1) ("(0"(Bng(0@(B" 4 3) ("(0#(Bng(0@(B" 4 5) ("(0$(Bng(0@(B" 4 7) + ("ao(0@(B" 5 0) ("(0!(Bo(0@(B" 5 1) ("(0"(Bo(0@(B" 5 3) ("(0#(Bo(0@(B" 5 5) ("(0$(Bo(0@(B" 5 7) + ("e(0@(B" 6 0) ("(0%@(B" 6 1) ("(0&@(B" 6 3) ("(0'@(B" 6 5) ("(0(@(B" 6 7) + ("ei(0@(B" 7 0) ("(0%(Bi(0@(B" 7 1) ("(0&(Bi(0@(B" 7 3) ("(0'(Bi(0@(B" 7 5) ("(0((Bi(0@(B" 7 7) + ("en(0@(B" 8 0) ("(0%(Bn(0@(B" 8 1) ("(0&(Bn(0@(B" 8 3) ("(0'(Bn(0@(B" 8 5) ("(0((Bn(0@(B" 8 7) + ("eng(0@(B" 9 0) ("(0%(Bng(0@(B" 9 1) ("(0&(Bng(0@(B" 9 3) ("(0'(Bng(0@(B" 9 5) ("(0((Bng(0@(B" 9 7) + ("er(0@(B" 10 0) ("(0%(Br(0@(B" 10 1) ("(0&(Br(0@(B" 10 3) ("(0'(Br(0@(B" 10 5) ("(0((Br(0@(B" 10 7) + ("i(0@(B" 11 0) ("(0)@(B" 11 1) ("(0*@(B" 11 3) ("(0+@(B" 11 5) ("(0,@(B" 11 7) + ("ia(0@(B" 12 0) ("i(0!@(B" 12 1) ("i(0"@(B" 12 3) ("i(0#@(B" 12 5) ("i(0$@(B" 12 7) + ("ian(0@(B" 13 0) ("i(0!(Bn(0@(B" 13 1) ("i(0"(Bn(0@(B" 13 3) ("i(0#(Bn(0@(B" 13 5) ("i(0$(Bn(0@(B" 13 7) + ("iang(0@(B" 14 0) ("i(0!(Bng(0@(B" 14 1) ("i(0"(Bng(0@(B" 14 3) ("i(0#(Bng(0@(B" 14 5) ("i(0$(Bng(0@(B" 14 7) + ("iao(0@(B" 15 0) ("i(0!(Bo(0@(B" 15 1) ("i(0"(Bo(0@(B" 15 3) ("i(0#(Bo(0@(B" 15 5) ("i(0$(Bo(0@(B" 15 7) + ("ie(0@(B" 16 0) ("i(0%@(B" 16 1) ("i(0&@(B" 16 3) ("i(0'@(B" 16 5) ("i(0(@(B" 16 7) + ("in(0@(B" 17 0) ("(0)(Bn(0@(B" 17 1) ("(0*(Bn(0@(B" 17 3) ("(0+(Bn(0@(B" 17 5) ("(0,(Bn(0@(B" 17 7) + ("ing(0@(B" 18 0) ("(0)(Bng(0@(B" 18 1) ("(0*(Bng(0@(B" 18 3) ("(0+(Bng(0@(B" 18 5) ("(0,(Bng(0@(B" 18 7) + ("iong(0@(B" 19 0) ("i(0-(Bng(0@(B" 19 1) ("i(0.(Bng(0@(B" 19 3) ("i(0/(Bng(0@(B" 19 5) ("i(00(Bng(0@(B" 19 7) + ("iu(0@(B" 20 0) ("i(01@(B" 20 1) ("i(02@(B" 20 3) ("i(03@(B" 20 5) ("i(04@(B" 20 7) + ("m(0@(B" 21 0) ("m(0@(B" 21 1) ("m(0@(B" 21 3) ("m(0@(B" 21 5) ("m(0@(B" 21 7) + ("n(0@(B" 22 0) ("n(0@(B" 22 1) ("(0=@(B" 22 3) ("(0>@(B" 22 5) ("(0?@(B" 22 7) + ("ng(0@(B" 23 0) ("ng(0@(B" 23 1) ("ng(0@(B" 23 3) ("ng(0@(B" 23 5) ("ng(0@(B" 23 7) + ("o(0@(B" 24 0) ("(0-@(B" 24 1) ("(0.@(B" 24 3) ("(0/@(B" 24 5) ("(00@(B" 24 7) + ("ong(0@(B" 25 0) ("(0-(Bng(0@(B" 25 1) ("(0.(Bng(0@(B" 25 3) ("(0/(Bng(0@(B" 25 5) ("(00(Bng(0@(B" 25 7) + ("ou(0@(B" 26 0) ("(0-(Bu(0@(B" 26 1) ("(0.(Bu(0@(B" 26 3) ("(0/(Bu(0@(B" 26 5) ("(00(Bu(0@(B" 26 7) + ("u(0@(B" 27 0) ("(01@(B" 27 1) ("(02@(B" 27 3) ("(03@(B" 27 5) ("(04@(B" 27 7) + ("ua(0@(B" 28 0) ("u(0!@(B" 28 1) ("u(0"@(B" 28 3) ("u(0#@(B" 28 5) ("u(0$@(B" 28 7) + ("uai(0@(B" 29 0) ("u(0!(Bi(0@(B" 29 1) ("u(0"(Bi(0@(B" 29 3) ("u(0#(Bi(0@(B" 29 5) ("u(0$(Bi(0@(B" 29 7) + ("uan(0@(B" 30 0) ("u(0!(Bn(0@(B" 30 1) ("u(0"(Bn(0@(B" 30 3) ("u(0#(Bn(0@(B" 30 5) ("u(0$(Bn(0@(B" 30 7) + ("uang(0@(B" 31 0) ("u(0!(Bng(0@(B" 31 1) ("u(0"(Bng(0@(B" 31 3) ("u(0#(Bng(0@(B" 31 5) ("u(0$(Bng(0@(B" 31 7) + ("ue(0@(B" 32 0) ("u(0%@(B" 32 1) ("u(0&@(B" 32 3) ("u(0'@(B" 32 5) ("u(0(@(B" 32 7) + ("ui(0@(B" 33 0) ("u(0)@(B" 33 1) ("u(0*@(B" 33 3) ("u(0+@(B" 33 5) ("u(0,@(B" 33 7) + ("un(0@(B" 34 0) ("(01(Bn(0@(B" 34 1) ("(02(Bn(0@(B" 34 3) ("(03(Bn(0@(B" 34 5) ("(04(Bn(0@(B" 34 7) + ("uo(0@(B" 35 0) ("u(0-@(B" 35 1) ("u(0.@(B" 35 3) ("u(0/@(B" 35 5) ("u(00@(B" 35 7) + ("(09@(B" 36 0) ("(05@(B" 36 1) ("(06@(B" 36 3) ("(07@(B" 36 5) ("(08@(B" 36 7) + ("(09(Be(0@(B" 37 0) ("(09%@(B" 37 1) ("(09&@(B" 37 3) ("(09'@(B" 37 5) ("(09(@(B" 37 7) + ("0(0@(B" 38 0) ("1(0@(B" 38 1) ("2(0@(B" 38 3) ("3(0@(B" 38 5) ("4(0@(B" 38 7))) + +(defconst egg-pinyin-table + [ + 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 + 0 1 1 1 1 1 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 + 0 1 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 + 0 1 1 1 1 1 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 1 1 0 0 1 + 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 0 1 0 0 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 + 0 1 0 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 1 + 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 1 1 0 0 1 + 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 1 1 1 1 1 1 0 1 1 1 0 0 1 + 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 0 0 1 0 1 0 1 0 0 0 1 + 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 1 1 0 0 1 + 0 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 0 1 0 0 0 1 1 1 1 0 0 1 0 0 0 1 1 1 1 1 + 0 1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 1 1 1 0 1 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 1 + 0 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 0 1 0 0 0 0 1 1 1 0 0 1 0 0 0 0 1 1 1 1 + 0 1 1 1 1 1 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 1 + 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 0 0 1 0 1 0 1 0 0 0 1 + 0 0 0 1 1 1 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 0 0 1 1 1 0 0 1 + 0 1 1 1 1 1 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 + 0 1 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 1 1 1 0 0 1 + 0 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 0 1 0 0 0 0 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 + 0 1 1 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 + 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 0 0 1 0 1 0 1 0 0 0 1 + 0 1 0 1 1 1 1 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 1 1 1 0 0 1 0 1 0 1 0 0 0 1 + 0 1 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 + 0 1 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 1 1 0 0 1 + ]) + +(defconst egg-zhuyin-shengmu + '(("" . 0) ("(0E(B" . 1) ("(0X(B" . 2) ("(0T(B" . 3) ("(0I(B" . 4) + ("(0H(B" . 5) ("(0M(B" . 6) ("(0O(B" . 7) ("(0P(B" . 8) ("(0N(B" . 9) + ("(0L(B" . 10) ("(0G(B" . 11) ("(0K(B" . 12) ("(0F(B" . 13) ("(0Q(B" . 14) + ("(0V(B" . 15) ("(0Y(B" . 16) ("(0U(B" . 17) ("(0J(B" . 18) ("(0h(B" . 19) + ("(0R(B" . 20) ("(0g(B" . 21) ("(0W(B" . 22) ("(0S(B" . 23))) + +(defconst egg-zhuyin-yunmu + '(("(0@(B" 0 0) ("(0A(B" 0 1) ("(0B(B" 0 3) ("(0C(B" 0 5) ("(0D(B" 0 7) ; i + ("(0Z@(B" 1 0) ("(0ZA(B" 1 1) ("(0ZB(B" 1 3) ("(0ZC(B" 1 5) ("(0ZD(B" 1 7) ; a + ("(0^@(B" 2 0) ("(0^A(B" 2 1) ("(0^B(B" 2 3) ("(0^C(B" 2 5) ("(0^D(B" 2 7) ; ai + ("(0b@(B" 3 0) ("(0bA(B" 3 1) ("(0bB(B" 3 3) ("(0bC(B" 3 5) ("(0bD(B" 3 7) ; an + ("(0d@(B" 4 0) ("(0dA(B" 4 1) ("(0dB(B" 4 3) ("(0dC(B" 4 5) ("(0dD(B" 4 7) ; ang + ("(0`@(B" 5 0) ("(0`A(B" 5 1) ("(0`B(B" 5 3) ("(0`C(B" 5 5) ("(0`D(B" 5 7) ; ao + ("(0\@(B" 6 0) ("(0\A(B" 6 1) ("(0\B(B" 6 3) ("(0\C(B" 6 5) ("(0\D(B" 6 7) ; e + ("(0_@(B" 7 0) ("(0_A(B" 7 1) ("(0_B(B" 7 3) ("(0_C(B" 7 5) ("(0_D(B" 7 7) ; ei + ("(0c@(B" 8 0) ("(0cA(B" 8 1) ("(0cB(B" 8 3) ("(0cC(B" 8 5) ("(0cD(B" 8 7) ; en + ("(0e@(B" 9 0) ("(0eA(B" 9 1) ("(0eB(B" 9 3) ("(0eC(B" 9 5) ("(0eD(B" 9 7) ; eng + ("(0f@(B" 10 0) ("(0fA(B" 10 1) ("(0fB(B" 10 3) ("(0fC(B" 10 5) ("(0fD(B" 10 7) ; er + ("(0g@(B" 11 0) ("(0gA(B" 11 1) ("(0gB(B" 11 3) ("(0gC(B" 11 5) ("(0gD(B" 11 7) ; i + ("(0gZ@(B" 12 0) ("(0gZA(B" 12 1) ("(0gZB(B" 12 3) ("(0gZC(B" 12 5) ("(0gZD(B" 12 7) ; ia + ("(0gb@(B" 13 0) ("(0gbA(B" 13 1) ("(0gbB(B" 13 3) ("(0gbC(B" 13 5) ("(0gbD(B" 13 7) ; ian + ("(0gd@(B" 14 0) ("(0gdA(B" 14 1) ("(0gdB(B" 14 3) ("(0gdC(B" 14 5) ("(0gdD(B" 14 7) ; iang + ("(0g`@(B" 15 0) ("(0g`A(B" 15 1) ("(0g`B(B" 15 3) ("(0g`C(B" 15 5) ("(0g`D(B" 15 7) ; iao + ("(0g]@(B" 16 0) ("(0g]A(B" 16 1) ("(0g]B(B" 16 3) ("(0g]C(B" 16 5) ("(0g]D(B" 16 7) ; ie + ("(0gc@(B" 17 0) ("(0gcA(B" 17 1) ("(0gcB(B" 17 3) ("(0gcC(B" 17 5) ("(0gcD(B" 17 7) ; in + ("(0ge@(B" 18 0) ("(0geA(B" 18 1) ("(0geB(B" 18 3) ("(0geC(B" 18 5) ("(0geD(B" 18 7) ; ing + ("(0ie@(B" 19 0) ("(0ieA(B" 19 1) ("(0ieB(B" 19 3) ("(0ieC(B" 19 5) ("(0ieD(B" 19 7) ; iong + ("(0ga@(B" 20 0) ("(0gaA(B" 20 1) ("(0gaB(B" 20 3) ("(0gaC(B" 20 5) ("(0gaD(B" 20 7) ; iu + ("(0G@(B" 21 0) ("(0GA(B" 21 1) ("(0GB(B" 21 3) ("(0GC(B" 21 5) ("(0GD(B" 21 7) ; m + ("(0K@(B" 22 0) ("(0KA(B" 22 1) ("(0KB(B" 22 3) ("(0KC(B" 22 5) ("(0KD(B" 22 7) ; n + ("@(0@(B" 23 0) ("@(0A(B" 23 1) ("@(0B(B" 23 3) ("@(0C(B" 23 5) ("@(0D(B" 23 7) ; ng + ("(0[@(B" 24 0) ("(0[A(B" 24 1) ("(0[B(B" 24 3) ("(0[C(B" 24 5) ("(0[D(B" 24 7) ; o + ("(0he@(B" 25 0) ("(0heA(B" 25 1) ("(0heB(B" 25 3) ("(0heC(B" 25 5) ("(0heD(B" 25 7) ; ong + ("(0a@(B" 26 0) ("(0aA(B" 26 1) ("(0aB(B" 26 3) ("(0aC(B" 26 5) ("(0aD(B" 26 7) ; ou + ("(0h@(B" 27 0) ("(0hA(B" 27 1) ("(0hB(B" 27 3) ("(0hC(B" 27 5) ("(0hD(B" 27 7) ; u + ("(0hZ@(B" 28 0) ("(0hZA(B" 28 1) ("(0hZB(B" 28 3) ("(0hZC(B" 28 5) ("(0hZD(B" 28 7) ; ua + ("(0h^@(B" 29 0) ("(0h^A(B" 29 1) ("(0h^B(B" 29 3) ("(0h^C(B" 29 5) ("(0h^D(B" 29 7) ; uai + ("(0hb@(B" 30 0) ("(0hbA(B" 30 1) ("(0hbB(B" 30 3) ("(0hbC(B" 30 5) ("(0hbD(B" 30 7) ; uan + ("(0hd@(B" 31 0) ("(0hdA(B" 31 1) ("(0hdB(B" 31 3) ("(0hdC(B" 31 5) ("(0hdD(B" 31 7) ; uang + ("(0i]@(B" 37 0) ("(0i]A(B" 37 1) ("(0i]B(B" 37 3) ("(0i]C(B" 37 5) ("(0i]D(B" 37 7) ; ue + ("(0h_@(B" 33 0) ("(0h_A(B" 33 1) ("(0h_B(B" 33 3) ("(0h_C(B" 33 5) ("(0h_D(B" 33 7) ; ui + ("(0hc@(B" 34 0) ("(0hcA(B" 34 1) ("(0hcB(B" 34 3) ("(0hcC(B" 34 5) ("(0hcD(B" 34 7) ; un + ("(0h[@(B" 35 0) ("(0h[A(B" 35 1) ("(0h[B(B" 35 3) ("(0h[C(B" 35 5) ("(0h[D(B" 35 7) ; uo + ("(0i@(B" 36 0) ("(0iA(B" 36 1) ("(0iB(B" 36 3) ("(0iC(B" 36 5) ("(0iD(B" 36 7) ; (09(B + ("(0i]@(B" 37 0) ("(0i]A(B" 37 1) ("(0i]B(B" 37 3) ("(0i]C(B" 37 5) ("(0i]D(B" 37 7) ; (09(Be + ("0(0@(B" 38 0) ("1(0A(B" 38 1) ("2(0B(B" 38 3) ("3(0C(B" 38 5) ("4(0D(B" 38 7) ; undefined + ("(0ib@(B" 39 0) ("(0ibA(B" 39 1) ("(0ibB(B" 39 3) ("(0ibC(B" 39 5) ("(0ibD(B" 39 7) ; (09(Ban + ("(0ic@(B" 40 0) ("(0icA(B" 40 1) ("(0icB(B" 40 3) ("(0icC(B" 40 5) ("(0icD(B" 40 7) ; (09(Bn + )) + +(defconst egg-zhuyin-table + [ + ;; empty ShengMu + ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 + ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x9586 ?\x0000 ?\x9592 ?\x9599 + ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x0000 ?\x0000 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x959b ?\x95a0 ?\x0000 ?\x959e + ?\x95a2 + ;; ShengMu B + ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 + ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 + ?\x0000 + ;; ShengMu C + ?\x828b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 + ?\x0000 ?\x0280 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 + ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 + ?\x0000 + ;; ShengMu Ch + ?\x838b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 + ?\x0000 ?\x0380 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 + ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 + ?\x0000 + ;; ShengMu D + ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 + ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x0000 + ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 + ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 + ?\x0000 + ;; ShengMu F + ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 + ?\x0000 + ;; ShengMu G + ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 + ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 + ?\x0000 + ;; ShengMu H + ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 + ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 + ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 + ?\x0000 + ;; ShengMu J + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 + ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 + ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x08a4 ?\x0000 ?\x0000 + ?\x08a7 ?\x0000 ?\x08a5 ?\x0000 ?\x08a8 ?\x0000 ?\x889b ?\x88a0 ?\x8000 ?\x889e + ?\x88a2 + ;; ShengMu K + ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 + ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 + ?\x0000 + ;; ShengMu L + ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 + ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 + ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 + ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 + ?\x0000 + ;; ShengMu M + ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 + ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 + ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 + ?\x0000 + ;; ShengMu N + ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 + ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 + ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 + ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 + ?\x0000 + ;; ShengMu P + ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 + ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 + ?\x0000 + ;; ShengMu Q + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 + ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 + ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0ea4 ?\x0000 ?\x0000 + ?\x0ea7 ?\x0000 ?\x0ea5 ?\x0000 ?\x0ea8 ?\x0000 ?\x8e9b ?\x8ea0 ?\x8000 ?\x8e9e + ?\x8ea2 + ;; ShengMu R + ?\x8f8b ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 + ?\x0000 ?\x0f80 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 + ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 + ?\x0000 + ;; ShengMu S + ?\x908b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 + ?\x0000 ?\x1080 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 + ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 + ?\x0000 + ;; ShengMu Sh + ?\x918b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 + ?\x0000 ?\x1180 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 + ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 + ?\x0000 + ;; ShengMu T + ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 + ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 + ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 + ?\x0000 + ;; ShengMu W + ?\x939b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 ?\x0000 ?\x1380 ?\x0000 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 + ?\x0000 + ;; ShengMu X + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 + ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 + ?\x8000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x14a4 ?\x0000 ?\x0000 + ?\x14a7 ?\x0000 ?\x14a5 ?\x0000 ?\x14a8 ?\x0000 ?\x949b ?\x94a0 ?\x8000 ?\x949e + ?\x94a2 + ;; ShengMu Y + ?\x958b ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0090 ?\x0000 ?\x9591 ?\x9592 + ?\x0000 ?\x1580 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x1588 ?\x1589 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0093 ?\x8000 ?\x00a4 ?\x0000 ?\x0000 + ?\x00a7 ?\x0000 ?\x00a5 ?\x0000 ?\x00a8 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 + ?\x0000 + ;; ShengMu Z + ?\x968b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 + ?\x0000 ?\x1680 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 + ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 + ?\x0000 + ;; ShengMu Zh + ?\x978b ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 + ?\x0000 ?\x1780 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 + ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 ?\x8000 + ?\x8000 ?\x8000 ?\x0000 ?\x8000 ?\x8000 ?\x8000 ?\x0000 ?\x0000 ?\x8000 ?\x0000 + ?\x0000 + ]) + +(defconst egg-chinese-syllable-max-len + (max (length "Zhu(0!(Bng(0@(B") (length "(0ShdA(B"))) + +(defun egg-chinese-syllable (str pos) + (setq str (substring str pos (min (length str) + (+ pos egg-chinese-syllable-max-len)))) + (or (car (egg-pinyin-syllable str)) + (car (egg-zhuyin-syllable str)))) + +(defsubst egg-make-fixed-euc-china-code (s y) + (cons + (+ (* 2 (nth 1 y)) (logand (nth 2 y) 1) 32) + (+ (* 4 (if (= s 0) 20 s)) (lsh (nth 2 y) -1) 156))) + +(defun egg-pinyin-syllable (str) + (if (eq (string-match "^[A-Za-z(0!(B-(0?(B]+(0@(B" str) 0) + (let (s y end) + (setq end (match-end 0)) + (cond + ((setq s (cdr (assoc (substring str 0 2) egg-pinyin-shengmu))) + (setq y (substring str 2 end))) + ((setq s (cdr (assoc (substring str 0 1) egg-pinyin-shengmu))) + (setq y (substring str 1 end))) + (t + (setq s 0 y (substring str 0 end)))) + (if (and (setq y (assoc y egg-pinyin-yunmu)) + (= (aref egg-pinyin-table (+ (* 39 s) (nth 1 y))) 1)) + (cons end (egg-make-fixed-euc-china-code s y)))))) + +(defun egg-zhuyin-syllable (str) + (if (eq (string-match "^[(0E(B-(0i(B@0-4]+[(0@ABCD(B]" str) 0) + (let (end s y c z (zhuyin-len (length "(0E(B"))) + (setq end (match-end 0) + c (substring str 0 zhuyin-len) + s (cdr (assoc c egg-zhuyin-shengmu)) + y (assoc (substring str zhuyin-len end) egg-zhuyin-yunmu)) + (if (or (null (and s y)) + (and (or (eq s 11) (eq s 12)) (eq (nth 1 y) 0))) ; [(0GK(B][(0@ABCD(B] + (setq s 0 + y (assoc (substring str 0 end) egg-zhuyin-yunmu))) + (if (and y + (setq z (aref egg-zhuyin-table (+ (* 41 s) (nth 1 y)))) + (/= (logand z ?\x8000) 0)) + (if (/= (logand z ?\x80) 0) + (cons end (egg-make-fixed-euc-china-code + (logand (lsh z -8) ?\x7f) + (list nil (logand z ?\x7f) (nth 2 y)))) + (cons end (egg-make-fixed-euc-china-code s y))))))) + +(defun encode-fixed-euc-china-region (beg end type) + "Encode the text in the region to EUC-CN/TW." + (let (s syl c cset) + (save-excursion + (save-restriction + (narrow-to-region beg end) + (goto-char (point-min)) + (while (< (point) (point-max)) + (setq s (buffer-substring + (point) + (min (point-max) (+ (point) egg-chinese-syllable-max-len)))) + (cond + ((setq syl (egg-pinyin-syllable s)) + (delete-region (point) (+ (point) (car syl))) + (insert (car (cdr syl)) (cdr (cdr syl)))) + ((setq syl (egg-zhuyin-syllable s)) + (delete-region (point) (+ (point) (car syl))) + (insert (car (cdr syl)) (cdr (cdr syl)))) + (t + (setq c (split-char (following-char)) + cset (car c)) + (cond + ((or (and (eq cset 'chinese-gb2312) (eq type 'cn)) + (and (eq cset 'chinese-cns11643-1) (eq type 'tw))) + (delete-char 1) + (insert (+ (nth 1 c) 128) (+ (nth 2 c) 128))) + ((and (eq cset 'chinese-cns11643-2) (eq type 'tw)) + (delete-char 1) + (insert (+ (nth 1 c) 128) (nth 2 c))) + ((eq cset 'chinese-sisheng) + (delete-char 1) + (insert 0 (+ (nth 1 c) 128))) + ((eq cset 'ascii) + (delete-char 1) + (insert 0 (nth 1 c))) + (t + (delete-char 1)))))) + (- (point-max) (point-min)))))) + +(defun pre-write-encode-fixed-euc-china (from to type) + (let ((buf (current-buffer)) + (work (get-buffer-create " *pre-write-encoding-work*"))) + (set-buffer work) + (erase-buffer) + (if (null (stringp from)) + (save-excursion + (set-buffer buf) + (setq from (buffer-substring from to)))) + (insert (string-as-multibyte from)) + (encode-fixed-euc-china-region 1 (point-max) type) + nil)) + +(defun pre-write-encode-euc-cn (from to) + (pre-write-encode-fixed-euc-china from to 'cn)) + +(defun pre-write-encode-euc-tw (from to) + (pre-write-encode-fixed-euc-china from to 'tw)) + +(defun decode-fixed-euc-china-region (beg end type zhuyin) + "Decode EUC-CN/TW encoded text in the region. +Return the length of resulting text." + (prog1 + (let ((str (string-as-unibyte (buffer-substring beg end))) + (i 0) + l c0 c1 s y ss) + (delete-region beg end) + (setq l (1- (length str))) + (while (< i l) + (setq c0 (aref str i) + c1 (aref str (1+ i)) + i (+ i 2)) + (cond + ((eq c0 0) + (if (> c1 ?\xa0) + (insert leading-code-private-11 + (charset-id 'chinese-sisheng) + c1) + (insert c1))) + ((>= c0 ?\x80) + (cond + ((eq type 'cn) + (insert (charset-id 'chinese-gb2312) c0 (logior c1 ?\x80))) + ((>= c1 ?\x80) + (insert (charset-id 'chinese-cns11643-1) c0 c1)) + (t + (insert (charset-id 'chinese-cns11643-2) c0 (+ c1 ?\x80))))) + (t + (setq c1 (logand c1 ?\x7f)) + (setq s (- (lsh c1 -2) 7);;(+ (lsh (- c1 32) -2) 1) + y (- (lsh c0 -1) 16);;(lsh (- c0 32) -1) + ss (+ (logand c0 1) (logand c1 3))) + (if (and (eq s 20) + (eq (aref egg-pinyin-table (+ (* 39 20) y)) 0)) + (setq s 0)) + (if (null zhuyin) + (setq s (car (nth s egg-pinyin-shengmu)) + y (car (nth (+ (* 5 y) ss) egg-pinyin-yunmu))) + (setq c0 (aref egg-zhuyin-table (+ (* 41 s) y))) + (if (eq (logand c0 ?\x8080) ?\x80) + (setq s (lsh c0 -8) + y (logand c0 ?\x7f))) + (setq s (car (nth s egg-zhuyin-shengmu)) + y (car (nth (+ (* 5 y) ss) egg-zhuyin-yunmu)))) + (if enable-multibyte-characters + (insert s y) + (insert (string-as-unibyte s) (string-as-unibyte y)))))) + (- (point) beg)) + (if (looking-at "\0\0") (forward-char 2)))) + +(defun post-read-decode-fixed-euc-china (len type zhuyin) + (let ((pos (point)) + (buffer-modified-p (buffer-modified-p))) + (prog1 + (decode-fixed-euc-china-region pos (+ pos len) type zhuyin) + (set-buffer-modified-p buffer-modified-p)))) + +(defun post-read-decode-euc-py-cn (len) + (post-read-decode-fixed-euc-china len 'cn nil)) + +(defun post-read-decode-euc-zy-cn (len) + (post-read-decode-fixed-euc-china len 'cn t)) + +(defun post-read-decode-euc-py-tw (len) + (post-read-decode-fixed-euc-china len 'tw nil)) + +(defun post-read-decode-euc-zy-tw (len) + (post-read-decode-fixed-euc-china len 'tw t)) + +(make-coding-system 'fixed-euc-py-cn 0 ?W + "Coding System for fixed EUC Chinese-gb2312") +(coding-system-put 'fixed-euc-py-cn + 'pre-write-conversion 'pre-write-encode-euc-cn) +(coding-system-put 'fixed-euc-py-cn + 'post-read-conversion 'post-read-decode-euc-py-cn) + +(make-coding-system 'fixed-euc-zy-cn 0 ?W + "Coding System for fixed EUC Chinese-gb2312") +(coding-system-put 'fixed-euc-zy-cn + 'pre-write-conversion 'pre-write-encode-euc-cn) +(coding-system-put 'fixed-euc-zy-cn + 'post-read-conversion 'post-read-decode-euc-zy-cn) + +(make-coding-system 'fixed-euc-py-tw 0 ?W + "Coding System for fixed EUC Chinese-cns11643") +(coding-system-put 'fixed-euc-py-tw + 'pre-write-conversion 'pre-write-encode-euc-tw) +(coding-system-put 'fixed-euc-py-tw + 'post-read-conversion 'post-read-decode-euc-py-tw) + +(make-coding-system 'fixed-euc-zy-tw 0 ?W + "Coding System for fixed EUC Chinese-cns11643") +(coding-system-put 'fixed-euc-zy-tw + 'pre-write-conversion 'pre-write-encode-euc-tw) +(coding-system-put 'fixed-euc-zy-tw + 'post-read-conversion 'post-read-decode-euc-zy-tw) + +;; Binary data + +(eval-and-compile +(define-ccl-program ccl-decode-egg-binary + `(2 + ((read r0) + (loop + (if (r0 == ?\xff) + (read r1)) ; toss out + (write-read-repeat r0))))) + +(define-ccl-program ccl-encode-egg-binary + `(1 + ((read r0) + (loop + (if (r0 == ?\xff) + ((write r0) + (r0 = 0))) + (write-read-repeat r0)))))) + +(make-coding-system 'egg-binary 4 ?W "Coding System for binary data" + (cons ccl-decode-egg-binary ccl-encode-egg-binary)) + + +(defun comm-format-u32c (uint32c) + (insert-char (logand (lsh (car uint32c) -8) 255) 1) + (insert-char (logand (car uint32c) 255) 1) + (insert-char (logand (lsh (nth 1 uint32c) -8) 255) 1) + (insert-char (logand (nth 1 uint32c) 255) 1)) + +(defun comm-format-u32 (uint32) + (insert-char (logand (lsh uint32 -24) 255) 1) + (insert-char (logand (lsh uint32 -16) 255) 1) + (insert-char (logand (lsh uint32 -8) 255) 1) + (insert-char (logand uint32 255) 1)) + +(defun comm-format-i32 (int32) + (insert-char (logand (ash int32 -24) 255) 1) + (insert-char (logand (ash int32 -16) 255) 1) + (insert-char (logand (ash int32 -8) 255) 1) + (insert-char (logand int32 255) 1)) + +(defun comm-format-u16 (uint16) + (insert-char (logand (lsh uint16 -8) 255) 1) + (insert-char (logand uint16 255) 1)) + +(defun comm-format-u8 (uint8) + (insert-char (logand uint8 255) 1)) + +(defun comm-format-truncate-after-null (s) + (if (string-match "\0" s) + (substring s 0 (match-beginning 0)) + s)) + +(defun comm-format-u16-string (s) + (insert (encode-coding-string (comm-format-truncate-after-null s) + egg-fixed-euc)) + (insert-char 0 2)) + +(defun comm-format-mb-string (s) + (insert (encode-coding-string (comm-format-truncate-after-null s) + egg-mb-euc)) + (insert-char 0 1)) + +(defun comm-format-u8-string (s) + (insert (comm-format-truncate-after-null s)) + (insert-char 0 1)) + +(defun comm-format-binary-data (s) + (insert (encode-coding-string s 'egg-binary)) + (insert-char ?\377 2)) + +(defun comm-format-fixlen-string (s len) + (setq s (comm-format-truncate-after-null s)) + (insert (if (< (length s) len) s (substring s 0 (1- len)))) + (insert-char 0 (max (- len (length s)) 1))) + +(defun comm-format-vector (s len) + (setq s (concat s)) + (insert (if (<= (length s) len) s (substring s 0 len))) + (insert-char 0 (- len (length s)))) + +(defmacro comm-format (format &rest args) + "Format a string out of a control-list and arguments into the buffer. +The formated datas are network byte oder (i.e. big endian).. +U: 32-bit integer. The argument is 2 element 16-bit unsigned integer list. +u: 32-bit integer. The argument is treat as unsigned integer. + (Note: Elisp's integer may be less than 32 bits) +i: 32-bit integer. +w: 16-bit integer. +b: 8-bit integer. +S: 16-bit wide-character EUC string (0x0000 terminated). +E: Multibyte EUC string (0x00 terminated). +s: 8-bit string (0x00 terminated). +B: Binary data (0xff terminated). +v: 8-bit vector (no terminator). This takes 2 args (data length). +V: Fixed length string (0x00 terminated). This takes 2 args (data length)." + (let ((p args) + (form format) + (result (list 'progn)) + f arg) + (while (and form p) + (setq f (car form) + arg (car p)) + (nconc result + (list + (cond ((eq f 'U) (list 'comm-format-u32c arg)) + ((eq f 'u) (list 'comm-format-u32 arg)) + ((eq f 'i) (list 'comm-format-i32 arg)) + ((eq f 'w) (list 'comm-format-u16 arg)) + ((eq f 'b) (list 'comm-format-u8 arg)) + ((eq f 'S) (list 'comm-format-u16-string arg)) + ((eq f 'E) (list 'comm-format-mb-string arg)) + ((eq f 's) (list 'comm-format-u8-string arg)) + ((eq f 'B) (list 'comm-format-binary-data arg)) + ((eq f 'V) (setq p (cdr p)) + (list 'comm-format-fixlen-string arg (car p))) + ((eq f 'v) (setq p (cdr p)) + (list 'comm-format-vector arg (car p)))))) + (setq form (cdr form) + p (cdr p))) + (if (or form p) + (error "comm-format %s: arguments mismatch" format)) + result)) + +(defvar comm-accept-timeout nil) + +;; Assume PROC is bound to the process of current buffer +;; Do not move the point, leave it where it was. +(defmacro comm-accept-process-output () + `(let ((p (point))) + (if (null (accept-process-output proc comm-accept-timeout)) + (egg-error "backend timeout")) + (goto-char p))) + +(defmacro comm-require-process-output (n) + `(if (< (point-max) (+ (point) ,n)) + (comm-wait-for-space proc ,n))) + +(defun comm-wait-for-space (proc n) + (let ((p (point)) + (r (+ (point) n))) + (while (< (point-max) r) + (if (null (accept-process-output proc comm-accept-timeout)) + (egg-error "backend timeout")) + (goto-char p)))) + +(defmacro comm-following+forward-char () + `(prog1 + (following-char) + (forward-char 1))) + +(defun comm-unpack-u32c () + (progn + (comm-require-process-output 4) + (list (+ (lsh (comm-following+forward-char) 8) + (comm-following+forward-char)) + (+ (lsh (comm-following+forward-char) 8) + (comm-following+forward-char))))) + +(defun comm-unpack-u32 () + (progn + (comm-require-process-output 4) + (+ (lsh (comm-following+forward-char) 24) + (lsh (comm-following+forward-char) 16) + (lsh (comm-following+forward-char) 8) + (comm-following+forward-char)))) + +(defun comm-unpack-u16 () + (progn + (comm-require-process-output 2) + (+ (lsh (comm-following+forward-char) 8) + (comm-following+forward-char)))) + +(defun comm-unpack-u8 () + (progn + (comm-require-process-output 1) + (comm-following+forward-char))) + +(defun comm-unpack-u16-string () + (let ((start (point))) + (while (not (search-forward "\0\0" nil t)) + (comm-accept-process-output)) + (decode-coding-string (buffer-substring start (- (point) 2)) + egg-fixed-euc))) + +(defun comm-unpack-mb-string () + (let ((start (point))) + (while (not (search-forward "\0" nil t)) + (comm-accept-process-output)) + (decode-coding-string (buffer-substring start (1- (point))) + egg-mb-euc))) + +(defun comm-unpack-u8-string () + (let ((start (point))) + (while (not (search-forward "\0" nil 1)) + (comm-accept-process-output)) + (buffer-substring start (1- (point))))) + +(defun comm-unpack-binary-data () + (let ((start (point))) + (while (not (search-forward "\377\377" nil 1)) + (comm-accept-process-output)) + (string-as-unibyte + (decode-coding-string (buffer-substring start (- (point) 2)) + 'egg-binary)))) + +(defun comm-unpack-fixlen-string (len) + (let (s) + (comm-require-process-output len) + (goto-char (+ (point) len)) + (setq s (buffer-substring (- (point) len) (point))) + (if (string-match "\0" s) + (setq s (substring s 0 (match-beginning 0)))) + s)) + +(defun comm-unpack-vector (len) + (progn + (comm-require-process-output len) + (goto-char (+ (point) len)) + (buffer-substring (- (point) len) (point)))) + +(defmacro comm-unpack (format &rest args) + "Unpack a string out of a control-string and set arguments. +See `comm-format' for FORMAT." + (let ((p args) + (form format) + (result (list 'progn)) + arg f) + (while (and form p) + (setq f (car form) + arg (car p)) + (nconc result + (list + (cond ((eq f 'U) `(setq ,arg (comm-unpack-u32c))) + ((eq f 'u) `(setq ,arg (comm-unpack-u32))) + ((eq f 'i) `(setq ,arg (comm-unpack-u32))) + ((eq f 'w) `(setq ,arg (comm-unpack-u16))) + ((eq f 'b) `(setq ,arg (comm-unpack-u8))) + ((eq f 'S) `(setq ,arg (comm-unpack-u16-string))) + ((eq f 'E) `(setq ,arg (comm-unpack-mb-string))) + ((eq f 's) `(setq ,arg (comm-unpack-u8-string))) + ((eq f 'B) `(setq ,arg (comm-unpack-binary-data))) + ((eq f 'V) (setq p (cdr p)) + `(setq ,arg (comm-unpack-fixlen-string ,(car p)))) + ((eq f 'v) (setq p (cdr p)) + `(setq ,arg (comm-unpack-vector ,(car p))))))) + (setq form (cdr form) + p (cdr p))) + (if (or form p) + (error "comm-unpack %s: arguments mismatch" format)) + result)) + +(defmacro comm-call-with-proc (proc vlist send-expr &rest receive-exprs) + (let ((euc-select + (and (eq (car-safe (car vlist)) 'zhuyin) + '((egg-fixed-euc (nth (if zhuyin 1 0) egg-fixed-euc)))))) + `(let* ((proc ,proc) + (buffer (process-buffer proc)) + ,@vlist) + (if (and (eq (process-status proc) 'open) + (buffer-live-p buffer)) + (save-excursion + (set-buffer buffer) + (let ,euc-select + (erase-buffer) + ,send-expr + (goto-char (point-max)) + (process-send-region proc (point-min) (point-max)) + ,@receive-exprs)) + (egg-error "process %s was killed" proc))))) + +(defmacro comm-call-with-proc-1 (proc vlist send-expr &rest receive-exprs) + `(let ,vlist + (erase-buffer) + ,send-expr + (goto-char (point-max)) + (process-send-region proc (point-min) (point-max)) + ,@receive-exprs)) + +(provide 'egg-com) +;;; egg-com.el ends here. diff --git a/egg-dotemacs b/egg-dotemacs new file mode 100644 index 0000000..e0ac692 --- /dev/null +++ b/egg-dotemacs @@ -0,0 +1,31 @@ +;;; Emacs/Egg Configuration + +;; + +(set-language-info "Japanese" 'input-method "japanese-egg-wnn") + +(defvar its-hira-enable-double-n t + "*Enable \"nn\" input for \"$B$s(B\" ") + +(defvar its-hira-period "$B!#(B" ;;; ". " "$B!%(B" + "*$B%T%j%*%I(B") + +(defvar its-hira-comma "$B!"(B" ;;; ", " "$B!$(B" + "*$B%3%s%^(B") + +(defvar its-hira-open-bracket "$B!V(B" ;;; "$B!N(B" + "*[") + +(defvar its-hira-close-bracket "$B!W(B" ;;; "$B!O(B" + "*]") + +(defvar its-hira-horizontal "$B!<(B" ;;; "$B!](B" + "*-") + +(set-language-info "Chinese-GB" 'input-method "chinese-gb-egg-wnn-py") +(set-language-info "Chinese-CNS" 'input-method "chinese-cns-egg-wnn-py") +(set-language-info "Korean" 'input-method "korean-egg-wnn") + +(require 'egg) + +;; diff --git a/egg-edep.el b/egg-edep.el new file mode 100644 index 0000000..8a93a96 --- /dev/null +++ b/egg-edep.el @@ -0,0 +1,96 @@ +;; egg-edep.el --- This file serves Emacs version dependent definitions + +;; Copyright (C) 1999,2000 PFU LIMITED + +;; Author: NIIBE Yutaka +;; KATAYAMA Yoshio + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;;; Code: + + +(if (and (fboundp 'set-buffer-multibyte) + (subrp (symbol-function 'set-buffer-multibyte))) + ;; Emacs 20.3 + (progn + (defun egg-char-bytes (x) 1) + (defun egg-charset-bytes (x) 1) + (defun egg-char-bytes-at (str pos) 1) + (defun egg-chars-in-period (str pos len) len) + (defalias 'egg-string-to-vector 'identity) + (defalias 'egg-string-to-char-at 'aref) + ) + ;; Emacs 20.2 + (defun set-buffer-multibyte (flag) + (setq enable-multibyte-characters flag)) + (defalias 'string-as-unibyte 'identity) + (defalias 'string-as-multibyte 'identity) + (defalias 'coding-system-put 'put) + + (defalias 'egg-char-bytes 'char-bytes) + (defalias 'egg-charset-bytes 'charset-bytes) + (defun egg-char-bytes-at (str pos) + (char-bytes (egg-string-to-char-at str pos))) + (defun egg-chars-in-period (str pos len) + (chars-in-string (substring str pos (+ pos len)))) + (defalias 'egg-string-to-vector 'string-to-vector) + (defalias 'egg-string-to-char-at 'sref) + ) + +;; Elisp bug fix + +(defun egg-next-single-property-change (pos prop &optional object limit) + (if limit + (min limit (next-single-property-change pos prop object (1+ limit))) + (next-single-property-change pos prop object))) + +(defun egg-string-match-charset (charset string &optional start) + (let ((cur-ct (category-table)) + category) + (unwind-protect + (progn + (set-category-table (copy-category-table)) + (setq category (get-unused-category)) + (define-category category "") + (modify-category-entry (make-char charset) category) + (string-match (concat "\\c" (list category) "+") string start)) + (set-category-table cur-ct)))) + +(unless (egg-string-match-charset 'japanese-jisx0208 "$B!#(B") + (defun egg-string-match-charset (charset string &optional start) + (let (min max) + (if (= (charset-chars charset) 94) + (setq min 33 max 126) + (setq min 32 max 127)) + (string-match (if (= (charset-dimension charset) 1) + (concat "[" (list (make-char charset min)) + "-" (list (make-char charset max)) + "]+") + (concat "[" (list (make-char charset min min)) + "-" (list (make-char charset max max)) + "]+")) + string start)))) + +(provide 'egg-edep) diff --git a/egg-mlh.el b/egg-mlh.el new file mode 100644 index 0000000..bb87d28 --- /dev/null +++ b/egg-mlh.el @@ -0,0 +1,550 @@ +;;; egg-mlh.el --- Modeless Conversion Facility in Egg Input +;;; Method Architecture + +;; Copyright (C) 1999, 2000 Free Software Foundation, Inc + +;; Author: NIIBE Yutaka +;; KATAYAMA Yoshio ; Multilingual Enhancement + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + + +;;; Code: + + +(defvar mlh-default-backend "wnn") + +(defun mlh-space-bar-backward-henkan () + "If the character preceding point is / (slash), +Do `mlh-backward-henkan'. Then, invoke appropriate conversion, if needed. +Or else, execute command that space-bar invokes usually." + (interactive) + (let ((henkan-begin nil) + (inhibit-henkan t) + (its-disable-special-action t)) + (if (null (assq 'Japanese egg-conversion-backend-alist)) + (progn + (setq egg-mode-preference nil) + (activate-input-method (concat "japanese-egg-" mlh-default-backend))) + ;; force to Japanese + (its-select-hiragana)) + (mlh-backward-henkan) + (if henkan-begin + (if (or inhibit-henkan (= henkan-begin (point))) + (egg-do-auto-fill) + (progn + (message "Converting...") + (sit-for 0) + (egg-convert-region henkan-begin (point)) + (message "") )) + (setq this-command 'self-insert-command) + (call-interactively 'self-insert-command)))) + +(defvar mlh-punctuations nil) +(if mlh-punctuations + () + (setq mlh-punctuations "!()?;:")) + +(defvar mlh-conversion-scheme-table + '( + (?- . mlh-kanji) +; (?` . mlh-ltn) +; (?' . mlh-ltn) +; (?, . mlh-ltn) + (?, . mlh-kanji) + (?. . mlh-kanji) +; (?^ . mlh-ltn) +; (?~ . mlh-ltn) +; (?\". mlh-ltn) +; (?@ . mlh-ltn) +; (?< . mlh-ltn) +; (?> . mlh-ltn) + (?a . mlh-kanji) +; (?b . mlh-) + (?c . mlh-capitalize) + (?d . mlh-user-defined-conversion) + (?e . mlh-kanji) + (?f . mlh-hiragana) + (?g . mlh-greek) + (?h . mlh-hangul) + (?i . mlh-kanji) + (?j . mlh-jis-code) + (?k . mlh-katakana) +; (?l . mlh-ligature) +; (?m . mlh-) + (?n . mlh-kanji) +; (?n . mlh-no-conversion) + (?o . mlh-kanji) + (?p . mlh-upcase-letter) + (?q . mlh-quit) +; (?r . mlh-) + (?s . mlh-small-letter) + (?t . mlh-zhongwen-tw) + (?u . mlh-kanji) +; (?v . mlh-) + (?w . mlh-white-space) + (?x . mlh-execute) +; (?y . mlh-) + (?z . mlh-zhongwen) + (?H . mlh-hiragana-to-kanji) + (?L . mlh-lisp-expression) + (?W . mlh-zenkaku-white) + (?X . mlh-exit) + (?Z . mlh-zenkaku) +)) + +(defun mlh-zenkaku-white () + (forward-char -1) + (skip-chars-backward "0-9") + (mlh-backward-henkan) + (setq beg (point)) + (goto-char end-marker) + (backward-delete-char 2) + (let* ((str (buffer-substring beg (point))) + (val (string-to-int str))) + (delete-region beg (point)) + (if (= val 0) + (setq val 1)) + (while (> val 0) + (insert "$B!!(B") + (setq val (1- val)))) + (if (null henkan-begin) + (setq henkan-begin beg))) + +(defun mlh-exit () + (goto-char end-marker) + (backward-delete-char 2) + (insert " ") + (setq henkan-begin (point))) + +(defun mlh-upcase-letter () + (forward-char -1) + (skip-chars-backward "a-zA-Z0-9") + (mlh-backward-henkan) + (setq beg (point)) + (goto-char end-marker) + (backward-delete-char 2) + (upcase-region beg (point)) + (if (null henkan-begin) + (setq henkan-begin beg))) + +(defun mlh-capitalize () + (forward-char -1) + (skip-chars-backward "a-zA-Z1-9") + (mlh-backward-henkan) + (setq beg (point)) + (goto-char end-marker) + (backward-delete-char 2) + (capitalize-region beg (point)) + (if (null henkan-begin) + (setq henkan-begin beg))) + +(defun mlh-jis-code () + (forward-char -1) + (skip-chars-backward "0-9a-fA-F") + (mlh-backward-henkan) + (if (/= (- end-marker (point)) 6) + (error "invalid length")) + (setq beg (point)) + (let ((val (car (read-from-string + (concat "?\\x" (buffer-substring beg (- end-marker 2))))))) + (insert (make-char 'japanese-jisx0208 (/ val 256) (% val 256))) + (delete-region (point) end-marker)) + (if (null henkan-begin) + (setq henkan-begin beg))) + +(defun mlh-lisp-expression () + (forward-char -1) + (let ((stab (syntax-table))) + (unwind-protect + (progn + (set-syntax-table emacs-lisp-mode-syntax-table) + (forward-sexp -1)) + (set-syntax-table stab))) + (mlh-backward-henkan) + (setq beg (point)) + (goto-char end-marker) + (backward-delete-char 2) + (let* ((exp-str + (buffer-substring beg (point))) + (exp (car (read-from-string exp-str))) + (result (eval exp))) + (delete-region beg (point)) + (insert (format "%s" result))) + (if (null henkan-begin) + (setq henkan-begin beg))) + +(defun mlh-quit () + (goto-char end-marker) + (backward-delete-char 2) + (setq henkan-begin (point))) + +(defun mlh-no-conversion () + (forward-char -1) + (skip-chars-backward "\041-\056\060-\176") + (mlh-backward-henkan) + (setq beg (point)) + (goto-char end-marker) + (backward-delete-char 2) + (if (null henkan-begin) + (setq henkan-begin beg))) + +(fset 'mlh-small-letter (symbol-function 'mlh-no-conversion)) + +(defun mlh-white-space () + (forward-char -1) + (skip-chars-backward "0-9") + (mlh-backward-henkan) + (setq beg (point)) + (goto-char end-marker) + (backward-delete-char 2) + (let* ((str (buffer-substring beg (point))) + (val (string-to-int str))) + (delete-region beg (point)) + (if (= val 0) + (setq val 1)) + (insert (make-string val ?\ ))) + (if (null henkan-begin) + (setq henkan-begin beg))) + +(defun mlh-execute () + (forward-char -1) + (if (fboundp 'mlh-userdef-function) + (mlh-userdef-function) + (mlh-backward-henkan) + (setq beg (point)) + (goto-char end-marker) + (backward-delete-char 2) + (if (null henkan-begin) + (setq henkan-begin beg)))) + +(defun mlh-backward-henkan () + "For each words seperated by / (slash), do conversion. +Accoding to a character preceding slash, conversion scheme are selected. + +CHAR. MNEMONIC CONVERSION SCHEME + + H Hiragana to kanji Convert Hiragana to Kanji + L Lisp Evaluate as Emacs-Lisp expression + W zenkaku White space Insert Zenkaku spaces + X eXit Quit going backward, insert space + Z Zenkaku Convert to Zenkaku + c Capitalize Capitalize + d user Definition Convert with user definition table + f Firagana ?? Convert to Hiragana + g Greek letter Convert to single greek letter + h Hangul Convert to Hangul + j Jis-code Convert to character which has code + k Katakana Convert to Katakana + l Ligature Ligature (not implemented yet) + p uPcase letter uPcase + q Quit Quit going backward + s Small letter No conversion + w White space Insert spaces + x eXecute Call user defined function + z Zhongwen Convert to Zhongwen + OTHERWISE Convert to KANJI +" + (if (eq (preceding-char) ?/) + (let ((end-marker (point-marker)) + (char nil) + (beg nil)) + (set-marker-insertion-type end-marker t) + (unwind-protect + (let (scheme) + (backward-char 1) + (setq char (preceding-char)) + (cond + ((setq scheme (assq char mlh-conversion-scheme-table)) + (funcall (cdr scheme))) + (t + (goto-char end-marker))) + (if beg + (progn + (goto-char beg) + (mlh-do-spacing) + (goto-char end-marker)))) + (set-marker end-marker nil))))) + + +(defvar mlh-syntax-table nil + "Syntax table of mlh, which are used to determine spacing.") +(if mlh-syntax-table + () + (setq mlh-syntax-table (copy-syntax-table emacs-lisp-mode-syntax-table)) + (modify-syntax-entry ?! "." mlh-syntax-table) + (modify-syntax-entry ?$ "'" mlh-syntax-table) + (modify-syntax-entry ?% "'" mlh-syntax-table) + (modify-syntax-entry ?& "'" mlh-syntax-table) + (modify-syntax-entry ?{ "(}" mlh-syntax-table) + (modify-syntax-entry ?} "){" mlh-syntax-table) +) + +;;; XXX RTFM, gniibe! +(defvar mlh-space-control + '( + (("al".?w).("al".?w)) + (("al".?w).("al".?_)) + (("al".?w).("Hj|".?e)) + (("al".?w).("Cj|".?e)) + (("al".?_).("al".?w)) + (("al".?_).("al".?_)) + (("al".?_).("Hj|".?e)) + (("al".?_).("Cj|".?e)) + (("al".?.).("al".?w)) + (("al".?.).("al".?_)) + (("al".?_).("Hj|".?e)) + (("al".?_).("Cj|".?e)) + (("Hj|".?e).("al".?w)) + (("Cj|".?e).("al".?w)) + (("Hj|".?e).("al".?_)) + (("Cj|".?e).("al".?_)) + ) + "Alist that determines inserting space.") + +(defun mlh-do-spacing () + "Arrange spacing as you like." + (if (bobp) + () + (let ((s-tab (syntax-table)) + s-pc s-fc + c-pc c-fc) + (unwind-protect + (progn + (set-syntax-table mlh-syntax-table) + (setq s-pc (char-syntax (preceding-char)) + s-fc (char-syntax (following-char)))) + (set-syntax-table s-tab)) + (setq c-pc (category-set-mnemonics (char-category-set (preceding-char))) + c-fc (category-set-mnemonics (char-category-set (following-char)))) + (if (member (cons (cons c-pc s-pc) (cons c-fc s-fc)) mlh-space-control) + (progn + (and henkan-begin + (>= henkan-begin (point)) + (setq henkan-begin (1+ henkan-begin))) + (insert " ")))))) + +(defvar mlh-select-mode-map (make-keymap)) + +;;; acutually this map is not necessary now. for future extention +(defvar mlh-select-mode-esc-map (make-keymap)) + +(define-key mlh-select-mode-map [t] 'undefined) +(define-key mlh-select-mode-esc-map [t] 'undefined) + +(let ((ch 32)) + (while (< ch 127) + (define-key mlh-select-mode-map (char-to-string ch) + 'mlh-select-kakutei-and-self-insert) + (setq ch (1+ ch)))) + +(define-key mlh-select-mode-map "\C-m" 'mlh-select-kakutei-and-self-insert) +(define-key mlh-select-mode-map "\C-b" 'mlh-select-prev-candidate) +(define-key mlh-select-mode-map "\C-f" 'mlh-select-next-candidate) +(define-key mlh-select-mode-map "\177" 'mlh-select-prev-candidate) +(define-key mlh-select-mode-map " " 'mlh-select-next-candidate) +(define-key mlh-select-mode-map "/" 'mlh-select-kakutei) + +(if (eq window-system 'x) + (let () + (define-key mlh-select-mode-map [return] 'mlh-select-kakutei-and-self-insert) + (define-key mlh-select-mode-map [delete] 'mlh-select-prev-candidate) + )) + +(defun mlh-select-insert-candidate (n) + (delete-region beg (point)) + (insert (nth n candidates))) + +(defun mlh-select-prev-candidate () + (interactive) + (setq current-candidate (1- current-candidate)) + (if (< current-candidate 0) + (setq current-candidate (1- number-of-candidates))) + (mlh-select-insert-candidate current-candidate)) + +(defun mlh-select-next-candidate () + (interactive) + (setq current-candidate (1+ current-candidate)) + (if (>= current-candidate number-of-candidates) + (setq current-candidate 0)) + (mlh-select-insert-candidate current-candidate)) + +(defun mlh-recursive-edit-select (beg end candidates) + (mlh-select-insert-candidate 0) + (and (boundp 'disable-undo) (setq disable-undo t)) + (let ((old-local-map (current-local-map)) + (number-of-candidates (length candidates)) + (current-candidate 0)) + (use-local-map mlh-select-mode-map) + (recursive-edit) + (use-local-map old-local-map))) + +(defun mlh-select-kakutei-and-self-insert () + (interactive) + (setq unread-command-events (list last-command-event)) + (mlh-select-kakutei)) + +(defun mlh-select-kakutei () + (interactive) + (and (boundp 'disable-undo) (setq disable-undo nil)) + (exit-recursive-edit)) + +(defun mlh-user-defined-conversion () + (forward-char -1) + (skip-chars-backward "-a-zA-Z") + (mlh-backward-henkan) + (setq beg (point)) + (goto-char end-marker) + (backward-delete-char 2) + (let* ((str (buffer-substring beg (point))) + (userdef (mlh-userdef<==string str))) + (cond ((stringp userdef) + (delete-region beg (point)) + (insert userdef)) + ((null userdef) + (delete-region beg (point)) + ;; (add-userdef) (insert new-userdef) + (insert "?udef?")) + ((consp userdef) + (mlh-recursive-edit-select beg (point) userdef)))) + (if (null henkan-begin) + (setq henkan-begin beg))) + +(defvar mlh-userdef-table nil + "Convertion table of words(string) to another words(string).") + +(defun mlh-userdef<==string (str) + "Convert string to another string with `mlh-userdef-table'" + (cdr (assoc str mlh-userdef-table))) + +(defvar mlh-kanji-function 'mlh-kanji-with-henkan-region-function) + +(defun mlh-kanji () + (funcall mlh-kanji-function)) + +(defun mlh-kanji-with-henkan-region-function () + (skip-chars-backward "-a-z,.'N[]") + (mlh-backward-henkan) + (setq inhibit-henkan nil) + (setq beg (point)) + (goto-char end-marker) + (forward-char -1) + (its-translate-region-internal beg (point)) + (delete-region (point) end-marker) + (if (null henkan-begin) + (setq henkan-begin beg))) + +(defun mlh-hiragana () + (forward-char -1) + (skip-chars-backward "-a-z,.'N[]") + (mlh-backward-henkan) + (setq beg (point)) + (goto-char end-marker) + (forward-char -2) + (its-translate-region-internal beg (point)) + (delete-region (point) end-marker) + (setq henkan-begin (point))) + +(defun mlh-hiragana-to-kanji () + (forward-char -1) + (skip-chars-backward "$B$!(B-$B$s!<(B") + (mlh-backward-henkan) + (setq beg (point)) + (setq inhibit-henkan nil) + (goto-char end-marker) + (backward-delete-char 2) + (if (null henkan-begin) + (setq henkan-begin beg))) + +(defun mlh-katakana () + (forward-char -1) + (skip-chars-backward "-a-z,.'N[]") + (mlh-backward-henkan) + (setq beg (point)) + (goto-char end-marker) + (forward-char -2) + (its-translate-region-internal beg (point)) + (japanese-katakana-region beg (point)) + (delete-region (point) end-marker) + (if (null henkan-begin) + (setq henkan-begin beg))) + +(defun mlh-zenkaku () + (forward-char -1) + (skip-chars-backward "\041-\056\060-\176") + (mlh-backward-henkan) + (setq beg (point)) + (goto-char end-marker) + (backward-delete-char 2) + (japanese-zenkaku-region beg (point)) + (if (null henkan-begin) + (setq henkan-begin beg))) + +(defun mlh-hangul () + (forward-char -1) + (skip-chars-backward "a-zEO-RTW,.[]") + (mlh-backward-henkan) + (setq beg (point)) + (setq inhibit-henkan nil) + (goto-char end-marker) + (forward-char -2) + (let (its-current-map its-current-language) + (its-select-hangul nil t) + (its-translate-region-internal beg (point))) + (delete-region (point) end-marker) + (if (null henkan-begin) + (setq henkan-begin beg))) + +(defun mlh-zhongwen () + (forward-char -1) + (skip-chars-backward "a-z0-4 ,.[]") + (mlh-backward-henkan) + (setq beg (point)) + (setq inhibit-henkan nil) + (goto-char end-marker) + (forward-char -2) + (let (its-current-map its-current-language) + (its-select-pinyin-cn nil t) + (its-translate-region-internal beg (point))) + (delete-region (point) end-marker) + (if (null henkan-begin) + (setq henkan-begin beg))) + +(defun mlh-zhongwen-tw () + (forward-char -1) + (skip-chars-backward "a-z0-4,.[]") + (mlh-backward-henkan) + (setq beg (point)) + (setq inhibit-henkan nil) + (goto-char end-marker) + (forward-char -2) + (let (its-current-map its-current-language) + (its-select-pinyin-tw nil t) + (its-translate-region-internal beg (point))) + (delete-region (point) end-marker) + (if (null henkan-begin) + (setq henkan-begin beg))) + +(provide 'egg-mlh) +;;; egg-mlh.el ends here. diff --git a/egg.el b/egg.el new file mode 100644 index 0000000..43465ba --- /dev/null +++ b/egg.el @@ -0,0 +1,281 @@ +;;; egg.el --- EGG Input Method Architecture + +;; Copyright (C) 1999, 2000 Free Software Foundation, Inc + +;; Author: NIIBE Yutaka +;; KATAYAMA Yoshio + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;;; Code: + +(require 'cl) +(require 'egg-edep) + +(defgroup egg nil + "Tamagotchy --- EGG Versio 4.0") + +(defcustom egg-mode-preference t + "*Make Egg as modefull input method, if non-NIL." + :group 'egg :type 'boolean) + +(defvar egg-default-language) + +(defvar egg-last-method-name) +(make-variable-buffer-local 'egg-last-method-name) +(put 'egg-last-method-name 'permanent-local t) + +(defvar egg-current-keymap nil) +(make-variable-buffer-local 'egg-current-keymap) +(put 'egg-current-keymap 'permanent-local t) + +;;;###autoload +(defun egg-mode (&rest arg) + "Toggle EGG mode. +\\[describe-bindings] +" + (interactive "P") + (if (null arg) + ;; Turn off + (unwind-protect + (progn + (its-exit-mode) + (egg-exit-conversion)) + (setq describe-current-input-method-function nil) + (if (eq (current-local-map) egg-current-keymap) + (use-local-map (keymap-parent (current-local-map)))) + (remove-hook 'input-method-activate-hook 'its-set-mode-line-title t) + (force-mode-line-update)) + ;; Turn on + (if (null (string= (car arg) egg-last-method-name)) + (progn + (funcall (nth 1 arg)) + (setq egg-default-language its-current-language))) + (egg-set-conversion-backend (nthcdr 2 arg)) + (egg-set-conversion-backend + (list (assq its-current-language (nthcdr 2 arg))) t) + (setq egg-last-method-name (car arg)) + (setq egg-current-keymap (if egg-mode-preference + (egg-modefull-map) + (egg-modeless-map))) + (use-local-map egg-current-keymap) + (setq inactivate-current-input-method-function 'egg-mode) + (setq describe-current-input-method-function 'egg-help) + (make-local-hook 'input-method-activate-hook) + (add-hook 'input-method-activate-hook 'its-set-mode-line-title nil t) + (if (eq (selected-window) (minibuffer-window)) + (add-hook 'minibuffer-exit-hook 'egg-exit-from-minibuffer)) + (run-hooks 'egg-mode-hook))) + +(defun egg-exit-from-minibuffer () + (inactivate-input-method) + (if (<= (minibuffer-depth) 1) + (remove-hook 'minibuffer-exit-hook 'egg-exit-from-minibuffer))) + +(defun egg-modefull-map () + "Generate modefull keymap for EGG mode." + (let ((map (make-sparse-keymap)) + (i 33)) + (define-key map "\C-_" 'egg-jis-code-input) + (while (< i 127) + (define-key map (vector i) 'egg-self-insert-char) + (setq i (1+ i))) + (its-define-select-keys map) + (set-keymap-parent map (current-local-map)) + map)) + +(defun egg-modeless-map () + "Generate modeless keymap for EGG mode." + (let ((map (make-sparse-keymap))) + (define-key map " " 'mlh-space-bar-backward-henkan) + (define-key map "\C-_" 'egg-jis-code-input) + (set-keymap-parent map (current-local-map)) + map)) + +(defvar egg-context nil) + +(defun egg-self-insert-char () + (interactive) + (its-start last-command-char (and (eq last-command 'egg-use-context) + egg-context))) + +(defvar egg-mark-list nil) +(defvar egg-suppress-marking nil) + +(defun egg-set-face (beg eng face &optional object) + (put face 'face face) + (add-text-properties beg eng + (list 'category face + 'egg-face t + 'modification-hooks '(egg-mark-modification)) + object)) + +(defun egg-mark-modification (beg end) + (if (and (null egg-suppress-marking) + (or (get-text-property beg 'egg-face) + (setq beg (next-single-property-change beg 'egg-face))) + (or (get-text-property (1- end) 'egg-face) + (setq end (previous-single-property-change end 'egg-face))) + (< beg end)) + (let ((list egg-mark-list) + (found 0) + pair mb me b e) + (add-hook 'post-command-hook 'egg-redraw-face t) + (setq list egg-mark-list) + (while (and list (< found 2)) + (setq pair (car list) + list (cdr list) + mb (car pair) + me (cdr pair) + b (marker-position mb) + e (marker-position me)) + (cond + ;; no overwrapping -- SKIP + ((or (null (eq (marker-buffer mb) (current-buffer))) + (or (> beg e) (< end b)))) + ;; completely included + ((and (>= beg b) (<= end e)) + (setq found 3)) + ;; partially overwrapping + (t + (set-marker mb nil) + (set-marker me nil) + (setq egg-mark-list (delete pair egg-mark-list) + beg (min beg b) + end (max end e) + found (1+ found))))) + (if (< found 3) + (progn + (setq b (make-marker) + e (make-marker) + egg-mark-list (cons (cons b e) egg-mark-list)) + (set-marker b beg) + (set-marker e end)))))) + +(defun egg-redraw-face () + (let ((inhibit-read-only t) + (inhibit-point-motion-hooks t) + (egg-suppress-marking t) + (list egg-mark-list) + (org-buffer (current-buffer)) + (org-point (point)) + mb me b e p) + (setq egg-mark-list nil) + (remove-hook 'post-command-hook 'egg-redraw-face) + (while list + (setq mb (car (car list)) + me (cdr (car list)) + list (cdr list)) + (when (marker-buffer mb) + (set-buffer (marker-buffer mb)) + (let ((before-change-functions nil) (after-change-functions nil)) + (save-restriction + (widen) + (setq b (max mb (point-min)) + e (min me (point-max))) + (set-marker mb nil) + (set-marker me nil) + (while (< b e) + (if (null (get-text-property b 'egg-face)) + (setq b (next-single-property-change b 'egg-face nil e))) + (setq p (next-single-property-change b 'egg-face nil e)) + (when (< b p) + (goto-char b) + (setq str (buffer-substring b p)) + (delete-region b p) + (remove-text-properties 0 (- p b) '(face) str) + (insert str) + (setq b p))))))) + (set-buffer org-buffer) + (goto-char org-point))) + +(defvar egg-messages nil) +(defvar egg-message-language-alist nil) + +(defun egg-get-message (message) + (let ((lang (or (cdr (assq egg-default-language egg-message-language-alist)) + egg-default-language))) + (or (nth 1 (assq message (cdr (assq lang egg-messages)))) + (nth 1 (assq message (cdr (assq nil egg-messages)))) + (error "EGG internal error: no such message: %s (%s)" + message egg-default-language)))) + +(defun egg-add-message (list) + (let (l msg-l) + (while list + (setq l (car list)) + (or (setq msg-l (assq (car l) egg-messages)) + (setq egg-messages (cons (list (car l)) egg-messages) + msg-l (car egg-messages))) + (mapcar + (lambda (msg) + (setcdr msg-l (cons msg (delq (assq (car msg) msg-l) (cdr msg-l))))) + (cdr l)) + (setq list (cdr list))))) + +(defun egg-set-message-language-alist (alist) + (let ((a alist)) + (while a + (setq egg-message-language-alist + (delq (assq (caar a) egg-message-language-alist) + egg-message-language-alist)) + (setq a (cdr a))) + (setq egg-message-language-alist + (append alist egg-message-language-alist)))) + +(put 'egg-error 'error-conditions '(error egg-error)) +(put 'egg-error 'error-message "EGG error") + +(defun egg-error (message &rest args) + (if (symbolp message) + (setq message (egg-get-message message))) + (signal 'egg-error (list (apply 'format message args)))) + +;;; +;;; auto fill controll +;;; + +(defun egg-do-auto-fill () + (if (and auto-fill-function (> (current-column) fill-column)) + (let ((ocolumn (current-column))) + (funcall auto-fill-function) + (while (and (< fill-column (current-column)) + (< (current-column) ocolumn)) + (setq ocolumn (current-column)) + (funcall auto-fill-function))))) + +(eval-when (eval load) + (require 'its) + (require 'menudiag) + (require 'egg-mlh) + (require 'egg-cnv) + (require 'egg-com)) + +(add-hook 'kill-emacs-hook 'egg-kill-emacs-function) +(defun egg-kill-emacs-function () + (egg-finalize-backend)) + +(provide 'egg) + +;;; egg.el ends here diff --git a/egg/canna.el b/egg/canna.el new file mode 100644 index 0000000..78ded66 --- /dev/null +++ b/egg/canna.el @@ -0,0 +1,286 @@ +;;; egg/canna.el --- Canna Support (high level interface) in +;;; Egg Input Method Architecture + +;; Copyright (C) 1999, 2000 Free Software Foundation, Inc + +;; Author: NIIBE Yutaka + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;;; Code: + + +(require 'egg-edep) + +(eval-when-compile + (defmacro CANNA-const (c) + (cond ((eq c 'FileNotExist) xxxxxxxxxxxxxx) + ))) + +(defconst canna-conversion-backend + [ canna-init + + canna-start-conversion + canna-get-bunsetsu-converted + canna-get-bunsetsu-source + canna-list-candidates + canna-get-number-of-candidates + canna-get-current-candidate-number + canna-get-all-candidates + canna-decide-candidate + canna-change-bunsetsu-length + canna-end-conversion + nil + + canna-fini + ]) + +(defconst canna-server-port 5680 "Port number of Canna server") +(defvar canna-hostname "localhost" + "Hostname of Canna server") + +(defun canna-open (hostname) + "Establish the connection to CANNA server. Return environment object." + (let* ((buf (generate-new-buffer " *CANNA*")) + (proc (open-network-stream "CANNA" buf hostname canna-server-port)) + result) + (process-kill-without-query proc) + (set-process-coding-system proc 'no-conversion 'no-conversion) + (set-marker-insertion-type (process-mark proc) t) + (save-excursion + (set-buffer buf) + (erase-buffer) + (buffer-disable-undo) + (set-buffer-multibyte nil)) + (setq result (cannarpc-open proc (user-login-name))) + (if (< result 0) + (let ((msg (cannarpc-get-error-message (- result)))) + (delete-process proc) + (kill-buffer buf) + (error "Can't open CANNA session (%s): %s" hostname msg))) + (vector proc result))) + +;; XXX: Should support multiple outstanding context +;; ::= [ ] +(defvar canna-environment nil + "Environment for CANNA kana-kanji conversion") + +(defsubst cannaenv-get-proc (env) + (aref env 0)) +(defsubst cannaenv-get-context (env) + (aref env 1)) + +;; ::= +;; [ +;; ] +(defsubst canna-make-bunsetsu (env converted bunsetsu-pos) + (vector env converted bunsetsu-pos nil nil nil)) + +(defsubst cannabunsetsu-get-env (b) + (aref b 0)) +(defsubst cannabunsetsu-get-converted (b) + (aref b 1)) +(defsubst cannabunsetsu-get-bunsetsu-pos (b) + (aref b 2)) +(defsubst cannabunsetsu-get-source (b) + (aref b 3)) +(defsubst cannabunsetsu-set-source (b s) + (aset b 3 s)) +(defsubst cannabunsetsu-get-zenkouho-pos (b) + (aref b 4)) +(defsubst cannabunsetsu-set-zenkouho-pos (b p) + (aset b 4 p)) +(defsubst cannabunsetsu-get-zenkouho (b) + (aref b 5)) +(defsubst cannabunsetsu-set-zenkouho (b z) + (aset b 5 z)) + +(defun canna-get-bunsetsu-source (b) + (let ((s (cannabunsetsu-get-source b))) + (or s + (let* ((env (cannabunsetsu-get-env b)) + (bp (cannabunsetsu-get-bunsetsu-pos b)) + (s (cannarpc-get-bunsetsu-source env bp))) + (cannabunsetsu-set-source b s))))) + +(defun canna-get-bunsetsu-converted (b) + (cannabunsetsu-get-converted b)) + +(defconst canna-dictionary-specification + '("iroha" + "fuzokugo" + "hojomwd" + "hojoswd" + "bushu" + "user" + ) + "Dictionary specification of CANNA.") + +(defun canna-filename (p) + "" + (cond ((consp p) (concat (car p) "/" (user-login-name))) + (t p))) + +(defun canna-get-environment () + "Return the backend of CANNA environment." + (if canna-environment + canna-environment + (let* ((env (canna-open canna-hostname)) + (l canna-dictionary-specification) + dict-list) + (while l + (let ((dic (car l)) + result) + (setq result + (canna-open-dictionary env (canna-filename dic))) + (if (= result 255) + (error "Damedamedame") ; XXX + (setq l (cdr l))))) + (setq canna-environment env)))) + +(defun canna-open-dictionary (env name) + (let ((trying t) + ret) + (while trying + (setq ret (cannarpc-open-dictionary env name 0)) ; XXX MODE=0 + (if (= ret 0) + (setq trying nil) + (message "$B<-=q%U%!%$%k(B(%s)$B$,$"$j$^$;$s(B" name) + (setq ret (- ret)) ; Get error code. + (if (and (y-or-n-p + (format "$B<-=q%U%!%$%k(B(%s)$B$,$"$j$^$;$s!#:n$j$^$9$+(B? " + name)) + (= (cannarpc-make-dictionary env name) 0)) + (message "$B<-=q%U%!%$%k(B(%s)$B$r:n$j$^$7$?(B" name) + (error "Fatal")))) + ret)) + +(defun canna-init () + ) + +(defun canna-start-conversion (yomi lang) + "Convert YOMI string to kanji, and enter conversion mode. +Return the list of bunsetsu." + (if (eq lang 'Japanese) + (let ((env (canna-get-environment))) + (cannarpc-begin-conversion env yomi)) + (signal 'lang-not-supported))) + +(defun canna-end-conversion (bunsetsu-list abort) + (let* ((env (cannabunsetsu-get-env (car bunsetsu-list))) + (l bunsetsu-list) + (len (length bunsetsu-list)) + (zenkouho-pos-vector (make-vector (* 2 len) 0)) + (i 0) + (mode 1) ;XXX MODE=1 attru? + bunsetsu zenkouho-pos) + (if abort + (setq mode 0)) + (while l + (setq bunsetsu (car l)) + (setq l (cdr l)) + (setq zenkouho-pos (cannabunsetsu-get-zenkouho-pos bunsetsu)) + (if (null zenkouho-pos) + () ; XXX: NIL--> 0 atteru??? + (aset zenkouho-pos-vector i 0) ; XXX Don't support >=256 + (aset zenkouho-pos-vector (1+ i) zenkouho-pos)) + (setq i (+ i 2))) + (cannarpc-end-conversion env len zenkouho-pos-vector 0))) + +(defun canna-list-candidates (bunsetsu prev-bunsetsu) + (let* ((env (cannabunsetsu-get-env bunsetsu)) + (bunsetsu-pos (cannabunsetsu-get-bunsetsu-pos bunsetsu)) + (z (cannarpc-get-bunsetsu-candidates env bunsetsu-pos))) + (cannabunsetsu-set-zenkouho bunsetsu z) + (cannabunsetsu-set-zenkouho-pos bunsetsu 0) + 0)) + +(defun canna-get-number-of-candidates (bunsetsu) + (let ((l (cannabunsetsu-get-zenkouho bunsetsu))) + (if l + (length l) + nil))) + +(defun canna-decide-candidate (bunsetsu candidate-pos) + (let* ((candidate-list (cannabunsetsu-get-zenkouho bunsetsu)) + (candidate (nth candidate-pos candidate-list))) + (cannabunsetsu-set-zenkouho candidate candidate-list) + (cannabunsetsu-set-zenkouho-pos candidate candidate-pos) + candidate)) + +(defun canna-get-current-candidate-number (bunsetsu) + (cannabunsetsu-get-zenkouho-pos bunsetsu)) + +(defun canna-get-all-candidates (bunsetsu) + (let* ((l (cannabunsetsu-get-zenkouho bunsetsu)) + (result (cons nil nil)) + (r result)) + (catch 'break + (while t + (let ((candidate (car l))) + (setcar r (cannabunsetsu-get-converted candidate)) + (if (null (setq l (cdr l))) + (throw 'break nil) + (setq r (setcdr r (cons nil nil))))))) + result)) + +;;;;;;;;;;;;;;;;;;;;;;; MADAMADA zenzendame, just copy from SJ3 +(defun canna-change-bunsetsu-length (b0 b1 b2 len) + (let ((yomi (concat + (cannabunsetsu-get-source b1) + (if b2 (cannabunsetsu-get-source b2)))) + (env (cannabunsetsu-get-env b1)) + yomi1 yomi2 + bunsetsu1 bunsetsu2) + (setq yomi1 (substring yomi 0 len) + yomi2 (substring yomi len)) + (setq bunsetsu1 + (cannarpc-tanbunsetsu-conversion env yomi1)) + ;; Only set once (memory original length of the bunsetsu). + (cannabunsetsu-set-kugiri-changed bunsetsu1 + (or (cannabunsetsu-get-kugiri-changed b1) + (length (cannabunsetsu-get-source b1)))) + (if (< 0 (length yomi2)) + (setq bunsetsu2 (cannarpc-tanbunsetsu-conversion env yomi2)) + (setq bunsetsu2 nil)) + (if bunsetsu2 + (list bunsetsu1 bunsetsu2) + (list bunsetsu1)))) + +;;;;;;;;;;;;;; MADAMADA +(defun canna-fini () +) + +;;; setup +(require 'egg) + +;;;###autoload +(defun egg-activate-canna (&rest arg) + "Activate CANNA backend of Tamagotchy." + (setq egg-conversion-backend canna-conversion-backend) + (if (not (fboundp 'cannarpc-open)) + (load-library "egg/canna")) + (apply 'egg-mode arg)) + +;;; egg/canna.el ends here. diff --git a/egg/cannarpc.el b/egg/cannarpc.el new file mode 100644 index 0000000..8cd2aa0 --- /dev/null +++ b/egg/cannarpc.el @@ -0,0 +1,205 @@ +;;; egg/cannarpc.el --- Canna Support (low level interface) in +;;; Egg Input Method Architecture + +;; Copyright (C) 1999, 2000 Free Software Foundation, Inc + +;; Author: NIIBE Yutaka + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + + +;;; Code: + + + +(eval-when-compile + (require 'egg-com) +;; (load-library "egg/canna") + (defmacro canna-const (c) + (cond ((eq c 'Initialize) 1) + ((eq c 'Finalize) 2) + ((eq c 'CreateContext) 3) + ((eq c 'CloseContext) 5) + ((eq c 'GetDictionaryList) 6) + ((eq c 'GetDirectoryList) 7) + ((eq c 'MountDictionary) 8) + ((eq c 'UnmountDictionary) 9) + ((eq c 'BeginConvert) 15) + ((eq c 'EndConvert) 16) + ((eq c 'GetCandidacyList) 17) + ((eq c 'GetYomi) 18) + ((eq c 'ResizePause) 26) + + ((eq c 'CreateDictionary) 3) + (t (error "No such constant"))))) + +(defun cannarpc-get-error-message (errno) + (or (aref cannarpc-error-message errno) (format "#%d" errno))) + +(defmacro cannarpc-call-with-environment (e vlist send-expr &rest receive-exprs) + (let ((v (append + `((proc (cannaenv-get-proc ,e)) + (context (cannaenv-get-context ,e))) + vlist))) + (list + 'let v + (append + `(save-excursion + (set-buffer (process-buffer proc)) + (erase-buffer) + ,send-expr + (process-send-region proc (point-min) (point-max)) + (goto-char (prog1 (point) (accept-process-output proc)))) + receive-exprs)))) + +(defconst canna-version-fmt "2.0:%s") + +(defun cannarpc-open (proc username) + "Open the session. Return 0 on success, error code on failure." + (let ((verusr (format canna-version-fmt username))) + (comm-call-with-proc proc (result) + (comm-format (u u v) (canna-const Initialize) (length verusr) verusr) + (comm-unpack (u) result) + result))) + +(defun cannarpc-close (proc) + (comm-call-with-proc proc (dummy result) + (comm-format (b b w) (canna-const Finalize) 0 0) + (comm-unpack (b b w b) dummy dummy dummy result) + result)) + +(defun cannarpc-create-context (proc) + (comm-call-with-proc proc (dummy result) + (comm-format (b b w) (canna-const CreateContext) 0 0) + (comm-unpack (b b w w) dummy dummy dummy result) + result)) + +(defun cannarpc-close-context (proc context) + (comm-call-with-proc proc (dummy result) + (comm-format (b b w w) (canna-const CloseContext) 0 2 context) + (comm-unpack (b b w b) dummy dummy dummy result) + result)) + +;; XXX: Not implemented fully +(defun cannarpc-get-dictionary-list (env) + (cannarpc-call-with-environment env (dymmy result) + (comm-format (b b w w w) (canna-const GetDictionaryList) 0 4 + context 1024) + (comm-unpack (u w) dummy result) + ;; follow list of dictionaries + result)) + +;; XXX: Not implemented fully +(defun cannarpc-get-directory-list (env) + (cannarpc-call-with-environment env (dymmy result) + (comm-format (b b w w w) (canna-const GetDirectoryList) 0 4 + context 1024) + (comm-unpack (u w) dummy result) + ;; follow list of directories + result)) + +(defun cannarpc-open-dictionary (env dict-file-name mode) + (cannarpc-call-with-environment env (dymmy result) + (comm-format (b b w u w s) (canna-const MountDictionary) 0 + (+ (length dict-file-name) 7) + mode context dict-file-name) + (comm-unpack (u b) dummy result) + result)) + +(defun cannarpc-close-dictionary (env dict-file-name mode) + (cannarpc-call-with-environment env (dymmy result) + (comm-format (b b w u w s) (canna-const UnmountDictionary) 0 + (+ (length dict-file-name) 6) + mode context dict-file-name) + (comm-unpack (u b) dummy result) + result)) + +(defun cannarpc-begin-conversion (env yomi) + "Begin conversion." + (let ((yomi-ext (encode-coding-string yomi 'euc-japan)) + (i 0) + converted bunsetsu-list bl) + (cannarpc-call-with-environment env (dummy result) + (comm-format (b b w u w S) (canna-const BeginConvert) 0 + (+ (length yomi-ext) 8) 0 context yomi) + (comm-unpack (u w) dummy result) + (if (= result 65535) + -1 ; failure + (while (< i result) + (comm-unpack (S) converted) + (let ((bl1 (cons (canna-make-bunsetsu env converted i) + nil))) + (if bl + (setq bl (setcdr bl bl1)) + (setq bunsetsu-list (setq bl bl1)))) + (setq i (1+ i))) + bunsetsu-list)))) + +(defun cannarpc-end-conversion (env len zenkouho-pos-vector mode) + "End conversion." + (cannarpc-call-with-environment env (dummy result) + (comm-format (b b w w w u v) (canna-const EndConvert) 0 + (+ (* len 2) 8) context len mode zenkouho-pos-vector) + (comm-unpack (u b) dummy result) + (if (= result 255) + -1 ; failure + result))) + +(defun cannarpc-make-dictionary (env dict-name) + (cannarpc-call-with-environment env (dummy result) + (comm-format (b b w u w s) (canna-const CreateDictionary) 1 + (+ (length dict-name) 7) 0 context dict-name) + (comm-unpack (u b) dummy result) + result)) + +(defun cannarpc-get-bunsetsu-source (env bunsetsu-pos) + (cannarpc-call-with-environment env (dummy result) + (comm-format (b b w w w w) (canna-const GetYomi) 0 6 context + bunsetsu-pos 1024) + (comm-unpack (u w) dummy result) + (if (= result 65535) + -1 + (comm-unpack (S) result) + result))) + +(defun cannarpc-get-bunsetsu-candidates (env bunsetsu-pos) + (let ((i 0) + converted bunsetsu-list bl) + (cannarpc-call-with-environment env (dummy result) + (comm-format (b b w w w w) (canna-const GetCandidacyList) 0 6 context + bunsetsu-pos 1024) + (comm-unpack (u w) dymmy result) + (if (= result 65535) + -1 ; failure + (while (< i result) + (comm-unpack (S) converted) + (let ((bl1 (cons (canna-make-bunsetsu env converted bunsetsu-pos) + nil))) + (if bl + (setq bl (setcdr bl bl1)) + (setq bunsetsu-list (setq bl bl1)))) + (setq i (1+ i))) + bunsetsu-list)))) + +;;; egg/cannarpc.el ends here. diff --git a/egg/sj3.el b/egg/sj3.el new file mode 100644 index 0000000..d1d1f56 --- /dev/null +++ b/egg/sj3.el @@ -0,0 +1,372 @@ +;;; egg/sj3.el --- SJ3 Support (high level interface) in Egg +;;; Input Method Architecture + +;; Copyright (C) 1999, 2000 Free Software Foundation, Inc + +;; Author: NIIBE Yutaka + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + + +;;; Code: + + +(require 'egg-edep) + +(eval-when-compile + (defmacro SJ3-const (c) + (cond ((eq c 'FileNotExist) 35) + ))) + +(setplist 'sj3-conversion-backend + '(egg-start-conversion sj3-start-conversion + egg-get-bunsetsu-source sj3-get-bunsetsu-source + egg-get-bunsetsu-converted sj3-get-bunsetsu-converted + egg-get-source-language sj3-get-source-language + egg-get-converted-language sj3-get-converted-language + egg-list-candidates sj3-list-candidates + egg-decide-candidate sj3-decide-candidate + egg-change-bunsetsu-length sj3-change-bunsetsu-length + egg-end-conversion sj3-end-conversion)) + +(defconst sj3-backend-alist '((Japanese ((sj3-conversion-backend))))) + +(egg-set-finalize-backend '(sj3-finalize-backend)) + +(defvar sj3-server-port 3086 "Port number of SJ3 server") +(defvar sj3-stdy-size 0 "STDYSIZE of SJ3 server") +(defvar sj3-hostname "localhost" + "Hostname of SJ3 server") + +(defvar sj3-open-message) + +(defun sj3-open (hostname) + "Establish the connection to SJ3 server. Return process object." + (let* ((buf (generate-new-buffer " *SJ3*")) + proc result) + (condition-case err + (setq proc (open-network-stream "SJ3" buf hostname sj3-server-port)) + ((error quit) + (egg-error "failed to connect sj3 server"))) + (process-kill-without-query proc) + (set-process-coding-system proc 'no-conversion 'no-conversion) + (set-marker-insertion-type (process-mark proc) t) + (save-excursion + (set-buffer buf) + (erase-buffer) + (buffer-disable-undo) + (set-buffer-multibyte nil)) + ;; Initialize dictionaries + (setq sj3-sys-dict-list nil) + (setq sj3-user-dict-list nil) + (setq result (sj3rpc-open proc (system-name) (user-login-name))) + (if (< result 0) + (let ((msg (sj3rpc-get-error-message (- result)))) + (delete-process proc) + (kill-buffer buf) + (egg-error "Can't open SJ3 session (%s): %s" hostname msg))) + (setq result (sj3rpc-get-stdy-size proc)) + (if (< result 0) + (let ((msg (sj3rpc-get-error-message (- result)))) + (delete-process proc) + (kill-buffer buf) + (egg-error "Can't get SJ3 STDYSIZE: %s"msg))) + (setq sj3-stdy-size result) + proc)) + +;; (defun sj3-open (hostname-list) +;; "Establish the connection to SJ3 server. Return process object." +;; (let* ((buf (generate-new-buffer " *SJ3*")) +;; (msg-form "SJ3: connecting to sj3serv at %s...") +;; hostname proc result msg) +;; (save-excursion +;; (set-buffer buf) +;; (erase-buffer) +;; (buffer-disable-undo) +;; (setq enable-multibyte-characters nil)) +;; (cond +;; ((null hostname-list) +;; (setq hostname-list '("localhost"))) +;; ((null (listp hostname-list)) +;; (setq hostname-list (list hostname-list)))) +;; (while (and hostname-list (null proc)) +;; (setq hostname (car hostname-list) +;; hostname-list (cdr hostname-list)) +;; (message msg-form hostname) +;; (sit-for 0) +;; (condition-case result +;; (setq proc (open-network-stream "SJ3" buf hostname sj3-server-port)) +;; (error nil)) +;; (if proc +;; (progn +;; (process-kill-without-query proc) +;; (set-process-coding-system proc 'no-conversion 'no-conversion) +;; (set-marker-insertion-type (process-mark proc) t) +;; ;; Initialize dictionaries +;; (setq sj3-sys-dict-list nil) +;; (setq sj3-user-dict-list nil) +;; (setq result (sj3rpc-open proc (system-name) (user-login-name))) +;; (if (< result 0) +;; (progn +;; (delete-process proc) +;; (setq proc nil +;; msg (format "Can't open SJ3 session (%s): %s" +;; hostname msg))) +;; (setq result (sj3rpc-get-stdy-size proc)) +;; (if (< result 0) +;; (progn +;; (delete-process proc) +;; (setq proc nil +;; msg (format "Can't get SJ3 STDYSIZE: %s" +;; (sj3rpc-get-error-message (- result))))) +;; (setq sj3-stdy-size result)))))) +;; (if proc +;; (progn +;; (setq sj3-open-message (format (concat msg-form "done") hostname)) +;; proc) +;; (kill-buffer buf) +;; (error "%s" (or msg "no sj3serv available"))))) + +;; ::= [ ] +(defvar sj3-environment nil + "Environment for SJ3 kana-kanji conversion") + +(defsubst sj3env-get-proc (env) + (aref env 0)) +(defsubst sj3env-get-dictionary-list (env) + (aref env 1)) + +;; ::= +;; [ +;; +;; ] +(defsubst sj3-make-bunsetsu (env source converted rest stdy) + (egg-bunsetsu-create + 'sj3-conversion-backend + (vector env source converted rest stdy nil nil nil nil nil))) + +(defsubst sj3bunsetsu-get-env (b) + (aref (egg-bunsetsu-get-info b) 0)) +(defsubst sj3bunsetsu-get-source (b) + (aref (egg-bunsetsu-get-info b) 1)) +(defsubst sj3bunsetsu-get-converted (b) + (aref (egg-bunsetsu-get-info b) 2)) +(defsubst sj3bunsetsu-get-rest (b) + (aref (egg-bunsetsu-get-info b) 3)) +(defsubst sj3bunsetsu-get-stdy (b) + (aref (egg-bunsetsu-get-info b) 4)) + +(defsubst sj3bunsetsu-get-zenkouho (b) + (aref (egg-bunsetsu-get-info b) 5)) +(defsubst sj3bunsetsu-set-zenkouho (b z) + (aset (egg-bunsetsu-get-info b) 5 z)) + +(defsubst sj3bunsetsu-get-zenkouho-pos (b) + (aref (egg-bunsetsu-get-info b) 6)) +(defsubst sj3bunsetsu-set-zenkouho-pos (b zp) + (aset (egg-bunsetsu-get-info b) 6 zp)) + +(defsubst sj3bunsetsu-get-zenkouho-converted (b) + (aref (egg-bunsetsu-get-info b) 7)) +(defsubst sj3bunsetsu-set-zenkouho-converted (b zc) + (aset (egg-bunsetsu-get-info b) 7 zc)) + +(defsubst sj3bunsetsu-get-kugiri-changed (b) + (aref (egg-bunsetsu-get-info b) 8)) +(defsubst sj3bunsetsu-set-kugiri-changed (b s) + (aset (egg-bunsetsu-get-info b) 8 s)) + +(defun sj3-get-bunsetsu-source (b) + (sj3bunsetsu-get-source b)) + +(defun sj3-get-bunsetsu-converted (b) + (concat (sj3bunsetsu-get-converted b) (sj3bunsetsu-get-rest b))) + +(defun sj3-get-source-language (b) 'Japanese) +(defun sj3-get-converted-language (b) 'Japanese) +(defun sj3-get-bunsetsu-stdy (b) (sj3bunsetsu-get-stdy b)) + +(defvar sj3-dictionary-specification + '(("study.dat") + ["sj3main.dic" ""] + [("private.dic") ""]) + "Dictionary specification of SJ3.") + +(defvar sj3-usr-dic-dir (concat "user/" (user-login-name)) + "*Directory of user dictionary for SJ3.") + +(defun sj3-filename (p) + "" + (cond ((consp p) (concat sj3-usr-dic-dir "/" (car p))) + (t p))) + +(defun sj3-get-environment () + "Return the backend of SJ3 environment." + (if sj3-environment + sj3-environment + (let* ((proc (sj3-open sj3-hostname)) + (freq-info-name (sj3-filename (car sj3-dictionary-specification))) + (l (cdr sj3-dictionary-specification)) + dict-list) + (sj3-open-freq-info proc freq-info-name) + (while l + (let ((dic (car l)) + dic-id) + (setq dic-id + (sj3-open-dictionary proc (sj3-filename (aref dic 0)) + (aref dic 1))) + (if (< dic-id 0) + (egg-error "Dame2") ; XXX + (setq dict-list (cons dic-id dict-list) + l (cdr l))))) + (setq sj3-environment (vector proc dict-list))))) + +(defun sj3-open-freq-info (proc name) + (let ((trying t) + ret) + (while trying + (setq ret (sj3rpc-open-stdy proc name)) + (if (= ret 0) + (setq trying nil) + (message "$B3X=,%U%!%$%k(B(%s)$B$,$"$j$^$;$s(B" name) + (if (/= ret (SJ3-const FileNotExist)) + (egg-error "Fatal1") ; XXX + (if (and (y-or-n-p + (format "$B3X=,%U%!%$%k(B(%s)$B$,$"$j$^$;$s!#:n$j$^$9$+(B? " + name)) + (sj3rpc-make-directory proc + (file-name-directory name)) + ;; ignore error + (= (sj3rpc-make-stdy proc name) 0)) + (message "$B3X=,%U%!%$%k(B(%s)$B$r:n$j$^$7$?(B" name) + (egg-error "Fatal2"))))))) ; XXX + +(defun sj3-open-dictionary (proc name passwd) + (let ((trying t) + ret) + (while trying + (setq ret (sj3rpc-open-dictionary proc name passwd)) + (if (>= ret 0) + (setq trying nil) + (message "$B<-=q%U%!%$%k(B(%s)$B$,$"$j$^$;$s(B" name) + (setq ret (- ret)) ; Get error code. + (if (/= ret (SJ3-const FileNotExist)) + (egg-error "Fatal3 %d" ret) ; XXX + (if (and (y-or-n-p + (format "$B<-=q%U%!%$%k(B(%s)$B$,$"$j$^$;$s!#:n$j$^$9$+(B? " + name)) + (= (sj3rpc-make-dictionary proc name) 0)) + (message "$B<-=q%U%!%$%k(B(%s)$B$r:n$j$^$7$?(B" name) + (egg-error "Fatal4"))))) ; XXX + ret)) + +(defun sj3-start-conversion (backend yomi &optional context) + "Convert YOMI string to kanji, and enter conversion mode. +Return the list of bunsetsu." + (let ((env (sj3-get-environment))) + (sj3rpc-begin env yomi))) + +(defun sj3-end-conversion (bunsetsu-list abort) + (if abort + () + (let ((env (sj3bunsetsu-get-env (car bunsetsu-list))) + (l bunsetsu-list) + bunsetsu stdy kugiri-changed) + (while l + (setq bunsetsu (car l)) + (setq l (cdr l)) + (setq stdy (sj3bunsetsu-get-stdy bunsetsu)) + (if stdy + (sj3rpc-bunsetsu-stdy env stdy)) + (if (setq kugiri-changed (sj3bunsetsu-get-kugiri-changed bunsetsu)) + (let ((yomi1 (sj3bunsetsu-get-source bunsetsu)) + (yomi2 (sj3bunsetsu-get-source (car l)))) + (if (/= kugiri-changed (length yomi1)) + (sj3rpc-kugiri-stdy env yomi1 yomi2 + (sj3bunsetsu-get-stdy (car l)))))))))) + +(defun sj3-list-candidates (bunsetsu prev-bunsetsu next-bunsetsu major) + (setq bunsetsu (car bunsetsu)) + (if (sj3bunsetsu-get-zenkouho bunsetsu) + (cons (sj3bunsetsu-get-zenkouho-pos bunsetsu) + (sj3bunsetsu-get-zenkouho-converted bunsetsu)) + (let* ((env (sj3bunsetsu-get-env bunsetsu)) + (yomi (sj3bunsetsu-get-source bunsetsu)) + (z (sj3rpc-get-bunsetsu-candidates env yomi))) + (sj3bunsetsu-set-zenkouho bunsetsu z) + (cons (sj3bunsetsu-set-zenkouho-pos bunsetsu 0) + (sj3bunsetsu-set-zenkouho-converted + bunsetsu + (mapcar 'sj3bunsetsu-get-converted z)))))) + +(defun sj3-decide-candidate (bunsetsu candidate-pos prev-b next-b) + (setq bunsetsu (car bunsetsu)) + (let* ((candidate-list (sj3bunsetsu-get-zenkouho bunsetsu)) + (candidate (nth candidate-pos candidate-list))) + (sj3bunsetsu-set-zenkouho candidate candidate-list) + (sj3bunsetsu-set-zenkouho-pos candidate candidate-pos) + (sj3bunsetsu-set-zenkouho-converted + candidate (sj3bunsetsu-get-zenkouho-converted bunsetsu)) + (list (list candidate)))) + +(defun sj3-change-bunsetsu-length (bunsetsu prev-b next-b len major) + (let ((yomi (apply 'concat (mapcar 'sj3bunsetsu-get-source bunsetsu))) + (env (sj3bunsetsu-get-env (car bunsetsu))) + (old (car bunsetsu)) + new yomi1 yomi2) + (setq yomi1 (substring yomi 0 len) + yomi2 (substring yomi len)) + (setq new (sj3rpc-tanbunsetsu-conversion env yomi1)) + ;; Only set once (memory original length of the bunsetsu). + (sj3bunsetsu-set-kugiri-changed new + (or (sj3bunsetsu-get-kugiri-changed old) + (length (sj3bunsetsu-get-source old)))) + (if (> (length yomi2) 0) + (list (list new (sj3rpc-tanbunsetsu-conversion env yomi2))) + (list (list new))))) + +(defun sj3-finalize-backend () + (if sj3-environment + (let ((proc (sj3env-get-proc sj3-environment)) + (dict-list (sj3env-get-dictionary-list sj3-environment)) + dict) + (while dict-list + (setq dict (car dict-list)) + (setq dict-list (cdr dict-list)) + (sj3rpc-close-dictionary proc dict)) ; XXX: check error + (sj3rpc-close-stdy proc) + (sj3rpc-close proc) + (setq sj3-environment nil)))) + +;;; setup + +(load "egg/sj3rpc") +(run-hooks 'sj3-load-hook) + +;;;###autoload +(defun egg-activate-sj3 (&rest arg) + "Activate SJ3 backend of Tamagotchy." + (apply 'egg-mode (append arg sj3-backend-alist))) + +;;; egg/sj3.el ends here. diff --git a/egg/sj3rpc.el b/egg/sj3rpc.el new file mode 100644 index 0000000..f3ad8b2 --- /dev/null +++ b/egg/sj3rpc.el @@ -0,0 +1,292 @@ +;;; egg/sj3rpc.el --- SJ3 Support (low level interface) in Egg +;;; Input Method Architecture + +;; Copyright (C) 1999, 2000 Free Software Foundation, Inc + +;; Author: NIIBE Yutaka + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + + +;;; Code: + + + +;; Only support SJ3 version 2. + +(eval-when-compile + (require 'egg-com) +;; (load-library "egg/sj3") + (defmacro sj3-const (c) + (cond ((eq c 'OPEN) 1) + ((eq c 'CLOSE) 2) + ((eq c 'DICADD) 11) + ((eq c 'DICDEL) 12) + ((eq c 'OPENSTDY) 21) + ((eq c 'CLOSESTDY) 22) + ((eq c 'STDYSIZE) 23) + ((eq c 'LOCK) 31) + ((eq c 'UNLOCK) 32) + ((eq c 'BEGIN) 41) + ((eq c 'BEGIN_EUC) 111) + ((eq c 'TANCONV) 51) + ((eq c 'TANCONV_EUC) 112) + ((eq c 'KOUHO) 54) + ((eq c 'KOUHO_EUC) 115) + ((eq c 'KOUHOSU) 55) + ((eq c 'KOUHOSU_EUC) 116) + ((eq c 'STDY) 61) + ((eq c 'CLSTDY) 62) + ((eq c 'CLSTDY_EUC) 117) + ((eq c 'WREG) 71) + ((eq c 'WREG_EUC) 118) + ((eq c 'WDEL) 72) + ((eq c 'WDEL_EUC) 119) + ((eq c 'MKDIC) 81) + ((eq c 'MKSTDY) 82) + ((eq c 'MKDIR) 83) + ((eq c 'ACCESS) 84) + ((eq c 'WSCH) 91) + ((eq c 'WSCH_EUC) 120) + ((eq c 'WNSCH) 92) + ((eq c 'WNSCH_EUC) 121) + ((eq c 'VERSION) 103) + (t (error "No such constant"))))) + +;; XXX +(defconst sj3rpc-error-message (vector )) + +(defun sj3rpc-get-error-message (errno) + (or (and (>= errno 0) + (< errno (length sj3rpc-error-message)) + (aref sj3rpc-error-message errno)) + (format "#%d" errno))) + +(defmacro sj3rpc-call-with-environment (e vlist send-expr &rest receive-exprs) + (let ((v (append + `((proc (sj3env-get-proc ,e))) + vlist))) + (list + 'let v + (append + `(save-excursion + (set-buffer (process-buffer proc)) + (erase-buffer) + ,send-expr + (process-send-region proc (point-min) (point-max)) + (goto-char (prog1 (point) (accept-process-output proc)))) + receive-exprs)))) + +(defun sj3rpc-open (proc myhostname username) + "Open the session. Return 0 on success, error code on failure." + (comm-call-with-proc proc (result) + (comm-format (u u s s s) (sj3-const OPEN) 2 ; Server version + myhostname username + ;; program name + (format "%d.emacs-egg" (emacs-pid))) + (comm-unpack (u) result) + (if (= result -2) + 0 + result))) + +(defun sj3rpc-close (proc) + (comm-call-with-proc proc (result) + (comm-format (u) (sj3-const CLOSE)) + (comm-unpack (u) result) + result)) + +(defun sj3rpc-get-stdy-size (proc) + "Return STDYSIZE of SJ3 server. On failure, return error code." + (comm-call-with-proc proc (result) + (comm-format (u) (sj3-const STDYSIZE)) + (comm-unpack (u) result) + (if (/= result 0) + (- result) ; failure + (comm-unpack (u) result) + result))) + +(defsubst sj3rpc-get-stdy (proc) + (let ((n 0) + (stdy (make-vector sj3-stdy-size 0))) + (while (< n sj3-stdy-size) + (comm-unpack (b) r) + (aset stdy n r) + (setq n (1+ n))) + stdy)) + +(defun sj3rpc-begin (env yomi) + "Begin conversion." + (let ((yomi-ext (encode-coding-string yomi 'euc-japan)) + (p 0) + len source converted stdy bunsetsu-list bl) + (sj3rpc-call-with-environment env (result) + (comm-format (u s) (sj3-const BEGIN_EUC) yomi-ext) + (comm-unpack (u) result) + (if (/= result 0) + (- result) ; failure + (comm-unpack (u) result) ; skip + (while (progn + (comm-unpack (b) len) + (> len 0)) + (setq stdy (sj3rpc-get-stdy proc)) + (comm-unpack (E) converted) + (setq source + (decode-coding-string (substring yomi-ext p (+ p len)) + 'euc-japan) + p (+ p len)) + (let ((bl1 (cons (sj3-make-bunsetsu env + source converted nil stdy) nil))) + (if bl + (setq bl (setcdr bl bl1)) + (setq bunsetsu-list (setq bl bl1))))) + bunsetsu-list)))) + +(defun sj3rpc-open-dictionary (proc dict-file-name password) + (comm-call-with-proc proc (result) + (comm-format (u s s) (sj3-const DICADD) dict-file-name password) + (comm-unpack (u) result) + (if (/= result 0) + (- result) ; failure + (comm-unpack (u) result) + result))) + +(defun sj3rpc-close-dictionary (proc dict-no) + (comm-call-with-proc proc (result) + (comm-format (u u) (sj3-const DICDEL) dict-no) + (comm-unpack (u) result) + result)) + +(defun sj3rpc-make-dictionary (proc dict-name) + (comm-call-with-proc proc (result) + (comm-format (u s u u u) (sj3-const MKDIC) dict-name + 2048 ; Index length + 2048 ; Length + 256 ; Number + ) + (comm-unpack (u) result) + result)) + +(defun sj3rpc-open-stdy (proc stdy-name) + (comm-call-with-proc proc (result) + (comm-format (u s s) (sj3-const OPENSTDY) stdy-name "") + (comm-unpack (u) result) + result)) + +(defun sj3rpc-close-stdy (proc) + (comm-call-with-proc proc (result) + (comm-format (u) (sj3-const CLOSESTDY)) + (comm-unpack (u) result) + result)) + +(defun sj3rpc-make-stdy (proc stdy-name) + (comm-call-with-proc proc (result) + (comm-format (u s u u u) (sj3-const MKSTDY) stdy-name + 2048 ; Number + 1 ; Step + 2048 ; Length + ) + (comm-unpack (u) result) + result)) + +(defun sj3rpc-make-directory (proc name) + (comm-call-with-proc proc (result) + (comm-format (u s) (sj3-const MKDIR) name) + (comm-unpack (u) result) + result)) + +(defun sj3rpc-get-bunsetsu-candidates-sub (proc env yomi yomi-ext len n) + (let ((i 0) + stdy converted bunsetsu bl bunsetsu-list cylen rest) + (comm-call-with-proc-1 proc (result) + (comm-format (u u s) (sj3-const KOUHO_EUC) len yomi-ext) + (comm-unpack (u) result) + (if (/= result 0) + (- result) ; failure + (while (< i n) + (comm-unpack (u) cylen) + (setq stdy (sj3rpc-get-stdy proc)) + (comm-unpack (E) converted) + (setq rest (decode-coding-string + (substring yomi-ext cylen) 'euc-japan)) + (setq bunsetsu (sj3-make-bunsetsu env yomi converted rest stdy)) + (if bl + (setq bl (setcdr bl (cons bunsetsu nil))) + (setq bunsetsu-list (setq bl (cons bunsetsu nil)))) + (setq i (1+ i))) + (setq bunsetsu (sj3-make-bunsetsu env yomi yomi nil nil)) + (setq bl (setcdr bl (cons bunsetsu nil))) + (setq bunsetsu + (sj3-make-bunsetsu env yomi (japanese-katakana yomi) nil nil)) + (setq bl (setcdr bl (cons bunsetsu nil))) + bunsetsu-list)))) + +(defun sj3rpc-get-bunsetsu-candidates (env yomi) + (let* ((yomi-ext (encode-coding-string yomi 'euc-japan)) + (len (length yomi-ext))) + (sj3rpc-call-with-environment env (result) + (comm-format (u u s) (sj3-const KOUHOSU_EUC) len yomi-ext) + (comm-unpack (u) result) + (if (/= result 0) + (- result) ; failure + (comm-unpack (u) result) + (if (= result 0) + (list (sj3-make-bunsetsu env yomi yomi nil nil)) ; XXX + (sj3rpc-get-bunsetsu-candidates-sub proc env + yomi yomi-ext len result)))))) + +(defun sj3rpc-tanbunsetsu-conversion (env yomi) + (let* ((yomi-ext (encode-coding-string yomi 'euc-japan)) + (len (length yomi-ext)) cylen stdy converted rest) + (sj3rpc-call-with-environment env (result) + (comm-format (u u s) (sj3-const TANCONV_EUC) len yomi-ext) + (comm-unpack (u) result) + (if (/= result 0) + (- result) + (comm-unpack (u) cylen) + (setq stdy (sj3rpc-get-stdy proc)) + (comm-unpack (E) converted) + (setq rest (decode-coding-string + (substring yomi-ext cylen) 'euc-japan)) + (setq bunsetsu (sj3-make-bunsetsu env yomi converted rest stdy)))))) + +(defun sj3rpc-bunsetsu-stdy (env stdy) + (sj3rpc-call-with-environment env (result) + (comm-format (u v) (sj3-const STDY) stdy (length stdy)) + (comm-unpack (u) result) + (if (/= result 0) + (- result) + 0))) + +(defun sj3rpc-kugiri-stdy (env yomi1 yomi2 stdy) + (let* ((yomi1-ext (encode-coding-string yomi1 'euc-japan)) + (yomi2-ext (encode-coding-string yomi2 'euc-japan))) + (sj3rpc-call-with-environment env (result) + (comm-format (u s s v) (sj3-const CLSTDY_EUC) + yomi1-ext yomi2-ext stdy (length stdy)) + (comm-unpack (u) result) + (if (/= result 0) + (- result) + 0)))) + +;;; egg/sj3rpc.el ends here. diff --git a/egg/wnn.el b/egg/wnn.el new file mode 100644 index 0000000..c2cb2c0 --- /dev/null +++ b/egg/wnn.el @@ -0,0 +1,2096 @@ +;;; egg/wnn.el --- WNN Support (high level interface) in Egg +;;; Input Method Architecture + +;; Copyright (C) 1999,2000 PFU LIMITED + +;; Author: NIIBE Yutaka +;; KATAYAMA Yoshio + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + + +;;; Code: + +(require 'egg) +(require 'egg-edep) + +(defgroup wnn nil + "Wnn interface for Tamagotchy" + :group 'egg) + +(defcustom wnn-auto-save-dictionaries 0 + "*Save dictionaries automatically after N-th end conversion, if positive" + :group 'wnn :type 'integer) + +(defcustom wnn-use-v3-eggrc nil + "*Enable old style eggrc, if non-NIL" + :group 'wnn :type 'boolean) + +(defcustom wnn-use-bixing (not wnn-use-v3-eggrc) + "*Enable bixing (stroke) input-method, if non-NIL" + :group 'wnn :type 'boolean) + +(defcustom wnn-force-set-environment nil + "*Regardless the existence of the Wnn environment in the server, +reset the environment, if non-NIL. Otherwise, reset the environment +only when it is created." + :group 'wnn :type 'boolean) + +(defcustom wnn-one-level-conversion nil + "*Don't use major clause (dai bunsetu/da wenjie/dae munjeol), if non-NIL." + :group 'wnn :type 'boolean) + +(defcustom wnn-usr-dic-dir (concat "usr/" (user-login-name)) + "*Directory of user dictionary for Wnn." + :group 'wnn + :type 'string) + +(defcustom wnn-user-name (or (getenv "WNNUSER") (user-login-name)) + "User name at Wnn server. Default value is login name or +WNNUSER evironment variable, if it is defined." + :group 'wnn :type 'string) + +(defcustom wnn-uniq-level 'wnn-uniq + "Uniq level for candidate selection. +wnn-no-uniq: Use all candidates. +wnn-uniq-entry: Use only one among same dictionary entry candidates. +wnn-uniq: Use only one among same hinshi candidates. (default) +wnn-uniq-kanji: Use only one among same kanji candidates." + :group 'wnn :type '(choice (const wnn-no-uniq) + (const wnn-uniq-entry) + (const wnn-uniq) + (const wnn-uniq-kanji))) + +(defcustom wnn-jserver nil + "jserver hostname list. Use N-th port, if hostname is followed +by ':' and digit N." + :group 'wnn :type '(repeat string)) +(defcustom wnn-cserver nil + "cserver hostname list. Use N-th port, if hostname is followed +by ':' and digit N." + :group 'wnn :type '(repeat string)) +(defcustom wnn-tserver nil + "tserver hostname list. Use N-th port, if hostname is followed +by ':' and digit N." + :group 'wnn :type '(repeat string)) +(defcustom wnn-kserver nil + "kserver hostname list. Use N-th port, if hostname is followed + by ':' and digit N." + :group 'wnn :type '(repeat string)) + +(defcustom wnn-jport 22273 "jserver port number" :group 'wnn :type 'integer) +(defcustom wnn-cport 22289 "cserver port number" :group 'wnn :type 'integer) +(defcustom wnn-tport 22321 "tserver port number" :group 'wnn :type 'integer) +(defcustom wnn-kport 22305 "kserver port number" :group 'wnn :type 'integer) + +(defmacro wnn-backend-plist () + ''(egg-initialize-backend wnn-init + egg-start-conversion wnn-start-conversion + egg-get-bunsetsu-source wnn-get-bunsetsu-source + egg-get-bunsetsu-converted wnn-get-bunsetsu-converted + egg-get-source-language wnn-get-source-language + egg-get-converted-language wnn-get-converted-language + egg-major-bunsetsu-continue-p wnn-major-bunsetsu-continue-p + egg-list-candidates wnn-list-candidates + egg-decide-candidate wnn-decide-candidate + egg-change-bunsetsu-length wnn-change-bunsetsu-length + egg-bunsetsu-combinable-p wnn-bunsetsu-combinable-p + egg-end-conversion wnn-end-conversion + egg-word-inspection wnn-word-inspection + egg-word-registration wnn-word-registration)) + +(defun wnn-backend-func-name (name lang &optional env) + (intern (concat name "-" (symbol-name lang) + (and env "-") (and env (symbol-name env))))) + +(defun wnn-make-backend (lang env &optional source-lang converted-lang) + (let ((finalize (wnn-backend-func-name "wnn-finalize-backend" lang)) + (backend (wnn-backend-func-name "wnn-backend" lang env))) + (if (null (fboundp finalize)) + (progn + (fset finalize `(lambda () (wnn-finalize-backend ',lang))) + (egg-set-finalize-backend (list finalize)))) + (if (null (get backend 'egg-start-conversion)) + (setplist backend (apply 'list + 'language lang + 'source-language (or source-lang lang) + 'converted-language (or converted-lang lang) + (wnn-backend-plist)))) + backend)) + +(defun wnn-define-backend (lang env-name-list) + (mapcar (lambda (env) + (if (consp env) + (wnn-define-backend lang env) + (wnn-make-backend lang env))) + env-name-list)) + +(wnn-make-backend 'Chinese-GB 'Q 'QianMa 'Chinese-GB) +(wnn-make-backend 'Chinese-GB 'QR 'Chinese-GB 'QianMa) +(wnn-make-backend 'Chinese-GB 'W 'WuBi 'Chinese-GB) +(wnn-make-backend 'Chinese-GB 'WR 'Chinese-GB 'WuBi) + +(defconst wnn-backend-language-alist '((QianMa . Chinese-GB) + (WuBi . Chinese-GB))) + +(defvar wnn-backend-alist nil) + +(defun wnn-define-backend-alist (deflist) + (setq wnn-backend-alist + (mapcar (lambda (slot) + (let* ((lang (car slot)) + (alt (cdr (assq lang wnn-backend-language-alist)))) + (cons lang (wnn-define-backend (or alt lang) (cdr slot))))) + deflist))) + +(defcustom wnn-backend-define-list + (if wnn-use-bixing + '((Japanese ((nil nil R)) ((R nil R))) + (Chinese-GB ((PZ PZ PZR)) ((PZR PZ PZR)) + ((QR Q QR)) ((WR W WR))) + (Chinese-CNS ((PZ PZ PZR)) ((PZR PZ PZR))) + (Korean ((nil nil R)) ((R nil R))) + (QianMa ((Q Q QR))) + (WuBi ((W W WR)))) + '((Japanese ((nil nil R)) ((R nil R))) + (Chinese-GB ((PZ PZ PZR)) ((PZR PZ PZR))) + (Chinese-CNS ((PZ PZ PZR)) ((PZR PZ PZR))) + (Korean ((nil nil R)) ((R nil R))))) + "Alist of language and lists of the Wnn backend suffixes." + :group 'wnn + :set (lambda (sym value) + (set-default sym value) + (wnn-define-backend-alist value)) + :type '(repeat + (cons + :tag "Language - Backend" + (choice :tag "Language" + (const Japanese) + (const Chinese-GB) + (const Chinese-CNS) + (const Korean) + (const QianMa) + (const WuBi) + (symbol :tag "Other")) + (repeat + (cons + :tag "Backend Sequece" + (cons :tag "First Conversion Stage" + (symbol :tag "Backend for Start Conversion") + (repeat :tag "Backends for Reconvert" + (symbol :tag "Backend"))) + (repeat + :tag "Following Conversion Stages" + (cons + :tag "N-th Stage" + (symbol :tag "Backend for This Stage") + (repeat :tag "Backends for Reconvert" + (symbol :tag "Backend"))))))))) + +(eval-when-compile + (defmacro WNN-const (c) + (cond ((eq c 'BUN_SENTOU) -1) + ((eq c 'NO_EXIST) 1) + ((eq c 'NO_MATCH) 10) + ((eq c 'IMA_OFF) -4) + ((eq c 'IMA_ON) -3) + ((eq c 'CONNECT) 1) + ((eq c 'CONNECT_BK) 1) + ((eq c 'HIRAGANA) -1) + ((eq c 'KATAKANA) -11) + ((eq c 'IKEIJI_ENTRY) -50) + ((eq c 'LEARNING_LEN) 3) + ((eq c 'MUHENKAN_DIC) -3) + ((eq c 'HINDO_NOP) -2) + ((eq c 'HINDO_INC) -3) + ((eq c 'DIC_RW) 0) + ((eq c 'DIC_RDONLY) 1) + ((eq c 'DIC_GROUP) 3) + ((eq c 'DIC_MERGE) 4) + ((eq c 'NOTRANS_LEARN) 1) + ((eq c 'BMODIFY_LEARN) 2) + ((eq c 'DIC_NO_TEMPS) ?\x3f)))) + +;; Retern value of system-name may differ from hostname. +(defconst wnn-system-name + (or (with-temp-buffer + (condition-case nil + (call-process "hostname" + nil `(,(current-buffer) nil) "hostname") + (error)) + (goto-char (point-min)) + (if (re-search-forward "[\0- ]" nil 0) + (goto-char (1- (point)))) + (if (> (point) 1) + (buffer-substring 1 (point)))) + (system-name))) + +(egg-add-message + '((nil + (wnn-connect-error "cannot connect to the server") + (wnn-fail-make-env "cannot make the Wnn environment") + (wnn-dict-saving "saving %s's frequency/dictionary information") + (wnn-dict-saved "finish to save %s's frequency/dictionary information") + (wnn-dir-missing "directory %s missing. Create it? ") + (wnn-dir-failed "failed to create directory %s") + (wnn-dir-created "directory %s created") + (wnn-dict-missing-1 "dictionary file %s is missing: %s") + (wnn-dict-missing-2 "dictionary file %s is missing. Create it? ") + (wnn-dict-created "dictionary file %s is created") + (wnn-freq-missing-1 "frequency file %s is missing: %s") + (wnn-freq-missing-2 "frequency file %s is missing. Create it? ") + (wnn-freq-created "frequency file %s is created") + (wnn-no-match "unmatch dictionary and freq. file %s. Re-create it? ") + (wnn-re-create-freq "frequency file %s is re-created") + (wnn-pseud-bunsetsu "pseud clause") + (wnn-register-1 "dictionary name:") + (wnn-register-2 "clause class name") + (wnn-no-writable-d "no writable dictionary")) + (Japanese + (wnn-connect-error "$B%5!<%P$H@\B3$G$-$^$;$s$G$7$?(B") + (wnn-fail-make-env "$B4D6-$r:n$k$3$H$O$G$-$^$;$s$G$7$?(B") + (wnn-dict-saving "%s $B$NIQEY>pJs!&<-=q>pJs$rB`Hr$7$F$$$^$9(B") + (wnn-dict-saved "%s $B$NIQEY>pJs!&<-=q>pJs$rB`Hr$7$^$7$?(B") + (wnn-dir-missing "$B%G%#%l%/%H%j(B %s $B$,$"$j$^$;$s!#:n$j$^$9$+(B? ") + (wnn-dir-failed "$B%G%#%l%/%H%j(B %s $B$N:n@.$K<:GT$7$^$7$?(B") + (wnn-dir-created "$B%G%#%l%/%H%j(B %s $B$r:n$j$^$7$?(B") + (wnn-dict-missing-1 "$B<-=q%U%!%$%k(B %s $B$,$"$j$^$;$s(B: %s") + (wnn-dict-missing-2 "$B<-=q%U%!%$%k(B %s $B$,$"$j$^$;$s!#:n$j$^$9$+(B? ") + (wnn-dict-created "$B<-=q%U%!%$%k(B %s $B$r:n$j$^$7$?(B") + (wnn-freq-missing-1 "$BIQEY%U%!%$%k(B %s $B$,$"$j$^$;$s(B: %s") + (wnn-freq-missing-2 "$BIQEY%U%!%$%k(B %s $B$,$"$j$^$;$s!#:n$j$^$9$+(B? ") + (wnn-freq-created "$BIQEY%U%!%$%k(B %s $B$r:n$j$^$7$?(B") + (wnn-no-match "$B<-=q$HIQEY(B %s $B$N@09g@-$,$"$j$^$;$s!#:n$jD>$7$^$9$+(B? ") + (wnn-re-create-freq "$BIQEY%U%!%$%k(B %s $B$r:n$jD>$7$^$7$?(B") + (wnn-pseud-bunsetsu "$B5?;wJ8@a(B") + (wnn-register-1 "$BEPO?<-=qL>(B:") + (wnn-register-2 "$BIJ;lL>(B") + (wnn-no-writable-d "$BEPO?2DG=$J<-=q$,$"$j$^$;$s(B")) + (Chinese-GB + (wnn-connect-error "$A2;D\:M(Bserver$AA,=S(B") + (wnn-fail-make-env "$A;7>32;D\44=((B") + (wnn-dict-saving "%s $A5DF56HND<~:M4G5dPEO"U}TZMK3v(B") + (wnn-dict-saved "%s $A5DF56HND<~:M4G5dPEO"RQ>-MK3vAK(B") + (wnn-dir-missing "$AD?B<(B %s $AC;SP!#R*=(A"Bp(B? ") + (wnn-dir-failed "$AD?B<(B %s $A=(A"J'0\AK(B") + (wnn-dir-created "$AD?B<(B %s $A=(A"AK(B") + (wnn-dict-missing-1 "$AWV5dND<~(B %s $AC;SP(B: %s") + (wnn-dict-missing-2 "$AWV5dND<~(B %s $AC;SP!#R*=(A"Bp(B? ") + (wnn-dict-created "$AWV5dND<~(B %s $A=(A"AK(B") + (wnn-freq-missing-1 "$AF56HND<~(B %s $AC;SP(B: %s") + (wnn-freq-missing-2 "$AF56HND<~(B %s $AC;SP!#R*=(A"Bp(B? ") + (wnn-freq-created "$AF56HND<~(B %s $A=(A"AK(B") + (wnn-no-match "$AWV5d:MF56H(B %s $A5DU{:OPTC;SP!#R*TY=(A"Bp(B? ") + (wnn-re-create-freq "$AF56HND<~(B %s $ATY=(A"AK(B") + (wnn-pseud-bunsetsu "$ARIKFND=Z(B") + (wnn-register-1 "$A5GB<4G5dC{(B:") + (wnn-register-2 "$A4JPTC{(B") + (wnn-no-writable-d "$AC;SP?ID\5GB<5D4G5d(B")) + (Chinese-CNS + (wnn-connect-error "$(GDbWdLO(Bserver$(G]YZY(B") + (wnn-fail-make-env "$(Gt?h:DbWd^6Pz(B") + (wnn-dict-saving "%s $(GN{s"PyEFG5LOy0L(OjUIF_GcXMEx(B") + (wnn-dict-saved "%s $(GN{s"PyEFG5LOy0L(OjUIDXenXMExD'(B") + (wnn-dir-missing "$(GFxrg(B %s $(GJtH4!$SQPzG!cC(B? ") + (wnn-dir-failed "$(GFxrg(B %s $(GPzG!FBZuD'(B") + (wnn-dir-created "$(GFxrg(B %s $(GPzG!D'(B") + (wnn-dict-missing-1 "$(GGsL(EFG5(B %s $(GJtH4(B: %s") + (wnn-dict-missing-2 "$(GGsL(EFG5(B %s $(GJtH4!$SQPzG!cC(B? ") + (wnn-dict-created "$(GGsL(EFG5(B %s $(GPzG!D'(B") + (wnn-freq-missing-1 "$(Gs"PyEFG5(B %s $(GJtH4(B: %s") + (wnn-freq-missing-2 "$(Gs"PyEFG5(B %s $(GJtH4!$SQPzG!cC(B? ") + (wnn-freq-created "$(Gs"PyEFG5(B %s $(GPzG!D'(B") + (wnn-no-match "$(GGsL(LOs"Py(B %s $(GN{plLOMLJtH4!$SQGBPzG!cC(B? ") + (wnn-re-create-freq "$(Gs"PyEFG5(B %s $(GGBPzG!D'(B") + (wnn-pseud-bunsetsu "$(GijH}EFeg(B") + (wnn-register-1 "$(G`trgy0L(GX(B:") + (wnn-register-2 "$(Gb$MLGX(B") + (wnn-no-writable-d "$(GJtH4F+Wd`trgN{GsL((B")) + (Korean + (wnn-connect-error "$(C<-9v(B(Server) $(C?M(B $(CA"CKGR(B $(Cx@>4O4Y(B") + (wnn-fail-make-env "$(CH/0f@;(B $(C@[<:GR(B $(Cx@>4O4Y(B") + (wnn-dict-saving "%s $(C@G(B $(C:s55A$:8?M(B $(C;g@|A$:88&(B $(C<<@L:jGO0m(B $(C@V=@4O4Y(B") + (wnn-dict-saved "%s $(C@G(B $(C:s55A$:8?M(B $(C;g@|A$:88&(B $(C<<@L:jG_=@4O4Y(B") + (wnn-dir-missing "$(C5p7:Ed8.(B %s $(C@L(B $(C>x@>4O4Y#.@[<:GO0Z=@4O1n(B? ") + (wnn-dir-failed "$(C5p7:Ed8.(B %s $(C@;(B $(C@[<:GR(B $(Cx@>4O4Y(B") + (wnn-dir-created "$(C5p7:Ed8.(B %s $(C@;(B $(C@[<:G_=@4O4Y(B") + (wnn-dict-missing-1 "$(C;g@|H-@O(B %s $(C@L(B $(C>x@>4O4Y(B: %s") + (wnn-dict-missing-2 "$(C;g@|H-@O(B %s $(C@L(B $(C>x@>4O4Y#.4Y=C(B $(C@[<:GO0Z=@4O1n(B? ") + (wnn-dict-created "$(C;g@|H-@O(B %s $(C@;(B $(C@[<:G_=@4O4Y(B") + (wnn-freq-missing-1 "$(C:s55H-@O(B %s $(C@L(B $(C>x@>4O4Y(B: %s") + (wnn-freq-missing-2 "$(C:s55H-@O(B %s $(C@L(B $(C>x@>4O4Y#.4Y=C(B $(C@[<:GO0Z=@4O1n(B? ") + (wnn-freq-created "$(C:s55H-@O(B %s $(C@;(B $(C@[<:G_=@4O4Y(B") + (wnn-no-match "$(C;g@|0z(B $(C:s55(B %s $(C0!(B $(C8BAv(B $(C>J=@4O4Y#.4Y=C(B $(C@[<:GO0Z=@4O1n(B? ") + (wnn-re-create-freq "$(C:s55H-@O(B %s $(C@;(B $(C4Y=C(B $(C@[<:G_=@4O4Y(B") + (wnn-pseud-bunsetsu "$(C@G;g9.@}(B") + (wnn-register-1 "$(C5n7O;g@|8m(B:") + (wnn-register-2 "$(CG0;g8m(B") + (wnn-no-writable-d "$(C5n7O(B $(C0!4IGQ(B $(CAvA$@L(B $(C>F4U4O4Y(B")))) + +;; ::= [ +;; ] + +(defun wnnenv-create (proc env-id &optional server-type wnn-version + backend tankan name) + (if name + (set (setq name (make-symbol name)) (make-vector 5 nil))) + (vector proc env-id server-type wnn-version backend tankan name + (make-vector 2 (WNN-const DIC_RDONLY)))) + +(defsubst wnnenv-get-proc (env) (aref env 0)) +(defsubst wnnenv-get-env-id (env) (aref env 1)) +(defsubst wnnenv-get-server-type (env) (aref env 2)) +(defsubst wnnenv-get-wnn-version (env) (aref env 3)) +(defsubst wnnenv-get-backend (env) (aref env 4)) +(defsubst wnnenv-get-tankan (env) (aref env 5)) + +(defun wnnenv-get-client-file (env name) + (let ((hash (intern-soft name (symbol-value (aref env 6))))) + (and hash (symbol-value hash)))) + +(defun wnnenv-set-client-file (env name) + (set (intern (concat wnn-system-name "!" name) (symbol-value (aref env 6))) + name)) + +(defsubst wnnenv-get-hinshi (env h) (or (get (aref env 6) h) -1)) +(defsubst wnnenv-set-hinshi (env h v) (put (aref env 6) h v)) + +(defsubst wnnenv-get-auto-learn (env) (aref env 7)) +(defsubst wnnenv-get-notrans (env) (aref (wnnenv-get-auto-learn env) 0)) +(defsubst wnnenv-get-bmodify (env) (aref (wnnenv-get-auto-learn env) 1)) +(defsubst wnnenv-set-notrans (env v) (aset (wnnenv-get-auto-learn env) 0 v)) +(defsubst wnnenv-set-bmodify (env v) (aset (wnnenv-get-auto-learn env) 1 v)) + +(defsubst wnnenv-is-wnn6 (env) (eq (wnnenv-get-wnn-version env) 'wnn6)) + +(defvar wnn-environments nil + "Environment for Wnn conversion server") + +;; ::= [ +;; +;; +;; +;; +;; ] +;; +;; ::= [ ] +;; + +(defsubst wnn-bunsetsu-create (env jirilen dic-no entry freq right-now hinshi + status status-backward kangovect evaluation) + (egg-bunsetsu-create (wnnenv-get-backend env) + (vector env jirilen dic-no entry freq right-now hinshi + status status-backward kangovect evaluation + nil nil nil nil nil nil nil nil nil nil))) + +(defsubst wnn-bunsetsu-get-env (b) + (aref (egg-bunsetsu-get-info b) 0)) +(defsubst wnn-bunsetsu-get-jirilen (b) + (aref (egg-bunsetsu-get-info b) 1)) +(defsubst wnn-bunsetsu-get-dic-no (b) + (aref (egg-bunsetsu-get-info b) 2)) +(defsubst wnn-bunsetsu-set-dic-no (b dic) + (aset (egg-bunsetsu-get-info b) 2 dic)) +(defsubst wnn-bunsetsu-get-entry (b) + (aref (egg-bunsetsu-get-info b) 3)) +(defsubst wnn-bunsetsu-set-entry (b ent) + (aset (egg-bunsetsu-get-info b) 3 ent)) +(defsubst wnn-bunsetsu-get-freq (b) + (aref (egg-bunsetsu-get-info b) 4)) +(defsubst wnn-bunsetsu-get-right-now (b) + (aref (egg-bunsetsu-get-info b) 5)) +(defsubst wnn-bunsetsu-get-hinshi (b) + (aref (egg-bunsetsu-get-info b) 6)) +(defsubst wnn-bunsetsu-get-status (b) + (aref (egg-bunsetsu-get-info b) 7)) +(defsubst wnn-bunsetsu-get-status-backward (b) + (aref (egg-bunsetsu-get-info b) 8)) +(defsubst wnn-bunsetsu-get-kangovect (b) + (aref (egg-bunsetsu-get-info b) 9)) +(defsubst wnn-bunsetsu-get-evaluation (b) + (aref (egg-bunsetsu-get-info b) 10)) + +(defsubst wnn-bunsetsu-get-converted (b) + (aref (egg-bunsetsu-get-info b) 11)) +(defsubst wnn-bunsetsu-set-converted (b cvt) + (aset (egg-bunsetsu-get-info b) 11 cvt)) + +(defsubst wnn-bunsetsu-get-yomi (b) + (aref (egg-bunsetsu-get-info b) 12)) +(defsubst wnn-bunsetsu-set-yomi (b yomi) + (aset (egg-bunsetsu-get-info b) 12 yomi)) + +(defsubst wnn-bunsetsu-get-fuzokugo (b) + (aref (egg-bunsetsu-get-info b) 13)) +(defsubst wnn-bunsetsu-set-fuzokugo (b fuzokugo) + (aset (egg-bunsetsu-get-info b) 13 fuzokugo)) + +(defsubst wnn-bunsetsu-get-dai-evaluation (b) + (aref (egg-bunsetsu-get-info b) 14)) +(defsubst wnn-bunsetsu-set-dai-evaluation (b de) + (aset (egg-bunsetsu-get-info b) 14 de)) + +(defsubst wnn-bunsetsu-get-dai-continue (b) + (aref (egg-bunsetsu-get-info b) 15)) +(defsubst wnn-bunsetsu-set-dai-continue (b dc) + (aset (egg-bunsetsu-get-info b) 15 dc)) + +(defsubst wnn-bunsetsu-get-change-top (b) + (aref (egg-bunsetsu-get-info b) 16)) +(defsubst wnn-bunsetsu-set-change-top (b top) + (aset (egg-bunsetsu-get-info b) 16 top)) + +(defsubst wnn-bunsetsu-get-zenkouho (b) + (aref (egg-bunsetsu-get-info b) 17)) +(defsubst wnn-bunsetsu-set-zenkouho (b z) + (aset (egg-bunsetsu-get-info b) 17 z)) + +(defsubst wnn-bunsetsu-get-freq-down (b) + (aref (egg-bunsetsu-get-info b) 18)) +(defsubst wnn-bunsetsu-set-freq-down (b fd) + (aset (egg-bunsetsu-get-info b) 18 fd)) + +(defsubst wnn-bunsetsu-get-fi-rel (b) + (aref (egg-bunsetsu-get-info b) 19)) +(defsubst wnn-bunsetsu-set-fi-rel (b fr) + (aset (egg-bunsetsu-get-info b) 19 fr)) + +(defsubst wnn-bunsetsu-get-context (b) + (aref (egg-bunsetsu-get-info b) 20)) +(defsubst wnn-bunsetsu-set-context (b c) + (aset (egg-bunsetsu-get-info b) 20 c)) + +(defsubst wnn-zenkouho-create (pos list converted dai prev-b nxet-b) + (vector pos list converted dai prev-b nxet-b)) + +(defsubst wnn-bunsetsu-get-zenkouho-pos (b) + (aref (wnn-bunsetsu-get-zenkouho b) 0)) +(defsubst wnn-bunsetsu-set-zenkouho-pos (b p) + (aset (wnn-bunsetsu-get-zenkouho b) 0 p)) + +(defsubst wnn-bunsetsu-get-zenkouho-list (b) + (aref (wnn-bunsetsu-get-zenkouho b) 1)) +(defsubst wnn-bunsetsu-get-zenkouho-converted (b) + (aref (wnn-bunsetsu-get-zenkouho b) 2)) +(defsubst wnn-bunsetsu-get-zenkouho-dai (b) + (aref (wnn-bunsetsu-get-zenkouho b) 3)) +(defsubst wnn-bunsetsu-get-zenkouho-prev-b (b) + (aref (wnn-bunsetsu-get-zenkouho b) 4)) +(defsubst wnn-bunsetsu-get-zenkouho-next-b (b) + (aref (wnn-bunsetsu-get-zenkouho b) 5)) + +(defsubst wnn-bunsetsu-connect-prev (bunsetsu) + (= (wnn-bunsetsu-get-status bunsetsu) (WNN-const CONNECT))) +(defsubst wnn-bunsetsu-connect-next (bunsetsu) + (= (wnn-bunsetsu-get-status-backward bunsetsu) (WNN-const CONNECT_BK))) + +(defsubst wnn-context-create (dic-no entry jirilen hinshi fuzokugo + converted freq right-now) + (vector dic-no entry jirilen hinshi fuzokugo + converted freq right-now + (egg-chars-in-period converted 0 (length converted)))) + +(defsubst wnn-context-dic-no (context) (aref context 0)) +(defsubst wnn-context-entry (context) (aref context 1)) +(defsubst wnn-context-jirilen (context) (aref context 2)) +(defsubst wnn-context-hinshi (context) (aref context 3)) +(defsubst wnn-context-fuzokugo (context) (aref context 4)) +(defsubst wnn-context-converted (context) (aref context 5)) +(defsubst wnn-context-right-now (context) (aref context 6)) +(defsubst wnn-context-set-right-now (context r) (aset context 6 r)) +(defsubst wnn-context-freq (context) (aref context 7)) +(defsubst wnn-context-set-freq (context f) (aset context 7 f)) +(defsubst wnn-context-length (context) (aref context 8)) + +(defun wnn-null-context () + (list (wnn-context-create -2 0 0 0 "" "" 0 0) + (wnn-context-create -2 0 0 0 "" "" 0 0))) + +(defun wnn-major-bunsetsu-set-context (bunsetsu-list context) + (while bunsetsu-list + (wnn-bunsetsu-set-context (car bunsetsu-list) context) + (setq bunsetsu-list (cdr bunsetsu-list)))) + +(defsubst wnn-bunsetsu-equal (bunsetsu-1 bunsetsu-2) + (and (= (wnn-bunsetsu-get-dic-no bunsetsu-1) + (wnn-bunsetsu-get-dic-no bunsetsu-2)) + (= (wnn-bunsetsu-get-entry bunsetsu-1) + (wnn-bunsetsu-get-entry bunsetsu-2)) + (= (wnn-bunsetsu-get-kangovect bunsetsu-1) + (wnn-bunsetsu-get-kangovect bunsetsu-2)) + (equal (wnn-bunsetsu-get-converted bunsetsu-1) + (wnn-bunsetsu-get-converted bunsetsu-2)) + (equal (wnn-bunsetsu-get-fuzokugo bunsetsu-1) + (wnn-bunsetsu-get-fuzokugo bunsetsu-2)))) + +(defun wnn-bunsetsu-list-equal (b1 b2) + (while (and b1 b2 (wnn-bunsetsu-equal (car b1) (car b2))) + (setq b1 (cdr b1) + b2 (cdr b2))) + (and (null b1) (null b2))) + +(defun wnn-bunsetsu-list-copy (bunsetsu) + (mapcar (lambda (b) + (egg-bunsetsu-create (egg-bunsetsu-get-backend b) + (copy-sequence (egg-bunsetsu-get-info b)))) + bunsetsu)) + +(defconst wnn-server-info-list + ;; language server port hostname proc coding-system + '((Japanese jserver wnn-jport wnn-jserver "Wnn" (fixed-euc-jp fixed-euc-jp)) + (Chinese-GB cserver wnn-cport wnn-cserver "cWnn" (fixed-euc-py-cn fixed-euc-zy-cn)) + (Chinese-CNS tserver wnn-tport wnn-tserver "tWnn" (fixed-euc-py-tw fixed-euc-zy-tw)) + (Korean kserver wnn-kport wnn-kserver "kWnn" (fixed-euc-kr fixed-euc-kr)))) + +(defsubst wnn-server-get-info (lang) + (or (assq lang wnn-server-info-list) + (egg-error "unsupported language: %s" lang))) + +(defsubst wnn-server-language (info) + (car info)) +(defsubst wnn-server-type (info) + (nth 1 info)) +(defsubst wnn-server-port (info) + (symbol-value (nth 2 info))) +(defsubst wnn-server-hostname (info) + (symbol-value (nth 3 info))) +(defsubst wnn-server-proc-name (info) + (nth 4 info)) +(defsubst wnn-server-buffer-name (info) + (concat " *" (wnn-server-proc-name info) "*")) +(defsubst wnn-server-coding-system (info) + (nth 5 info)) + +(defconst wnn-accept-charset-alist + '((Chinese-CNS ascii chinese-sisheng chinese-cns11643-1 chinese-cns11643-2))) + +(defsubst wnn-backend-get-language (backend) + (get backend 'language)) + +(defsubst wnn-backend-get-source-language (backend) + (get backend 'source-language)) + +(defsubst wnn-backend-get-converted-language (backend) + (get backend 'converted-language)) + +(defvar wnn-prev-context nil) + +(defun wnn-start-conversion (backend yomi &optional context) + "Convert YOMI string to kanji, and enter conversion mode. +Return the list of bunsetsu." + (let ((accepts (cdr (assq (wnn-backend-get-source-language backend) + wnn-accept-charset-alist))) + env hinshi fuzokugo result) + (if accepts + (let ((charsets (mapcar 'char-charset (string-to-list yomi)))) + (while accepts + (setq charsets (delq (car accepts) charsets) + accepts (cdr accepts))) + (if charsets + (egg-error "cannot handle %s" (car charsets))))) + (setq env (wnn-get-environment backend)) + (cond ((eq (car (car-safe context)) backend) + (setq wnn-prev-context (car context) + context (cdr wnn-prev-context) + hinshi (wnn-context-hinshi (nth 1 context)) + fuzokugo (wnn-context-fuzokugo (nth 1 context)))) + ((listp context) + (setq wnn-prev-context (cons nil (wnn-null-context)) + context (cdr wnn-prev-context) + hinshi (WNN-const BUN_SENTOU) + fuzokugo "")) + ((eq (car wnn-prev-context) backend) + (setq context (cdr wnn-prev-context) + hinshi (wnnenv-get-hinshi env 'noun) + fuzokugo "")) + (t + (setq context (wnn-null-context) + hinshi (wnnenv-get-hinshi env 'noun) + fuzokugo ""))) + (setq result (wnn-renbunsetsu-conversion env yomi hinshi fuzokugo nil + context)) + (if (numberp result) + (egg-error "%s" (wnnrpc-get-error-message (- result)))) + result)) + +(defun wnn-get-source-language (bunsetsu) + (wnn-backend-get-source-language (egg-bunsetsu-get-backend bunsetsu))) + +(defun wnn-get-converted-language (bunsetsu) + (wnn-backend-get-converted-language (egg-bunsetsu-get-backend bunsetsu))) + +(defun wnn-get-bunsetsu-converted (bunsetsu) + (concat (wnn-bunsetsu-get-converted bunsetsu) + (wnn-bunsetsu-get-fuzokugo bunsetsu))) + +(defun wnn-get-bunsetsu-source (bunsetsu) + (concat (wnn-bunsetsu-get-yomi bunsetsu) + (wnn-bunsetsu-get-fuzokugo bunsetsu))) + +(defun wnn-get-major-bunsetsu-converted (bunsetsu) + (mapconcat 'wnn-get-bunsetsu-converted bunsetsu "")) + +(defun wnn-get-major-bunsetsu-source (bunsetsu) + (mapconcat 'wnn-get-bunsetsu-source bunsetsu "")) + +(defun wnn-major-bunsetsu-continue-p (bunsetsu) + (wnn-bunsetsu-get-dai-continue bunsetsu)) + +(defun wnn-uniq-hash (bunsetsu hash-table) + (intern (mapconcat (lambda (b) + (concat (cond + ((eq wnn-uniq-level 'wnn-uniq) + (wnn-bunsetsu-get-hinshi b)) + ((eq wnn-uniq-level 'wnn-uniq-entry) + (concat (wnn-bunsetsu-get-dic-no b) + "+" + (wnn-bunsetsu-get-entry b)))) + (concat "\0" + (wnn-bunsetsu-get-converted b) + "\0" + (wnn-bunsetsu-get-fuzokugo b)))) + bunsetsu "\0") + hash-table)) + +(defun wnn-uniq-candidates (candidates) + (if (eq wnn-uniq-level 'wnn-no-uniq) + candidates + (let ((hash-table (make-vector (length candidates) 0))) + (delq nil (mapcar (lambda (b) + (let ((sym (wnn-uniq-hash b hash-table))) + (if (null (boundp sym)) + (set sym b)))) + candidates))))) + +(defsubst wnn-uniq-bunsetsu-equal (bunsetsu-1 bunsetsu-2) + (and (or (eq wnn-uniq-level 'wnn-uniq-kanji) + (and (eq wnn-uniq-level 'wnn-uniq) + (= (wnn-bunsetsu-get-hinshi bunsetsu-1) + (wnn-bunsetsu-get-hinshi bunsetsu-2))) + (and (= (wnn-bunsetsu-get-dic-no bunsetsu-1) + (wnn-bunsetsu-get-dic-no bunsetsu-2)) + (= (wnn-bunsetsu-get-entry bunsetsu-1) + (wnn-bunsetsu-get-entry bunsetsu-2)) + (or (eq wnn-uniq-level 'wnn-uniq-entry) + (= (wnn-bunsetsu-get-kangovect bunsetsu-1) + (wnn-bunsetsu-get-kangovect bunsetsu-2))))) + (equal (wnn-bunsetsu-get-converted bunsetsu-1) + (wnn-bunsetsu-get-converted bunsetsu-2)) + (equal (wnn-bunsetsu-get-fuzokugo bunsetsu-1) + (wnn-bunsetsu-get-fuzokugo bunsetsu-2)))) + +(defun wnn-uniq-bunsetsu-list-equal (b1 b2) + (while (and b1 b2 (wnn-uniq-bunsetsu-equal (car b1) (car b2))) + (setq b1 (cdr b1) + b2 (cdr b2))) + (and (null b1) (null b2))) + +(defun wnn-candidate-pos (bunsetsu candidates) + (let ((n 0) + pos) + (while (and (null pos) candidates) + (if (wnn-uniq-bunsetsu-list-equal (car candidates) bunsetsu) + (setq pos n) + (setq candidates (cdr candidates) + n (1+ n)))) + (or pos -1))) + +(defun wnn-get-candidates-converted (candidates) + (mapcar 'wnn-get-major-bunsetsu-converted candidates)) + +(defun wnn-set-candidate-info (bunsetsu zenkouho) + (wnn-bunsetsu-set-zenkouho (car bunsetsu) zenkouho) + (mapcar (lambda (b) (wnn-bunsetsu-set-zenkouho b t)) (cdr bunsetsu))) + +(defun wnn-list-candidates (bunsetsu prev-b next-b major) + (let* ((head (car bunsetsu)) + (backend (egg-bunsetsu-get-backend head)) + (env (wnn-bunsetsu-get-env head)) + (yomi (wnn-get-major-bunsetsu-source bunsetsu)) + (continue (eq (wnn-bunsetsu-get-zenkouho head) t)) + pos cand converted hinshi fuzokugo v) + (if prev-b + (setq prev-b (egg-get-bunsetsu-tail prev-b) + hinshi (wnn-bunsetsu-get-hinshi prev-b) + fuzokugo (wnn-bunsetsu-get-fuzokugo prev-b)) + (setq hinshi -1 + fuzokugo "")) + (if next-b + (setq next-b (car next-b) + v (wnn-bunsetsu-get-kangovect next-b))) + (if (vectorp (wnn-bunsetsu-get-zenkouho head)) + (setq pos (wnn-bunsetsu-get-zenkouho-pos head) + cand (wnn-bunsetsu-get-zenkouho-list head))) + (if (and pos + (wnn-bunsetsu-list-equal bunsetsu (nth pos cand)) + (eq major (wnn-bunsetsu-get-zenkouho-dai head)) + (eq prev-b (wnn-bunsetsu-get-zenkouho-prev-b head)) + (eq next-b (wnn-bunsetsu-get-zenkouho-next-b head))) + (cons pos (wnn-bunsetsu-get-zenkouho-converted head)) + (setq cand (wnn-get-bunsetsu-candidates env yomi hinshi fuzokugo v major)) + (if (numberp cand) + (egg-error "%s" (wnnrpc-get-error-message (- cand)))) + (setq pos (wnn-candidate-pos bunsetsu cand)) + (cond ((< pos 0) + (setq cand (cons (wnn-bunsetsu-list-copy bunsetsu) cand))) + ((and (> pos 0) + (null (eq (wnn-bunsetsu-get-zenkouho head) t))) + (setq cand (cons (nth pos cand) (delq (nth pos cand) cand))))) + (setq cand (wnn-uniq-candidates cand) + pos (wnn-candidate-pos bunsetsu cand) + converted (wnn-get-candidates-converted cand)) + (wnn-set-candidate-info bunsetsu + (wnn-zenkouho-create pos cand converted + major prev-b next-b)) + (wnn-add-freq-down head cand) + (cons pos converted)))) + +(defun wnn-decide-candidate (bunsetsu pos prev-b next-b) + (let* ((head (car bunsetsu)) + (cand-list (wnn-bunsetsu-get-zenkouho-list head)) + (cand (nth pos cand-list)) + (c-head (car cand))) + (wnn-bunsetsu-set-zenkouho-pos head pos) + (wnn-bunsetsu-set-change-top c-head (wnn-bunsetsu-get-change-top head)) + (wnn-bunsetsu-set-freq-down c-head (wnn-bunsetsu-get-freq-down head)) + (wnn-merge-fi-rel c-head bunsetsu) + (wnn-major-bunsetsu-set-context cand (wnn-bunsetsu-get-context head)) + (wnn-set-candidate-info cand (wnn-bunsetsu-get-zenkouho head)) + (if (and prev-b (null wnn-one-level-conversion)) + (progn + (setq prev-b (list (egg-get-bunsetsu-tail prev-b))) + (wnn-bunsetsu-set-dai-continue (car prev-b) + (wnn-bunsetsu-connect-prev c-head)))) + (if next-b + (setq next-b (list (car next-b)))) + (list cand prev-b next-b))) + +(defun wnn-change-bunsetsu-length (bunsetsu prev-b next-b len major) + (let ((backend (egg-bunsetsu-get-backend (car bunsetsu))) + (env (wnn-bunsetsu-get-env (car bunsetsu))) + (tail (egg-get-bunsetsu-tail prev-b)) + (yomi (wnn-get-major-bunsetsu-source bunsetsu)) + (context (wnn-bunsetsu-get-context (car bunsetsu))) + yomi1 yomi2 hinshi fuzokugo new) + (if tail + (setq hinshi (wnn-bunsetsu-get-hinshi tail) + fuzokugo (wnn-bunsetsu-get-fuzokugo tail)) + (setq hinshi -1 + fuzokugo "")) + (setq yomi1 (substring yomi 0 len) + yomi2 (concat (substring yomi len) + (wnn-get-major-bunsetsu-source next-b))) + (setq new (wnn-tanbunsetsu-conversion env yomi1 hinshi fuzokugo nil major)) + (if (numberp new) + (egg-error "%s" (wnnrpc-get-error-message (- new)))) + (if (and prev-b (null wnn-one-level-conversion)) + (wnn-bunsetsu-set-dai-continue tail + (wnn-bunsetsu-connect-prev (car new)))) + (wnn-bunsetsu-set-change-top (car new) t) + (wnn-merge-freq-down (car new) bunsetsu) + (wnn-merge-fi-rel (car new) bunsetsu) + (wnn-merge-fi-rel (car new) next-b) + (wnn-major-bunsetsu-set-context new context) + (if (= (length yomi2) 0) + (setq next-b nil) + (setq tail (egg-get-bunsetsu-tail new) + next-b (wnn-renbunsetsu-conversion env yomi2 + (wnn-bunsetsu-get-hinshi tail) + (wnn-bunsetsu-get-fuzokugo tail) + nil context)) + (if (numberp next-b) + (egg-error "%s" (wnnrpc-get-error-message (- next-b)))) + (if (and (null major) (null wnn-one-level-conversion)) + (wnn-bunsetsu-set-dai-continue + tail + (wnn-bunsetsu-connect-prev (car next-b))))) + (list new prev-b next-b))) + +(defun wnn-add-freq-down (bunsetsu down-list) + (let ((freq-down (wnn-bunsetsu-get-freq-down bunsetsu)) + b-list b pair) + (while down-list + (setq b-list (car down-list) + down-list (cdr down-list)) + (while b-list + (setq b (car b-list) + b-list (cdr b-list) + pair (cons (wnn-bunsetsu-get-dic-no b) + (wnn-bunsetsu-get-entry b))) + (if (and (/= (wnn-bunsetsu-get-right-now b) 0) + (/= (car pair) -1) + (null (member pair freq-down))) + (setq freq-down (cons pair freq-down))))) + (wnn-bunsetsu-set-freq-down bunsetsu freq-down))) + +(defun wnn-merge-freq-down (bunsetsu b-list) + (let ((freq-down0 (wnn-bunsetsu-get-freq-down bunsetsu)) + freq-down1) + (while b-list + (setq freq-down1 (wnn-bunsetsu-get-freq-down (car b-list)) + b-list (cdr b-list)) + (while freq-down1 + (if (null (member (car freq-down1) freq-down0)) + (setq freq-down0 (cons (car freq-down1) freq-down0))) + (setq freq-down1 (cdr freq-down1))) + (wnn-bunsetsu-set-freq-down bunsetsu freq-down0)))) + +(defun wnn-merge-fi-rel (bunsetsu b-list) + (let ((fi-rel (cons nil (wnn-bunsetsu-get-fi-rel bunsetsu)))) + (if (eq bunsetsu (car b-list)) + (setq b-list (cdr b-list))) + (while b-list + (nconc fi-rel (wnn-bunsetsu-get-fi-rel (car b-list))) + (wnn-bunsetsu-set-fi-rel (car b-list) nil) + (setq b-list (cdr b-list))) + (wnn-bunsetsu-set-fi-rel bunsetsu (cdr fi-rel)))) + +(defun wnn-bunsetsu-combinable-p (bunsetsu1 bunsetsu2) + (eq (wnn-bunsetsu-get-env bunsetsu1) + (wnn-bunsetsu-get-env bunsetsu2))) + +(defvar wnn-auto-save-dic-count 0) + +(defun wnn-end-conversion (bunsetsu-list abort) + (unless abort + (let* ((head (car bunsetsu-list)) + (env (wnn-bunsetsu-get-env head))) + (prog1 + (if (wnnenv-is-wnn6 env) + (progn + (wnn-clear-now-flag bunsetsu-list) + (wnn-merge-fi-rel head (cdr bunsetsu-list)) + (wnnrpc-set-fi-priority env (wnn-bunsetsu-get-fi-rel head)) + (wnn-optimize-in-local bunsetsu-list) + (wnn-optimize-in-server bunsetsu-list)) + (wnn-clear-now-flag bunsetsu-list) + (wnn-count-up-frequency bunsetsu-list)) + (setq wnn-auto-save-dic-count (1+ wnn-auto-save-dic-count)) + (when (eq wnn-auto-save-dic-count wnn-auto-save-dictionaries) + (wnn-save-dictionaries env) + (setq wnn-auto-save-dic-count 0)))))) + +(defun wnn-clear-now-flag (bunsetsu-list) + (let ((env (wnn-bunsetsu-get-env (car bunsetsu-list)))) + (while bunsetsu-list + (setq fd (wnn-bunsetsu-get-freq-down (car bunsetsu-list)) + bunsetsu-list (cdr bunsetsu-list)) + (while fd + (wnnrpc-set-frequency env (caar fd) (cdar fd) + (WNN-const IMA_OFF) (WNN-const HINDO_NOP)) + (setq fd (cdr fd)))))) + +(defun wnn-count-up-frequency (bunsetsu-list) + (let ((env (wnn-bunsetsu-get-env (car bunsetsu-list))) + (context (wnn-null-context)) + dic-no entry b) + (while bunsetsu-list + (setq b (car bunsetsu-list) + bunsetsu-list (cdr bunsetsu-list) + dic-no (wnn-bunsetsu-get-dic-no b) + entry (wnn-bunsetsu-get-entry b) + context (cons (wnn-context-create dic-no entry + (wnn-bunsetsu-get-jirilen b) + (wnn-bunsetsu-get-hinshi b) + (wnn-bunsetsu-get-fuzokugo b) + (wnn-bunsetsu-get-converted b) + (wnn-bunsetsu-get-right-now b) + (wnn-bunsetsu-get-freq b)) + context)) + (wnnrpc-set-frequency env dic-no entry + (WNN-const IMA_ON) (WNN-const HINDO_INC))) + (list (car context) (nth 1 context)))) + +(defun wnn-optimize-in-local (bunsetsu-list) + (let ((env (wnn-bunsetsu-get-env (car bunsetsu-list))) + b prev-b next-b major-top entry hinshi) + (setq next-b (car bunsetsu-list) + bunsetsu-list (cdr bunsetsu-list)) + (cond + ((eq (wnnenv-get-server-type env) 'jserver) + (while next-b + (setq major-top (null (and b (wnn-bunsetsu-get-dai-continue b))) + prev-b b + b next-b + next-b (car bunsetsu-list) + bunsetsu-list (cdr bunsetsu-list) + hinshi (wnn-bunsetsu-get-hinshi b)) + (when (or + (and (/= (wnnenv-get-notrans env) (WNN-const DIC_RDONLY)) + (= (wnn-bunsetsu-get-dic-no b) -1) + (or (= (wnn-bunsetsu-get-entry b) (WNN-const HIRAGANA)) + (= (wnn-bunsetsu-get-entry b) (WNN-const KATAKANA))) + (>= (wnn-bunsetsu-get-jirilen b) (WNN-const LEARNING_LEN))) + (= (wnn-bunsetsu-get-entry b) (WNN-const IKEIJI_ENTRY))) + (setq entry (wnn-notrans-auto-learning b)) + (when (/= entry -1) + (wnn-bunsetsu-set-dic-no b (WNN-const MUHENKAN_DIC)) + (wnn-bunsetsu-set-entry b entry))) + (cond + ((and next-b + major-top + (wnn-bunsetsu-get-dai-continue b)) + (wnn-adjacent-learning b next-b)) + ((and prev-b + (= hinshi (wnnenv-get-hinshi env 'rendaku)) + (equal (wnn-bunsetsu-get-fuzokugo prev-b) "")) + (wnn-adjacent-learning prev-b b)) + ((and next-b + (= hinshi (wnnenv-get-hinshi env 'settou))) + (wnn-adjacent-learning b next-b)) + ((and (/= (wnnenv-get-bmodify env) (WNN-const DIC_RDONLY)) + (wnn-bunsetsu-get-change-top b) + next-b + (/= (wnn-bunsetsu-get-hinshi next-b) + (wnnenv-get-hinshi env 'rendaku)) + (/= hinshi (wnnenv-get-hinshi env 'settou))) + (wnn-bmodify-learning b next-b))))) + ((eq (wnnenv-get-server-type env) 'kserver) + ;; Soory, not implemented + nil)))) + +(defun wnn-notrans-auto-learning (bunsetsu) + (let ((env (wnn-bunsetsu-get-env bunsetsu))) + (wnnrpc-auto-learning env (WNN-const NOTRANS_LEARN) + (wnn-bunsetsu-get-yomi bunsetsu) + (wnn-bunsetsu-get-converted bunsetsu) + "" + (if (= (wnn-bunsetsu-get-entry bunsetsu) + (WNN-const IKEIJI_ENTRY)) + (wnn-bunsetsu-get-hinshi bunsetsu) + (wnnenv-get-hinshi env 'noun)) + 0))) + +(defun wnn-adjacent-learning (bunsetsu1 bunsetsu2) + (let ((env (wnn-bunsetsu-get-env bunsetsu1)) + (yomi (concat (wnn-bunsetsu-get-yomi bunsetsu1) + (wnn-bunsetsu-get-yomi bunsetsu2))) + (kanji (concat (wnn-bunsetsu-get-converted bunsetsu1) + (wnn-bunsetsu-get-converted bunsetsu2))) + (hinshi (wnnenv-get-hinshi env 'noun))) + (if (= (wnnenv-get-bmodify env) (WNN-const DIC_RW)) + (wnnrpc-auto-learning env (WNN-const BMODIFY_LEARN) + yomi kanji "" hinshi 0) + (wnnrpc-temporary-learning env yomi kanji "" hinshi 0)))) + +(defun wnn-bmodify-learning (bunsetsu1 bunsetsu2) + (let ((env (wnn-bunsetsu-get-env bunsetsu1)) + (yomi (concat (wnn-bunsetsu-get-yomi bunsetsu1) + (wnn-bunsetsu-get-fuzokugo bunsetsu1) + (wnn-bunsetsu-get-yomi bunsetsu2))) + (kanji (concat (wnn-bunsetsu-get-converted bunsetsu1) + (wnn-bunsetsu-get-fuzokugo bunsetsu1) + (wnn-bunsetsu-get-converted bunsetsu2))) + (hinshi (wnn-bunsetsu-get-hinshi bunsetsu2))) + (wnnrpc-auto-learning env (WNN-const BMODIFY_LEARN) + yomi kanji "" hinshi 0))) + +(defun wnn-optimize-in-server (bunsetsu-list) + (let ((env (wnn-bunsetsu-get-env (car bunsetsu-list))) + (context (wnn-bunsetsu-get-context (car bunsetsu-list))) + b) + (when (eq (wnnenv-get-server-type env) 'jserver) + (wnn-context-set-right-now (car context) (WNN-const HINDO_NOP)) + (wnn-context-set-freq (car context) (WNN-const HINDO_NOP)) + (wnn-context-set-right-now (nth 1 context) (WNN-const HINDO_NOP)) + (wnn-context-set-freq (nth 1 context) (WNN-const HINDO_NOP)) + (while bunsetsu-list + (setq b (car bunsetsu-list) + bunsetsu-list (cdr bunsetsu-list) + context (cons (wnn-context-create (wnn-bunsetsu-get-dic-no b) + (wnn-bunsetsu-get-entry b) + (wnn-bunsetsu-get-jirilen b) + (wnn-bunsetsu-get-hinshi b) + (wnn-bunsetsu-get-fuzokugo b) + (wnn-bunsetsu-get-converted b) + (WNN-const IMA_ON) + (WNN-const HINDO_INC)) + context))) + (prog1 + (list (car context) (nth 1 context)) + (wnnrpc-optimize-fi env (nreverse context)))))) + +(defun wnn-finalize-backend (lang &optional action) + (let* ((save-inhibit-quit inhibit-quit) + (inhibit-quit t) + (server-info (wnn-server-get-info lang)) + (server-type (wnn-server-type server-info)) + (env-list wnn-environments) + env proc-list saved) + (when server-type + (while env-list + (setq env (car env-list) + env-list (cdr env-list)) + (if (eq (wnnenv-get-server-type env) server-type) + (condition-case err + (progn + (unless (memq (wnnenv-get-proc env) proc-list) + (setq proc-list (cons (wnnenv-get-proc env) proc-list))) + (unless (eq action 'disconnect-only) + (unless saved + (setq saved t) + (message (egg-get-message 'wnn-dict-saving) + (wnn-server-proc-name server-info))) + (let ((inhibit-quit save-inhibit-quit)) + (wnn-save-dictionaries env))) + (unless (eq action 'save-only) + (wnnrpc-disconnect env))) + ((error quit) + (message "signal %S occured when dictionary saving" err))))) + (if saved + (message (egg-get-message 'wnn-dict-saved) + (wnn-server-proc-name server-info))) + (unless (eq action 'save-only) + (while proc-list + (if (and (car proc-list) + (eq (process-status (car proc-list)) 'open)) + (wnnrpc-close (car proc-list))) + (setq proc-list (cdr proc-list))))))) + +(defun wnn-close (lang) + "Save dictionaries and close the Wnn session." + (interactive (list (wnn-read-active-lang))) + (or (listp lang) + (setq lang (list lang))) + (while lang + (wnn-finalize-backend (car lang)) + (setq lang (cdr lang)))) + +(defun wnn-disconnect (lang) + "Disconnect the Wnn session without dictionary saving." + (interactive (list (wnn-read-active-lang))) + (or (listp lang) + (setq lang (list lang))) + (while lang + (wnn-finalize-backend (car lang) 'disconnect-only) + (setq lang (cdr lang)))) + +(defun wnn-dictionary-save (lang) + "Save Wnn dictionaries." + (interactive (list (wnn-read-active-lang))) + (or (listp lang) + (setq lang (list lang))) + (while lang + (wnn-finalize-backend (car lang) 'save-only) + (setq lang (cdr lang)))) + +(defun wnn-read-active-lang () + (let ((completion-ignore-case t) + (env wnn-environments) + langs server server-list) + (while env + (setq server (wnnenv-get-server-type (car env)) + env (cdr env)) + (if (null (memq server server-list)) + (setq server-list (cons server server-list)))) + (setq langs (delq nil + (mapcar (lambda (info) + (if (memq (wnn-server-type info) server-list) + (wnn-server-language info))) + wnn-server-info-list))) + (if (<= (length langs) 1) + langs + (setq langs (cons (cons "All" langs) + (mapcar (lambda (lang) (cons (symbol-name lang) lang)) + langs))) + (cdr (assoc (completing-read "language? " langs nil t nil nil "All") + langs))))) + +;; +(defun wnn-comm-sentinel (proc reason) ; assume it is close + (let ((inhibit-quit t)) + (kill-buffer (process-buffer proc)) + ;; delete env from the list. + (setq wnn-environments + (delq nil (mapcar (lambda (env) + (if (null (eq (wnnenv-get-proc env) proc)) + env)) + wnn-environments))))) + +(defun wnn-open (server-info) + "Establish the connection to WNN server. Return process object." + ;; Open the session to WNN server, + (let ((save-inhibit-quit inhibit-quit) + (inhibit-quit t) + (server-type (wnn-server-type server-info)) + (port (wnn-server-port server-info)) + (hostname-list (wnn-server-hostname server-info)) + (proc-name (wnn-server-proc-name server-info)) + (msg-form "Wnn: connecting to %S at %s...") + (user-name (user-login-name)) + buf hostname myname port-off proc result msg) + (unwind-protect + (progn + (setq buf (generate-new-buffer (wnn-server-buffer-name server-info))) + (save-excursion + (set-buffer buf) + (erase-buffer) + (buffer-disable-undo) + (set-buffer-multibyte nil) + (setq egg-fixed-euc (wnn-server-coding-system server-info))) + (or (consp hostname-list) + (setq hostname-list (list hostname-list))) + (while (and hostname-list (null proc)) + (setq hostname (or (car hostname-list) "") + hostname-list (cdr hostname-list) + myname (if (equal hostname "") "unix" wnn-system-name)) + (if (null (string-match ":" hostname)) + (setq port-off 0) + (setq port-off (string-to-int (substring hostname (match-end 0))) + hostname (substring hostname 0 (match-beginning 0)))) + (and (equal hostname "") (setq hostname "localhost")) + (let ((inhibit-quit save-inhibit-quit)) + (if (and msg + (null (y-or-n-p (format "%s failed. Try to %s? " + msg hostname)))) + (egg-error "abort connect"))) + (setq msg (format "Wnn: connecting to %S at %s..." + server-type hostname)) + (message "%s" msg) + (let ((inhibit-quit save-inhibit-quit)) + (condition-case nil + (setq proc (open-network-stream proc-name buf hostname + (+ port port-off))) + ((error quit)))) + (when proc + (process-kill-without-query proc) + (set-process-coding-system proc 'no-conversion 'no-conversion) + (set-process-sentinel proc 'wnn-comm-sentinel) + (set-marker-insertion-type (process-mark proc) t) + (setq result (wnnrpc-open proc myname user-name)) + (when (numberp result) + (delete-process proc) + (setq proc nil)))) + (cons proc result)) + (if proc + (message (concat msg "done")) + (if buf (kill-buffer buf)) + (egg-error 'wnn-connect-error))))) + +(defvar wnn-envspec-list nil) +(defvar wnn-current-envspec nil) +(defvar wnn-current-envspec-reverse nil) +(defvar wnn-server-type nil) +(defvar wnn-wnn6-server nil) + +(defmacro wnn-envspec-conv-param-name-list () + ''(last-is-first complex okuri-learn okuri + prefix-learn prefix suffix-learn common-learn freq-func + numeric alphabet symbol yuragi rendaku bunsetsugiri muhenkan + fi-relation-learn fi-freq-func)) + +(defmacro wnn-envspec-conv-param-length () + (length (wnn-envspec-conv-param-name-list))) + +(defun wnn-envspec-create (env-name tankan stickey) + (vector (and env-name (setq env-name (intern env-name))) + (wnn-make-backend egg-language env-name) + tankan stickey nil nil + 0 (make-vector (wnn-envspec-conv-param-length) 0) + (list nil) (list nil) (list nil))) + +(defsubst wnn-envspec-env-type (spec) (aref spec 0)) +(defsubst wnn-envspec-backend (spec) (aref spec 1)) +(defsubst wnn-envspec-tankan (spec) (aref spec 2)) +(defsubst wnn-envspec-sticky (spec) (aref spec 3)) +(defsubst wnn-envspec-param (spec) (aref spec 4)) +(defsubst wnn-envspec-fuzokugo (spec) (aref spec 5)) +(defsubst wnn-envspec-conv-vmask (spec) (aref spec 6)) +(defsubst wnn-envspec-conv-param (spec) (aref spec 7)) +(defsubst wnn-envspec-dic-list (spec) (cdr (aref spec 8))) +(defsubst wnn-envspec-fi-dic-list (spec) (cdr (aref spec 9))) +(defsubst wnn-envspec-autolearn-dic-list (spec) (cdr (aref spec 10))) + +(defsubst wnn-envspec-set-param (spec param) + (aset spec 4 param)) +(defsubst wnn-envspec-set-fuzokugo (spec fzk) + (aset spec 5 fzk)) +(defsubst wnn-envspec-set-conv-vmask (spec val) + (aset spec 6 val)) +(defsubst wnn-envspec-set-conv-param (spec num val) + (aset (aref spec 7) num val)) +(defsubst wnn-envspec-add-dic-list (spec &rest dic) + (nconc (aref spec 8) (list (apply 'vector dic)))) +(defsubst wnn-envspec-add-fi-dic-list (spec &rest dic) + (nconc (aref spec 9) (list (apply 'vector dic)))) +(defsubst wnn-envspec-add-autolearn-dic-list (spec type &rest dic) + (nconc (aref spec 10) (list (cons type (apply 'vector dic))))) + +(eval-when-compile + (defun wnn-conv-param (param) + (- (wnn-envspec-conv-param-length) + (length (memq param (wnn-envspec-conv-param-name-list)))))) + +(defmacro define-wnn-conv-param-func () + (let ((name-list (wnn-envspec-conv-param-name-list)) + (defs (list 'progn)) + n set get) + (while name-list + (setq n (car name-list) + name-list (cdr name-list) + set (intern (format "wnn-envspec-set-conv-param-%s" n)) + get (intern (format "wnn-get-conv-param-%s" n))) + (nconc defs `((defsubst ,set (spec val) + (wnn-envspec-set-conv-param spec ,(wnn-conv-param n) val) + (wnn-envspec-set-conv-vmask + spec (logior (wnn-envspec-conv-vmask spec) + ,(lsh 1 (wnn-conv-param n))))) + (defsubst ,get (param) + (aref param ,(wnn-conv-param n)))))) + defs)) + +(define-wnn-conv-param-func) + +(defmacro wnn-arg-type-error (func) + `(egg-error ,(format "%s: Wrong type argument" func))) + +(defun wnn-define-environment (reverse &optional env-name tankan stickey) + "Define a Wnn environment for normal/reverse conversion according +to REVERSE. ENV-NAME specifies suffix of the Wnn environment name. +Make single character conversion (Tan-Kanji conversion) environment, +if tankan is non-NIL. Make the environment as sticky, if STICKEY +is non-NIL." + (if (and env-name (null (stringp env-name))) + (wnn-arg-type-error wnn-define-environment)) + (setq env-name (if reverse (concat env-name "R") env-name) + wnn-current-envspec (wnn-envspec-create env-name tankan stickey) + wnn-current-envspec-reverse reverse + wnn-envspec-list (nconc wnn-envspec-list + (list wnn-current-envspec)))) + +(defun wnn-set-fuzokugo (filename) + (cond ((equal filename "") + (setq filename nil)) + ((null (stringp filename)) + (wnn-arg-type-error wnn-set-fuzokugo))) + (wnn-envspec-set-fuzokugo wnn-current-envspec filename)) + +(defmacro wnn-add-dict-param-check (func + dict &optional freq prior drw dmax frw fmax + dpass fpass rev) + `(progn + (if (or (and (null (stringp ,dict)) (null (stringp (car-safe ,dict)))) + ,@(if freq + `((and ,freq (null (stringp ,freq)) + (null (stringp (car-safe ,freq)))))) + ,@(if prior `((null (integerp ,prior)))) + ,@(if drw + `((null (or (eq ,drw nil) (eq ,drw t) + (eq ,drw 0) (eq ,drw 1) + ,@(if dmax + `((and wnn-wnn6-server + ,@(let ((x `((eq ,drw 2)))) + (when (>= dmax 3) + (nconc x `((eq ,drw 3)))) + (when (>= dmax 4) + (nconc x `((eq ,drw 4)))) + x)))))))) + ,@(if frw + `((null (or (eq ,frw nil) (eq ,frw t) + (eq ,frw 0) (eq ,frw 1) + ,@(if fmax + `((and wnn-wnn6-server + ,@(let ((x `((eq ,frw 2)))) + (when (>= fmax 3) + (nconc x `((eq ,frw 3)))) + (when (>= fmax 4) + (nconc x `((eq ,frw 4)))) + x)))))))) + ,@(if dpass `((and ,dpass (null (stringp ,dpass))))) + ,@(if fpass `((and ,fpass (null (stringp ,fpass)))))) + (wnn-arg-type-error ,func)) + (if (or (equal ,dict "") (equal (car-safe ,dict) "")) + (egg-error ,(format "%s: Dictionary name should not be null." func))) + ,@(if freq + `((if (or (equal ,freq "") (equal (car-safe ,freq) "")) + (setq ,freq nil)))) + ,@(if rev + `((setq ,rev (if ,rev (car ,rev) wnn-current-envspec-reverse)))))) + +(defmacro wnn-wnn6-env-func (func) + `(or wnn-wnn6-server + (egg-error ,(format "%s is available only on Wnn6" func)))) + +(defun wnn-add-dict (dict freq priority dict-rw freq-rw + &optional dict-passwd freq-passwd &rest reverse) + (wnn-add-dict-param-check wnn-add-dict + dict freq priority dict-rw 4 freq-rw 2 + dict-passwd freq-passwd reverse) + (wnn-envspec-add-dic-list wnn-current-envspec + dict freq priority dict-rw freq-rw + dict-passwd freq-passwd reverse)) + +(defun wnn-add-fisys-dict (dict freq freq-rw &optional freq-passwd) + (wnn-wnn6-env-func wnn-add-fisys-dict) + (wnn-add-dict-param-check wnn-add-fisys-dict + dict freq nil nil nil freq-rw 3 + nil freq-passwd) + (wnn-envspec-add-fi-dic-list wnn-current-envspec + dict freq t nil freq-rw nil freq-passwd nil)) + +(defun wnn-add-fiusr-dict (dict freq dict-rw freq-rw + &optional dict-passwd freq-passwd) + (wnn-wnn6-env-func wnn-add-fiusr-dict) + (wnn-add-dict-param-check wnn-add-fiusr-dict + dict freq nil dict-rw 3 freq-rw 3 + dict-passwd freq-passwd) + (wnn-envspec-add-fi-dic-list wnn-current-envspec + dict freq nil dict-rw freq-rw + dict-passwd freq-passwd nil)) + +(defun wnn-add-notrans-dict (dict priority dict-rw + &optional dict-passwd &rest reverse) + (wnn-wnn6-env-func wnn-add-notrans-dict) + (wnn-add-dict-param-check wnn-add-notrans-dict + dict nil priority dict-rw nil nil nil + dict-passwd nil reverse) + (wnn-envspec-add-autolearn-dic-list wnn-current-envspec + (WNN-const NOTRANS_LEARN) + dict nil priority dict-rw nil + dict-passwd nil reverse)) + +(defun wnn-add-bmodify-dict (dict priority dict-rw + &optional dict-passwd &rest reverse) + (wnn-wnn6-env-func wnn-add-notrans-dict) + (wnn-add-dict-param-check wnn-add-bmodify-dict + dict nil priority dict-rw nil nil nil + dict-passwd nil reverse) + (wnn-envspec-add-autolearn-dic-list wnn-current-envspec + (WNN-const BMODIFY_LEARN) + dict nil priority dict-rw nil + dict-passwd nil reverse)) + +(defun wnn-set-param (&rest args) + (if (/= (length args) 17) + (egg-error "wnn-set-param: Wrong number of arguments")) + (mapcar (lambda (n) + (if (null (integerp n)) + (wnn-arg-type-error wnn-set-param))) + args) + (wnn-envspec-set-param wnn-current-envspec (apply 'vector args))) + +(defmacro wnn-boolean-param-check (func flag) + `(setq ,flag (cond ((or (eq ,flag 0) (eq ,flag nil)) 0) + ((or (eq ,flag 1) (eq ,flag t)) 1) + (t (wnn-arg-type-error ,func))))) + +(defun wnn-set-last-is-first-mode (flag) + (wnn-wnn6-env-func wnn-set-last-is-first-mode) + (wnn-boolean-param-check wnn-set-last-is-first-mode flag) + (wnn-envspec-set-conv-param-last-is-first wnn-current-envspec flag)) + +(defun wnn-set-complex-conv-mode (flag) + (wnn-wnn6-env-func wnn-set-complex-conv-mode) + (wnn-boolean-param-check wnn-set-complex-conv-mode flag) + (wnn-envspec-set-conv-param-complex wnn-current-envspec flag)) + +(defun wnn-set-okuri-learn-mode (flag) + (wnn-wnn6-env-func wnn-set-okuri-learn-mode) + (wnn-boolean-param-check wnn-set-okuri-learn-mode flag) + (wnn-envspec-set-conv-param-okuri-learn wnn-current-envspec flag)) + +(defun wnn-set-okuri-flag (mode) + (wnn-wnn6-env-func wnn-set-okuri-flag) + (setq mode (cond ((or (eq mode -1) (eq mode 'regulation)) -1) + ((or (eq mode 0) (eq mode 'no)) 0) + ((or (eq mode 1) (eq mode 'yes)) 1) + (t (wnn-arg-type-error wnn-set-okuri-flag)))) + (wnn-envspec-set-conv-param-okuri wnn-current-envspec mode)) + +(defun wnn-set-prefix-learn-mode (flag) + (wnn-wnn6-env-func wnn-set-prefix-learn-mode) + (wnn-boolean-param-check wnn-set-prefix-learn-mode flag) + (wnn-envspec-set-conv-param-prefix-learn wnn-current-envspec flag)) + +(defun wnn-set-prefix-flag (mode) + (wnn-wnn6-env-func wnn-set-prefix-flag) + (setq mode (cond ((or (eq mode 0) (eq mode 'hiragana)) 0) + ((or (eq mode 1) (eq mode 'kanji)) 1) + (t (wnn-arg-type-error wnn-set-prefix-flag)))) + (wnn-envspec-set-conv-param-prefix wnn-current-envspec mode)) + +(defun wnn-set-suffix-learn-mode (flag) + (wnn-wnn6-env-func wnn-set-suffix-learn-mode) + (wnn-boolean-param-check wnn-set-suffix-learn-mode flag) + (wnn-envspec-set-conv-param-suffix-learn wnn-current-envspec flag)) + +(defun wnn-set-common-learn-mode (flag) + (wnn-wnn6-env-func wnn-set-common-learn-mode) + (wnn-boolean-param-check wnn-set-common-learn-mode flag) + (wnn-envspec-set-conv-param-common-learn wnn-current-envspec flag)) + +(defun wnn-set-freq-func-mode (mode) + (wnn-wnn6-env-func wnn-set-freq-func-mode) + (setq mode (cond ((or (eq mode 0) (eq mode 'not)) 0) + ((or (eq mode 1) (eq mode 'always)) 1) + ((or (eq mode 2) (eq mode 'high)) 2) + ((or (eq mode 3) (eq mode 'normal)) 3) + ((or (eq mode 4) (eq mode 'low)) 4) + (t (wnn-arg-type-error wnn-set-freq-func-mode)))) + (wnn-envspec-set-conv-param-freq-func wnn-current-envspec mode)) + +(defun wnn-set-numeric-mode (mode) + (wnn-wnn6-env-func wnn-set-numeric-mode) + (setq mode (cond ((or (eq mode -2) (eq mode 'han)) -2) + ((or (eq mode -12) (eq mode 'zen)) -12) + ((or (eq mode -13) (eq mode 'kan)) -13) + ((or (eq mode -15) (eq mode 'kansuuji)) -15) + ((or (eq mode -16) (eq mode 'kanold)) -16) + ((or (eq mode -17) (eq mode 'hancan)) -17) + ((or (eq mode -18) (eq mode 'zencan)) -18) + (t (wnn-arg-type-error wnn-set-numeric-mode)))) + (wnn-envspec-set-conv-param-numeric wnn-current-envspec mode)) + +(defun wnn-set-alphabet-mode (mode) + (wnn-wnn6-env-func wnn-set-alphabet-mode) + (setq mode (cond ((or (eq mode -4) (eq mode 'han)) -4) + ((or (eq mode -30) (eq mode 'zen)) -30) + (t (wnn-arg-type-error wnn-set-alphabet-mode)))) + (wnn-envspec-set-conv-param-alphabet wnn-current-envspec mode)) + +(defun wnn-set-symbol-mode (mode) + (wnn-wnn6-env-func wnn-set-symbol-mode) + (setq mode (cond ((or (eq mode -5) (eq mode 'han)) -5) + ((or (eq mode -40) (eq mode 'jis)) -40) + ((or (eq mode -41) (eq mode 'asc)) -41) + (t (wnn-arg-type-error wnn-set-symbol-mode)))) + (wnn-envspec-set-conv-param-symbol wnn-current-envspec mode)) + +(defun wnn-set-yuragi-mode (flag) + (wnn-wnn6-env-func wnn-set-yuragi-mode) + (wnn-boolean-param-check wnn-set-yuragi-mode flag) + (wnn-envspec-set-conv-param-yuragi wnn-current-envspec flag)) + +(defun wnn-set-rendaku-mode (flag) + (wnn-wnn6-env-func wnn-set-rendaku-mode) + (wnn-boolean-param-check wnn-set-rendaku-mode flag) + (wnn-envspec-set-conv-param-rendaku wnn-current-envspec flag)) + +(defun wnn-renbunsetsu-conversion (env yomi hinshi fuzokugo v context) + (let ((result + (cond + ((wnnenv-get-tankan env) + (wnnrpc-tanbunsetsu-conversion env yomi hinshi fuzokugo v)) + ((wnnenv-is-wnn6 env) + (wnnrpc-fi-renbunsetsu-conversion env yomi hinshi fuzokugo v + context)) + (t + (wnnrpc-renbunsetsu-conversion env yomi hinshi fuzokugo v))))) + (prog1 + result + (if wnn-one-level-conversion + (while (consp result) + (wnn-bunsetsu-set-dai-continue (car result) nil) + (setq result (cdr result))))))) + +(defun wnn-tanbunsetsu-conversion (env yomi hinshi fuzokugo v major) + (if (or (null major) + wnn-one-level-conversion + (wnnenv-get-tankan env)) + (wnnrpc-tanbunsetsu-conversion env yomi hinshi fuzokugo v) + (wnnrpc-daibunsetsu-conversion env yomi hinshi fuzokugo v))) + +(defun wnn-get-bunsetsu-candidates (env yomi hinshi fuzokugo v major) + (cond + ((or wnn-one-level-conversion + (wnnenv-get-tankan env)) + (let ((result (wnnrpc-get-bunsetsu-candidates env yomi hinshi fuzokugo v))) + (prog1 + result + (while (consp result) + (wnn-bunsetsu-set-dai-continue (caar result) nil) + (setq result (cdr result)))))) + ((null major) + (wnnrpc-get-bunsetsu-candidates env yomi hinshi fuzokugo v)) + (t + (wnnrpc-get-daibunsetsu-candidates env yomi hinshi fuzokugo v)))) + +(defsubst wnn-filename (p) + (substitute-in-file-name + (if (consp p) (concat wnn-usr-dic-dir "/" (car p)) p))) + +(defsubst wnn-client-file-p (filename) + (and (stringp filename) + (= (aref filename 0) ?!))) + +(defsubst wnn-client-filename (filename) + (substitute-in-file-name (expand-file-name (substring filename 1) "~"))) + +(defun wnn-open-file (env filename) + "Open the file FILENAME on the environment ENV. +Return file ID. NIL means NO-file. +On failure, return negative error code." + (and filename + (if (wnn-client-file-p filename) + (wnnrpc-file-send env (wnn-client-filename filename)) + (wnnrpc-file-read env (wnn-filename filename))))) + +(defun wnn-create-directory (env path noquery) + "Create directory to the path. Retun non-NIL value on success." + (if (wnn-client-file-p path) + (let ((local-name (directory-file-name (file-name-directory + (wnn-client-filename path))))) + (cond + ((file-directory-p local-name) t) + ((or noquery + (y-or-n-p (format (egg-get-message 'wnn-dir-missing) + (file-name-directory path)))) + (make-directory local-name t) + (if (file-directory-p local-name) + (progn + (message (egg-get-message 'wnn-dir-created) path) + t) + (message (egg-get-message 'wnn-dir-failed) path) + nil)))) + (let ((name (directory-file-name (file-name-directory + (wnn-filename path)))) + create-list) + (setq path name) + (while (and name (/= (wnnrpc-access env name 0) 0)) + (setq create-list (cons name create-list) + name (file-name-directory name) + name (and name (directory-file-name name)))) + (or (null create-list) + (if (or noquery + (y-or-n-p (format (egg-get-message 'wnn-dir-missing) path))) + (let ((result 0)) + (while (and (>= result 0) create-list) + (setq result (wnnrpc-mkdir env (car create-list)) + create-list (cdr create-list))) + (if (>= result 0) + (progn + (message (egg-get-message 'wnn-dir-created) path) + t) + (message (egg-get-message 'wnn-dir-failed) path) + nil))))))) + +(defun wnn-file-remove (proc filename passwd) + (let ((result (if (wnn-client-file-p filename) + (wnnrpc-file-remove-client + proc (wnn-client-filename filename) passwd) + (wnnrpc-file-remove proc (wnn-filename filename) passwd)))) + (or (= result 0) + (progn + (message (wnnrpc-get-error-message (- result))) + nil)))) + +(defun wnn-open-dictionary (env fi name rw comment dpasswd fpasswd + &optional noquery) + (let ((dic-id (wnn-open-file env name))) + (cond + ((null dic-id) + (message "Wnn: cannot omit dictionary name") + nil) + ((>= dic-id 0) dic-id) + ((or (null rw) (/= dic-id (- (WNN-const NO_EXIST)))) + (message (egg-get-message 'wnn-dict-missing-1) + name (wnnrpc-get-error-message (- dic-id))) + nil) + ((and (or noquery + (y-or-n-p (format (egg-get-message 'wnn-dict-missing-2) name))) + (wnn-create-directory env name noquery) + (wnn-create-dictionary env name (wnnrpc-writable-dic-type env fi rw) + comment dpasswd fpasswd)) + (message (egg-get-message 'wnn-dict-created) name) + (setq dic-id (wnn-open-file env name)) + (if (>= dic-id 0) + dic-id + (message "%s" (wnnrpc-get-error-message (- dic-id))) + nil))))) + +(defun wnn-create-dictionary (env name type comment dpasswd fpasswd) + "Create a dictionary file on the server or the client depending on name." + (let ((result (if (wnn-client-file-p name) + (wnnrpc-dic-file-create-client + env (wnn-client-filename name) type + comment dpasswd fpasswd) + (wnnrpc-dic-file-create + env (wnn-filename name) type comment dpasswd fpasswd)))) + (or (= result 0) + (progn + (message (wnnrpc-get-error-message (- result))) + nil)))) + +(defun wnn-open-frequency (env fi dic-id name rw comment passwd) + (let ((freq-id (wnn-open-file env name))) + (cond + ((null freq-id) -1) + ((>= freq-id 0) freq-id) + ((or (null rw) (/= freq-id (- (WNN-const NO_EXIST)))) + (message (egg-get-message 'wnn-freq-missing-1) + name (wnnrpc-get-error-message (- freq-id))) + nil) + ((and (y-or-n-p + (format (egg-get-message 'wnn-freq-missing-2) name)) + (wnn-create-directory env name nil) + (wnn-create-frequency env fi dic-id name comment passwd)) + (message (egg-get-message 'wnn-freq-created) name) + (setq freq-id (wnn-open-file env name)) + (if (>= freq-id 0) + freq-id + (message "%s" (wnnrpc-get-error-message (- dic-id))) + nil))))) + +(defun wnn-create-frequency (env fi dic-id name comment passwd) + "Create a frequency file on the server or the client depending on name." + (let ((result (if (wnn-client-file-p name) + (wnnrpc-hindo-file-create-client + env fi dic-id (wnn-client-filename name) comment passwd) + (wnnrpc-hindo-file-create + env fi dic-id (wnn-filename name) comment passwd)))) + (or (= result 0) + (progn + (message (wnnrpc-get-error-message (- result))) + nil)))) + +(defun wnn-set-dictionary (env fi dic-spec) + "" + (let ((dname (aref dic-spec 0)) + (fname (aref dic-spec 1)) + (prior (aref dic-spec 2)) + (drw (aref dic-spec 3)) + (frw (aref dic-spec 4)) + (dpass (aref dic-spec 5)) + (fpass (aref dic-spec 6)) + (rev (aref dic-spec 7)) + did fid result) + (cond + ((numberp (setq dpass (wnnrpc-read-passwd-file dpass))) + (message "%s" (wnnrpc-get-error-message (- dpass))) + nil) + ((numberp (setq fpass (if fname (wnnrpc-read-passwd-file fpass) ""))) + (message "%s" (wnnrpc-get-error-message (- fpass))) + nil) + ((and (setq did (wnn-open-dictionary env fi dname drw "" dpass fpass)) + (setq fid (wnn-open-frequency env fi did fname frw "" fpass))) + (if fi + (setq result (wnnrpc-set-fi-dictionary env did fid prior drw frw + dpass fpass)) + (setq drw (cond ((eq drw (WNN-const DIC_GROUP)) (WNN-const DIC_RW)) + ((eq drw (WNN-const DIC_MERGE)) (WNN-const DIC_RDONLY)) + (t drw)) + result (wnnrpc-set-dictionary env did fid prior drw frw + dpass fpass rev))) + (cond + ((>= result 0) t) + ((or (null frw) (/= result (- (WNN-const NO_MATCH)))) + (message "%s (%s): %s" + dname (if fname fname "") + (wnnrpc-get-error-message (- result))) + nil) + ((and (y-or-n-p (format (egg-get-message 'wnn-no-match) fname)) + (>= (wnnrpc-file-discard env fid) 0) + (wnn-file-remove proc fname fpass) + (wnn-create-frequency env fi did fname "" fpass)) + (message (egg-get-message 'wnn-re-create-freq) fname) + (and (>= (setq fid (wnn-open-file env fname)) 0) + (>= (wnnrpc-set-dictionary env + did fid prior drw frw + dpass fpass rev) + 0)))))))) + +(defun wnn-temporary-dic-add (env rev) + (let ((result (wnnrpc-temporary-dic-loaded env))) + (if (= result 0) + (wnnrpc-temporary-dic-add env rev) + result))) + +(defun wnn-set-autolearn-dictionary (env type dic-spec) + (let ((dname (aref dic-spec 0)) + (prior (aref dic-spec 2)) + (drw (aref dic-spec 3)) + (dpass (aref dic-spec 5)) + (rev (aref dic-spec 7)) + (did (wnnrpc-get-autolearning-dic env type)) + result) + (or (numberp drw) + (setq drw (if drw 0 1))) + (cond + ((< did 0) + (message "%s" (wnnrpc-get-error-message (- did))) + nil) + ((> did 0) + (setq result (wnn-temporary-dic-add env rev)) + (if (>= result 0) + drw + (message "%s" (wnnrpc-get-error-message (- result))) + nil)) + ((numberp (setq dpass (wnnrpc-read-passwd-file dpass))) + (message "%s" (wnnrpc-get-error-message (- dpass))) + nil) + ((setq did (wnn-open-dictionary env nil dname t "" dpass "" t)) + (if (and (>= (setq did (wnnrpc-set-dictionary env did -1 prior drw drw + dpass "" rev)) + 0) + (>= (setq did (wnnrpc-set-autolearning-dic env type did)) 0) + (>= (setq did (wnn-temporary-dic-add env rev)) 0)) + drw + (message "%s" (wnnrpc-get-error-message (- did))) + nil))))) + +(defun wnn-search-environment (backend) + (let ((env-list wnn-environments) + env) + (while (and (null env) env-list) + (setq env (and (eq (wnnenv-get-backend (car env-list)) backend) + (car env-list)) + env-list (cdr env-list))) + env)) + +(defun wnn-v3-eggrc-defines () + (if (null (fboundp 'set-wnn-reverse)) + (progn + (fset 'set-wnn-reverse + (lambda (arg) + (wnn-define-environment arg + (and (or (eq wnn-server-type 'cserver) + (eq wnn-server-type 'tserver)) + "PZ")))) + (fset 'is-wnn6-server (lambda () wnn-wnn6-server)) + (fset 'set-wnn-fuzokugo 'wnn-set-fuzokugo) + (fset 'add-wnn-dict 'wnn-add-dict) + (fset 'set-wnn-param 'wnn-set-param) + (fset 'add-wnn-fisys-dict 'wnn-add-fisys-dict) + (fset 'add-wnn-fiusr-dict 'wnn-add-fiusr-dict) + (fset 'add-wnn-notrans-dict 'wnn-add-notrans-dict) + (fset 'add-wnn-bmodify-dict 'wnn-add-bmodify-dict) + (fset 'set-last-is-first-mode 'wnn-set-last-is-first-mode) + (fset 'set-complex-conv-mode 'wnn-set-complex-conv-mode) + (fset 'set-okuri-flag 'wnn-set-okuri-flag) + (fset 'set-prefix-learn-mode 'wnn-set-prefix-learn-mode) + (fset 'set-suffix-learn-mode 'wnn-set-suffix-learn-mode) + (fset 'set-common-learn-mode 'wnn-set-common-learn-mode) + (fset 'set-yuragi-mode 'wnn-set-yuragi-mode) + (fset 'set-freq-func-mode 'wnn-set-freq-func-mode) + (fset 'set-numeric-mode 'wnn-set-numeric-mode) + (fset 'set-alphabet-mode 'wnn-set-alphabet-mode) + (fset 'set-symbol-mode 'wnn-set-symbol-mode) + (setq wnn-v3-defined t)))) + +(defun wnn-get-environment (backend) + "Return Wnn Environemt for BACKEND. If none, create new +environment." + (let ((env (wnn-search-environment backend)) + proc error) + (or env + (unwind-protect + (let* ((language (wnn-backend-get-language backend)) + (server-info (wnn-server-get-info language)) + (server-type (wnn-server-type server-info)) + version specs) + (setq proc (wnn-open server-info) + version (cdr proc) + proc (car proc) + wnn-envspec-list nil) + (condition-case err + (let ((wnn-server-type server-type) + (wnn-wnn6-server (eq version 'wnn6))) + (if wnn-use-v3-eggrc + (wnn-v3-eggrc-defines)) + (egg-load-startup-file 'wnn language)) + (egg-error + (setq error err) + (signal (car error) (cdr error)))) + (setq specs wnn-envspec-list) + (while specs + (wnn-create-environment proc server-type version (car specs)) + (setq specs (cdr specs))) + (setq env (wnn-search-environment backend))) + (if (and proc (null env)) + (progn + (wnnrpc-close proc) + (if error + (signal (car error) (cdr error)) + (egg-error 'wnn-fail-make-env)))))))) + +;; Create a new environment in the conversion server, if necessary. +(defun wnn-create-environment (proc server-type version spec) + (let* ((save-inhibit-quit inhibit-quit) + (inhibit-quit t) + (name (wnn-make-env-name spec)) + (backend (wnn-envspec-backend spec)) + (tankan (wnn-envspec-tankan spec)) + (sticky (wnn-envspec-sticky spec)) + (parameter (wnn-envspec-param spec)) + (fzk (wnn-envspec-fuzokugo spec)) + (dic-list (wnn-envspec-dic-list spec)) + (fi-dic-list (wnn-envspec-fi-dic-list spec)) + (autolearn-dic-list (wnn-envspec-autolearn-dic-list spec)) + exist env-id env fid cvmask param mode type dic-spec) + (condition-case err + (progn + (setq exist (wnnrpc-env-exist proc name) + env-id (wnnrpc-connect proc name)) + (if (< env-id 0) + (egg-error "%s" (wnnrpc-get-error-message (- env-id)))) + (setq env (wnnenv-create proc env-id server-type version + backend tankan name)) + (cond + ((or wnn-force-set-environment (= exist 0)) + (let ((inhibit-quit save-inhibit-quit)) + (and fzk + (or (< (setq fid (wnn-open-file env fzk)) 0) + (< (setq fid (wnnrpc-set-fuzokugo-file env fid)) 0)) + (message "%s" (wnnrpc-get-error-message (- fid)))) + (while fi-dic-list + (wnn-set-dictionary env t (car fi-dic-list)) + (setq fi-dic-list (cdr fi-dic-list))) + (while dic-list + (wnn-set-dictionary env nil (car dic-list)) + (setq dic-list (cdr dic-list))) + (while autolearn-dic-list + (setq type (caar autolearn-dic-list) + dic-spec (cdar autolearn-dic-list) + autolearn-dic-list (cdr autolearn-dic-list) + mode (wnn-set-autolearn-dictionary env type dic-spec)) + (if mode + (if (eq type (WNN-const NOTRANS_LEARN)) + (progn + (wnnenv-set-notrans env mode) + (wnn-envspec-set-conv-param-muhenkan spec mode)) + (wnnenv-set-bmodify env mode) + (wnn-envspec-set-conv-param-bunsetsugiri spec mode)))) + (if parameter + (wnnrpc-set-conversion-parameter env parameter)) + (setq cvmask (wnn-envspec-conv-vmask spec) + param (wnn-envspec-conv-param spec)) + (if (/= cvmask 0) + (wnnrpc-set-conversion-env-param env cvmask param)))) + ((eq version 'wnn6) + (wnnenv-set-bmodify env (wnn-get-autolearning-dic-mode + env (WNN-const BMODIFY_LEARN))) + (wnnenv-set-notrans env (wnn-get-autolearning-dic-mode + env (WNN-const NOTRANS_LEARN))))) + (cond + ((eq (wnnenv-get-server-type env) 'jserver) + (wnn-set-hinshi env 'noun "$BL>;l(B") + (when (wnnenv-is-wnn6 env) + (wnn-set-hinshi env 'settou "$B@\F,8l(B($B$*(B)") + (wnn-set-hinshi env 'rendaku "$BO"By(B"))) + ((eq (wnnenv-get-server-type env) 'cserver) + (wnn-set-hinshi env 'noun "$AFUM(C{(B")) + ((eq (wnnenv-get-server-type env) 'tserver) + (wnn-set-hinshi env 'noun "$(G_[]WGX(B")) + ((eq (wnnenv-get-server-type env) 'kserver) + (wnn-set-hinshi env 'noun "$(CY#^r(B"))) + (if sticky + (wnnrpc-make-env-sticky env) + (wnnrpc-make-env-unsticky env)) + (setq wnn-environments (nconc wnn-environments (list env)))) + ((egg-error quit) + (if (eq (car err) 'egg-error) + (message "%s" (nth 1 err))) + (if env + (progn + (wnnrpc-disconnect env) + (setq wnn-environments (delq env wnn-environments)))) + (if (eq (car err) 'quit) + (signal 'quit (cdr err))))))) + +(defun wnn-make-env-name (spec) + (let ((env-type (wnn-envspec-env-type spec))) + (concat wnn-user-name (if env-type (symbol-name env-type) "")))) + +(defun wnn-set-hinshi (env sym name) + (let ((hinshi (wnnrpc-hinshi-number (wnnenv-get-proc env) name))) + (if (>= hinshi 0) + (wnnenv-set-hinshi env sym hinshi)))) + +(defsubst wnn-dicinfo-entry (info) (aref info 0)) +(defsubst wnn-dicinfo-id (info freq) (aref info (+ 1 freq))) +(defsubst wnn-dicinfo-mode (info freq) (aref info (+ 3 freq))) +(defsubst wnn-dicinfo-enable (info) (aref info 5)) +(defsubst wnn-dicinfo-nice (info) (aref info 6)) +(defsubst wnn-dicinfo-reverse (info) (aref info 7)) +(defsubst wnn-dicinfo-comment (info) (aref info 8)) +(defsubst wnn-dicinfo-name (info freq) (aref info (+ 9 freq))) +(defsubst wnn-dicinfo-passwd (info freq) (aref info (+ 11 freq))) +(defsubst wnn-dicinfo-type (info) (aref info 13)) +(defsubst wnn-dicinfo-words (info) (aref info 14)) +(defsubst wnn-dicinfo-local (info freq) (aref info (+ 15 freq))) + +(defun wnn-get-autolearning-dic-mode (env type) + (let* ((dic (wnnrpc-get-autolearning-dic env type)) + (info (and (> dic 0) (wnnrpc-get-dictionary-info env (1- dic))))) + (if (vectorp (car-safe info)) + (wnn-dicinfo-mode (car info) 0) + (WNN-const DIC_RDONLY)))) + +(defun wnn-get-dictionary-list-with-environment (env) + (if (wnnenv-is-wnn6 env) + (wnnrpc-get-fi-dictionary-list-with-environment env + (WNN-const DIC_NO_TEMPS)) + (wnnrpc-get-dictionary-list-with-environment env))) + +(defun wnn-save-dictionaries (env) + (let ((dic-list (wnn-get-dictionary-list-with-environment env)) + (result 0) info freq fid name local-name) + (while dic-list + (setq info (car dic-list) + dic-list (cdr dic-list) + freq 0) + (while (<= freq 1) + (setq fid (wnn-dicinfo-id info freq) + name (wnn-dicinfo-name info freq)) + (if (and (> fid 0) (= (wnn-dicinfo-mode info freq) 0)) + (cond + ((= (wnn-dicinfo-local info freq) 1) + (wnnrpc-write-file env fid name)) + ((setq local-name (wnnenv-get-client-file env name)) + (wnnrpc-file-receive env fid local-name)) + ((and (setq local-name (wnn-file-loaded-client env name fid)) + (file-writable-p local-name)) + (wnnrpc-file-receive env fid local-name)))) + (setq freq (1+ freq)))))) + +(defun wnn-file-loaded-client (env name fid) + (let ((len (length wnn-system-name)) + local-name) + (and (> (length name) len) + (equal (substring name 0 len) wnn-system-name) + (prog1 + (wnn-client-file-p (substring name len)) + (setq local-name (wnn-client-filename (substring name len)))) + (= (wnnrpc-file-loaded-local (wnnenv-get-proc env) local-name t) fid) + local-name))) + +(defun wnn-word-inspection (bunsetsu) + (let ((env (wnn-bunsetsu-get-env bunsetsu)) + (converted (wnn-get-bunsetsu-converted bunsetsu)) + (yomi (wnn-bunsetsu-get-yomi bunsetsu)) + (fuzokugo (wnn-bunsetsu-get-fuzokugo bunsetsu)) + (hinshi-no (wnn-bunsetsu-get-hinshi bunsetsu)) + (dic-no (wnn-bunsetsu-get-dic-no bunsetsu)) + (entry (wnn-bunsetsu-get-entry bunsetsu)) + (now (wnn-bunsetsu-get-right-now bunsetsu)) + (freq (wnn-bunsetsu-get-freq bunsetsu)) + (evaluation (wnn-bunsetsu-get-evaluation bunsetsu)) + (evaluation-dai (or (wnn-bunsetsu-get-dai-evaluation bunsetsu) "---")) + (kangovect (wnn-bunsetsu-get-kangovect bunsetsu)) + hinsi dic) + (setq hinshi (wnnrpc-hinshi-name (wnnenv-get-proc env) hinshi-no)) + (setq dic (if (>= dic-no 0) + (wnn-dict-name (car (wnnrpc-get-dictionary-info env dic-no))) + (egg-get-message 'wnn-pseud-bunsetsu))) + (message "%s %s+%s(%s %s:%s Freq:%s%s) S:%s D:%s V:%s " + converted yomi fuzokugo hinshi dic entry + (if (= now 1) "*" " ") freq evaluation evaluation-dai kangovect))) + +;;; not implemented yet (NIY) +(defun wnn-delete-dictionary () + (dj-delete-dic XXX)) + +;;; NIY, might never be implemented +(defun wnn-server-inspect ()) + +;;; NIY +(defun wnn-get-conversion-parameter () + (js-get-parameter)) + +;;; Dictionary management (word registration) is not implemented yet. + +(defun wnn-find-dictionary-by-id (id dic-list) + (catch 'return + (while dic-list + (let ((dic (car dic-list))) + (if (= (wnndic-get-id dic) id) + (throw 'return dic) + (setq dic-list (cdr dic-list))))))) + +(defun wnn-dict-name (dic-info) + (let ((comment (wnndic-get-comment dic-info)) + (name (wnndic-get-dictname dic-info))) + (cond ((null (string= comment "")) comment) + ((wnn-client-file-p name) name) + (t (file-name-nondirectory name))))) + +(defun wnn-list-writable-dictionaries-byname (env) + (let ((dic-list (wnn-get-dictionary-list-with-environment env)) + (w-id-list (wnnrpc-get-writable-dictionary-id-list env))) + (cond ((numberp w-id-list) + (egg-error "%s" (wnnrpc-get-error-message (- w-id-list)))) + ((null w-id-list) + (egg-error 'wnn-no-writable-d)) + (t + (delq nil + (mapcar (lambda (id) + (let ((dic (wnn-find-dictionary-by-id id dic-list))) + (and dic (cons (wnn-dict-name dic) dic)))) + w-id-list)))))) + +(defun wnn-word-registration (backend kanji yomi) + (let (env dic dic-id hinshi result) + (if (or (null (eq (egg-get-language 0 kanji) + (wnn-backend-get-converted-language backend))) + (next-single-property-change 0 'egg-lang kanji) + (null (eq (egg-get-language 0 yomi) + (wnn-backend-get-source-language backend))) + (next-single-property-change 0 'egg-lang yomi)) + (egg-error "word registration: invalid character") + (setq env (wnn-get-environment backend) + dic (wnn-dictionary-select env) + dic-id (wnndic-get-id dic) + hinshi (wnn-hinshi-select env dic-id) + result (wnnrpc-hinshi-number (wnnenv-get-proc env) hinshi)) + (or (< result 0) + (setq result (wnnrpc-add-word env dic-id yomi kanji "" result 0))) + (if (>= result 0) + (list hinshi (wnn-dict-name dic)) + (egg-error (wnnrpc-get-error-message (- result))))))) + +(defun wnn-dictionary-select (env) + (menudiag-select (list 'menu + (egg-get-message 'wnn-register-1) + (wnn-list-writable-dictionaries-byname env)))) + +(defun wnn-hinshi-select (env dic-id) + (menudiag-select (wnn-make-hinshi-menu + env dic-id "/" + (egg-get-message 'wnn-register-2)))) + +(defun wnn-make-hinshi-menu (env dic-id hinshi prompt) + (let ((hinshi-list (wnnrpc-get-hinshi-list env dic-id hinshi))) + (if (numberp hinshi-list) + (egg-error "%s" (wnnrpc-get-error-message (- hinshi-list))) + (list 'menu + (format (if (equal hinshi "/") "%s:" "%s[%s]:") + prompt + (substring hinshi 0 (1- (length hinshi)))) + (mapcar (lambda (h) + (if (= (aref h (1- (length h))) ?/) + (cons h (wnn-make-hinshi-menu env dic-id h prompt)) + h)) + hinshi-list))))) + +;;; setup + +(load "egg/wnnrpc") +(run-hooks 'wnn-load-hook) + +;;;###autoload +(defun egg-activate-wnn (&rest arg) + "Activate Wnn backend of Tamagotchy." + (apply 'egg-mode (append arg wnn-backend-alist))) + +;;; egg/wnn.el ends here. diff --git a/egg/wnnrpc.el b/egg/wnnrpc.el new file mode 100644 index 0000000..f09fcdc --- /dev/null +++ b/egg/wnnrpc.el @@ -0,0 +1,1762 @@ +;;; egg/wnnrpc.el --- WNN Support (low level interface) in Egg +;;; Input Method Architecture + +;; Copyright (C) 1999, 2000 Free Software Foundation, Inc + +;; Author: NIIBE Yutaka +;; KATAYAMA Yoshio ; Korean, Chinese support. + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + + +;;; Code: + + +(eval-when-compile + (require 'egg-com) + (defmacro wnn-file-string () + (string-as-unibyte (decode-coding-string "$B#W#n#n$N%U%!%$%k(B" 'euc-jp))) + (defmacro wnn-const (c) + "Macro for WNN constants." + (cond ((eq c 'JS_VERSION) 0) + ((eq c 'JS_OPEN) 1) + ((eq c 'JS_CLOSE) 3) + ((eq c 'JS_CONNECT) 5) + ((eq c 'JS_DISCONNECT) 6) + ((eq c 'JS_ENV_EXIST) 7) + ((eq c 'JS_ENV_STICKY) 8) + ((eq c 'JS_ENV_UNSTICKY) 9) + ((eq c 'JS_KANREN) 17) + ((eq c 'JS_KANTAN_SHO) 18) + ((eq c 'JS_KANZEN_SHO) 19) + ((eq c 'JS_KANTAN_DAI) 20) + ((eq c 'JS_KANZEN_DAI) 21) + ((eq c 'JS_HINDO_SET) 24) + ((eq c 'JS_DIC_ADD) 33) + ((eq c 'JS_DIC_DELETE) 34) + ((eq c 'JS_DIC_USE) 35) + ((eq c 'JS_DIC_LIST) 36) + ((eq c 'JS_DIC_INFO) 37) + ((eq c 'JS_FUZOKUGO_SET) 41) + ((eq c 'JS_FUZOKUGO_GET) 48) + ((eq c 'JS_WORD_ADD) 49) + ((eq c 'JS_WORD_DELETE) 50) + ((eq c 'JS_WORD_SEARCH) 51) + ((eq c 'JS_WORD_SEARCH_BY_ENV) 52) + ((eq c 'JS_WORD_INFO) 53) + ((eq c 'JS_WORD_COMMENT_SET) 54) + ((eq c 'JS_PARAM_SET) 65) + ((eq c 'JS_PARAM_GET) 66) + ((eq c 'JS_MKDIR) 81) + ((eq c 'JS_ACCESS) 82) + ((eq c 'JS_WHO) 83) + ((eq c 'JS_ENV_LIST) 85) + ((eq c 'JS_FILE_LIST_ALL) 86) + ((eq c 'JS_DIC_LIST_ALL) 87) + ((eq c 'JS_FILE_READ) 97) + ((eq c 'JS_FILE_WRITE) 98) + ((eq c 'JS_FILE_SEND) 99) + ((eq c 'JS_FILE_RECEIVE) 100) + ((eq c 'JS_HINDO_FILE_CREATE) 101) + ((eq c 'JS_DIC_FILE_CREATE) 102) + ((eq c 'JS_FILE_REMOVE) 103) + ((eq c 'JS_FILE_LIST) 104) + ((eq c 'JS_FILE_INFO) 105) + ((eq c 'JS_FILE_LOADED) 106) + ((eq c 'JS_FILE_LOADED_LOCAL) 107) + ((eq c 'JS_FILE_DISCARD) 108) + ((eq c 'JS_FILE_COMMENT_SET) 109) + ((eq c 'JS_FILE_PASSWORD_SET) 110) + ((eq c 'JS_FILE_STAT) 111) + ((eq c 'JS_KILL) 112) + ((eq c 'JS_HINSI_LIST) 114) + ((eq c 'JS_HINSI_NAME) 115) + ((eq c 'JS_HINSI_NUMBER) 116) + ((eq c 'JS_HINSI_DICTS) 117) + ((eq c 'JS_HINSI_TABLE_SET) 118) + ((eq c 'JS_ACCESS_ADD_HOST) ?\xf00011) + ((eq c 'JS_ACCESS_ADD_USER) ?\xf00012) + ((eq c 'JS_ACCESS_REMOVE_HOST) ?\xf00013) + ((eq c 'JS_ACCESS_REMOVE_USER) ?\xf00014) + ((eq c 'JS_ACCESS_ENABLE) ?\xf00015) + ((eq c 'JS_ACCESS_DISABLE) ?\xf00016) + ((eq c 'JS_ACCESS_GET_INFO) ?\xf00017) + ((eq c 'JS_TEMPORARY_DIC_ADD) ?\xf00021) + ((eq c 'JS_TEMPORARY_DIC_DELETE) ?\xf00022) + ((eq c 'JS_AUTOLEARNING_WORD_ADD) ?\xf00023) + ((eq c 'JS_SET_AUTOLEARNING_DIC) ?\xf00024) + ((eq c 'JS_GET_AUTOLEARNING_DIC) ?\xf00025) + ((eq c 'JS_IS_LOADED_TEMPORARY_DIC) ?\xf00026) + ((eq c 'JS_TEMPORARY_WORD_ADD) ?\xf00027) + ((eq c 'JS_SET_HENKAN_ENV) ?\xf00031) + ((eq c 'JS_GET_HENKAN_ENV) ?\xf00032) + ((eq c 'JS_SET_HENKAN_HINSI) ?\xf00033) + ((eq c 'JS_GET_HENKAN_HINSI) ?\xf00034) + ((eq c 'JS_HENKAN_WITH_DATA) ?\xf00035) + ((eq c 'JS_FI_DIC_ADD) ?\xf00061) + ((eq c 'JS_FI_HINDO_FILE_CREATE) ?\xf00062) + ((eq c 'JS_FI_KANREN) ?\xf00065) + ((eq c 'JS_SET_FI_PRIORITY) ?\xf00066) + ((eq c 'JS_OPTIMIZE_FI) ?\xf00067) + ((eq c 'JS_HENKAN_IKEIJI) ?\xf0006f) + ((eq c 'JS_LOCK) ?\xf00071) + ((eq c 'JS_UNLOCK) ?\xf00072) + ((eq c 'JS_FI_DIC_LIST) ?\xf00081) + ((eq c 'JS_FI_DIC_LIST_ALL) ?\xf00082) + ((eq c 'JS_FUZOKUGO_LIST) ?\xf00083) + + ((eq c 'JLIB_VERSION) ?\x4003) + ((eq c 'JLIB_VERSION_WNN6) ?\x4f00) + + ((eq c 'WNN_C_LOCAL) "!") + ((eq c 'WNN_FT_DICT_FILE) 1) + ((eq c 'WNN_FT_HINDO_FILE) 2) + ((eq c 'WNN_FILE_STRING) (encode-coding-string + "$B#W#n#n$N%U%!%$%k(B" 'euc-jp)) + ((eq c 'WNN_FILE_STRING_LEN) 16) + ((eq c 'WNN_PASSWD_LEN) 16) + ((eq c 'WNN_HOST_LEN) 16) + ((eq c 'WNN_UNIQ_LEN) 28) + ((eq c 'WNN_FILE_HEADER_LEN) 128) + ((eq c 'WNN_FILE_HEADER_PAD) 36) + ((eq c 'WNN_FILE_BODY_PAD) 116) + ((eq c 'WNN_ENVNAME_LEN) 32) + ((eq c 'WNN_MAX_ENV_OF_A_CLIENT) 32) + ((eq c 'WNN_MAX_DIC_OF_AN_ENV) 30) + ((eq c 'WNN_MAX_FILE_OF_AN_ENV) 60) + + ((eq c 'WNN_ACK) 0) + ((eq c 'WNN_NAK) -1) + + ((eq c 'WNN_NO_EXIST) 1) + ((eq c 'WNN_OPENF_ERR) 16) + ((eq c 'WNN_JSERVER_DEAD) 70) + ((eq c 'WNN_BAD_VERSION) 73) + ((eq c 'WNN_FILE_READ_ERROR) 90) + ((eq c 'WNN_FILE_WRITE_ERROR) 91) + ((eq c 'WNN_INCORRECT_PASSWD) 94) + ((eq c 'WNN_FILE_IN_USE) 95) + ((eq c 'WNN_UNLINK) 96) + ((eq c 'WNN_FILE_CREATE_ERROR) 97) + ((eq c 'WNN_NOT_A_FILE) 98) + ((eq c 'WNN_INODE_CHECK_ERROR) 99) + + ((eq c 'WNN_UD_DICT) 2) + ((eq c 'WNN_REV_DICT) 3) + ((eq c 'CWNN_REV_DICT) ?\x103) + ((eq c 'BWNN_REV_DICT) ?\x203) + ((eq c 'WNN_COMPACT_DICT) 5) + ((eq c 'WNN_FI_SYSTEM_DICT) 6) + ((eq c 'WNN_FI_USER_DICT) 7) + ((eq c 'WNN_FI_HINDO_FILE) 8) + ((eq c 'WNN_GROUP_DICT) 9) + ((eq c 'WNN_MERGE_DICT) 10) + ((eq c 'WNN_VECT_NO) -1) + ((eq c 'WNN_VECT_BUNSETSU) 2) + ((eq c 'WNN_VECT_KANREN) 0) + ((eq c 'WNN_VECT_KANZEN) 1) + ((eq c 'WNN_VECT_KANTAN) 1)))) + +(defconst wnnrpc-error-message + '((Japanese . + [ + nil + "$B%U%!%$%k$,B8:_$7$^$;$s(B" + nil + "$B%a%b%j(B allocation $B$G<:GT$7$^$7$?(B" + nil + "$B<-=q$G$O$"$j$^$;$s(B" + "$BIQEY%U%!%$%k$G$O$"$j$^$;$s(B" + "$BIUB08l%U%!%$%k$G$O$"$j$^$;$s(B" + nil + "$B<-=q%F!<%V%k$,0lGU$G$9(B" + "$BIQEY%U%!%$%k$,;XDj$5$l$?<-=q$NIQEY%U%!%$%k$G$O$"$j$^$;$s(B" + nil + nil + nil + nil + nil + "$B%U%!%$%k$,%*!<%W%s$G$-$^$;$s(B" + "$B@5$7$$IQEY%U%!%$%k$G$O$"$j$^$;$s(B" + "$B@5$7$$IUB08l%U%!%$%k$G$O$"$j$^$;$s(B" + "$BIUB08l$N8D?t(B, $B%Y%/%?D9$5$J$I$,B?2a$.$^$9(B" + "$B$=$NHV9f$N<-=q$O;H$o$l$F$$$^$;$s(B" + nil + nil + nil + "$BIUB08l%U%!%$%k$NFbMF$,@5$7$/$"$j$^$;$s(B" + "$B5?;wIJ;lHV9f$,0[>o$G$9(B(hinsi.data $B$,@5$7$/$"$j$^$;$s(B)" + "$BL$Dj5A$NIJ;l$,A0Ce%U%!%$%k$rFI$_9~$`$3$H$,$G$-$^$;$s(B" + "$B%Q%9%o!<%I$,4V0c$C$F$$$^$9(B" + "$B%U%!%$%k$,FI$_9~$^$l$F$$$^$9(B" + "$B%U%!%$%k$,:o=|$G$-$^$;$s(B" + "$B%U%!%$%k$,:n@.=PMh$^$;$s(B" + "WNN $B$N%U%!%$%k$G$"$j$^$;$s(B" + "$B%U%!%$%k$N(B inode $B$H(B FILE_UNIQ $B$r0lCW$5$;$k;v$,$G$-$^$;$s(B" + "$BIJ;l%U%!%$%k$,Bg$-2a$.$^$9(B" + "$BIJ;l%U%!%$%k$,Bg$-2a$.$^$9(B" + "$BIJ;l%U%!%$%k$,B8:_$7$^$;$s(B" + "$BIJ;l%U%!%$%k$NFbMF$,4V0c$C$F$$$^$9(B" + nil + "$BIJ;l%U%!%$%k$,FI$_9~$^$l$F$$$^$;$s(B" + "$BIJ;lL>$,4V0c$C$F$$$^$9(B" + "$BIJ;lHV9f$,4V0c$C$F$$$^$9(B" + nil + "$B$=$NA`:n$O%5%]!<%H$5$l$F$$$^$;$s(B" + "$B%Q%9%o!<%I$NF~$C$F$$$k%U%!%$%k$,%*!<%W%s$G$-$^$;$s(B" + "uumrc $B%U%!%$%k$,B8:_$7$^$;$s(B" + "uumrc $B%U%!%$%k$N7A<0$,8m$C$F$$$^$9(B" + "$B$3$l0J>e4D6-$r:n$k$3$H$O$G$-$^$;$s(B" + "$B$3$N%/%i%$%"%s%H$,FI$_9~$s$@%U%!%$%k$G$"$j$^$;$s(B" + "$B<-=q$KIQEY%U%!%$%k$,$D$$$F$$$^$;$s(B" + "$B%Q%9%o!<%I$N%U%!%$%k$,:n@.=PMh$^$;$s(B" + ]) + (Chinese-GB . + [ + nil + "$AND<~2;4fTZ(B" + nil + "$ADZ4f(Balloc$AJ'0\(B" + nil + "$A2;JGWV5d(B" + "$A2;JGF56HND<~(B" + "$A2;JGND7(ND<~(B" + nil + "$AWV5d1m8qBz(B" + "$AF56HND<~#:2;JGV86(5DWV5d5DF56HND<~(B" + nil + nil + nil + nil + nil + "$AND<~2;D\4r?*(B" + "$A2;JGU}H75DF56HND<~(B" + "$A2;JGU}H75DND7(ND<~(B" + "$A8=JtSo5D8vJ}!"OrA?3$6H5H3,9}(B" + "$AUb8v:EBk5DWV5d!"C;SPJ9SC(B" + nil + nil + nil + "$AND7(ND<~5DDZH]2;U}H7(B" + "$APiDb4JPT:EBkRl3#(Bcixing.data$A2;U}H7(B" + "$AN46(Re5D4JPT!"6(ReAKG06K4JPT(B" + "$AND7(ND<~2;D\6AH!(B" + nil + nil + "$AWV5d5DOnJ}3,9}(B" + "$A1d;;:sWV7{4.5D3$6H3,9}(B" + "$A8=JtSo=bNvSr2;9;(B" + nil + "$A4N:n29Sr2;9;(B" + "$A:n29(B 1$A8vR2C;SP(B" + nil + nil + nil + nil + "$A6ARt3$6H3,9}(B" + "$A::WV3$6H3,9}(B" + "$AV86(5DWV5d!"2;D\5GB<(B" + "$A6ARt5D3$6HJG(B 0" + "$AV86(5DWV5d!"2;D\Df2i(B" + "$AV;6A5DWV5d!"5GB<(B/$AO{3}AK(B" + "$A;7>3VP2;4fTZ5DWV5d!"5GB2;7{(B" + "$A2;JG#c#W#n#nSC;'Iz3I5D;7>3(B" + nil + nil + nil + nil + nil + "$AWSD?B<2;D\44=((B" + nil + nil + nil + nil + nil + nil + nil + nil + nil + "$AND<~2;D\6AH!(B" + "$AND<~2;D\P43v(B" + "$A2;JG#c#W#n#nSC;'?I6AH!5DND<~(B" + "$ARTIO5DND<~2;D\6AH!(B" + "password$A2;6T(B" + "$AND<~U}TZ6AH!(B" + "$AND<~2;D\O{3}(B" + "$AND<~C;SP44=(3v@4(B" + "$A2;JG#c#W#n#n5DND<~(B" + "$AND<~5D(BI-node$A:M(BFILE_UNIQ$A2;D\R;VB(B" + "$A4JPTND<~L+4s(B" + "$A4JPTND<~L+4s(B" + "$A4JPTND<~2;4fTZ(B" + "$A4JPTND<~5DDZH]2;6T(B" + nil + "$A4JPTND<~2;D\6AH!(B" + "$A4JPTC{2;6T(B" + "$A4JPT:EBk2;6T(B" + nil + "$AUb8v2YWw2;V'3V(B" + "password$A5DJdHkND<~2;D\4r?*(B" + "uumrc$AND<~2;4fTZ(B" + "uumrc$AND<~5DPNJ=4mNs(B" + "$ARTIO;7>32;D\44=((B" + "$AUb8v#c#W#n#nSC;'!"6AH!5DND<~C;SP(B" + "$AWV5d5DF56HND<~C;SP(B" + "password$A5DND<~C;SP44=(3v@4(B" + ]) + (Chinese-CNS . + [ + nil + "$(GEFG5DbGtGc(B" + nil + "$(GDyGt(Balloc$(GFBZu(B" + nil + "$(GDbQRGsL((B" + "$(GDbQRs"PyEFG5(B" + "$(GDbQREFNNEFG5(B" + nil + "$(GGsL(OPV*iH(B" + "$(Gs"PyEFG5!3DbQRQ@LyN{GsL(N{s"PyEFG5(B" + nil + nil + nil + nil + nil + "$(GEFG5DbWdFTbd(B" + "$(GDbQRF_m}N{s"PyEFG5(B" + "$(GDbQRF_m}N{EFNNEFG5(B" + "$(GOazhk#N{T6m0!#GWbXO[Pya+b>g4(B" + "$(G]UT6f@n#N{GsL(!#JtH4KpFn(B" + nil + nil + nil + "$(GEFNNEFG5N{DyU)DbF_m}(B" + "$(Gapsib$MLf@n#\,Z&(Bcixing.data$(GDbF_m}(B" + "$(GF\LyexN{b$ML!#LyexD'P)j&b$ML(B" + "$(GEFNNEFG5DbWd{tL=(B" + nil + nil + "$(GGsL(N{bzm0b>g4(B" + "$(G|H_PG[Gs\JHkN{O[Pyb>g4(B" + "$(GOazhk#fXN5YQDbY\(B" + nil + "$(GH9OlfPYQDbY\(B" + "$(GOlfP(B 1$(GT6D>JtH4(B" + nil + nil + nil + nil + "$(G{tSvO[Pyb>g4(B" + "$(GiGGsO[Pyb>g4(B" + "$(GQ@LyN{GsL(!#DbWd`trg(B" + "$(G{tSvN{O[PyQR(B 0" + "$(GQ@LyN{GsL(!#DbWdXKQg(B" + "$(GF7{tN{GsL(!#`trg(B/$(GVJ=@4O4Y(B" + nil + "$(C8^8p8.(B alloc $(C?!<-(B $(C=GFPG_@>4O4Y(B" + nil + "$(C;g@|@L(B $(C>F4U4O4Y(B" + "$(C:s55(B $(CH-@O@L(B $(C>F4U4O4Y(B" + "$(C:Nn(B $(CH-@O@L(B $(C>F4U4O4Y(B" + nil + "$(C;g@|(B $(CEW@L:m@L(B $(C2K(B $(CC!@>4O4Y(B" + "$(CAvA$5H(B $(C;g@|@G(B $(C:s55(B $(CH-@O@L(B $(C>F4U4O4Y(B" + nil + nil + nil + nil + nil + "$(CH-@O@;(B $(C?-(B $(Cx@>4O4Y(B" + "$(C8B4B(B $(C:s55(B $(CH-@O@L(B $(C>F4U4O4Y(B" + "$(C8B4B(B $(C:Nn(B $(CH-@O@L(B $(C>F4U4O4Y(B" + "$(C:Nn@G(B $(C09J=@4O4Y(B" + nil + nil + nil + "$(C:Nn(B $(CH-@O@G(B $(C3;?k@L(B $(C8BAv(B $(C>J=@4O4Y(B" + "$(C0!;s(B $(CG0;g@G(B $(C9xH#0!(B $(CF2834O4Y(B. hinsi.data $(C0!(B $(C8BAv(B $(C>J=@4O4Y(B" + "$(C9LA$@G@G(B $(CG0;g0!(B $(C@|4\(B $(CG0;g7N(B $(CA$@G5G>n(B $(C@V=@4O4Y(B" + "$(C:Nn(B $(CH-@O@L(B $(C@PGtA.(B $(C@VAv(B $(C>J=@4O4Y(B" + nil + nil + "$(C;g@|@G(B $(C?#F.8.0!(B $(C3J9+(B $(C89=@4O4Y(B" + "$(C:/H/GO7A4B(B $(C9.@Z?-@L(B $(C3J9+(B $(C1i4O4Y(B" + "$(C:Nn(B $(CGX<.(B $(C?5?*@L(B $(C:NA7GU4O4Y(B" + nil + "$(C4Y@=(B $(CHD:8(B $(C?5?*@L(B $(C:NA7GU4O4Y(B" + "$(CHD:80!(B $(C>x@>4O4Y(B" + nil + nil + nil + nil + "$(CGQ1[@L(B $(C3J9+(B $(C1i4O4Y(B" + "$(CGQ@Z0!(B $(C3J9+(B $(C1i4O4Y(B" + "$(CAvA$5H(B $(C;g@|@:(B $(C5n7O(B $(C:R0!4I@T4O4Y(B" + "$(CGQ1[@G(B $(C1f@L0!(B 0 $(C@T4O4Y(B" + "$(CAvA$5H(B $(C;g@|@:(B $(C?*B|A6(B $(C:R0!4I@T4O4Y(B" + "$(C@P1b@|?k(B $(C;g@|?!(B $(C5n7O(B/$(C4O4Y(B" + "$(CA8@gGOAv(B $(C>J4B(B $(C;g@|?!(B $(C5n7O(B $(CGO7A0m(B $(CG_@>4O4Y(B" + nil + nil + "$(C@P1b@|?k(B $(C:s558&(B $(C0f=E(B $(CGO7A0m(B $(CG_@>4O4Y(B" + "$(CAvA$5H(B $(C4\>n4B(B $(CA8@gGOAv(B $(C>J=@4O4Y(B" + nil + nil + nil + nil + nil + nil + nil + nil + nil + "$(C8^8p8.(B alloc $(C?!(B $(C=GFPG_@>4O4Y(B" + nil + nil + nil + nil + nil + nil + nil + "$(C?!7/0!(B $(C9_;}G_@>4O4Y(B" + "$(C9v1W(B(Bug)$(C0!(B $(C9_;}G_@>4O4Y(B" + "$(C<-9v(B(Server)$(C0!(B $(CAW>n(B $(C@V@>4O4Y(B" + "alloc$(C?!(B $(C=GFPG_@>4O4Y(B" + "$(C<-9v(B(Server) $(C?M(B $(CA"CKGR(B $(Cx@>4O4Y(B" + "$(CEk=E(B $(CGA7NEdD]@G(B $(C9vA/@L(B $(C8BAv(B $(C>J=@4O4Y(B" + "$(CE,6s@L>HF.0!(B $(C;}<:GQ(B $(CH/0f@L(B $(C>F4U4O4Y(B" + nil + nil + nil + nil + nil + "$(C5p7:Ed8.8&(B $(C885i(B $(Cx@>4O4Y(B" + nil + nil + nil + nil + nil + nil + nil + nil + nil + "$(CH-@O(B $(C@P1b?!(B $(C=GFPG_@>4O4Y(B" + "$(CH-@O(B $(C>21b?!(B $(C=GFPG_@>4O4Y(B" + "$(CE,6s@L>HF.0!(B $(C@P>n(B $(C5e80(B $(CH-@O@L(B $(C>F4U4O4Y(B" + "$(C4u(B $(C@L;s@G(B $(CH-@O@;(B $(C@P>n(B $(C5e81(B $(Cx@>4O4Y(B" + "$(CFP=:?v5e0!(B $(CF2834O4Y(B" + "$(CH-@O@L(B $(C@PGtA.(B $(C@V@>4O4Y(B" + "$(CH-@O@;(B $(Cx@>4O4Y(B" + "$(CH-@O@;(B $(C@[<:GR(B $(Cx@>4O4Y(B" + "kWnn$(C@G(B $(CH-@O@L(B $(C>F4U4O4Y(B" + "$(CH-@O@G(B I-node $(C?M(B FILE_UNIQ $(C8&(B $(C@OD!=CE3(B $(Cx@>4O4Y(B" + "$(CG0;g(B $(CH-@O@G(B $(CE)1b0!(B $(C3J9+(B $(CE.4O4Y(B" + "$(CG0;g(B $(CH-@O@G(B $(CE)1b0!(B $(C3J9+(B $(CE.4O4Y(B" + "$(CG0;g(B $(CH-@O@L(B $(CA8@gGOAv(B $(C>J=@4O4Y(B" + "$(CG0;g(B $(CH-@O@G(B $(C3;?k@L(B $(CF2834O4Y(B" + nil + "$(CG0;g(B $(CH-@O@L(B $(C@PGtA.(B $(C@VAv(B $(C>J=@4O4Y(B" + "$(CG0;g(B $(C@L8'@L(B $(CF2834O4Y(B" + "$(CG0;g(B $(C9xH#0!(B $(CF2834O4Y(B" + nil + "$(C1W(B $(CA6@[@:(B $(CAv?x5GAv(B $(C>J=@4O4Y(B" + "$(CFP=:?v5e0!(B $(C5i>n@V4B(B $(CH-@O@;(B $(C?-(B $(Cx@>4O4Y(B" + "uumrc $(C@L(B $(CA8@gGOAv(B $(C>J=@4O4Y(B" + "uumrc $(C@G(B $(CG|=D@L(B $(CF2834O4Y(B" + "$(C@L(B $(C@L;s(B $(CH/0f@;(B $(C@[<:GR(B $(Cx@>4O4Y(B" + "$(CE)6s@L>HF.0!(B $(C@P>n(B $(C5e80(B $(CH-@O@L(B $(C>F4U4O4Y(B" + "$(C;g@|?!(B $(C:s55(B $(CH-@O@L(B $(CA8@gGOAv(B $(C>J=@4O4Y(B" + "$(CFP=:?v5e(B $(CH-@O@;(B $(C@[<:GR(B $(Cx@>4O4Y(B" + ])) + "Array of WNN error messages. Indexed by error code.") + +(defvar wnnrpc-timeout 10) + +(defun wnnrpc-message-language (lang) + (or (cdr (assq lang egg-message-language-alist)) lang)) + +(defun wnnrpc-get-error-message (errno) + "Return error message string specified by ERRNO." + (let ((msg (cdr (or (assq (wnnrpc-message-language egg-default-language) + wnnrpc-error-message) + (assq (wnnrpc-message-language its-current-language) + wnnrpc-error-message) + (assq 'Japanese wnnrpc-error-message))))) + (or (and (< errno (length msg)) (aref msg errno)) + (format "#%d" errno)))) + +(defmacro wnnrpc-call-with-proc (proc vlist send-expr &rest receive-exprs) + `(comm-call-with-proc ,proc + ((zhuyin its-zhuyin) + (comm-accept-timeout wnnrpc-timeout) + ,@vlist) + ,send-expr ,@receive-exprs)) + +(defmacro wnnrpc-call-with-environment (env vlist send-expr &rest rcv-exprs) + `(comm-call-with-proc (wnnenv-get-proc ,env) + ((zhuyin its-zhuyin) + (comm-accept-timeout wnnrpc-timeout) + (env-id (wnnenv-get-env-id ,env)) + ,@vlist) + ,send-expr ,@rcv-exprs)) + +(defmacro wnnrpc-get-result (&rest body) + `(let (result) + (comm-unpack (u) result) + (if (< result 0) + (progn + (comm-unpack (u) result) + (- result)) + ,@(or body '(result))))) + +(defun wnnrpc-open-internal (proc version myhostname username) + "Open the session. Return 0 on success, error code on failure." + (comm-call-with-proc proc () + (comm-format (u u s s) + (wnn-const JS_OPEN) + version myhostname username) + (wnnrpc-get-result))) + +(defun wnnrpc-open (proc myhostname username) + "Open the session. Return wnn4 or wnn6 on success, NIL on failure." + (let ((type-list `((wnn6 . ,(wnn-const JLIB_VERSION_WNN6)) + (wnn4 . ,(wnn-const JLIB_VERSION)))) + (result (- (wnn-const WNN_BAD_VERSION))) + type version) + (while (and type-list (= result (- (wnn-const WNN_BAD_VERSION)))) + (setq type (caar type-list) + version (cdar type-list) + type-list (cdr type-list) + result (wnnrpc-open-internal proc version myhostname username))) + (if (zerop result) + type + result))) + +(defun wnnrpc-connect (proc envname) + "Establish new `connection' and make an environment. +Return the identitifation of the environment on success, +or negative error code on failure." + (comm-call-with-proc proc () + (comm-format (u s) (wnn-const JS_CONNECT) envname) + (wnnrpc-get-result))) + +(defun wnnrpc-file-read (env filename) + "Read the file FILENAME on the environment ENV +Return non-negative file ID on success, or negative error code on failure." + (wnnrpc-call-with-environment env () + (comm-format (u u s) (wnn-const JS_FILE_READ) env-id filename) + (wnnrpc-get-result))) + +(defun wnnrpc-set-fuzokugo-file (env fid) + "For PROC, on environment ENV-ID, +Set Fuzokugo file specified by FID. +Return 0 on success, negate-encoded error code on failure." + (wnnrpc-call-with-environment env () + (comm-format (u u i) (wnn-const JS_FUZOKUGO_SET) env-id fid) + (wnnrpc-get-result))) + +(defun wnnrpc-set-dictionary (env dic-id freq-id priority dic-rw freq-rw + dic-passwd freq-passwd reverse) + "Set dictionary on server. +Return dictionary number on success, negate-encoded error code on faiulure." + (wnnrpc-call-with-environment env () + (comm-format (u u i i i u u s s u) (wnn-const JS_DIC_ADD) + env-id dic-id freq-id + priority + (if (numberp dic-rw) dic-rw (if dic-rw 0 1)) + (if (numberp freq-rw) freq-rw (if freq-rw 0 1)) + dic-passwd freq-passwd + (if reverse 1 0)) + (wnnrpc-get-result))) + +(defun wnnrpc-set-fi-dictionary (env dic-id freq-id sys dic-rw freq-rw + dic-passwd freq-passwd) + "Set FI dictionary on the server. +Return 0 on success, negate-encoded error code on faiulure." + (wnnrpc-call-with-environment env () + (comm-format (u u i i u u u s s) (wnn-const JS_FI_DIC_ADD) + env-id dic-id freq-id + (if sys + (wnn-const WNN_FI_SYSTEM_DICT) + (wnn-const WNN_FI_USER_DICT)) + (if (numberp dic-rw) dic-rw (if dic-rw 0 1)) + (if (numberp freq-rw) freq-rw (if freq-rw 0 1)) + dic-passwd freq-passwd) + (wnnrpc-get-result))) + +(defun wnnrpc-get-autolearning-dic (env type) + "Get id of auto learning dictionary on the server. +Return dictionary id + 1 on success, 0 on no dictionary, negate-encoded +error code on faiulure." + (wnnrpc-call-with-environment env (result) + (comm-format (u u u) (wnn-const JS_GET_AUTOLEARNING_DIC) + env-id type) + (wnnrpc-get-result + (comm-unpack (u) result) + (1+ result)))) + +(defun wnnrpc-set-autolearning-dic (env type dic-id) + "Set auto learning dictionary on the server. +Return 0 on success, negate-encoded error code on faiulure." + (wnnrpc-call-with-environment env () + (comm-format (u u u i) (wnn-const JS_SET_AUTOLEARNING_DIC) + env-id type dic-id) + (wnnrpc-get-result))) + +(defun wnnrpc-version (proc) + "Return the version number of WNN server." + (comm-call-with-proc proc (result) + (comm-format (u) (wnn-const JS_VERSION)) + (comm-unpack (u) result) + result)) + +(defun wnnrpc-access (env path mode) + "Check the accessibility of file in the environment ENV. +Return 0 when the remote file (dictionary/frequency) of PATH on server +can be accessed in mode MODE. Return Non-zero otherwise." + (wnnrpc-call-with-environment env (result) + (comm-format (u u u s) (wnn-const JS_ACCESS) env-id mode path) + (comm-unpack (u) result) + result)) + +(defun wnnrpc-mkdir (env path) + "Create directory specified by PATH." + (wnnrpc-call-with-environment env () + (comm-format (u u s) (wnn-const JS_MKDIR) env-id path) + (wnnrpc-get-result))) + +(defun wnnrpc-writable-dic-type (env fi rw) + (let ((server (wnnenv-get-server-type env))) + (cond (fi (wnn-const WNN_FI_USER_DICT)) + ((or (eq server 'cserver) + (eq server 'tserver)) (wnn-const CWNN_REV_DICT)) + ((eq rw 3) (wnn-const WNN_GROUP_DICT)) + ((eq rw 4) (wnn-const WNN_MERGE_DICT)) + (t (wnn-const WNN_REV_DICT))))) + +(defun wnnrpc-dic-file-create (env dicname type comment passwd hpasswd) + "Create a dictionary on the server." + (wnnrpc-call-with-environment env () + (comm-format (u u s S s s u) (wnn-const JS_DIC_FILE_CREATE) + env-id dicname comment + passwd hpasswd type) + (wnnrpc-get-result))) + +(defun wnnrpc-hindo-file-create (env fi dic-id freqname comment passwd) + "Create a frequency file on the server." + (wnnrpc-call-with-environment env () + (comm-format (u u u s S s) + (if fi + (wnn-const JS_FI_HINDO_FILE_CREATE) + (wnn-const JS_HINDO_FILE_CREATE)) + env-id dic-id freqname comment passwd) + (wnnrpc-get-result))) + +(defun wnnrpc-file-discard (env fid) + "Discard a file specified by FID. Call this for already-opened file +before remove and create new file." + (wnnrpc-call-with-environment env () + (comm-format (u u i) (wnn-const JS_FILE_DISCARD) + env-id fid) + (wnnrpc-get-result))) + +(defun wnnrpc-file-remove (proc filename passwd) + "Remove the file." + (comm-call-with-proc proc () + (comm-format (u s s) (wnn-const JS_FILE_REMOVE) + filename (or passwd "")) + (wnnrpc-get-result))) + +(defun wnnrpc-set-conversion-parameter (env v) + "Set conversion parameter." + (wnnrpc-call-with-environment env () + (comm-format (u u i i i i i i i i i i i i i i i i i) + (wnn-const JS_PARAM_SET) + env-id + (aref v 0) (aref v 1) (aref v 2) (aref v 3) (aref v 4) + (aref v 5) (aref v 6) (aref v 7) (aref v 8) (aref v 9) + (aref v 10) (aref v 11) (aref v 12) (aref v 13) (aref v 14) + (aref v 15) (aref v 16)) + (wnnrpc-get-result))) + +(defun wnnrpc-set-conversion-env-param (env mask v) + "Set Wnn6 conversion parameter." + (wnnrpc-call-with-environment env () + (comm-format (u u u i i i i i i i i i i i i i i i i i i) + (wnn-const JS_SET_HENKAN_ENV) + env-id mask + (aref v 0) (aref v 1) (aref v 2) (aref v 3) (aref v 4) + (aref v 5) (aref v 6) (aref v 7) (aref v 8) (aref v 9) + (aref v 10) (aref v 11) (aref v 12) (aref v 13) (aref v 14) + (aref v 15) (aref v 16) (aref v 17)) + (wnnrpc-get-result))) + +(defun wnnrpc-temporary-dic-loaded (env) + "Ask to the server whether the temporary dictionary is loaded or not. +Return positive if loaded, zero if not, negative on failure." + (wnnrpc-call-with-environment env () + (comm-format (u u) (wnn-const JS_IS_LOADED_TEMPORARY_DIC) + env-id) + (wnnrpc-get-result))) + +(defun wnnrpc-temporary-dic-add (env reverse) + "Add temporary dictionary on the server." + (wnnrpc-call-with-environment env () + (comm-format (u u u) (wnn-const JS_TEMPORARY_DIC_ADD) + env-id (if reverse 1 0)) + (wnnrpc-get-result))) + +(defun wnnrpc-receive-sho-bunsetsu-list (env n-bunsetsu) + (let ((proc (wnnenv-get-proc env)) + slist + end start jiritsugo-end dic-no entry freq right-now + hinshi status status-backward kangovect evaluation + result source fuzokugo) + (while (> n-bunsetsu 0) + (comm-unpack (u u u u u u u u u u u u) + end start jiritsugo-end + dic-no entry freq right-now hinshi + status status-backward kangovect evaluation) + (setq slist + (cons + (wnn-bunsetsu-create env (1+ (- jiritsugo-end start)) + dic-no entry freq right-now hinshi + status status-backward kangovect evaluation) + slist)) + (setq n-bunsetsu (1- n-bunsetsu))) + (prog1 + (setq slist (nreverse slist)) + (while slist + (comm-unpack (S S S) result source fuzokugo) + (wnn-bunsetsu-set-converted (car slist) result) + (wnn-bunsetsu-set-yomi (car slist) source) + (wnn-bunsetsu-set-fuzokugo (car slist) fuzokugo) + (setq slist (cdr slist)))))) + +(defun wnnrpc-receive-dai-bunsetsu-list (env n-dai separate) + (let ((proc (wnnenv-get-proc env)) + n-bunstsu kanji-length dlist slist + end start n-sho evaluation + n retval) + (comm-unpack (u u) n-bunstsu kanji-length) + (while (> n-dai 0) + (comm-unpack (u u u u) end start n-sho evaluation) + (setq dlist (cons (cons n-sho evaluation) dlist) + n-dai (1- n-dai))) + (setq dlist (nreverse dlist) + slist (wnnrpc-receive-sho-bunsetsu-list env n-bunstsu)) + (if (null separate) + (prog1 + slist + (while dlist + (setq n (caar dlist)) + (while (> n 0) + (wnn-bunsetsu-set-dai-evaluation (car slist) (cdar dlist)) + (wnn-bunsetsu-set-dai-continue (car slist) (> n 1)) + (setq slist (cdr slist) + n (1- n))) + (setq dlist (cdr dlist)))) + (while dlist + (setq retval (cons slist retval) + n (caar dlist)) + (while (> n 1) + (wnn-bunsetsu-set-dai-evaluation (car slist) (cdar dlist)) + (wnn-bunsetsu-set-dai-continue (car slist) t) + (setq slist (cdr slist) + n (1- n))) + (wnn-bunsetsu-set-dai-evaluation (car slist) (cdar dlist)) + (wnn-bunsetsu-set-dai-continue (car slist) + (wnn-bunsetsu-connect-next (car slist))) + (setq slist (prog1 (cdr slist) (setcdr slist nil)) + dlist (cdr dlist))) + (nreverse retval)))) + +(defun wnnrpc-renbunsetsu-conversion (env yomi hinshi fuzokugo v) + "Convert YOMI string into Kanji. +HINSHI and FUZOKUGO are information of preceding bunsetsu." + (wnnrpc-call-with-environment env () + (comm-format (u u S i S i i i) (wnn-const JS_KANREN) + env-id yomi hinshi fuzokugo + (or v (wnn-const WNN_VECT_KANREN)) + (if v (wnn-const WNN_VECT_KANREN) (wnn-const WNN_VECT_NO)) + (wnn-const WNN_VECT_BUNSETSU)) + (wnnrpc-get-result + (wnnrpc-receive-dai-bunsetsu-list env result nil)))) + +(defun wnnrpc-fi-renbunsetsu-conversion (env yomi hinshi fuzokugo v context) + "Convert YOMI string into Kanji. +HINSHI and FUZOKUGO are information of preceding bunsetsu." + (wnnrpc-call-with-environment env (result) + (comm-format (u u S i S i i i i i i i S i i i i S) (wnn-const JS_FI_KANREN) + env-id yomi hinshi fuzokugo + (or v (wnn-const WNN_VECT_KANREN)) + (if v (wnn-const WNN_VECT_KANREN) (wnn-const WNN_VECT_NO)) + (wnn-const WNN_VECT_BUNSETSU) + (wnn-context-dic-no (car context)) + (wnn-context-entry (car context)) + (wnn-context-jirilen (car context)) + (wnn-context-hinshi (car context)) + (wnn-context-fuzokugo (car context)) + (wnn-context-dic-no (nth 1 context)) + (wnn-context-entry (nth 1 context)) + (wnn-context-jirilen (nth 1 context)) + (wnn-context-hinshi (nth 1 context)) + (wnn-context-fuzokugo (nth 1 context))) + (setq result (wnnrpc-get-result + (wnnrpc-receive-dai-bunsetsu-list env result nil))) + (prog1 + result + (unless (numberp result) + (wnn-bunsetsu-set-fi-rel (car result) + (wnnrpc-get-fi-relation-data env)) + (while result + (wnn-bunsetsu-set-context (car result) context) + (setq result (cdr result))))))) + +(defun wnnrpc-get-fi-relation-data (env) + "Receive FI relation data from the server." + (let ((proc (wnnenv-get-proc env)) + fi-dic dic entry offset num result) + (comm-unpack (i) num) + (while (> num 0) + (comm-unpack (u u u u) fi-dic dic entry offset) + (setq result (cons (vector fi-dic dic entry offset -2 -4) result) + num (1- num))) + (nreverse result))) + +(defun wnnrpc-tanbunsetsu-conversion (env yomi hinshi fuzoku v) + "" + (wnnrpc-call-with-environment env (kanji-length) + (comm-format (u u S i S i i) (wnn-const JS_KANTAN_SHO) + env-id yomi hinshi fuzoku + (or v (wnn-const WNN_VECT_KANTAN)) + (if v (wnn-const WNN_VECT_KANTAN) (wnn-const WNN_VECT_NO))) + (wnnrpc-get-result + (comm-unpack (u) kanji-length) ; ignore kanji-length + (wnnrpc-receive-sho-bunsetsu-list env result)))) + +(defun wnnrpc-get-bunsetsu-candidates (env yomi hinshi fuzoku v) + "" + (wnnrpc-call-with-environment env (kanji-length) + (comm-format (u u S i S i i) (wnn-const JS_KANZEN_SHO) + env-id yomi hinshi fuzoku + (or v (wnn-const WNN_VECT_KANZEN)) + (if v (wnn-const WNN_VECT_KANZEN) (wnn-const WNN_VECT_NO))) + (wnnrpc-get-result + (comm-unpack (u) kanji-length) ; ignore kanji-length + (mapcar (lambda (b) + (wnn-bunsetsu-set-dai-continue b (wnn-bunsetsu-connect-next b)) + (list b)) + (wnnrpc-receive-sho-bunsetsu-list env result))))) + +(defun wnnrpc-daibunsetsu-conversion (env yomi hinshi fuzoku v) + "" + (wnnrpc-call-with-environment env (n-sho-bunsetsu kanji-size) + (comm-format (u u S i S i i) (wnn-const JS_KANTAN_DAI) + env-id yomi hinshi fuzoku + (or v (wnn-const WNN_VECT_KANTAN)) + (if v (wnn-const WNN_VECT_KANTAN) (wnn-const WNN_VECT_NO))) + (wnnrpc-get-result + (wnnrpc-receive-dai-bunsetsu-list env result nil)))) + +(defun wnnrpc-get-daibunsetsu-candidates (env yomi hinshi fuzoku v) + "" + (wnnrpc-call-with-environment env (n-sho-bunsetsu kanji-size) + (comm-format (u u S i S i i) (wnn-const JS_KANZEN_DAI) + env-id yomi hinshi fuzoku + (or v (wnn-const WNN_VECT_KANZEN)) + (if v (wnn-const WNN_VECT_KANZEN) (wnn-const WNN_VECT_NO))) + (wnnrpc-get-result + (wnnrpc-receive-dai-bunsetsu-list env result t)))) + +(defun wnnrpc-set-frequency (env dicno entry ima hindo) + "" + (wnnrpc-call-with-environment env () + (comm-format (u u i i i i) (wnn-const JS_HINDO_SET) + env-id dicno entry ima hindo) + (wnnrpc-get-result))) + +(defun wnnrpc-set-fi-priority (env fi-rel) + "" + (wnnrpc-call-with-environment env () + (progn + (comm-format (u u u) (wnn-const JS_SET_FI_PRIORITY) + env-id (length fi-rel)) + (while fi-rel + (comm-format (i i i i i i) + (aref (car fi-rel) 0) (aref (car fi-rel) 1) + (aref (car fi-rel) 2) (aref (car fi-rel) 3) + (aref (car fi-rel) 4) (aref (car fi-rel) 5)) + (setq fi-rel (cdr fi-rel)))) + (wnnrpc-get-result))) + +(defun wnnrpc-optimize-fi (env context) + "" + (wnnrpc-call-with-environment env (c) + (progn + (comm-format (u u u) (wnn-const JS_OPTIMIZE_FI) + env-id (length context)) + (while context + (setq c (car context) + context (cdr context)) + (comm-format (i i i i i S) + (wnn-context-dic-no c) + (wnn-context-entry c) + (wnn-context-right-now c) + (wnn-context-freq c) + (wnn-context-length c) + (concat (wnn-context-converted c) + (wnn-context-fuzokugo c))))) + (wnnrpc-get-result))) + +(defun wnnrpc-close (proc) + "" + (comm-call-with-proc proc () + (comm-format (u) (wnn-const JS_CLOSE)) + (wnnrpc-get-result))) + +(defun wnnrpc-env-exist (proc envname) + "" + (comm-call-with-proc proc (result) + (comm-format (u s) (wnn-const JS_ENV_EXIST) envname) + (comm-unpack (u) result) + result)) + +(defun wnnrpc-make-env-sticky (env) + "" + (wnnrpc-call-with-environment env () + (comm-format (u u) (wnn-const JS_ENV_STICKY) env-id) + (wnnrpc-get-result))) + +(defun wnnrpc-make-env-unsticky (env) + "" + (wnnrpc-call-with-environment env () + (comm-format (u u) (wnn-const JS_ENV_UNSTICKY) env-id) + (wnnrpc-get-result))) + +(defun wnnrpc-disconnect (env) + "" + (wnnrpc-call-with-environment env () + (comm-format (u u) (wnn-const JS_DISCONNECT) env-id) + (wnnrpc-get-result))) + +(defun wnnrpc-add-word (env dictionary yomi kanji comment hinshi initial-freq) + "" + (wnnrpc-call-with-environment env () + (comm-format (u u u S S S u u) (wnn-const JS_WORD_ADD) + env-id dictionary yomi kanji comment hinshi initial-freq) + (wnnrpc-get-result))) + +(defun wnnrpc-auto-learning (env type yomi kanji comment hinshi initial-freq) + "" + (wnnrpc-call-with-environment env () + (comm-format (u u u S S S u u) (wnn-const JS_AUTOLEARNING_WORD_ADD) + env-id type yomi kanji comment hinshi initial-freq) + (wnnrpc-get-result))) + +(defun wnnrpc-temporary-learning (env yomi kanji comment hinshi initial-freq) + "" + (wnnrpc-call-with-environment env () + (comm-format (u u S S S u u) (wnn-const JS_AUTOLEARNING_WORD_ADD) + env-id yomi kanji comment hinshi initial-freq) + (wnnrpc-get-result))) + +(defun wnnrpc-get-dictionary-list-with-environment (env) + "" + (wnnrpc-call-with-environment env (n-dic) + (comm-format (u u) (wnn-const JS_DIC_LIST) env-id) + (comm-unpack (u) n-dic) + (wnnrpc-receive-dictionary-list proc n-dic))) + +(defun wnnrpc-get-fi-dictionary-list-with-environment (env mask) + "" + (wnnrpc-call-with-environment env (n-dic) + (comm-format (u u u) (wnn-const JS_FI_DIC_LIST) env-id mask) + (comm-unpack (u) n-dic) + (wnnrpc-receive-dictionary-list proc n-dic))) + +(defun wnnrpc-receive-dictionary-list (proc n-dic) + (let (entry dic freq dic-mode freq-mode enable-flag nice + rev comment dicname freqname dic-passwd freq-passwd + type gosuu dic-local-flag freq-local-flag retval) + (while (> n-dic 0) + (comm-unpack (u u u u u u u u S s s s s u u u u) + entry dic freq dic-mode freq-mode enable-flag nice + rev comment dicname freqname dic-passwd freq-passwd + type gosuu dic-local-flag freq-local-flag) + (setq retval (cons + (vector entry dic freq dic-mode freq-mode enable-flag nice + rev comment dicname freqname dic-passwd freq-passwd + type gosuu dic-local-flag freq-local-flag) + retval) + n-dic (1- n-dic))) + (nreverse retval))) + +(defsubst wnndic-get-id (dic) (aref dic 0)) +(defsubst wnndic-get-comment (dic) (aref dic 8)) +(defsubst wnndic-get-dictname (dic) (aref dic 9)) + +(defun wnnrpc-get-writable-dictionary-id-list (env) + "" + (wnnrpc-call-with-environment env (dic-list dic) + (comm-format (u u i) (wnn-const JS_HINSI_DICTS) env-id -1) + (wnnrpc-get-result + (while (> result 0) + (comm-unpack (u) dic) + (setq dic-list (nconc dic-list (list dic)) + result (1- result))) + dic-list))) + +(defun wnnrpc-get-hinshi-list (env dic name) + "" + (wnnrpc-call-with-environment env (hinshi hinshi-list str-size) + (comm-format (u u u S) (wnn-const JS_HINSI_LIST) env-id dic name) + (wnnrpc-get-result + (comm-unpack (u) str-size) ; ignore + (while (> result 0) + (comm-unpack (S) hinshi) + (setq hinshi-list (nconc hinshi-list (list hinshi)) + result (1- result))) + hinshi-list))) + +(defun wnnrpc-hinshi-number (proc name) + "" + (wnnrpc-call-with-proc proc () + (comm-format (u S) (wnn-const JS_HINSI_NUMBER) name) + (wnnrpc-get-result))) + +(defun wnnrpc-get-conversion-parameter (env) + "" + (wnnrpc-call-with-environment env (n nsho p1 p2 p3 p4 p5 p6 p7 p8 p9 + p10 p11 p12 p13 p14 p15) + (comm-format (u u) (wnn-const JS_PARAM_GET) env-id) + (wnnrpc-get-result + (comm-unpack (u u u u u u u u u u u u u u u u u) + n nsho p1 p2 p3 p4 p5 p6 p7 p8 p9 + p10 p11 p12 p13 p14 p15) + (vector n nsho p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15)))) + +(defun wnnrpc-get-conversion-env-param (env) + "" + (wnnrpc-call-with-environment env (p1 p2 p3 p4 p5 p6 p7 p8 p9 + p10 p11 p12 p13 p14 p15 p16 p17 p18) + (comm-format (u u) (wnn-const JS_GET_HENKAN_ENV) env-id) + (wnnrpc-get-result + (comm-unpack (i i i i i i i i i i i i i i i i i i) + p1 p2 p3 p4 p5 p6 p7 p8 p9 + p10 p11 p12 p13 p14 p15 p16 p17 p18) + (vector p1 p2 p3 p4 p5 p6 p7 p8 p9 + p10 p11 p12 p13 p14 p15 p16 p17 p18)))) + +(defun wnnrpc-file-loaded (proc path) + "" + (comm-call-with-proc proc (result) + (comm-format (u s) (wnn-const JS_FILE_LOADED) path) + (comm-unpack (u) result) + result)) + +(defun wnnrpc-write-file (env fid filename) + (wnnrpc-call-with-environment env () + (comm-format (u u u s) (wnn-const JS_FILE_WRITE) env-id fid filename) + (wnnrpc-get-result))) + +(defun wnnrpc-get-fuzokugo-file (env) + "" + (wnnrpc-call-with-environment env () + (comm-format (u u) (wnn-const JS_FUZOKUGO_GET) env-id) + (wnnrpc-get-result))) + +(defsubst wnnrpc-receive-file-list (proc) + (let ((i 0) + flist + nfiles fid local ref-count type name) + (comm-unpack (u) nfiles) + (while (> nfiles 0) + (comm-unpack (u u u u s) fid local ref-count type name) + (setq flist (nconc flist (list (vector fid local ref-count type name))) + nfiles (1- nfiles))) + flist)) + +(defun wnnrpc-get-file-list (proc) + "" + (comm-call-with-proc proc () + (comm-format (u) (wnn-const JS_FILE_LIST_ALL)) + (wnnrpc-receive-file-list proc))) + +(defun wnnrpc-get-file-list-with-env (env) + "" + (wnnrpc-call-with-environment env () + (comm-format (u u) (wnn-const JS_FILE_LIST) env-id) + (wnnrpc-receive-file-list proc))) + +(defun wnnrpc-file-attribute (env path) + "3: dictionary, 4: hindo file, 5: fuzokugo-file" + (wnnrpc-call-with-environment env (result) + (comm-format (u u s) (wnn-const JS_FILE_STAT) env-id path) + (comm-unpack (u) result) + result)) + +(defun wnnrpc-get-file-info (env fid) + "" + (wnnrpc-call-with-environment env (name local ref-count type) + (comm-format (u u u) (wnn-const JS_FILE_INFO) env-id fid) + (wnnrpc-get-result + (comm-unpack (s u u u) name local ref-count type) + (vector name local ref-count type)))) + +(defmacro wnnrpc-receive-vector (n) + `(let ((v (make-vector ,n -1)) + (i 0) + j) + (while (< i ,n) + (comm-unpack (u) j) + (aset v i j) + (setq i (1+ i))) + v)) + +(defun wnnrpc-who (proc) + "" + (comm-call-with-proc proc (who socket username hostname) + (comm-format (u) (wnn-const JS_WHO)) + (wnnrpc-get-result + (while (> result 0) + (comm-unpack (u s s) socket username hostname) + (setq who (nconc who + (list (vector socket username hostname + (wnnrpc-receive-vector + (wnn-const WNN_MAX_ENV_OF_A_CLIENT))))) + result (1- result))) + who))) + +(defun wnnrpc-get-env-list (proc) + (comm-call-with-proc proc (envs id name count fuzokugo dic-max) + (comm-format (u) (wnn-const JS_ENV_LIST)) + (wnnrpc-get-result + (while (> result 0) + (comm-unpack (u s u u u) id name count fuzokugo dic-max) + (setq envs (nconc envs + (list (vector id name count fuzokugo dic-max + (wnnrpc-receive-vector + (wnn-const WNN_MAX_DIC_OF_AN_ENV)) + (wnnrpc-receive-vector + (wnn-const WNN_MAX_FILE_OF_AN_ENV))))) + result (1- result))) + envs))) + +(defun wnnrpc-kill (proc) + "" + (comm-call-with-proc proc (result) + (comm-format (u) (wnn-const JS_KILL)) + (comm-unpack (u) result) + result)) + +(defun wnnrpc-delete-dictionary (env dic) + "" + (wnnrpc-call-with-environment env () + (comm-format (u u u) (wnn-const JS_DIC_DELETE) env-id dic) + (wnnrpc-get-result))) + +(defun wnnrpc-set-flag-on-dictionary (env dic flag) + "" + (wnnrpc-call-with-environment env () + (comm-format (u u u u) (wnn-const JS_DIC_USE) env-id dic flag) + (wnnrpc-get-result))) + +(defun wnnrpc-get-dictionary-list (proc) + "" + (wnnrpc-call-with-proc proc (n-dic) + (comm-format (u) (wnn-const JS_DIC_LIST_ALL)) + (comm-unpack (u) n-dic) + (wnnrpc-receive-dictionary-list proc n-dic))) + +(defun wnnrpc-delete-word (env dic entry) + "" + (wnnrpc-call-with-environment env () + (comm-format (u u u u) (wnn-const JS_WORD_DELETE) env-id dic entry) + (wnnrpc-get-result))) + +(defun wnnrpc-receive-word (proc yomi) + (let (dic serial hinshi hindo right-now internal-hindo internal-right-now + kanji comment l l1) + (comm-unpack (u) dic) + (while (>= dic 0) + (comm-unpack (u u u u u u) serial hinshi hindo right-now + internal-hindo internal-right-now) + (setq l (cons (vector dic serial hinshi hindo right-now + internal-hindo internal-right-now + yomi nil nil) + l)) + (comm-unpack (u) dic)) + (setq l (nreverse l) + l1 l) + (while l1 + (comm-unpack (S S) kanji comment) + (aset (car l1) 8 kanji) + (aset (car l1) 9 comment) + (setq l1 (cdr l1))) + l)) + +(defun wnnrpc-search-word-in-dictionary (env dic yomi) + "" + (wnnrpc-call-with-environment env (n-entries len) + (comm-format (u u u S) (wnn-const JS_WORD_SEARCH) env-id dic yomi) + (comm-unpack (u u) n-entries len) ; ignore + (wnnrpc-receive-word proc yomi))) + +(defun wnnrpc-search-word (env yomi) + "" + (wnnrpc-call-with-environment env (n-entries len) + (comm-format (u u S) (wnn-const JS_WORD_SEARCH_BY_ENV) env-id yomi) + (comm-unpack (u u) n-entries len) ; ignore + (wnnrpc-receive-word proc yomi))) + +(defun wnnrpc-get-word-info (env dic entry) + "" + (wnnrpc-call-with-environment env (n-entries len yomi) + (comm-format (u u u u) (wnn-const JS_WORD_INFO) env-id dic entry) + (wnnrpc-get-result + (comm-unpack (S) yomi) + (comm-unpack (u u) n-entries len) ; ignore + (wnnrpc-receive-word proc yomi)))) + +(defun wnnrpc-set-comment-on-word (env dic entry comment) + "" + (wnnrpc-call-with-environment env () + (comm-format (u u u u S) (wnn-const JS_WORD_COMMENT_SET) + env-id dic entry comment) + (wnnrpc-get-result))) + +(defun wnnrpc-get-dictionary-info (env dic) + "" + (wnnrpc-call-with-environment env () + (comm-format (u u u) (wnn-const JS_DIC_INFO) env-id dic) + (wnnrpc-get-result + (wnnrpc-receive-dictionary-list proc 1)))) + +(defun wnnrpc-set-file-comment (env fid comment) + "" + (wnnrpc-call-with-environment env () + (comm-format (u u u S) (wnn-const JS_FILE_COMMENT_SET) env-id fid comment) + (wnnrpc-get-result))) + +(defun wnnrpc-hinshi-name (proc hinshi) + "" + (wnnrpc-call-with-proc proc () + (comm-format (u u) (wnn-const JS_HINSI_NAME) hinshi) + (wnnrpc-get-result + (comm-unpack (S) result) + result))) + +(defun wnnrpc-set-file-password (env fid which old new) + "WHICH: 1: DIC, 2: HINDO, 3(0): Both" + (wnnrpc-call-with-environment env () + (comm-format (u u u u s s) (wnn-const JS_FILE_PASSWORD_SET) + env-id fid which old new) + (wnnrpc-get-result))) + +(defun wnnrpc-set-hinshi-table (env dic hinshi-table) + "" + (wnnrpc-call-with-environment env () + (comm-format (u u u S) (wnn-const JS_HINSI_TABLE_SET) + env-id dic hinshi-table) + (wnnrpc-get-result))) + +(defmacro wnnrpc-with-temp-buffer (&rest body) + `(with-temp-buffer + (let ((coding-system-for-read 'no-conversion) + (coding-system-for-write 'no-conversion)) + (set-buffer-multibyte nil) + ,@body))) + +(defmacro wnnrpc-with-write-file (filename error-handler &rest body) + `(condition-case error + (with-temp-file ,filename + (let ((coding-system-for-read 'no-conversion) + (coding-system-for-write 'no-conversion)) + (set-buffer-multibyte nil) + ,@body)) + (file-error ,error-handler))) + +(defmacro wnnrpc-terminate-current-command (errno) + `(progn + (comm-call-with-proc-1 proc () + (comm-format (i) (wnn-const WNN_NAK))) + (- (wnn-const ,errno)))) + +(defun wnnrpc-get-local-filename (name) + (if (and (string-match (wnn-const WNN_C_LOCAL) name) + (string= (substring name 0 (match-beginning 0)) wnn-system-name)) + (substring name (match-end 0)) + name)) + +;;
::= ( ) +;; ::= string +;; ::= string + +(defun wnnrpc-scan-file-header () + (let ((proc nil) + type uniq1 uniq2 passwd) + (if (and (> (point-max) (wnn-const WNN_FILE_HEADER_LEN)) + (equal (buffer-substring 1 (1+ (wnn-const WNN_FILE_STRING_LEN))) + (wnn-const WNN_FILE_STRING))) + (progn + (goto-char (1+ (wnn-const WNN_FILE_STRING_LEN))) + (comm-unpack (u v v v) + type + uniq1 (wnn-const WNN_UNIQ_LEN) + uniq2 (wnn-const WNN_UNIQ_LEN) + passwd (wnn-const WNN_PASSWD_LEN)) + (list type uniq1 uniq2 passwd))))) + +(defun wnnrpc-get-file-header (filename) + (wnnrpc-with-temp-buffer + (if (null (file-readable-p filename)) + (list nil (make-string (wnn-const WNN_UNIQ_LEN) 0) "" "") + (insert-file-contents filename nil 0 (wnn-const WNN_FILE_HEADER_LEN)) + (wnnrpc-scan-file-header)))) + +(defun wnnrpc-check-local-file (path &optional preserve) + (let ((header (wnnrpc-get-file-header path))) + (cond ((null header) + (- (wnn-const WNN_NOT_A_FILE))) + ((null (car header)) + (if (file-exists-p path) + (- (wnn-const WNN_OPENF_ERR)) + (- (wnn-const WNN_NO_EXIST)))) + (t + (if (wnnrpc-check-inode header path) + header + (if preserve + (- (wnn-const WNN_INODE_CHECK_ERROR)) + (wnnrpc-change-file-uniq header path) + (wnnrpc-check-local-file path t))))))) + +(defsubst wnnrpc-get-inode (uniq) + (+ (lsh (aref uniq 8) 24) + (lsh (aref uniq 9) 16) + (lsh (aref uniq 10) 8) + (aref uniq 11))) + +(defun wnnrpc-check-inode (header path) + (let ((inode (nth 10 (file-attributes path)))) + (and inode (= inode (wnnrpc-get-inode (nth 1 header)))))) + +(defun wnnrpc-make-uniq (attributes) + (wnnrpc-with-temp-buffer + (comm-format (U i u V) + (nth 6 attributes) (nth 11 attributes) (nth 10 attributes) + wnn-system-name (wnn-const WNN_HOST_LEN)) + (buffer-string))) + +(defun wnnrpc-change-file-uniq (header path &optional new) + (wnnrpc-with-write-file path + nil + (insert-file-contents path) + (if (wnnrpc-scan-file-header) + (let ((uniq (wnnrpc-make-uniq (file-attributes path)))) + (goto-char (1+ (wnn-const WNN_FILE_STRING_LEN))) + (delete-region (point) (1+ (wnn-const WNN_FILE_HEADER_LEN))) + (comm-format (u v v v v) + (car header) + uniq (wnn-const WNN_UNIQ_LEN) + (if new uniq (nth 1 header)) (wnn-const WNN_UNIQ_LEN) + (nth 3 header) (wnn-const WNN_PASSWD_LEN) + "" (wnn-const WNN_FILE_HEADER_PAD)) + t)))) + +(defun wnnrpc-check-passwd (proc passwd header) + (let ((env-id -1)) + (unwind-protect + (if (>= (setq env-id (wnnrpc-connect proc "")) 0) + (wnnrpc-call-with-environment (wnnenv-create proc env-id) + (file-id) + (comm-format (u u v) (wnn-const JS_FILE_SEND) + env-id + (nth 1 header) (wnn-const WNN_UNIQ_LEN)) + (comm-unpack (u) file-id) + (if (>= file-id 0) + (progn + (wnnrpc-get-result) ; ignore result code + (- (wnn-const WNN_FILE_IN_USE))) + (wnnrpc-get-result + (comm-call-with-proc-1 proc () + (comm-format (s B) + (concat wnn-system-name "!TEMPFILE") + (wnnrpc-make-dummy-dictionary header)) + (wnnrpc-get-result + (let ((egg-fixed-euc (list egg-fixed-euc egg-fixed-euc))) + (wnnrpc-set-dictionary (wnnenv-create proc env-id) + result -1 1 t t + passwd "" nil)))))))) + (if (>= env-id 0) + (wnnrpc-disconnect (wnnenv-create proc env-id)))))) + +(defun wnnrpc-make-dummy-dictionary (header) + (wnnrpc-with-temp-buffer + (comm-format (v u v v v v u v) + (wnn-const WNN_FILE_STRING) (wnn-const WNN_FILE_STRING_LEN) + (wnn-const WNN_FT_DICT_FILE) + (nth 1 header) (wnn-const WNN_UNIQ_LEN) + (nth 1 header) (wnn-const WNN_UNIQ_LEN) + (nth 3 header) (wnn-const WNN_PASSWD_LEN) + "" (wnn-const WNN_FILE_HEADER_PAD) + (wnn-const WNN_REV_DICT) + "" (wnn-const WNN_FILE_BODY_PAD)) + (buffer-string))) + +(defun wnnrpc-file-loaded-local (proc path &optional preserve) + "" + (let ((header (wnnrpc-check-local-file path preserve))) + (if (numberp header) + -1 + (comm-call-with-proc proc (result) + (comm-format (u v) (wnn-const JS_FILE_LOADED_LOCAL) + (nth 1 header) (wnn-const WNN_UNIQ_LEN)) + (comm-unpack (u) result) + result)))) + +(defun wnnrpc-file-receive (env fid local-filename) + "" + (condition-case err + (wnnrpc-call-with-environment env (filename) + (comm-format (u u u) (wnn-const JS_FILE_RECEIVE) + env-id fid) + (comm-unpack (s) filename) + (if (null local-filename) + (setq local-filename (wnnrpc-get-local-filename filename))) + (let ((header (wnnrpc-get-file-header local-filename)) + contents) + (if (null header) + (wnnrpc-terminate-current-command WNN_NOT_A_FILE) + (comm-call-with-proc-1 proc () + (comm-format (u v) (wnn-const WNN_ACK) + (nth 1 header) (wnn-const WNN_UNIQ_LEN))) + (wnnrpc-get-result + (cond + ((= result 0) 0) + ((null (file-writable-p local-filename)) + (wnnrpc-terminate-current-command WNN_FILE_WRITE_ERROR)) + (t + (wnnrpc-with-write-file local-filename + (- (wnn-const WNN_FILE_WRITE_ERROR)) + (comm-call-with-proc proc () + (comm-format (u) (wnn-const WNN_ACK)) + (comm-unpack (B) contents)) + (insert contents) + (if (= result 2) + (insert-file-contents local-filename nil (1- (point)))) + (save-excursion + (set-buffer (process-buffer proc)) + (wnnrpc-get-result))))))))) + ((quit error) + (wnnrpc-call-with-environment env () + (comm-format (i) (wnn-const WNN_NAK))) + (signal (car err) (cdr err))))) + +(defun wnnrpc-file-send (env filename) + "" + (let ((header (wnnrpc-check-local-file filename))) + (if (numberp header) + header + (condition-case err + (wnnrpc-call-with-environment env (file-id) + (comm-format (u u v) (wnn-const JS_FILE_SEND) + env-id + (nth 1 header) (wnn-const WNN_UNIQ_LEN)) + (comm-unpack (u) file-id) + (if (>= file-id 0) + (wnnrpc-get-result + (wnnenv-set-client-file env filename) + file-id) + (wnnrpc-get-result + (comm-call-with-proc-1 proc () + (comm-format (s B) + (concat wnn-system-name "!" filename) + (wnnrpc-with-temp-buffer + (insert-file-contents filename) + (buffer-string))) + (wnnrpc-get-result + (wnnenv-set-client-file env filename) + result))))) + ((quit error) + (wnnrpc-call-with-environment env () + (comm-format (s B B B B B B) "" "" "" "" "" "" "")) + (signal (car err) (cdr err))))))) + +(defun wnnrpc-file-remove-client (proc name passwd) + (let (header) + (cond + ((/= (wnnrpc-file-loaded-local proc name) -1) + (- (wnn-const WNN_FILE_IN_USE))) + ((null (file-readable-p name)) + (- (wnn-const WNN_FILE_READ_ERROR))) + ((null (numberp (car (setq header (wnnrpc-get-file-header name))))) + (- (wnn-const WNN_NOT_A_FILE))) + ((< (wnnrpc-check-passwd proc passwd header) 0) + (- (wnn-const WNN_INCORRECT_PASSWD))) + (t + (condition-case nil + (progn + (delete-file name) + 0) + (error (- (wnn-const WNN_UNLINK)))))))) + +(defun wnnrpc-dic-file-create-client (env dicname type comment passwd hpasswd) + (if (and (null (file-exists-p dicname)) + (file-writable-p dicname) + (or (eq type (wnn-const WNN_REV_DICT)) + (eq type (wnn-const CWNN_REV_DICT)) + (eq type (wnn-const BWNN_REV_DICT)) + (eq type (wnn-const WNN_UD_DICT)) + (and (wnnenv-is-wnn6 env) + (eq type (wnn-const WNN_FI_USER_DICT)))) + (wnnrpc-create-and-move-to-client env nil dicname type + comment passwd hpasswd)) + 0 + (- (wnn-const WNN_FILE_CREATE_ERROR)))) + + +(defun wnnrpc-hindo-file-create-client (env fi dic-id freqname comment passwd) + (if (and (null (file-exists-p freqname)) + (file-writable-p freqname) + (wnnrpc-create-and-move-to-client env dic-id freqname fi + comment passwd nil)) + 0 + (- (wnn-const WNN_FILE_CREATE_ERROR)))) + +(defun wnnrpc-make-temp-name (env) + (let ((n 0) + (temp-form "usr/temp")) + (while (= (wnnrpc-access env (concat temp-form n) 0) 0) + (setq n (1+ n))) + (concat temp-form n))) + +(defun wnnrpc-create-and-move-to-client (env dic-id filename type + comment passwd hpasswd) + (let ((tempfile (wnnrpc-make-temp-name env)) + (created -1) + (fid -1)) + (unwind-protect + (progn + (if (numberp type) + (setq created (wnnrpc-dic-file-create env tempfile type + comment passwd hpasswd)) + (setq created (wnnrpc-hindo-file-create env type dic-id tempfile + comment passwd))) + (if (and (>= created 0) + (>= (setq fid (wnnrpc-file-read env tempfile)) 0) + (>= (wnnrpc-file-receive env fid filename) 0)) + (wnnrpc-change-file-uniq (wnnrpc-get-file-header filename) + filename t) + (condition-case nil (delete-file filename) (error)) + nil)) + (if (>= fid 0) + (wnnrpc-file-discard env fid)) + (if (>= created 0) + (wnnrpc-file-remove (wnnenv-get-proc env) tempfile passwd))))) + +(defun wnnrpc-read-passwd-file (filename) + (cond + ((null filename) "") + ((null (file-readable-p filename)) (- (wnn-const WNN_FILE_READ_ERROR))) + (t + (wnnrpc-with-temp-buffer + (insert-file-contents filename nil 0 (1- (wnn-const WNN_PASSWD_LEN))) + (goto-char 1) + (if (and (search-forward-regexp "[\0\n]" nil 0) + (= (preceding-char) 0)) + (backward-char)) + (buffer-substring 1 (point)))))) + +;;; egg/wnnrpc.el ends here. diff --git a/eggrc b/eggrc new file mode 100644 index 0000000..965083d --- /dev/null +++ b/eggrc @@ -0,0 +1,196 @@ +;;; eggrc --- EGG Input Method Startup File + +;; Copyright (C) 1999, 2000 Free Software Foundation, Inc + +;; Author: KATAYAMA Yoshio + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;;; Code: + +(defun wnn4-jserver-setup () + (wnn-define-environment nil) + (wnn-set-fuzokugo "pubdic/full.fzk") + (wnn-add-dict "pubdic/kihon.dic" '("kihon.h") 5 nil t) + (wnn-add-dict "pubdic/setsuji.dic" '("setsuji.h") 5 nil t) + (wnn-add-dict "pubdic/koyuu.dic" '("koyuu.h") 1 nil t) + (wnn-add-dict "pubdic/chimei.dic" '("chimei.h") 1 nil t) + (wnn-add-dict "pubdic/jinmei.dic" '("jinmei.h") 1 nil t) + (wnn-add-dict "pubdic/special.dic" '("special.h") 5 nil t) + (wnn-add-dict "pubdic/computer.dic" '("computer.h") 5 nil t) + (wnn-add-dict "pubdic/symbol.dic" '("symbol.h") 1 nil t) + (wnn-add-dict "pubdic/tankan.dic" nil 1 nil nil) + (wnn-add-dict "pubdic/bio.dic" '("bio.h") 1 nil t) + (wnn-add-dict '("ud") nil 5 t t) + (wnn-add-dict "wnncons/tankan2.dic" nil 1 nil nil) + (wnn-add-dict "wnncons/tankan3.dic" nil 1 nil nil) +; (wnn-add-dict "gerodic/g-jinmei.dic" '("g-jinmei.h") 1 nil t) + (wnn-set-param 2 10 2 45 100 200 5 1 40 -100 200 -100 200 80 200 200 200) + + (wnn-define-environment t) + (wnn-set-fuzokugo "pubdic/full.fzk") + (wnn-add-dict "pubdic/kihon.dic" '("kihon.h") 5 nil t) + (wnn-add-dict "pubdic/setsuji.dic" '("setsuji.h") 5 nil t) + (wnn-add-dict "pubdic/koyuu.dic" '("koyuu.h") 1 nil t) + (wnn-add-dict "pubdic/chimei.dic" '("chimei.h") 1 nil t) + (wnn-add-dict "pubdic/jinmei.dic" '("jinmei.h") 1 nil t) + (wnn-add-dict "pubdic/special.dic" '("special.h") 5 nil t) + (wnn-add-dict "pubdic/computer.dic" '("computer.h") 5 nil t) + (wnn-add-dict "pubdic/symbol.dic" '("symbol.h") 1 nil t) + (wnn-add-dict "pubdic/tankan.dic" nil 1 nil nil) + (wnn-add-dict "pubdic/bio.dic" '("bio.h") 1 nil t) + (wnn-add-dict '("ud") nil 5 t t) + (wnn-add-dict "wnncons/tankan2.dic" nil 1 nil nil) + (wnn-add-dict "wnncons/tankan3.dic" nil 1 nil nil) +; (wnn-add-dict "gerodic/g-jinmei.dic" '("g-jinmei.h") 1 nil t) + (wnn-set-param 2 10 2 45 100 200 5 1 40 -100 200 -100 200 80 200 200 200)) + +(defun wnn6-jserver-setup () + (wnn-define-environment nil) + (wnn-set-fuzokugo "iwanami/kougo.fzk") + (wnn-add-fisys-dict "iwanami/fisd" '("fisd.h") t) + (wnn-add-fiusr-dict '("fiud") nil t nil) + (wnn-add-dict "iwanami/kihon.dic" '("kihon.h") 6 nil t) + (wnn-add-dict "iwanami/symbol.dic" '("symbol.h") 1 nil t) + (wnn-add-dict "iwanami/tankan.dic" nil 1 nil nil) + (wnn-add-dict "iwanami/tankan2.dic" nil 1 nil nil) + (wnn-add-dict "iwanami/tel.dic" nil 1 nil nil) + (wnn-add-dict "iwanami/zip.dic" nil 1 nil nil) + (wnn-add-dict '("ud") nil 15 t t) +; (wnn-add-dict "wnncons/tankan2.dic" nil 1 nil nil) +; (wnn-add-dict "wnncons/tankan3.dic" nil 1 nil nil) + (wnn-set-param 5 10 2 45 0 80 5 1 20 0 400 -100 400 80 200 2 200) + + (wnn-add-notrans-dict '("katakana") 15 t) + (wnn-add-bmodify-dict '("bunsetsu") 15 t) + + (wnn-set-last-is-first-mode t) + (wnn-set-complex-conv-mode nil) +; (wnn-set-okuri-flag -1) + (wnn-set-prefix-flag 0) + + (wnn-set-okuri-learn-mode t) + (wnn-set-prefix-learn-mode t) + (wnn-set-suffix-learn-mode t) + (wnn-set-common-learn-mode t) + (wnn-set-yuragi-mode nil) + + (wnn-set-freq-func-mode 4) + +; (wnn-set-numeric-mode -12) +; (wnn-set-alphabet-mode -30) +; (wnn-set-symbol-mode -40) + + (wnn-define-environment t) + (wnn-set-fuzokugo "iwanami/kougo.fzk") + (wnn-add-dict '("ud") "" 15 t t) + (wnn-set-param 2 10 2 45 1 80 5 1 50 -20 400 -10 100 -100 200 0 200)) + +(cond + ((eq egg-backend-type 'wnn) + (cond + ((eq wnn-server-type 'jserver) + (if wnn-wnn6-server + (wnn6-jserver-setup) + (wnn4-jserver-setup))) + + ((eq wnn-server-type 'cserver) + (if wnn-use-bixing + (progn + (wnn-define-environment nil "Q") + (wnn-set-fuzokugo "sys/full.con") + (wnn-add-dict "sys/QianMa.dic" nil 1 nil nil) + + (wnn-define-environment nil "W") + (wnn-set-fuzokugo "sys/full.con") + (wnn-add-dict "sys/WuBi.dic" nil 1 nil nil))) + + (wnn-define-environment nil "PZ") + (wnn-set-fuzokugo "sys/full.con") + (wnn-add-dict "sys/level_1.dic" '("level_1.h") 4 nil t) + (wnn-add-dict "sys/level_2.dic" '("level_2.h") 1 nil t) + (wnn-add-dict "sys/basic.dic" '("basic.h") 7 nil t) + (wnn-add-dict "sys/computer.dic" '("computer.h") 4 nil t) + (wnn-add-dict "sys/cwnn.dic" '("cwnn.h") 4 nil t) + (wnn-add-dict '("ud") nil 5 t t) + (wnn-set-param 1 5 2 750 10 80 10 5 1000 50 0 -200 0 0 0 16 0) + + (if wnn-use-bixing + (progn + (wnn-define-environment t "Q") + (wnn-set-fuzokugo "sys/full.conR") + (wnn-add-dict "sys/QianMa.dic" nil 1 nil nil) + + (wnn-define-environment t "W") + (wnn-set-fuzokugo "sys/full.conR") + (wnn-add-dict "sys/WuBi.dic" nil 1 nil nil))) + + (wnn-define-environment t "PZ") + (wnn-set-fuzokugo "sys/full.conR") + (wnn-add-dict "sys/level_1.dic" '("level_1.h") 4 nil t) + (wnn-add-dict "sys/level_2.dic" '("level_2.h") 1 nil t) + (wnn-add-dict "sys/basic.dic" '("basic.h") 7 nil t) + (wnn-add-dict "sys/computer.dic" '("computer.h") 4 nil t) + (wnn-add-dict "sys/cwnn.dic" '("cwnn.h") 4 nil t) + (wnn-add-dict '("ud") nil 5 t t) + (wnn-set-param 1 5 2 750 10 80 10 5 1000 50 0 -200 0 0 0 16 0)) + + ((eq wnn-server-type 'tserver) + (wnn-define-environment nil "PZ") + (wnn-set-fuzokugo "sys/full.con") + (wnn-add-dict "sys/cns_ch.dic" '("cns_ch.h") 4 nil t) + (wnn-add-dict "sys/cns_wd.dic" '("cns_wd.h") 1 nil t) + (wnn-add-dict '("ud") nil 5 t t) + (wnn-set-param 1 5 2 750 10 80 10 5 1000 50 0 -200 0 0 0 16 0) + + (wnn-define-environment t "PZ") + (wnn-set-fuzokugo "sys/full.conR") + (wnn-add-dict "sys/cns_ch.dic" '("cns_ch.h") 4 nil t) + (wnn-add-dict "sys/cns_wd.dic" '("cns_wd.h") 1 nil t) + (wnn-add-dict '("ud") nil 5 t t) + (wnn-set-param 1 5 2 750 10 80 10 5 1000 50 0 -200 0 0 0 16 0)) + + ((eq wnn-server-type 'kserver) + (wnn-define-environment nil) + (wnn-set-fuzokugo "sys/full.fzk") + (wnn-add-dict "sys/hword.dic" '("hword.h") 5 nil t) + (wnn-add-dict "sys/single.dic" '("single.h") 1 nil t) + (wnn-add-dict '("ud") nil 2 t t) + (wnn-set-param 2 5 2 45 200 80 5 1 40 0 400 -100 400 80 200 2 200) + + (wnn-define-environment t) + (wnn-set-fuzokugo "sys/full.fzk") + (wnn-add-dict "sys/hword.dic" '("hword.h") 5 nil t) + (wnn-add-dict "sys/single.dic" '("single.h") 1 nil t) + (wnn-add-dict '("ud") nil 2 t t) + (wnn-set-param 2 5 2 45 200 80 5 1 40 0 400 -100 400 80 200 2 200)))) + + ((eq egg-backend-type 'sj3) +; (sj3-set-default-sys-dic-directory "/usr/sony/dict/sj3") +; (sj3-set-default-usr-dic-directory "/usr/sony/dict/sj3/user/$USER") + + (sj3-setsysdic "sj3main.dic") + + (sj3-setusrdic "private.dic") + (sj3-setusrstdy "study.dat"))) diff --git a/its-keydef.el b/its-keydef.el new file mode 100644 index 0000000..6814fc1 --- /dev/null +++ b/its-keydef.el @@ -0,0 +1,146 @@ +;;; its-keydef.el + +;; Copyright (C) 1999, 2000 Free Software Foundation, Inc + +;; Author: NIIBE Yutaka + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; Project Leader: Satoru Tomura +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + + +;;; Code: + + + +(eval-when-compile + (require 'cl)) + +(defvar its-zhuyin nil) +(make-variable-buffer-local 'its-zhuyin) +(put 'its-zhuyin 'permanent-local t) + +(defvar its-select-alist nil) +(make-variable-buffer-local 'its-select-func-alist) +(put 'its-select-alist 'permanent-local t) + +(defvar its-select-func-default-alist nil) + +(eval-when-compile + (defmacro its-set-select-func-alist (list) + `'(setq ,list (cons (cons lang func) + (delq (assq lang ,list) ,list))))) + +(eval-and-compile + (defun its-make-select-func (key1 key2 func file map &optional zhuyin) + (setq func (intern (concat "its-select-" (symbol-name func))) + file (intern (concat "its/" (symbol-name file))) + map (intern (concat "its-" (symbol-name map) "-map"))) + (cons + `(defun ,func (&optional temporally mode-line-unchange) + (interactive "P") + (let ((inhibit-read-only t) + (func ',func) + lang) + (if temporally + (its-select-mode-temporally func) + (require ',file) + (cond + ((its-in-fence-p) + (its-input-end) + (its-put-cursor t)) + ((egg-get-bunsetsu-info (point)) + (egg-exit-conversion))) + (setq its-current-select-func func + its-current-map ',map + lang (its-get-language ,map)) + (when lang + (setq its-current-language lang) + ;; avoid overwriting when select temporally + (when (and (null its-previous-select-func) + (null (assq lang its-select-func-default-alist))) + ,(its-set-select-func-alist its-select-func-alist) + ,(its-set-select-func-alist its-select-func-default-alist))) + ,(if zhuyin `(setq its-zhuyin ,(eq zhuyin 'T))) + (if (null mode-line-unchange) + (its-set-mode-line-title))))) + `(,func ,(concat "\C-x\C-m" key1) ,(concat "\e" key2))))) + +(defmacro its-do-list-make-select-func (list) + (let (funcs keydefs pair) + (while list + (setq pair (apply 'its-make-select-func (car list)) + funcs (cons (car pair) funcs) + keydefs (cons (cdr pair) keydefs) + list (cdr list))) + `(progn + ,@funcs + (defvar its-define-select-key-list ',keydefs)))) + +(defmacro its-add-select-funcs (list) + (let (funcs keydefs pair) + (while list + (setq pair (apply 'its-make-select-func (car list)) + funcs (cons (car pair) funcs) + keydefs (cons (cdr pair) keydefs) + list (cdr list))) + `(progn + ,@funcs + (setq its-define-select-key-list + (append ',keydefs its-define-select-key-list))))) + +(defun its-define-select-keys (map &optional fence) + (let ((key-list its-define-select-key-list)) + (while key-list + (define-key map (nth 1 (car key-list)) (car (car key-list))) + (if fence + (define-key map (nth 2 (car key-list)) (car (car key-list)))) + (setq key-list (cdr key-list))))) + +(its-do-list-make-select-func + (("Q" "Q" upcase ascii up) + ("q" "q" downcase ascii down) + ("h" "\C-h" hiragana hira hira) + ("k" "\C-k" katakana kata kata) + ("x" "\C-x" hankaku-katakana hankata han-kata) + ("Z" "Z" zenkaku-upcase zenkaku zenkaku-up) + ("z" "z" zenkaku-downcase zenkaku zenkaku-down) + ("\C-e" "\C-e" erpin-cn erpin erpin-cn NIL) + ("\C-p" "\C-p" pinyin-cn pinyin pinyin-cn NIL) + ("\C-z" "\C-z" zhuyin-cn zhuyin zhuyin-cn T) + ("\C-q" "\C-q" qianma bixing qianma) + ("\C-w" "\C-w" wubi bixing wubi) + ("\C-u" "\C-u" quanjiao-upcase-cn quanjiao quanjiao-up-cn) + ("\C-d" "\C-d" quanjiao-downcase-cn quanjiao quanjiao-down-cn) + ("E" "E" erpin-tw erpin erpin-tw NIL) + ("P" "P" pinyin-tw pinyin pinyin-tw NIL) + ("C" "C" zhuyin-tw zhuyin zhuyin-tw T) + ("U" "U" quanjiao-upcase-tw quanjiao quanjiao-up-tw) + ("D" "D" quanjiao-downcase-tw quanjiao quanjiao-down-tw) + ("H" "H" hangul hangul hangul) + ("J" "J" jeonkak-upcase jeonkak jeonkak-up) + ("j" "j" jeonkak-downcase jeonkak jeonkak-down))) + +(provide 'its-keydef) diff --git a/its.el b/its.el new file mode 100644 index 0000000..5145c15 --- /dev/null +++ b/its.el @@ -0,0 +1,1325 @@ +;;; its.el --- Input Translation Systam AKA "ITS(uDekirunDa!)" + +;; Copyright (C) 1999,2000 PFU LIMITED + +;; Author: NIIBE Yutaka +;; KATAYAMA Yoshio + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + + +;;; Code: + +(require 'cl) +(require 'egg-edep) + +(defgroup its nil + "Input Translation System of Tamagotchy" + :group 'egg) + +(defcustom its-enable-fullwidth-alphabet t + "*Enable fullwidth symbol input." + :group 'its :type 'boolean) + +(defcustom its-barf-on-invalid-keyseq nil + "*Don't allow invalid key sequence in input buffer, if non-NIL." + :group 'its :type 'boolean) + +(defcustom its-delete-by-keystroke nil + "*Delete characters as if cancele input keystroke, if nin-NIL." + :group 'its :type 'boolean) + +(defcustom its-fence-invisible nil + "*Make fences invisible, if nin-NIL." + :group 'its :type 'boolean) + +(defcustom its-fence-open "|" + "*String of fence start mark. (should not be null string)" + :group 'its :type '(string :valid-regexp ".+")) + +(defcustom its-fence-continue "+" + "*String of fence start mark. (should not be null string)" + :group 'its :type '(string :valid-regexp ".+")) + +(defcustom its-fence-close "|" + "*String of fence end mark. (should not be null string)" + :group 'its :type '(string :valid-regexp ".+")) + +(defcustom its-fence-face nil + "*Face (or alist of languages and faces) of text in fences." + :group 'its + :type '(choice face + (repeat :tag "Language-Face alist" + (cons :tag "Language-Face" + (choice :tag "Language" + (const Japanese) + (const Chinese-GB) + (const Chinese-CNS) + (const Korean) + (const :tag "Default" t) + (symbol :tag "Other")) + face)))) + +(defvar its-current-map nil) +(make-variable-buffer-local 'its-current-map) +(put 'its-current-map 'permanent-local t) + +(defvar its-current-select-func nil) +(make-variable-buffer-local 'its-current-select-func) +(put 'its-current-select-func 'permanent-local t) + +(defvar its-previous-select-func nil) +(make-variable-buffer-local 'its-previous-select-func) +(put 'its-previous-select-func 'permanent-local t) + +(defvar its-current-language) +(make-variable-buffer-local 'its-current-language) +(put 'its-current-language 'permanent-local t) + +;; Data structure in ITS +;; (1) SYL and CURSOR +;; +;; "SYL" stands for something like a syllable. +;; +;; ::= ( . ( . )) ; Determined: DSYL +;; | ; Intermediate: ISYL +;; | ( . ) ; Verbatim: VSYL +;; | nil ; None +;; +;; ; ::= +;; ; ( . ( . )) +;; +;; ::= "string" of key sequence +;; ::= "string" +;; +;; ::= integer which specifies point +;; +;; ::= nil ; Previous SYL is active (input will go that SYL) +;; | t ; input makes new SYL. DEL deletes previous SYL +;; | its-cursor ; DEL breaks previous SYL, input makes new SYL + +;; Data structures in ITS +;; (2) State machine which recognizes SYL +;; +;; ::= ( . ) +;; +;; ::= ; intermediate state +;; | ; terminal state +;; +;; ::= ( . ) +;; ::= ( ... ) +;; ::= ( . ) +;; ::= Positive INTEGER which specifies KEY STROKE +;; | -1 ; means END of key stroke +;; +;; Only applicable for last transition. +;; ::= ( ( . ( . ))... ) +;; ::= something like "[a-z]" which specifies class of key. +;; | NIL; means ANY of key (except END of the key stroke) +;; +;; +;; ::= "string" +;; +;; ::= nil +;; | +;; +;; ::= integer which specifies how many key strokes we go back +;; +;; ::= "string" + +;; Data structure in ITS (3) Map +;; +;; ::= ( . ) +;; ::= "string" +;; ::= "string" +;; ::= "string" +;; ::= +;; + +(defsubst its-new-state (output keyseq back) + (cons output (cons keyseq back))) + +(defsubst its-new-map (name indicator language) + (cons name (cons indicator (cons language (its-new-state "" "" nil))))) + +(defsubst its-get-indicator (map) + (nth 1 map)) + +(defsubst its-get-language (map) + (nth 2 map)) + +(defsubst its-get-start-state (map) + (nthcdr 3 map)) + +(defsubst its-get-kst/t (state) + (cdr (cdr state))) + +(defsubst its-set-kst (state kst) + (setcdr (cdr state) kst)) + +(defsubst its-get-keyseq (state) + (car (cdr state))) + +(defsubst its-set-keyseq (state keyseq) + (setcar (cdr state) keyseq)) + +(defun its-get-keyseq-cooked (state) + (let ((keyseq (its-get-keyseq state)) + (back (its-get-kst/t state))) + (if back + (substring keyseq 0 back) + keyseq))) + +(defsubst its-kst-p (kst/t) + (not (or (numberp kst/t) (null kst/t)))) + +(defsubst its-get-output (syl/state) + (car syl/state)) + +(defsubst its-set-output (state output) + (setcar state output)) + +(defsubst its-get-keyseq-syl (syl) + (let ((l (cdr syl))) + (cond ((stringp l) ; DSYL + l) + ((numberp l) ; VSYL + (car syl)) + ((numberp (cdr l)) + (substring (car l) 0 (cdr l))) + (t + (car l))))) + +(defsubst its-eob-keyexpr (eob) + (car (cdr eob))) +(defsubst its-eob-back (eob) + (cdr (cdr eob))) + +(defsubst its-make-class+back (class back) + (cons class back)) +(defsubst its-make-otherwise (output class+back) + (cons output class+back)) + +(defsubst its-DSYL-with-back-p (syl) + (and (consp (cdr syl)) + (numberp (its-get-kst/t syl)))) + +(defsubst its-concrete-DSYL-p (syl) + (stringp (cdr syl))) + +(defsubst its-make-concrete-DSYL (syl) + (if (consp (cdr syl)) + (cons (its-get-output syl) (its-get-keyseq-syl syl)) + syl)) + +;; +;; + +(require 'its-keydef) + +(defvar its-mode-map + (let ((map (make-sparse-keymap)) + (i 33)) + (define-key map "\C-a" 'its-beginning-of-input-buffer) + (define-key map "\C-b" 'its-backward-SYL) + (define-key map "\C-c" 'its-cancel-input) + (define-key map "\C-d" 'its-delete-SYL) + (define-key map "\C-e" 'its-end-of-input-buffer) + (define-key map "\C-f" 'its-forward-SYL) + (define-key map "\C-g" 'its-select-previous-mode) + (define-key map "\C-]" 'its-cancel-input) + (define-key map "\C-h" 'its-mode-help-command) + (define-key map "\C-k" 'its-kill-line) +;; (define-key map "\C-l" 'its-exit-mode) + (define-key map "\C-m" 'its-exit-mode) ; RET + (define-key map [return] 'its-exit-mode) + (define-key map "\C-t" 'its-transpose-chars) + (define-key map "\C-w" 'its-kick-convert-region) + (define-key map "\C-y" 'its-yank) + (define-key map "\M-y" 'its-yank-pop) + (define-key map [backspace] 'its-delete-backward-SYL) + (define-key map [delete] 'its-delete-backward-SYL) + (define-key map [M-backspace] 'its-delete-backward-SYL-by-keystroke) + (define-key map [M-delete] 'its-delete-backward-SYL-by-keystroke) + (define-key map [right] 'its-forward-SYL) + (define-key map [left] 'its-backward-SYL) + (while (< i 127) + (define-key map (vector i) 'its-self-insert-char) + (setq i (1+ i))) + (define-key map " " 'its-kick-convert-region-or-self-insert) + (define-key map "\177" 'its-delete-backward-SYL) + ;; + (define-key map "\M-p" 'its-previous-map) + (define-key map "\M-n" 'its-next-map) + (define-key map "\M-h" 'its-hiragana) ; hiragana-region for input-buffer + (define-key map "\M-k" 'its-katakana) + (define-key map "\M-<" 'its-hankaku) + (define-key map "\M->" 'its-zenkaku) + map) + "Keymap for ITS mode.") + +(fset 'its-mode-map its-mode-map) + +(defconst its-setup-fence-before-insert-SYL nil) + +(defun its-get-fence-face (lang) + (if (null (consp its-fence-face)) + its-fence-face + (cdr (or (assq lang its-fence-face) + (assq t its-fence-face))))) + +(defun its-put-cursor (cursor) + (if (null (eq its-barf-on-invalid-keyseq 'its-keyseq-test)) + (let ((p (point))) + (insert "!") + (add-text-properties p (point) (list 'local-map 'its-mode-map + 'read-only t + 'invisible t + 'intangible 'its-part-2 + 'its-cursor cursor)) + (goto-char p)))) + +(defsubst its-set-cursor-status (cursor) + (put-text-property (point) (1+ (point)) 'its-cursor cursor) + cursor) + +(defvar its-context nil) + +;; +;; +-- START property +;; | --- CURSOR Property +;; | / +;; v v v-- END Property +;; |SYL SYL ^ SYL| +;; ^^^ ^^^ ^^^------ SYL Property +;; <-------><----> +;; intangible intangible +;; 1 2 +;; +(defun its-setup-fence-mode () + (let ((open-props '(its-start t intangible its-part-1)) + (close-props '(rear-nonsticky t its-end t intangible its-part-2)) + (p (point)) p1) + (if (or (null (stringp its-fence-open)) (zerop (length its-fence-open)) + (null (stringp its-fence-continue)) (zerop (length its-fence-continue)) + (null (stringp its-fence-close)) (zerop (length its-fence-close))) + (error "invalid fence")) + ;; Put open-fence before inhibit-read-only to detect read-only + (insert (if its-context its-fence-continue its-fence-open)) + (let ((inhibit-read-only t)) + (setq p1 (point)) + (add-text-properties p p1 open-props) + (if its-context + (put-text-property p p1 'its-context its-context)) + (insert its-fence-close) + (add-text-properties p1 (point) close-props) + (if its-fence-invisible + (put-text-property p (point) 'invisible t)) + (put-text-property p (point) 'read-only t) + (goto-char p1) + (its-define-select-keys its-mode-map t) + (its-put-cursor t)))) + +(defun its-start (key context) + (let ((its-setup-fence-before-insert-SYL t) + (its-context context)) + (its-input nil key))) + +(defun its-restart (str set-prop beginning context) + (let ((its-context context) + p) + (its-setup-fence-mode) + (setq p (point)) + (put-text-property 0 (length str) 'intangible 'its-part-1 str) + (insert str) + (if set-prop + (progn + (delete-region (point) (1+ (point))) + (its-setup-yanked-portion p (point)))) + (if beginning + (its-beginning-of-input-buffer)))) + +(defun its-self-insert-char () + (interactive) + (let ((inhibit-read-only t) + (key last-command-char) + (cursor (get-text-property (point) 'its-cursor)) + (syl (get-text-property (1- (point)) 'its-syl))) + (cond + ((or (eq cursor t) + (not (eq (get-text-property (1- (point)) 'its-map) its-current-map))) + (put-text-property (- (point) (length (its-get-output syl))) (point) + 'its-syl (its-make-concrete-DSYL syl)) + (setq syl nil)) + (cursor + (setq syl nil))) + (its-input syl key))) + +(defun its-current-language-length () + (+ (if (eq (get-text-property (1- (point)) 'egg-lang) its-current-language) + (- (point) (previous-single-property-change (point) 'egg-lang)) + 0) + (if (eq (get-text-property (1+ (point)) 'egg-lang) its-current-language) + (- (next-single-property-change (1+ (point)) 'egg-lang) (point) 1) + 0))) + +(defun its-initial-ISYL () + (its-get-start-state (symbol-value its-current-map))) + +(defun its-make-VSYL (keyseq) + (cons keyseq (length keyseq))) + +(defun its-input-error () + (error "Invalid Romaji Sequence")) + +(defvar its-stroke-input-alist nil) + +(defun its-input (syl key) + (let ((output (car syl)) + (k/kk/s (cdr syl)) + (stroke (assq its-current-language its-stroke-input-alist))) + (or syl (setq syl (its-initial-ISYL))) + (cond + ((numberp k/kk/s) + ;; k/kk/s is "point in keyseq" + (its-input-to-vsyl syl key k/kk/s output)) + ((and (or its-barf-on-invalid-keyseq stroke) + (null (its-keyseq-acceptable-p (vector key) syl))) + ;; signal before altering + (its-input-error)) + (t + ;; It's ISYL + (its-state-machine syl key 'its-buffer-ins/del-SYL) + (if (and stroke (>= (its-current-language-length) (cdr stroke))) + (its-kick-convert-region)))))) + +(defun its-input-to-vsyl (syl key point output) + (if (< key 0) + (its-set-cursor-status t) + (let ((len (length output))) + (if (= len point) + ;; point is at end of VSYL. Don't need to call state machine. + (its-buffer-ins/del-SYL + (its-make-VSYL (concat output (vector key))) syl nil) + ;; point is at middle of VSYL. + (let ((new-keyseq (concat (substring output 0 point) + (vector key) + (substring output point)))) + (its-state-machine-keyseq new-keyseq 'its-buffer-ins/del-SYL)))))) + +;;; +;;; ITS State Machine +;;; + +(defvar its-disable-special-action nil) + +;; Return CURSOR +(defun its-state-machine (state key emit) + (let ((next-state (its-get-next-state state key)) + expr-output-back kst/t output keyseq back) + (cond + ;; proceed to next status + ((and next-state + (not (and its-disable-special-action + (eq (its-get-kst/t next-state) t)))) + (setq kst/t (its-get-kst/t next-state) + output (its-get-output next-state) + keyseq (its-get-keyseq next-state)) + (cond + ;; Special actions. + ((eq kst/t t) + (if (stringp output) + (let ((its-current-language t)) + (funcall emit (cons output keyseq) state 'its-cursor)) + (funcall emit (cons "" keyseq) state 'its-cursor) + (apply (car output) (cdr output)))) + + ;; Still, it's a intermediate state. + ((its-kst-p kst/t) + (funcall emit next-state state nil)) + + ;; It's negative integer which specifies how many + ;; characters we go backwards + (kst/t + (funcall emit next-state state 'its-cursor) + (its-state-machine-keyseq (substring keyseq kst/t) emit (< key 0))) + + ;; Here we arrive to a terminal state. + ;; Emit a DSYL, and go ahead. + (t + (funcall emit next-state state 'its-cursor)))) + + ;; push back by otherwise status + ((and (>= key 0) + (setq expr-output-back (its-get-otherwise state key))) + (setq keyseq (concat (its-get-keyseq state) (vector key)) + back (its-eob-back expr-output-back)) + (funcall emit + (cons (or (its-get-output expr-output-back) + (its-get-output + (its-goto-state (substring keyseq 0 back)))) + (cons keyseq back)) + state t) + (its-state-machine-keyseq + (substring keyseq back) emit)) + + ((eq its-barf-on-invalid-keyseq 'its-keyseq-test) + 'its-keyseq-test-failed) + + ;; No next state for KEY. It's invalid sequence. + (its-barf-on-invalid-keyseq + (its-input-error)) + + (t + ;; XXX Should make DSYL (instead of VSYL)? + (setq keyseq (concat (its-get-keyseq state) (if (> key 0) (vector key)))) + (funcall emit (its-make-VSYL keyseq) state nil))))) + +(defvar its-latest-SYL nil "The latest SYL inserted.") + +(defsubst its-update-latest-SYL (syl) + (setq its-latest-SYL syl)) + +;; Return CURSOR +(defun its-state-machine-keyseq (keyseq emit &optional eol) + (let ((i 0) + (len (length keyseq)) + (syl (its-initial-ISYL)) + cursor) + (while (< i len) + (cond + ((numberp (cdr syl)) + ;; VSYL - no need looping + (funcall emit + (its-make-VSYL (concat (car syl) (substring keyseq i))) + syl nil) + (setq cursor nil + i len)) + (t + (setq cursor (its-state-machine syl (aref keyseq i) emit)))) + (if (eq cursor 'its-keyseq-test-failed) + (setq i len) + (setq syl (if cursor (its-initial-ISYL) its-latest-SYL) + i (1+ i)))) + (if (and eol (not (eq cursor 'its-keyseq-test-failed))) + (its-state-machine syl -1 emit) + cursor))) + +(defun its-buffer-ins/del-SYL (newsyl oldsyl cursor) + (if its-setup-fence-before-insert-SYL + (progn + (setq its-setup-fence-before-insert-SYL nil) + (its-setup-fence-mode))) + (let ((inhibit-read-only t) + (output (copy-sequence (its-get-output newsyl))) + (face (its-get-fence-face its-current-language))) + (its-buffer-delete-SYL oldsyl) + (its-update-latest-SYL newsyl) + (add-text-properties 0 (length output) + (list 'its-map its-current-map + 'its-syl newsyl + 'egg-lang its-current-language + 'read-only t + 'intangible 'its-part-1) + output) + (if face + (egg-set-face 0 (length output) face output)) + (insert output) + (its-set-cursor-status cursor))) + +(defun its-buffer-delete-SYL (syl) + (let ((len (length (its-get-output syl)))) + (delete-region (- (point) len) (point)))) + +(defun its-get-next-state (state key) + (let ((kst/t (its-get-kst/t state))) + (and (listp kst/t) + (cdr (assq key (car kst/t)))))) + +;; XXX XXX XXX +(defun its-otherwise-match (expr key) + (or (null expr) ; ::= NIL means "ANY" + (let ((case-fold-search nil)) + (string-match expr (char-to-string key))))) + +(defun its-get-otherwise (state key) + (let* ((kst/t (its-get-kst/t state)) + (ebl (cdr kst/t)) + expr-output-back) + (while ebl + (setq expr-output-back (car ebl)) + (let ((expr (its-eob-keyexpr expr-output-back))) + (if (its-otherwise-match expr key) + (setq ebl nil) + (setq ebl (cdr ebl))))) + expr-output-back)) + +(defun its-keyseq-acceptable-p (keyseq &optional syl eol) + (let ((i 0) + (len (length keyseq)) + (its-barf-on-invalid-keyseq 'its-keyseq-test) + (its-latest-SYL nil) + (emit (lambda (nsyl osyl cursor) + (its-update-latest-SYL nsyl) + cursor)) + (its-current-map its-current-map) + (its-current-select-func its-current-select-func) + (its-current-language its-current-language) + (its-zhuyin its-zhuyin) + (its-previous-select-func its-previous-select-func) + cursor) + (if (null syl) + (setq syl (its-initial-ISYL))) + (if (numberp (cdr syl)) + nil + (while (and syl (< i len)) + (setq cursor (its-state-machine syl (aref keyseq i) emit)) + (cond + ((eq cursor 'its-keyseq-test-failed) + (setq syl nil)) + (cursor + (setq syl (its-initial-ISYL))) + (t + its-latest-SYL)) + (setq i (1+ i))) + (if (and syl eol) + (setq cursor (its-state-machine syl -1 emit))) + (not (eq cursor 'its-keyseq-test-failed))))) + +;;; +;;; Name --> map +;;; +;;; ITS name: string + +(defvar its-map-alist nil) + +(defun its-get-map (name) + (assoc name its-map-alist)) + +(defun its-register-map (map) + (let* ((name (car map)) + (place (assoc name its-map-alist))) + (if place + (setcdr place (cdr map)) + (setq its-map-alist (cons map its-map-alist))) + map)) + +(defmacro define-its-state-machine (map name indicator lang doc &rest exprs) + (let ((its-current-map map)) + (set map (its-new-map name indicator + (if (eq (car-safe lang) 'quote) (nth 1 lang) lang))) + (eval (cons 'progn exprs)) + (set map (its-map-compaction (symbol-value map)))) + `(defconst ,map (its-map-rebuild ',(symbol-value map)) ,doc)) + +(defmacro define-its-state-machine-append (map &rest exprs) + `(let ((func (lambda () (let ((its-current-map ',map)) ,@exprs))) + (hook ',(intern (concat (symbol-name map) "-hook")))) + (if (null (boundp ',map)) + (add-hook hook func t) + (funcall func) + (run-hooks hook) + (setq hook nil)))) + +;; Data structure for map compaction +;; ::= ( ) ; atom +;; | ( ( . )) ; cons cell +;; +;; ::= integer ; 0 or negative - usage count +;; ; psotive - generated common sub-tree +;; +;; ::= integer ; subject to compaction +;; | nil ; not subject to compaction + +(defvar its-compaction-enable nil) +(defvar its-compaction-hash-table) +(defvar its-compaction-integer-table) +(defvar its-compaction-counter-1) +(defvar its-compaction-counter-2) +(defvar its-compaction-list) + +(defun its-map-compaction (map) + (if its-compaction-enable + (let ((its-compaction-hash-table (make-vector 1000 nil)) + (its-compaction-integer-table (make-vector 138 nil)) + (its-compaction-counter-1 1) + (its-compaction-counter-2 0) + (its-compaction-list nil)) + (its-map-compaction-internal map nil nil) + (cons (vconcat (nreverse its-compaction-list)) map)) + map)) + +(defmacro its-compaction-set-lr (node lr val) + `(if (eq ,lr 'car) (setcar ,node ,val) (setcdr ,node ,val))) + +(defmacro its-compaction-new-node () + '(1- (setq its-compaction-counter-1 (1+ its-compaction-counter-1)))) + +(defmacro its-compaction-new-cse (node) + `(1- (setq its-compaction-list (cons ,node its-compaction-list) + its-compaction-counter-2 (1+ its-compaction-counter-2)))) + +(defmacro its-compaction-hash (name node parent lr type) + (if (null type) + `(let ((hash (intern (concat ,@name) its-compaction-hash-table))) + (if (null (boundp hash)) + (car (set hash (list* (its-compaction-new-node) ,parent ,lr))) + (setq hash (symbol-value hash)) + (if (consp (cdr hash)) + (setcdr hash (its-compaction-set-lr + (cadr hash) (cddr hash) + (its-compaction-new-cse ,node)))) + (its-compaction-set-lr ,parent ,lr (cdr hash)) + (car hash))) + `(let ((hash ,(if (eq type 'integer) + `(intern (concat ,@name) its-compaction-hash-table) + `(aref its-compaction-integer-table (+ ,node 10))))) + (if (null ,(if (eq type 'integer) '(boundp hash) 'hash)) + (setq hash (,@(if (eq type 'integer) + '(set hash) + `(aset its-compaction-integer-table (+ ,node 10))) + (cons (its-compaction-new-node) + (its-compaction-new-cse ,node)))) + ,(if (eq type 'integer) '(setq hash (symbol-value hash)))) + (its-compaction-set-lr ,parent ,lr (cdr hash)) + (car hash)))) + +(defun its-map-compaction-internal (map parent lr) + (cond + ((consp map) (let ((candidate (or (null (stringp (car map))) (cdr map))) + (l (its-map-compaction-internal (car map) map 'car)) + (r (its-map-compaction-internal (cdr map) map 'cdr))) + (if (and candidate l r) + (its-compaction-hash (l " " r) map parent lr nil)))) + ((stringp map) (its-compaction-hash ("STR" map) map parent lr nil)) + ((integerp map) (if (and (>= map -10) (< map 128)) + (its-compaction-hash nil map parent lr small-int) + (its-compaction-hash ("INT" map) map parent lr integer))) + ((null map) 0))) + +(defvar its-map-rebuild-subtrees) + +(defun its-map-rebuild (map) + (if (vectorp (car map)) + (let ((its-map-rebuild-subtrees (car map)) + (len (length (car map))) + (i 0) + node) + (while (< i len) + (setq node (aref its-map-rebuild-subtrees i)) + (if (consp node) + (its-map-rebuild-1 node)) + (setq i (1+ i))) + (its-map-rebuild-1 (cdr map)) + (cdr map)) + map)) + +(defun its-map-rebuild-1 (map) + (let (lr) + (while (consp map) + (if (consp (setq lr (car map))) + (its-map-rebuild-1 lr) + (if (integerp lr) + (setcar map (aref its-map-rebuild-subtrees lr)))) + (setq lr map + map (cdr map))) + (if (integerp map) + (setcdr lr (aref its-map-rebuild-subtrees map))))) + +;; +;; Construct State Machine +;; +(defun its-defrule (input output &optional back enable-overwrite) + "$BF~NO(B INPUT $B$rG'<1$7(B, OUTPUT $B$r=PNO$9$k$h$&$K%9%F!<%H%^%7%s$r9=@.$9$k!#(B +BACK $B$,(B($BIi$N(B)$B@0?t$N;~$O(B, OUTPUT $B$r=PNO$7$?8e(B, BACK $B$NJ,(B key stroke $B$r(B +$BLa$C$FF0$/$b$N$H$9$k!#JQ495,B'$O$b$C$H$b:G6a$K(B its-define-state-machine +$B$5$l$?JQ49I=$KEPO?$5$l$k!#(B +Return last state." + (let ((state (its-goto-state input (if enable-overwrite t 'dup-check)))) + (its-set-output state output) + (its-set-kst state back) + state)) + +(defun its-defrule* (input output &optional interim-output enable-overwrite) + (let* ((state (its-goto-state input (if enable-overwrite t 'dup-check)))) + (its-set-kst state nil) + (its-set-interim-terminal-state state output) + (if interim-output + (its-set-output state interim-output)) + state)) + +(defvar its-parent-states) + +(defun its-goto-state (input &optional build-if-none) + (let ((len (length input)) + (i 0) + (state (its-initial-ISYL)) + brand-new next-state key) + (setq its-parent-states nil) + (while (< i len) + (setq its-parent-states (cons state its-parent-states) + key (aref input i) + i (1+ i) + next-state (its-get-next-state state key)) + (cond + (next-state + (setq state next-state)) + ((null build-if-none) + (error "No such state (%s)" input)) + (t + (if (not (or brand-new (= i 1) (its-get-kst/t state))) + (its-set-interim-terminal-state state)) + (setq state (its-make-next-state state key + (concat (its-get-output state) + (list key))) + brand-new t)))) + (if (and (eq build-if-none 'dup-check) (null brand-new)) + (error "Duplicated definition (%s)" input)) + state)) + +(defun its-set-interim-terminal-state (state &optional output) + (its-make-next-state state -1 (or output (its-get-output state))) + (its-defrule-otherwise state output)) + +(defun its-defoutput (input display) + (let ((state (its-goto-state input))) + (its-set-output state display))) + +(defun its-define-otherwise (state otherwise) + (let ((kst (its-get-kst/t state))) + (if kst + (setcdr kst (cons otherwise (cdr kst))) + (its-set-kst state (cons nil (cons otherwise nil)))))) + +(defun its-defrule-otherwise (state output &optional class back) + (its-define-otherwise + state + (its-make-otherwise output (its-make-class+back class (or back -1))))) + +(defun its-make-next-state (state key output &optional back) + (let ((next-state (its-new-state output + (concat (its-get-keyseq state) + (if (> key 0) (list key))) + back)) + (kst (its-get-kst/t state))) + (cond + ((null kst) + (its-set-kst state (list (list (cons key next-state))))) + ((consp kst) + (setcar kst (cons (cons key next-state) (car kst)))) + (t + (error "Can't make new state after %S" (its-get-keyseq state)))) + next-state)) + +(defmacro its-defrule-select-mode-temporally (input select-func) + `(its-defrule ,input '(its-select-mode-temporally + ,(intern (concat "its-select-" + (symbol-name select-func)))) + t)) + +;;; +(defun its-set-part-1 (beg end) + (let ((inhibit-point-motion-hooks t) + (str (buffer-substring beg end))) + (goto-char beg) + (delete-region beg end) + (put-text-property 0 (- end beg) 'intangible 'its-part-1 str) + (insert str))) + +(defun its-set-part-2 (beg end) + (let ((inhibit-point-motion-hooks t) + (str (buffer-substring beg end))) + (goto-char beg) + (delete-region beg end) + (put-text-property 0 (- end beg) 'intangible 'its-part-2 str) + (insert str))) + +(defun its-beginning-of-input-buffer () + (interactive) + (let ((inhibit-read-only t)) + (its-input-end) + (if (not (get-text-property (1- (point)) 'its-start)) + (let ((begpos (previous-single-property-change (point) 'its-start))) + ;; Make SYLs have property of "part 2" + (its-set-part-2 begpos (point)) + (goto-char begpos))) + (its-put-cursor t))) + +(defun its-end-of-input-buffer () + (interactive) + (let ((inhibit-read-only t)) + (its-input-end) + (if (not (get-text-property (point) 'its-end)) + (let ((endpos (next-single-property-change (point) 'its-end))) + ;; Make SYLs have property of "part 1" + (its-set-part-1 (point) endpos) + (goto-char endpos))) + (its-put-cursor t))) + +(defun its-kill-line (n) + (interactive "p") + (let ((inhibit-read-only t) + (p (point))) + (its-input-end) + (if (> n 0) + (cond + ((get-text-property (1- (point)) 'its-start) + (its-cancel-input)) + ((get-text-property (point) 'its-end) + (its-put-cursor t)) + (t + (delete-region (next-single-property-change (point) 'its-end) + (point)) + (its-put-cursor t))) + (cond + ((get-text-property (point) 'its-end) + (its-cancel-input)) + ((get-text-property (1- (point)) 'its-start) + (its-put-cursor t)) + (t + (delete-region (point) + (previous-single-property-change (point) 'its-start)) + (its-put-cursor t)))))) + +(defun its-cancel-input () + (interactive) + (let ((inhibit-read-only t)) + (delete-region (if (get-text-property (1- (point)) 'its-start) + (point) + (previous-single-property-change (point) 'its-start)) + (if (get-text-property (point) 'its-end) + (point) + (next-single-property-change (point) 'its-end))) + (its-put-cursor t) + (its-exit-mode-internal))) + +;; TODO: move in VSYL +(defun its-backward-SYL (n) + (interactive "p") + (let ((inhibit-read-only t) + syl p old-point) + (its-input-end) + (setq syl (get-text-property (1- (point)) 'its-syl) + p (point) + old-point (point)) + (while (and syl (> n 0)) + (setq p (- p (length (its-get-output syl)))) + (setq syl (get-text-property (1- p) 'its-syl)) + (setq n (1- n))) + ;; Make SYLs have property of "part 2" + (its-set-part-2 p old-point) + (goto-char p) + (its-put-cursor t) + (if (> n 0) + (signal 'beginning-of-buffer nil)))) + +;; TODO: move in VSYL +(defun its-forward-SYL (n) + (interactive "p") + (let ((inhibit-read-only t) + syl p old-point) + (its-input-end) + (setq syl (get-text-property (point) 'its-syl) + p (point) + old-point (point)) + (while (and syl (> n 0)) + (setq p (+ p (length (its-get-output syl)))) + (setq syl (get-text-property p 'its-syl)) + (setq n (1- n))) + ;; Make SYLs have property of "part 1" + (its-set-part-1 old-point p) + (goto-char p) + (its-put-cursor t) + (if (> n 0) + (signal 'end-of-buffer nil)))) + +;; TODO: handle VSYL. KILLFLAG +(defun its-delete-SYL (n killflag) + (interactive "p\nP") + (let ((inhibit-read-only t) + syl p) + (its-input-end) + (setq syl (get-text-property (point) 'its-syl) + p (point)) + (while (and syl (> n 0)) + (setq p (+ p (length (its-get-output syl)))) + (setq syl (get-text-property p 'its-syl)) + (setq n (1- n))) + (if (> n 0) + (progn + (its-put-cursor t) + (signal 'end-of-buffer nil)) + (delete-region (point) p) + (its-put-cursor t) + (its-exit-mode-if-empty)))) + +;; TODO: killflag +(defun its-delete-backward-SYL (n killflag) + (interactive "p\nP") + (let ((inhibit-read-only t) + (syl (get-text-property (1- (point)) 'its-syl)) + (cursor (get-text-property (point) 'its-cursor))) + (if (null syl) + (signal 'beginning-of-buffer nil) + (if (eq cursor t) + (its-delete-backward-SYL-internal n killflag) + (its-delete-backward-within-SYL syl n killflag))))) + +;; TODO: killflag +(defun its-delete-backward-SYL-internal (n killflag) + (let ((syl (get-text-property (1- (point)) 'its-syl)) + (p (point))) + (while (and syl (> n 0)) + (setq p (- p (length (its-get-output syl)))) + (setq syl (get-text-property (1- p) 'its-syl)) + (setq n (1- n))) + (if (> n 0) + (signal 'beginning-of-buffer nil) + (delete-region p (1+ (point))) ; also delete cursor + (its-put-cursor t) + (its-exit-mode-if-empty)))) + +(defun its-delete-backward-SYL-by-keystroke (n killflag) + (interactive "p\nP") + (let ((inhibit-read-only t) + (its-delete-by-keystroke t)) + (its-delete-backward-SYL n killflag))) + +;; TODO: killflag +(defun its-delete-backward-within-SYL (syl n killflag) + (let* ((keyseq (its-get-keyseq-syl syl)) + (len (length keyseq)) + (p (- (point) (length (its-get-output syl)))) + (its-current-map (get-text-property (1- (point)) 'its-map)) + (its-current-language (get-text-property (1- (point)) 'egg-lang)) + back pp) + (if (< n 0) + (signal 'args-out-of-range (list (- (point) n) (point)))) + (if its-delete-by-keystroke + (while (null (or (eq p pp) (its-concrete-DSYL-p syl))) + (setq pp p) + (while (and (setq syl (get-text-property (1- p) 'its-syl)) + (its-DSYL-with-back-p syl) + (<= (setq back (- (its-get-kst/t syl))) len) + (> back (- len n)) + (equal (substring (its-get-keyseq syl) (- back)) + (substring keyseq 0 back))) + (setq keyseq (concat (its-get-keyseq-syl syl) keyseq) + len (length keyseq) + p (- p (length (its-get-output syl))))) + (if (and (eq p pp) syl (> n len)) + (setq n (- n len) + keyseq (its-get-keyseq-syl syl) + len (length keyseq) + p (- p (length (its-get-output syl)))))) + (if (and (> n len) (its-concrete-DSYL-p syl)) + (setq len 1))) + (if (> n len) + (setq n (- n len) + len 0)) + (while (and (> n len) (setq syl (get-text-property (1- p) 'its-syl))) + (setq n (1- n) + p (- p (length (its-get-output syl))))) + (if (> n len) + (signal 'beginning-of-buffer nil)) + (delete-region p (point)) + (if (> len n) + (its-state-machine-keyseq (substring keyseq 0 (- len n)) + 'its-buffer-ins/del-SYL) + (its-set-cursor-status + (if (or (null its-delete-by-keystroke) + (its-concrete-DSYL-p (get-text-property (1- p) 'its-syl))) + t + 'its-cursor)))) + ;; exit its mode after unbind variables + (its-exit-mode-if-empty)) + +(defun its-transpose-chars (n) + (interactive "p") + (let ((inhibit-read-only t) + (syl (get-text-property (1- (point)) 'its-syl)) + (cursor (get-text-property (point) 'its-cursor)) + keyseq len) + (cond + ((null syl) + (signal 'beginning-of-buffer nil)) + ((eq cursor t) + (if (and (= n 1) (get-text-property (1+ (point)) 'its-end)) + (progn + (its-backward-SYL 1) + (setq syl (get-text-property (1- (point)) 'its-syl)) + (if (null syl) + (signal 'beginning-of-buffer nil)))) + (its-buffer-delete-SYL syl) + (while (> n 0) + (if (get-text-property (1+ (point)) 'its-end) + (progn + (its-buffer-ins/del-SYL syl nil t) + (signal 'end-of-buffer nil))) + (its-forward-SYL 1) + (setq n (1- n))) + (while (< n 0) + (if (get-text-property (1- (point)) 'its-start) + (progn + (its-buffer-ins/del-SYL syl nil t) + (signal 'beginning-of-buffer nil))) + (its-backward-SYL 1) + (setq n (1+ n))) + (its-buffer-ins/del-SYL syl nil t)) + (t + (setq keyseq (its-get-keyseq-syl syl) + len (length keyseq)) + (cond + ((or (> n 1) (<= len 1)) + (signal 'end-of-buffer nil)) + ((>= (- n) len) + (signal 'beginning-of-buffer nil)) + (t + (setq n (if (> n 0) (- -1 n) (1- n))) + (setq keyseq (concat (substring keyseq 0 n) + (substring keyseq -1) + (substring keyseq n -1))) + (if (and its-barf-on-invalid-keyseq + (null (its-keyseq-acceptable-p keyseq))) + (its-input-error)) + (delete-region (- (point) (length (its-get-output syl))) (point)) + (its-state-machine-keyseq keyseq 'its-buffer-ins/del-SYL))))))) + +(defun its-yank (&optional arg) + (interactive "*P") + (let ((inhibit-read-only t)) + (its-input-end) + (yank arg) + (its-setup-yanked-portion (region-beginning) (region-end)))) + +(defun its-yank-pop (arg) + (interactive "*p") + (let ((inhibit-read-only t)) + (its-input-end) + (yank-pop arg) + (its-setup-yanked-portion (region-beginning) (region-end)))) + +(defun its-setup-yanked-portion (start end) + (let ((yank-before (eq (point) end)) + syl face lang source no-prop-source len i j l) + (setq source (buffer-substring start end) + no-prop-source (buffer-substring-no-properties start end) + len (length source)) + (remove-text-properties 0 len '(intangible nil) source) + (egg-separate-languages source (get-text-property (1- start) 'egg-lang)) + (setq i 0) + (while (< i len) + (setq lang (get-text-property i 'egg-lang source)) + (if (and + (or (eq lang 'Chinese-GB) (eq lang 'Chinese-CNS)) + (setq l (egg-chinese-syllable source i))) + (setq j (+ i l)) + (setq j (+ i (egg-char-bytes (egg-string-to-char-at source i))))) + (setq syl (substring no-prop-source i j)) + (put-text-property i j 'its-syl (cons syl syl) source) + (setq i j)) + (if its-fence-face + (progn + (setq i 0) + (while (< i len) + (setq j (egg-next-single-property-change i 'egg-lang source len) + face (its-get-fence-face + (get-text-property i 'egg-lang source))) + (if face + (egg-set-face i j face source)) + (setq i j)))) + (delete-region start end) + (if yank-before + (progn + (add-text-properties 0 len '(read-only t intangible its-part-1) source) + (insert source)) + (add-text-properties 0 len '(read-only t intangible its-part-2) source) + (insert source) + (set-marker (mark-marker) (point) (current-buffer)) + (goto-char start)) + (its-put-cursor t))) + +;; Return VOID +(defun its-input-end () + (if (null (eq its-barf-on-invalid-keyseq 'its-keyseq-test)) + (let ((cursor (get-text-property (point) 'its-cursor))) + ;; key "END" + (if (null cursor) + (let ((its-current-language (get-text-property (1- (point)) + 'egg-lang))) + (its-input (get-text-property (1- (point)) 'its-syl) -1))) + (delete-region (point) (1+ (point)))))) + +(defun its-exit-mode () + "Exit ITS mode." + (interactive) + (if (its-in-fence-p) + (let ((inhibit-read-only t)) + (its-input-end) + (its-put-cursor t) + (its-exit-mode-internal)) + (its-select-previous-mode t))) + +(defun its-exit-mode-if-empty () + (and (get-text-property (1- (point)) 'its-start) + (get-text-property (1+ (point)) 'its-end) + (its-exit-mode-internal))) + +;; TODO: handle overwrite-mode, insertion-hook, fill... +(defun its-exit-mode-internal (&optional proceed-to-conversion n) + (let (start end s context) + (its-select-previous-mode t) + ;; Delete CURSOR + (delete-region (point) (1+ (point))) + ;; Delete open fence + (setq s (if (get-text-property (1- (point)) 'its-start) + (point) + (previous-single-property-change (point) 'its-start)) + start (previous-single-property-change s 'its-start nil (point-min)) + context (get-text-property start 'its-context)) + (delete-region start s) + ;; Delete close fence + (setq end (if (get-text-property (point) 'its-end) + (point) + (next-single-property-change (point) 'its-end))) + (delete-region end + (next-single-property-change end 'its-end nil (point-max))) + (if proceed-to-conversion + (egg-convert-region start end context n) + ;; Remove all properties + (goto-char start) + (insert (prog1 + (buffer-substring-no-properties start end) + (delete-region start end))) + (egg-do-auto-fill) + (run-hooks 'input-method-after-insert-chunk-hook)))) + +(defun its-kick-convert-region (&optional n) + (interactive "P") + (let ((inhibit-read-only t)) + (its-input-end) + (its-put-cursor t) + (its-exit-mode-internal t n))) + +(defun its-kick-convert-region-or-self-insert (&optional n) + (interactive "P") + (let ((syl (and (null (get-text-property (point) 'its-cursor)) + (get-text-property (1- (point)) 'its-syl)))) + (if (its-keyseq-acceptable-p (vector last-command-char) syl) + (its-self-insert-char) + (its-kick-convert-region n)))) + +(defun its-in-fence-p () + (eq (get-text-property (point) 'intangible) 'its-part-2)) + +(defvar its-translation-result "" "") + +(defun its-ins/del-SYL-batch (newsyl oldsyl cursor) + (its-update-latest-SYL newsyl) + (if (and newsyl + (consp (cdr newsyl)) + (not (its-kst-p (its-get-kst/t newsyl)))) + ;; DSYL + (let ((output (its-get-output newsyl)) + (oldlen (length its-translation-result))) + (setq its-translation-result (concat its-translation-result output)) + (put-text-property oldlen (length its-translation-result) + 'egg-lang its-current-language + its-translation-result))) + cursor) + +(defun its-translate-region (start end) + (interactive "r") + (its-translate-region-internal start end) + (set-text-properties start (point) nil)) + +(defun its-translate-region-internal (start end) + (setq its-translation-result "") + (goto-char start) + (let ((i 0) + (syl (its-initial-ISYL)) + ;; temporally enable DING + (its-barf-on-invalid-keyseq t) + cursor) + (while (< (point) end) + (let ((key (following-char))) + (setq cursor (its-state-machine syl key 'its-ins/del-SYL-batch)) + (forward-char 1) + (if cursor + (setq syl (its-initial-ISYL)) + (setq syl its-latest-SYL)))) + (if (eq syl its-latest-SYL) + (its-state-machine syl -1 'its-ins/del-SYL-batch)) + (delete-region start end) + (insert its-translation-result))) + +(defun its-set-mode-line-title () + (let ((title (its-get-indicator (symbol-value its-current-map)))) + (setq current-input-method-title (if its-previous-select-func + (concat "<" title ">") + title)) + (force-mode-line-update))) + +(defun its-select-mode-temporally (func) + (let ((select-func its-current-select-func)) + (let ((its-previous-select-func t)) + (funcall func)) + (if (null its-previous-select-func) + (setq its-previous-select-func select-func)) + (its-set-mode-line-title))) + +(defun its-select-previous-mode (&optional quiet) + (interactive) + (if (null its-previous-select-func) + (if (null quiet) + (beep)) + (funcall its-previous-select-func) + (setq its-previous-select-func nil) + (its-set-mode-line-title))) + +(defun its-set-stroke-input (alist) + (let ((a alist)) + (while a + (setq its-stroke-input-alist + (delq (assq (caar a) its-stroke-input-alist) + its-stroke-input-alist)) + (setq a (cdr a))) + (setq its-stroke-input-alist + (append alist its-stroke-input-alist)))) + +(defun its-mode () + "\\{its-mode-map}" + ;; dummy function to get docstring + ) + +(defun its-mode-help-command () + "Display documentation for ITS mode." + (interactive) + (with-output-to-temp-buffer "*Help*" + (princ "ITS mode:\n") + (princ (documentation 'its-mode)) + (help-setup-xref (cons #'help-xref-mode (current-buffer)) (interactive-p)))) + +(provide 'its) +;;; its.el ends here. diff --git a/its/ascii.el b/its/ascii.el new file mode 100644 index 0000000..b7c16ca --- /dev/null +++ b/its/ascii.el @@ -0,0 +1,61 @@ +;;; its/ascii.el --- ASCII Input in Egg Input Method Architecture + +;; Copyright (C) 1999,2000 PFU LIMITED + +;; Author: KATAYAMA Yoshio + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: +;; +;; Symbol input is desined by jiro@math.keio.ac.jp (TANAKA Jiro) +;; This file is based on the rules of its/hira.el in Mule-2.3 distribution. +;; + +;;; Code: + +(eval-when-compile + (require 'its)) + +(define-its-state-machine its-up-map + "upcase" "aA" nil + "Map for upcase input." + + (let ((i ? )) + (while (<= i ?~) + (its-defrule (char-to-string i) (upcase (char-to-string i))) + (setq i (1+ i))))) + +(define-its-state-machine-append its-up-map) + +(define-its-state-machine its-down-map + "downcase" "aa" nil + "Map for downcase input." + + (let ((i ? )) + (while (<= i ?~) + (its-defrule (char-to-string i) (char-to-string i)) + (setq i (1+ i))))) + +(define-its-state-machine-append its-down-map) + +(provide 'its/ascii) diff --git a/its/bixing.el b/its/bixing.el new file mode 100644 index 0000000..b623515 --- /dev/null +++ b/its/bixing.el @@ -0,0 +1,235 @@ +;;; its/bixing.el --- Bixing (stroke) Input in Egg Input Method Architecture + +;; Copyright (C) 1999,2000 PFU LIMITED + +;; Author: KATAYAMA Yoshio + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + + +;;; Code: + + +(eval-when-compile + (require 'its) + (require 'cl)) + +(defvar its-qianma-enable-quanjioao-alphabet + (if (boundp 'its-enable-fullwidth-alphabet) + its-enable-fullwidth-alphabet + t) + "*Enable Quanjiao alphabet") + +(defvar its-qianma-open-braket "$A!8(B" "*[") ; "$A#[(B" +(defvar its-qianma-close-braket "$A!9(B" "*]") ; "$A#](B" + +(defvar its-wubi-enable-quanjioao-alphabet + (if (boundp 'its-enable-fullwidth-alphabet) + its-enable-fullwidth-alphabet + t) + "*Enable Quanjiao alphabet") + +(defvar its-wubi-open-braket "$A!8(B" "*[") ; "$A#[(B" +(defvar its-wubi-close-braket "$A!9(B" "*]") ; "$A#](B" + +(its-set-stroke-input '((QianMa . 3) (WuBi . 4))) + +(egg-set-message-language-alist '((QianMa . Chinese-GB) (WuBi . Chinese-GB))) + +(define-its-state-machine its-qianma-map + "qinama" "$AG.(B" QianMa + "Map for QianMa input. (Chinese-GB)" + + (defconst its-quanjiao-escape "Z") + (defconst its-banjiao-escape "X") + + (its-defrule-select-mode-temporally "B" downcase) + (its-defrule-select-mode-temporally "Q" quanjiao-downcase-cn) + + (let ((ch (string-to-list "0123456789abcdefghijklmnopqrstuvwxyz;=@[]"))) + (while ch + (its-defrule (char-to-string (car ch)) (char-to-string (car ch))) + (setq ch (cdr ch)))) + + (dolist (ascii '(("0" . "$A#0(B") ("1" . "$A#1(B") ("2" . "$A#2(B") ("3" . "$A#3(B") + ("4" . "$A#4(B") ("5" . "$A#5(B") ("6" . "$A#6(B") ("7" . "$A#7(B") + ("8" . "$A#8(B") ("9" . "$A#9(B") + (" " . "$A!!(B") ("!" . "$A#!(B") ("@" . "$A#@(B") ("#" . "$A##(B") + ("$" . "$A!g(B") ("%" . "$A#%(B") ("^" . "$A#^(B") ("&" . "$A#&(B") + ("*" . "$A#*(B") ("(" . "$A#((B") (")" . "$A#)(B") + ("-" . "$A#-(B") ("=" . "$A#=(B") ("`" . "$A#`(B") ("\\" . "$A#\(B") + ("|" . "$A#|(B") ("_" . "$A#_(B") ("+" . "$A#+(B") ("~" . "$A!+(B") + ("[" . "$A#[(B") ("]" . "$A#](B") ("{" . "$A#{(B") ("}" . "$A#}(B") + (":" . "$A#:(B") (";" . "$A#;(B") ("\"" . "$A#"(B") ("'" . "$A#'(B") + ("<" . "$A#<(B") (">" . "$A#>(B") ("?" . "$A#?(B") ("/" . "$A#/(B") + ("," . "$A#,(B") ("." . "$A#.(B") + ("a" . "$A#a(B") ("b" . "$A#b(B") ("c" . "$A#c(B") ("d" . "$A#d(B") + ("e" . "$A#e(B") ("f" . "$A#f(B") ("g" . "$A#g(B") ("h" . "$A#h(B") + ("i" . "$A#i(B") ("j" . "$A#j(B") ("k" . "$A#k(B") ("l" . "$A#l(B") + ("m" . "$A#m(B") ("n" . "$A#n(B") ("o" . "$A#o(B") ("p" . "$A#p(B") + ("q" . "$A#q(B") ("r" . "$A#r(B") ("s" . "$A#s(B") ("t" . "$A#t(B") + ("u" . "$A#u(B") ("v" . "$A#v(B") ("w" . "$A#w(B") ("x" . "$A#x(B") + ("y" . "$A#y(B") ("z" . "$A#z(B") + ("A" . "$A#A(B") ("B" . "$A#B(B") ("C" . "$A#C(B") ("D" . "$A#D(B") + ("E" . "$A#E(B") ("F" . "$A#F(B") ("G" . "$A#G(B") ("H" . "$A#H(B") + ("I" . "$A#I(B") ("J" . "$A#J(B") ("K" . "$A#K(B") ("L" . "$A#L(B") + ("M" . "$A#M(B") ("N" . "$A#N(B") ("O" . "$A#O(B") ("P" . "$A#P(B") + ("Q" . "$A#Q(B") ("R" . "$A#R(B") ("S" . "$A#S(B") ("T" . "$A#T(B") + ("U" . "$A#U(B") ("V" . "$A#V(B") ("W" . "$A#W(B") ("X" . "$A#X(B") + ("Y" . "$A#Y(B") ("Z" . "$A#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule (concat its-banjiao-escape in) in t) + (its-defrule (concat its-quanjiao-escape in) out t))) + + (its-defrule "," "$A#,(B" t) + (its-defrule "." "$A!#(B" t) + (its-defrule "/" "$A!"(B" t) + (its-defrule ":" "$A#:(B" t) + (its-defrule "?" "$A#?(B" t) + (its-defrule "!" "$A#!(B" t)) + +(define-its-state-machine its-wubi-map + "wubi" "$ANe(B" WuBi + "Map for WuBi input. (Chinese-GB)" + + (defconst its-quanjiao-escape "Z") + (defconst its-banjiao-escape "X") + + (its-defrule-select-mode-temporally "B" downcase) + (its-defrule-select-mode-temporally "Q" quanjiao-downcase-cn) + + (let ((ch (string-to-list "abcdefghijklmnopqrstuvwxy"))) + (while ch + (its-defrule (char-to-string (car ch)) (char-to-string (car ch))) + (setq ch (cdr ch)))) + + (dolist (ascii '(("0" . "$A#0(B") ("1" . "$A#1(B") ("2" . "$A#2(B") ("3" . "$A#3(B") + ("4" . "$A#4(B") ("5" . "$A#5(B") ("6" . "$A#6(B") ("7" . "$A#7(B") + ("8" . "$A#8(B") ("9" . "$A#9(B") + (" " . "$A!!(B") ("!" . "$A#!(B") ("@" . "$A#@(B") ("#" . "$A##(B") + ("$" . "$A!g(B") ("%" . "$A#%(B") ("^" . "$A#^(B") ("&" . "$A#&(B") + ("*" . "$A#*(B") ("(" . "$A#((B") (")" . "$A#)(B") + ("-" . "$A#-(B") ("=" . "$A#=(B") ("`" . "$A#`(B") ("\\" . "$A#\(B") + ("|" . "$A#|(B") ("_" . "$A#_(B") ("+" . "$A#+(B") ("~" . "$A!+(B") + ("[" . "$A#[(B") ("]" . "$A#](B") ("{" . "$A#{(B") ("}" . "$A#}(B") + (":" . "$A#:(B") (";" . "$A#;(B") ("\"" . "$A#"(B") ("'" . "$A#'(B") + ("<" . "$A#<(B") (">" . "$A#>(B") ("?" . "$A#?(B") ("/" . "$A#/(B") + ("," . "$A#,(B") ("." . "$A#.(B") + ("a" . "$A#a(B") ("b" . "$A#b(B") ("c" . "$A#c(B") ("d" . "$A#d(B") + ("e" . "$A#e(B") ("f" . "$A#f(B") ("g" . "$A#g(B") ("h" . "$A#h(B") + ("i" . "$A#i(B") ("j" . "$A#j(B") ("k" . "$A#k(B") ("l" . "$A#l(B") + ("m" . "$A#m(B") ("n" . "$A#n(B") ("o" . "$A#o(B") ("p" . "$A#p(B") + ("q" . "$A#q(B") ("r" . "$A#r(B") ("s" . "$A#s(B") ("t" . "$A#t(B") + ("u" . "$A#u(B") ("v" . "$A#v(B") ("w" . "$A#w(B") ("x" . "$A#x(B") + ("y" . "$A#y(B") ("z" . "$A#z(B") + ("A" . "$A#A(B") ("B" . "$A#B(B") ("C" . "$A#C(B") ("D" . "$A#D(B") + ("E" . "$A#E(B") ("F" . "$A#F(B") ("G" . "$A#G(B") ("H" . "$A#H(B") + ("I" . "$A#I(B") ("J" . "$A#J(B") ("K" . "$A#K(B") ("L" . "$A#L(B") + ("M" . "$A#M(B") ("N" . "$A#N(B") ("O" . "$A#O(B") ("P" . "$A#P(B") + ("Q" . "$A#Q(B") ("R" . "$A#R(B") ("S" . "$A#S(B") ("T" . "$A#T(B") + ("U" . "$A#U(B") ("V" . "$A#V(B") ("W" . "$A#W(B") ("X" . "$A#X(B") + ("Y" . "$A#Y(B") ("Z" . "$A#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule (concat its-banjiao-escape in) in t) + (its-defrule (concat its-quanjiao-escape in) out t))) + + (its-defrule "," "$A#,(B" t) + (its-defrule "." "$A!#(B" t) + (its-defrule "/" "$A!"(B" t) + (its-defrule ";" "$A#;(B" t) + (its-defrule ":" "$A#:(B" t) + (its-defrule "?" "$A#?(B" t) + (its-defrule "!" "$A#!(B" t)) + +(define-its-state-machine-append its-qianma-map + (its-defrule "{" its-qianma-open-braket) + (its-defrule "}" its-qianma-close-braket) + + (if its-qianma-enable-quanjioao-alphabet + (progn + (its-defrule "#" "$A##(B" t) (its-defrule "$" "$A!g(B" t) + (its-defrule "%" "$A#%(B" t) (its-defrule "^" "$A#^(B" t) + (its-defrule "&" "$A#&(B" t) (its-defrule "*" "$A#*(B" t) + (its-defrule "(" "$A#((B" t) (its-defrule ")" "$A#)(B" t) + (its-defrule "-" "$A#-(B" t) (its-defrule "~" "$A!+(B" t) + (its-defrule "`" "$A#`(B" t) + (its-defrule "\\" "$A#\(B" t) (its-defrule "|" "$A#|(B" t) + (its-defrule "_" "$A#_(B" t) (its-defrule "+" "$A#+(B" t) + (its-defrule "\"" "$A#"(B" t) (its-defrule "'" "$A#'(B" t) + (its-defrule "<" "$A#<(B" t) (its-defrule ">" "$A#>(B" t)) + (progn + (its-defrule "#" "#" t) (its-defrule "$" "$" t) + (its-defrule "%" "%" t) (its-defrule "^" "^" t) + (its-defrule "&" "&" t) (its-defrule "*" "*" t) + (its-defrule "(" "(" t) (its-defrule ")" ")" t) + (its-defrule "-" "-" t) (its-defrule "~" "~" t) + (its-defrule "`" "`" t) + (its-defrule "\\" "\\" t) (its-defrule "|" "|" t) + (its-defrule "_" "_" t) (its-defrule "+" "+" t) + (its-defrule "\"" "\"" t) (its-defrule "'" "'" t) + (its-defrule "<" "<" t) (its-defrule ">" ">" t)))) + +(define-its-state-machine-append its-wubi-map + (its-defrule "[" its-wubi-open-braket) + (its-defrule "]" its-wubi-close-braket) + + (if its-wubi-enable-quanjioao-alphabet + (progn + (its-defrule "1" "$A#1(B" t) (its-defrule "2" "$A#2(B" t) + (its-defrule "3" "$A#3(B" t) (its-defrule "4" "$A#4(B" t) + (its-defrule "5" "$A#5(B" t) (its-defrule "6" "$A#6(B" t) + (its-defrule "7" "$A#7(B" t) (its-defrule "8" "$A#8(B" t) + (its-defrule "9" "$A#9(B" t) (its-defrule "0" "$A#0(B" t) + (its-defrule "@" "$A#@(B" t) + (its-defrule "#" "$A##(B" t) (its-defrule "$" "$A!g(B" t) + (its-defrule "%" "$A#%(B" t) (its-defrule "^" "$A#^(B" t) + (its-defrule "&" "$A#&(B" t) (its-defrule "*" "$A#*(B" t) + (its-defrule "(" "$A#((B" t) (its-defrule ")" "$A#)(B" t) + (its-defrule "-" "$A#-(B" t) (its-defrule "~" "$A!+(B" t) + (its-defrule "=" "$A#=(B" t) (its-defrule "`" "$A#`(B" t) + (its-defrule "\\" "$A#\(B" t) (its-defrule "|" "$A#|(B" t) + (its-defrule "_" "$A#_(B" t) (its-defrule "+" "$A#+(B" t) + (its-defrule "{" "$A#{(B" t) (its-defrule "}" "$A#}(B" t) + (its-defrule "\"" "$A#"(B" t) (its-defrule "'" "$A#'(B" t) + (its-defrule "<" "$A#<(B" t) (its-defrule ">" "$A#>(B" t)) + (progn + (its-defrule "1" "1" t) (its-defrule "2" "2" t) + (its-defrule "3" "3" t) (its-defrule "4" "4" t) + (its-defrule "5" "5" t) (its-defrule "6" "6" t) + (its-defrule "7" "7" t) (its-defrule "8" "8" t) + (its-defrule "9" "9" t) (its-defrule "0" "0" t) + (its-defrule "@" "@" t) + (its-defrule "#" "#" t) (its-defrule "$" "$" t) + (its-defrule "%" "%" t) (its-defrule "^" "^" t) + (its-defrule "&" "&" t) (its-defrule "*" "*" t) + (its-defrule "(" "(" t) (its-defrule ")" ")" t) + (its-defrule "-" "-" t) (its-defrule "~" "~" t) + (its-defrule "=" "=" t) (its-defrule "`" "`" t) + (its-defrule "\\" "\\" t) (its-defrule "|" "|" t) + (its-defrule "_" "_" t) (its-defrule "+" "+" t) + (its-defrule "{" "{" t) (its-defrule "}" "}" t) + (its-defrule "\"" "\"" t) (its-defrule "'" "'" t) + (its-defrule "<" "<" t) (its-defrule ">" ">" t)))) + +(provide 'its/bixing) diff --git a/its/erpin.el b/its/erpin.el new file mode 100644 index 0000000..6fa8d15 --- /dev/null +++ b/its/erpin.el @@ -0,0 +1,425 @@ +;;; its/erpin.el --- Erpin Input in Egg Input Method Architecture + +;; Copyright (C) 1999,2000 PFU LIMITED + +;; Author: KATAYAMA Yoshio + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + + +;;; Code: + + +(eval-when-compile + (require 'its) + (require 'cl)) + +(eval-when (compile) + (defconst its-compaction-enable t)) + +(defvar its-erpin-cn-enable-quanjioao-alphabet + (if (boundp 'its-enable-fullwidth-alphabet) + its-enable-fullwidth-alphabet + t) + "*Enable Quanjiao alphabet") + +(defvar its-erpin-cn-open-braket "$A!8(B" "*[") ; "$A#[(B" +(defvar its-erpin-cn-close-braket "$A!9(B" "*]") ; "$A#](B" + +(defvar its-erpin-tw-enable-quanjioao-alphabet + (if (boundp 'its-enable-fullwidth-alphabet) + its-enable-fullwidth-alphabet + t) + "*Enable Quanjiao alphabet") + +(defvar its-erpin-tw-open-braket "$(G!V(B" "*[") ; "$(G!b(B " +(defvar its-erpin-tw-close-braket "$(G!W(B" "*]") ; "$(G!c(B" + +(eval-when-compile + (defun its-define-erpin-qingsheng (shengmu yunmu &optional y) + (let ((input (concat (car shengmu) yunmu)) + (output (concat (cdr shengmu) (if y y yunmu) "(0@(B"))) + (prog1 + (its-defrule input output) + (its-defrule (concat input " ") output) + (its-defrule (concat input "0") output)))) + + (defmacro its-do-erpin-table (list) + `(progn + ,@(mapcar (lambda (syl) + `(its-define-erpin ,(car syl) ,(cdr syl))) + list))) + + (defmacro its-define-erpin (shengmu yunmu) + `(let ((y1 (nth 1 ,yunmu)) (y2 (nth 2 ,yunmu)) (y3 (nth 3 ,yunmu)) + (y4 (nth 4 ,yunmu)) (y5 (nth 5 ,yunmu)) (y (car ,yunmu)) + (ss (list ,@shengmu)) sa sd state) + (while ss + (setq sa (caar ss) sd (cdar ss) + state (its-define-erpin-qingsheng (car ss) y y5)) + (its-make-next-state state ?1 (concat sd y1 "(0@(B")) + (its-make-next-state state ?2 (concat sd y2 "(0@(B")) + (its-make-next-state state ?3 (concat sd y3 "(0@(B")) + (its-make-next-state state ?4 (concat sd y4 "(0@(B")) + (setq ss (cdr ss))))) + + (defmacro its-define-erpin-table () + '(let ((O '("o" . "")) (B '("b" . "B")) (C '("c" . "C")) (D '("d" . "D")) + (F '("f" . "F")) (G '("g" . "G")) (H '("h" . "H")) (J '("j" . "J")) + (K '("k" . "K")) (L '("l" . "L")) (M '("m" . "M")) (N '("n" . "N")) + (P '("p" . "P")) (Q '("q" . "Q")) (R '("r" . "R")) (S '("s" . "S")) + (T '("t" . "T")) (W '("w" . "W")) (X '("x" . "X")) (Y '("y" . "Y")) + (Z '("z" . "Z")) + (I '("i" . "Ch")) (U '("u" . "Sh")) (V '("v" . "Zh")) + + (a '("a" "(0!(B" "(0"(B" "(0#(B" "(0$(B" "a" )) + (ai '("s" "(0!(Bi" "(0"(Bi" "(0#(Bi" "(0$(Bi" "ai" )) + (an '("f" "(0!(Bn" "(0"(Bn" "(0#(Bn" "(0$(Bn" "an" )) + (ang '("g" "(0!(Bng" "(0"(Bng" "(0#(Bng" "(0$(Bng" "ang" )) + (ao '("d" "(0!(Bo" "(0"(Bo" "(0#(Bo" "(0$(Bo" "ao" )) + (e '("e" "(0%(B" "(0&(B" "(0'(B" "(0((B" "e" )) + (ei '("w" "(0%(Bi" "(0&(Bi" "(0'(Bi" "(0((Bi" "ei" )) + (en '("r" "(0%(Bn" "(0&(Bn" "(0'(Bn" "(0((Bn" "en" )) + (eng '("t" "(0%(Bng" "(0&(Bng" "(0'(Bng" "(0((Bng" "eng" )) + (er '("y" "(0%(Br" "(0&(Br" "(0'(Br" "(0((Br" "er" )) + (i '("i" "(0)(B" "(0*(B" "(0+(B" "(0,(B" "i" )) + (ia '("p" "i(0!(B" "i(0"(B" "i(0#(B" "i(0$(B" "ia" )) + (ian '("h" "i(0!(Bn" "i(0"(Bn" "i(0#(Bn" "i(0$(Bn" "ian" )) + (iang '("j" "i(0!(Bng" "i(0"(Bng" "i(0#(Bng" "i(0$(Bng" "iang")) + (iao '("k" "i(0!(Bo" "i(0"(Bo" "i(0#(Bo" "i(0$(Bo" "iao" )) + (ie '("l" "i(0%(B" "i(0&(B" "i(0'(B" "i(0((B" "ie" )) + (in '("m" "(0)(Bn" "(0*(Bn" "(0+(Bn" "(0,(Bn" "in" )) + (ing '("n" "(0)(Bng" "(0*(Bng" "(0+(Bng" "(0,(Bng" "ing" )) + (iong '("b" "i(0-(Bng" "i(0.(Bng" "i(0/(Bng" "i(00(Bng" "iong")) + (iu '("y" "i(01(B" "i(02(B" "i(03(B" "i(04(B" "iu" )) + (o '("o" "(0-(B" "(0.(B" "(0/(B" "(00(B" "o" )) + (ong '("b" "(0-(Bng" "(0.(Bng" "(0/(Bng" "(00(Bng" "ong" )) + (ou '("q" "(0-(Bu" "(0.(Bu" "(0/(Bu" "(00(Bu" "ou" )) + (u '("u" "(01(B" "(02(B" "(03(B" "(04(B" "u" )) + (v '("v" "(05(B" "(06(B" "(07(B" "(08(B" "(09(B" )) + (ua '("p" "u(0!(B" "u(0"(B" "u(0#(B" "u(0$(B" "ua" )) + (uai '("k" "u(0!(Bi" "u(0"(Bi" "u(0#(Bi" "u(0$(Bi" "uai" )) + (uan '("x" "u(0!(Bn" "u(0"(Bn" "u(0#(Bn" "u(0$(Bn" "uan" )) + (uang '("j" "u(0!(Bng" "u(0"(Bng" "u(0#(Bng" "u(0$(Bng" "uang")) + (ue '("c" "u(0%(B" "u(0&(B" "u(0'(B" "u(0((B" "ue" )) + (ve '("c" "(09%(B" "(09&(B" "(09'(B" "(09((B" "(09(Be" )) + (ui '("c" "u(0)(B" "u(0*(B" "u(0+(B" "u(0,(B" "ui" )) + (un '("z" "(01(Bn" "(02(Bn" "(03(Bn" "(04(Bn" "un" )) + (uo '("o" "u(0-(B" "u(0.(B" "u(0/(B" "u(00(B" "uo" ))) + + (its-do-erpin-table + (((O B C D F G H K L M N P S T W Y Z I U V) . a) + ((O B C D G H K L M N P S T W Z I U V) . ai) + ((O B C D F G H K L M N P R S T W Y Z I U V) . an) + ((O B C D F G H K L M N P R S T W Y Z I U V) . ang) + ((O B C D G H K L M N P R S T Y Z I U V) . ao) + ((O C D G H K L M N R S T Y Z I U V) . e) + ((O B C D F G H K L M N P T W Z U V) . ei) + ((O B C D F G H K M N P R S W Z I U V) . en) + ((O B C D F G H K L M N P R S T W Z I U V) . eng) + ((O ) . er) + (( B C D J L M N P Q R S T X Y Z I U V) . i) + (( D J L Q X ) . ia) + (( B D J L M N P Q T X ) . ian) + (( J L N Q X ) . iang) + (( B D J L M N P Q T X ) . iao) + (( B D J L M N P Q T X ) . ie) + (( B J L M N P Q X Y ) . in) + (( B D J L M N P Q T X Y ) . ing) + (( J Q X ) . iong) + (( D J L M N Q X ) . iu) + ((O B F M P W Y ) . o) + (( C D G H K L N R S T Y Z I V) . ong) + ((O C D F G H K L M N P R S T Y Z I U V) . ou) + (( B C D F G H J K L M N P Q R S T W X Y Z I U V) . u) + (( L N ) . v) + (( G H K R I U V) . ua) + (( G H K I U V) . uai) + (( C D G H J K L N Q R S T X Y Z I U V) . uan) + (( G H K I U V) . uang) + (( J Q X Y ) . ue) + (( L N ) . ve) + (( C D G H K R S T Z I U V) . ui) + (( C D G H J K L Q R S T X Y Z I U V) . un) + (( C D G H K L N R S T Z I U V) . uo) + + (('("" . "")) . (cons "er" (cdr er))) + + ((J Q X) . (cons "a" (cdr ia ))) + ((J Q X) . (cons "s" (cdr ia ))) + ((J Q X) . (cons "f" (cdr ian ))) + ((J Q X) . (cons "g" (cdr iang))) + ((J Q X) . (cons "d" (cdr iao ))) + ((J Q X) . (cons "e" (cdr ie ))) + ((J Q X) . (cons "w" (cdr ie ))) + ((J Q X) . (cons "r" (cdr in ))) + ((J Q X) . (cons "t" (cdr ing ))) + ((J Q X) . (cons "q" (cdr iu ))))) + + (dolist (SHENG (list B C D F G H J K L M N P Q R S T W X Y Z I U V)) + (its-defoutput (car SHENG) (cdr SHENG))) + + (its-define-erpin-qingsheng H "m") + (its-define-erpin-qingsheng H "n" "ng") + (its-define-erpin-qingsheng O "m") + (its-define-erpin-qingsheng O "n") + + (its-defrule "on5" "ng(0@(B") + (its-defrule "on2" "(0=@(B") + (its-defrule "on3" "(0>@(B") + (its-defrule "on4" "(0?@(B")))) + +(define-its-state-machine its-erpin-cn-map + "erpin-cn" "$A6~(BG" Chinese-GB + "Map for Erpin input. (Chinese-GB)" + + (defconst its-quanjiao-escape "Z") + (defconst its-banjiao-escape "X") + + (its-defrule-select-mode-temporally "B" downcase) + (its-defrule-select-mode-temporally "Q" quanjiao-downcase-cn) + + (its-define-erpin-table) + (its-defrule "b " "$A2;(B") + (its-defrule "c " "$A2E(B") + (its-defrule "ch " "$A3v(B") + (its-defrule "d " "$A5D(B") + (its-defrule "f " "$A74(B") + (its-defrule "g " "$A8v(B") + (its-defrule "h " "$A:M(B") + (its-defrule "i " "$AR;(B") + (its-defrule "j " "$A>M(B") + (its-defrule "k " "$A?I(B") + (its-defrule "l " "$AAK(B") + (its-defrule "m " "$AC?(B") + (its-defrule "n " "$ADj(B") + (its-defrule "p " "$AEz(B") + (its-defrule "q " "$AH%(B") + (its-defrule "r " "$AHU(B") + (its-defrule "s " "$AJG(B") + (its-defrule "u " "$AIO(B") + (its-defrule "t " "$AK{(B") + (its-defrule "w " "$ANR(B") + (its-defrule "x " "$AOr(B") + (its-defrule "y " "$ASV(B") + (its-defrule "z " "$ATZ(B") + (its-defrule "v " "$AWE(B") + + (dolist (ascii '(("0" . "$A#0(B") ("1" . "$A#1(B") ("2" . "$A#2(B") ("3" . "$A#3(B") + ("4" . "$A#4(B") ("5" . "$A#5(B") ("6" . "$A#6(B") ("7" . "$A#7(B") + ("8" . "$A#8(B") ("9" . "$A#9(B") + (" " . "$A!!(B") ("!" . "$A#!(B") ("@" . "$A#@(B") ("#" . "$A##(B") + ("$" . "$A!g(B") ("%" . "$A#%(B") ("^" . "$A#^(B") ("&" . "$A#&(B") + ("*" . "$A#*(B") ("(" . "$A#((B") (")" . "$A#)(B") + ("-" . "$A#-(B") ("=" . "$A#=(B") ("`" . "$A#`(B") ("\\" . "$A#\(B") + ("|" . "$A#|(B") ("_" . "$A#_(B") ("+" . "$A#+(B") ("~" . "$A!+(B") + ("[" . "$A#[(B") ("]" . "$A#](B") ("{" . "$A#{(B") ("}" . "$A#}(B") + (":" . "$A#:(B") (";" . "$A#;(B") ("\"" . "$A#"(B") ("'" . "$A#'(B") + ("<" . "$A#<(B") (">" . "$A#>(B") ("?" . "$A#?(B") ("/" . "$A#/(B") + ("," . "$A#,(B") ("." . "$A#.(B") + ("a" . "$A#a(B") ("b" . "$A#b(B") ("c" . "$A#c(B") ("d" . "$A#d(B") + ("e" . "$A#e(B") ("f" . "$A#f(B") ("g" . "$A#g(B") ("h" . "$A#h(B") + ("i" . "$A#i(B") ("j" . "$A#j(B") ("k" . "$A#k(B") ("l" . "$A#l(B") + ("m" . "$A#m(B") ("n" . "$A#n(B") ("o" . "$A#o(B") ("p" . "$A#p(B") + ("q" . "$A#q(B") ("r" . "$A#r(B") ("s" . "$A#s(B") ("t" . "$A#t(B") + ("u" . "$A#u(B") ("v" . "$A#v(B") ("w" . "$A#w(B") ("x" . "$A#x(B") + ("y" . "$A#y(B") ("z" . "$A#z(B") + ("A" . "$A#A(B") ("B" . "$A#B(B") ("C" . "$A#C(B") ("D" . "$A#D(B") + ("E" . "$A#E(B") ("F" . "$A#F(B") ("G" . "$A#G(B") ("H" . "$A#H(B") + ("I" . "$A#I(B") ("J" . "$A#J(B") ("K" . "$A#K(B") ("L" . "$A#L(B") + ("M" . "$A#M(B") ("N" . "$A#N(B") ("O" . "$A#O(B") ("P" . "$A#P(B") + ("Q" . "$A#Q(B") ("R" . "$A#R(B") ("S" . "$A#S(B") ("T" . "$A#T(B") + ("U" . "$A#U(B") ("V" . "$A#V(B") ("W" . "$A#W(B") ("X" . "$A#X(B") + ("Y" . "$A#Y(B") ("Z" . "$A#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule (concat its-banjiao-escape in) in) + (its-defrule (concat its-quanjiao-escape in) out))) + + (its-defrule "," "$A#,(B") + (its-defrule "." "$A!#(B") + (its-defrule "/" "$A!"(B") + (its-defrule ":" "$A#:(B") + (its-defrule ";" "$A#;(B") + (its-defrule "?" "$A#?(B") + (its-defrule "!" "$A#!(B")) + +(define-its-state-machine its-erpin-tw-map + "erpin-tw" "$(GD((BC" Chinese-CNS + "Map for Erpin input." + + (defconst its-quanjiao-escape "Z") + (defconst its-banjiao-escape "X") + + (its-defrule-select-mode-temporally "B" downcase) + (its-defrule-select-mode-temporally "Q" quanjiao-downcase-cn) + + (its-define-erpin-table) + (its-defrule "b " "$(GDb(B") + (its-defrule "c " "$(GD_(B") + (its-defrule "ch " "$(GEx(B") + (its-defrule "d " "$(GN{(B") + (its-defrule "f " "$(GE0(B") + (its-defrule "g " "$(GT6(B") + (its-defrule "h " "$(GLO(B") + (its-defrule "i " "$(GD!(B") + (its-defrule "j " "$(G^s(B") + (its-defrule "k " "$(GF+(B") + (its-defrule "l " "$(GD'(B") + (its-defrule "m " "$(GJd(B") + (its-defrule "n " "$(GH!(B") + (its-defrule "p " "$(GJG(B") + (its-defrule "q " "$(GF*(B") + (its-defrule "r " "$(GEJ(B") + (its-defrule "s " "$(GQR(B") + (its-defrule "u " "$(GD8(B") + (its-defrule "t " "$(GEl(B") + (its-defrule "w " "$(GJ<(B") + (its-defrule "x " "$(GGW(B") + (its-defrule "y " "$(GD4(B") + (its-defrule "z " "$(GGc(B") + (its-defrule "v " "$(Gaa(B") + + (dolist (ascii '(("0" . "$(G$!(B") ("1" . "$(G$"(B") ("2" . "$(G$#(B") ("3" . "$(G$$(B") + ("4" . "$(G$%(B") ("5" . "$(G$&(B") ("6" . "$(G$'(B") ("7" . "$(G$((B") + ("8" . "$(G$)(B") ("9" . "$(G$*(B") + (" " . "$(G!!(B") ("!" . "$(G!*(B") ("@" . "$(G"i(B") ("#" . "$(G!l(B") + ("$" . "$(G"c(B") ("%" . "$(G"h(B") ("^" . "$(G!T(B") ("&" . "$(G!m(B") + ("*" . "$(G!n(B") ("(" . "$(G!>(B") (")" . "$(G!?(B") + ("-" . "$(G"1(B") ("=" . "$(G"8(B") ("`" . "$(G!j(B") ("\\" . "$(G"`(B") + ("|" . "$(G"^(B") ("_" . "$(G"%(B") ("+" . "$(G"0(B") ("~" . "$(G"D(B") + ("[" . "$(G!b(B") ("]" . "$(G!c(B") ("{" . "$(G!B(B") ("}" . "$(G!C(B") + (":" . "$(G!((B") (";" . "$(G!'(B") ("\"" . "$(G!i(B") ("'" . "$(G!k(B") + ("<" . "$(G"6(B") (">" . "$(G"7(B") ("?" . "$(G!)(B") ("/" . "$(G"_(B") + ("," . "$(G!"(B") ("." . "$(G!%(B") + ("a" . "$(G$[(B") ("b" . "$(G$\(B") ("c" . "$(G$](B") ("d" . "$(G$^(B") + ("e" . "$(G$_(B") ("f" . "$(G$`(B") ("g" . "$(G$a(B") ("h" . "$(G$b(B") + ("i" . "$(G$c(B") ("j" . "$(G$d(B") ("k" . "$(G$e(B") ("l" . "$(G$f(B") + ("m" . "$(G$g(B") ("n" . "$(G$h(B") ("o" . "$(G$i(B") ("p" . "$(G$j(B") + ("q" . "$(G$k(B") ("r" . "$(G$l(B") ("s" . "$(G$m(B") ("t" . "$(G$n(B") + ("u" . "$(G$o(B") ("v" . "$(G$p(B") ("w" . "$(G$q(B") ("x" . "$(G$r(B") + ("y" . "$(G$s(B") ("z" . "$(G$t(B") + ("A" . "$(G$A(B") ("B" . "$(G$B(B") ("C" . "$(G$C(B") ("D" . "$(G$D(B") + ("E" . "$(G$E(B") ("F" . "$(G$F(B") ("G" . "$(G$G(B") ("H" . "$(G$H(B") + ("I" . "$(G$I(B") ("J" . "$(G$J(B") ("K" . "$(G$K(B") ("L" . "$(G$L(B") + ("M" . "$(G$M(B") ("N" . "$(G$N(B") ("O" . "$(G$O(B") ("P" . "$(G$P(B") + ("Q" . "$(G$Q(B") ("R" . "$(G$R(B") ("S" . "$(G$S(B") ("T" . "$(G$T(B") + ("U" . "$(G$U(B") ("V" . "$(G$V(B") ("W" . "$(G$W(B") ("X" . "$(G$X(B") + ("Y" . "$(G$Y(B") ("Z" . "$(G$Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule (concat its-banjiao-escape in) in) + (its-defrule (concat its-quanjiao-escape in) out))) + + (its-defrule "," "$(G!"(B") + (its-defrule "." "$(G!$(B") + (its-defrule "/" "$(G!#(B") + (its-defrule ":" "$(G!((B") + (its-defrule ";" "$(G!'(B") + (its-defrule "?" "$(G!)(B") + (its-defrule "!" "$(G!*(B")) + +(define-its-state-machine-append its-erpin-cn-map + (its-defrule "[" its-erpin-cn-open-braket) + (its-defrule "]" its-erpin-cn-close-braket) + + (if its-erpin-cn-enable-quanjioao-alphabet + (progn + (its-defrule "1" "$A#1(B") (its-defrule "2" "$A#2(B") + (its-defrule "3" "$A#3(B") (its-defrule "4" "$A#4(B") + (its-defrule "5" "$A#5(B") (its-defrule "6" "$A#6(B") + (its-defrule "7" "$A#7(B") (its-defrule "8" "$A#8(B") + (its-defrule "9" "$A#9(B") (its-defrule "0" "$A#0(B") + (its-defrule "@" "$A#@(B") + (its-defrule "#" "$A##(B") (its-defrule "$" "$A!g(B") + (its-defrule "%" "$A#%(B") (its-defrule "^" "$A#^(B") + (its-defrule "&" "$A#&(B") (its-defrule "*" "$A#*(B") + (its-defrule "(" "$A#((B") (its-defrule ")" "$A#)(B") + (its-defrule "-" "$A#-(B") (its-defrule "~" "$A!+(B") + (its-defrule "=" "$A#=(B") (its-defrule "`" "$A#`(B") + (its-defrule "\\" "$A#\(B") (its-defrule "|" "$A#|(B") + (its-defrule "_" "$A#_(B") (its-defrule "+" "$A#+(B") + (its-defrule "{" "$A#{(B") (its-defrule "}" "$A#}(B") + (its-defrule "\"" "$A#"(B") (its-defrule "'" "$A#'(B") + (its-defrule "<" "$A#<(B") (its-defrule ">" "$A#>(B")) + (progn + (its-defrule "1" "1") (its-defrule "2" "2") + (its-defrule "3" "3") (its-defrule "4" "4") + (its-defrule "5" "5") (its-defrule "6" "6") + (its-defrule "7" "7") (its-defrule "8" "8") + (its-defrule "9" "9") (its-defrule "0" "0") + (its-defrule "@" "@") + (its-defrule "#" "#") (its-defrule "$" "$") + (its-defrule "%" "%") (its-defrule "^" "^") + (its-defrule "&" "&") (its-defrule "*" "*") + (its-defrule "(" "(") (its-defrule ")" ")") + (its-defrule "-" "-") (its-defrule "~" "~") + (its-defrule "=" "=") (its-defrule "`" "`") + (its-defrule "\\" "\\") (its-defrule "|" "|") + (its-defrule "_" "_") (its-defrule "+" "+") + (its-defrule "{" "{") (its-defrule "}" "}") + (its-defrule "\"" "\"") (its-defrule "'" "'") + (its-defrule "<" "<") (its-defrule ">" ">")))) + +(define-its-state-machine-append its-erpin-tw-map + (its-defrule "[" its-erpin-tw-open-braket) + (its-defrule "]" its-erpin-tw-close-braket) + + (if its-erpin-tw-enable-quanjioao-alphabet + (progn + (its-defrule "1" "$(G$"(B") (its-defrule "2" "$(G$#(B") + (its-defrule "3" "$(G$$(B") (its-defrule "4" "$(G$%(B") + (its-defrule "5" "$(G$&(B") (its-defrule "6" "$(G$'(B") + (its-defrule "7" "$(G$((B") (its-defrule "8" "$(G$)(B") + (its-defrule "9" "$(G$*(B") (its-defrule "0" "$(G$!(B") + (its-defrule "@" "$(G"i(B") + (its-defrule "#" "$(G!l(B") (its-defrule "$" "$(G"c(B") + (its-defrule "%" "$(G"h(B") (its-defrule "^" "$(G!T(B") + (its-defrule "&" "$(G!m(B") (its-defrule "*" "$(G!n(B") + (its-defrule "(" "$(G!>(B") (its-defrule ")" "$(G!?(B") + (its-defrule "-" "$(G"1(B") (its-defrule "~" "$(G"D(B") + (its-defrule "=" "$(G"8(B") (its-defrule "`" "$(G!j(B") + (its-defrule "\\" "$(G"b(B") (its-defrule "|" "$(G"^(B") + (its-defrule "_" "$(G"%(B") (its-defrule "+" "$(G"0(B") + (its-defrule "{" "$(G!B(B") (its-defrule "}" "$(G!C(B") + (its-defrule "\"" "$(G!i(B") (its-defrule "'" "$(G!k(B") + (its-defrule "<" "$(G"6(B") (its-defrule ">" "$(G"7(B")) + (progn + (its-defrule "1" "1") (its-defrule "2" "2") + (its-defrule "3" "3") (its-defrule "4" "4") + (its-defrule "5" "5") (its-defrule "6" "6") + (its-defrule "7" "7") (its-defrule "8" "8") + (its-defrule "9" "9") (its-defrule "0" "0") + (its-defrule "@" "@") + (its-defrule "#" "#") (its-defrule "$" "$") + (its-defrule "%" "%") (its-defrule "^" "^") + (its-defrule "&" "&") (its-defrule "*" "*") + (its-defrule "(" "(") (its-defrule ")" ")") + (its-defrule "-" "-") (its-defrule "~" "~") + (its-defrule "=" "=") (its-defrule "`" "`") + (its-defrule "\\" "\\") (its-defrule "|" "|") + (its-defrule "_" "_") (its-defrule "+" "+") + (its-defrule "{" "{") (its-defrule "}" "}") + (its-defrule "\"" "\"") (its-defrule "'" "'") + (its-defrule "<" "<") (its-defrule ">" ">")))) + +(provide 'its/erpin) diff --git a/its/hangul.el b/its/hangul.el new file mode 100644 index 0000000..934f44a --- /dev/null +++ b/its/hangul.el @@ -0,0 +1,2933 @@ +;;; its/hangul.el --- Hangul Input in Egg Input Method Architecture + +;; Copyright (C) 1999,2000 PFU LIMITED + +;; Author: NIIBE Yutaka +;; KATAYAMA Yoshio + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + + +;;; Code: + + +(eval-when-compile + (require 'its) + (require 'cl)) + +(eval-when (compile) + (defconst its-compaction-enable t)) + +(defvar its-hangul-enable-jeonkak-alphabet + (if (boundp 'its-enable-fullwidth-alphabet) + its-enable-fullwidth-alphabet + t) + "*Enable Jeonkak alphabet") + +(defvar its-hangul-period ". " "*$(C#.(B") ; ". " "$(C#.(B" +(defvar its-hangul-comma ", " "*$(C#,(B") ; ", " "$(C#,(B" +(defvar its-hangul-open-bracket "$(C!8(B" "*[") ; "$(C#[(B" +(defvar its-hangul-close-bracket "$(C!9(B" "*]") ; "$(C#](B" + +(eval-when-compile + (defconst its-hangul-key-alist nil) + (defconst its-hangul-successor-list nil) + + (defsubst its-hangul-sequence-to-key (seq) + (concat (mapcar (lambda (c) + (cdr (assq c its-hangul-key-alist))) + (string-to-list seq)))) + + (defsubst its-hangul-make-successor (init keyseq) + (concat (if init (substring init 0 (1- (length init))) "[") + (list (aref keyseq 1)) + "]"))) + +(eval-when-compile + (defun its-define-hangul-key (key output) + (setq its-hangul-key-alist + (cons (cons (string-to-char output) + (string-to-char key)) + its-hangul-key-alist)) + (its-defrule key output)) + + (defun its-define-hangul-successor-list (keyseq) + (let ((pair (assq (aref keyseq 0) its-hangul-successor-list))) + (if (null pair) + (setq its-hangul-successor-list + (cons (cons (aref keyseq 0) + (its-hangul-make-successor nil keyseq)) + its-hangul-successor-list)) + (if (null (string-match (cdr pair) keyseq 1)) + (setcdr pair (its-hangul-make-successor (cdr pair) keyseq)))))) + + (defun its-defrule-hangul (input output) + (let* ((state (its-defrule input output nil nil)) + (prev-out (its-get-output (car its-parent-states))) + pair) + (if (and (= (length (string-to-list prev-out)) 1) + (> (string-to-char prev-out) ?\377) + (setq pair (assq (string-to-char (substring input -1)) + its-hangul-successor-list))) + (progn + (its-set-interim-terminal-state state) + (its-defrule-otherwise state nil (cdr pair) -2))))) + + (defmacro its-define-hangul (&rest list) + (cons 'progn + (mapcar (lambda (l) + (let ((case-fold-search nil) + (keyseq (its-hangul-sequence-to-key (car l)))) + (if (>= (length keyseq) 2) + (its-define-hangul-successor-list keyseq)) + (list 'its-defrule-hangul keyseq (nth 1 l)))) + list)))) + +(define-its-state-machine its-hangul-map + "hangul" "$(CGQ(B" Korean + "Map for Hangul input. (Korean)" + + (defconst its-jeonkak-escape "Z") + (defconst its-pankak-escape "X") + + (its-defrule-select-mode-temporally "B" downcase) + (its-defrule-select-mode-temporally "J" jeonkak-downcase) + + (its-define-hangul-key "r" "$(C$!(B") + (its-define-hangul-key "s" "$(C$$(B") + (its-define-hangul-key "e" "$(C$'(B") + (its-define-hangul-key "f" "$(C$)(B") + (its-define-hangul-key "a" "$(C$1(B") + (its-define-hangul-key "q" "$(C$2(B") + (its-define-hangul-key "t" "$(C$5(B") + (its-define-hangul-key "d" "$(C$7(B") + (its-define-hangul-key "w" "$(C$8(B") + (its-define-hangul-key "c" "$(C$:(B") + (its-define-hangul-key "z" "$(C$;(B") + (its-define-hangul-key "x" "$(C$<(B") + (its-define-hangul-key "v" "$(C$=(B") + (its-define-hangul-key "g" "$(C$>(B") + (its-define-hangul-key "R" "$(C$"(B") + (its-define-hangul-key "E" "$(C$((B") + (its-define-hangul-key "Q" "$(C$3(B") + (its-define-hangul-key "T" "$(C$6(B") + (its-define-hangul-key "W" "$(C$9(B") + + (its-define-hangul-key "k" "$(C$?(B") + (its-define-hangul-key "i" "$(C$A(B") + (its-define-hangul-key "j" "$(C$C(B") + (its-define-hangul-key "u" "$(C$E(B") + (its-define-hangul-key "h" "$(C$G(B") + (its-define-hangul-key "y" "$(C$K(B") + (its-define-hangul-key "n" "$(C$L(B") + (its-define-hangul-key "b" "$(C$P(B") + (its-define-hangul-key "m" "$(C$Q(B") + (its-define-hangul-key "l" "$(C$S(B") + (its-define-hangul-key "o" "$(C$@(B") + (its-define-hangul-key "p" "$(C$D(B") + (its-define-hangul-key "O" "$(C$B(B") + (its-define-hangul-key "P" "$(C$F(B") + + (its-define-hangul + ("$(C$!$?(B" "$(C0!(B") + ("$(C$!$?$!(B" "$(C0"(B") + ("$(C$!$?$$(B" "$(C0#(B") + ("$(C$!$?$'(B" "$(C0$(B") + ("$(C$!$?$)(B" "$(C0%(B") + ("$(C$!$?$)$!(B" "$(C0&(B") + ("$(C$!$?$)$1(B" "$(C0'(B") + ("$(C$!$?$1(B" "$(C0((B") + ("$(C$!$?$2(B" "$(C0)(B") + ("$(C$!$?$2$5(B" "$(C0*(B") + ("$(C$!$?$5(B" "$(C0+(B") + ("$(C$!$?$6(B" "$(C0,(B") + ("$(C$!$?$7(B" "$(C0-(B") + ("$(C$!$?$8(B" "$(C0.(B") + ("$(C$!$?$:(B" "$(C0/(B") + ("$(C$!$?$<(B" "$(C00(B") + ("$(C$!$?$=(B" "$(C01(B") + ("$(C$!$?$>(B" "$(C02(B") + + ("$(C$!$@(B" "$(C03(B") + ("$(C$!$@$!(B" "$(C04(B") + ("$(C$!$@$$(B" "$(C05(B") + ("$(C$!$@$)(B" "$(C06(B") + ("$(C$!$@$1(B" "$(C07(B") + ("$(C$!$@$2(B" "$(C08(B") + ("$(C$!$@$5(B" "$(C09(B") + ("$(C$!$@$6(B" "$(C0:(B") + ("$(C$!$@$7(B" "$(C0;(B") + + ("$(C$!$A(B" "$(C0<(B") + ("$(C$!$A$!(B" "$(C0=(B") + ("$(C$!$A$$(B" "$(C0>(B") + ("$(C$!$A$)(B" "$(C0?(B") + ("$(C$!$A$5(B" "$(C0@(B") + ("$(C$!$A$7(B" "$(C0A(B") + + ("$(C$!$B(B" "$(C0B(B") + ("$(C$!$B$$(B" "$(C0C(B") + ("$(C$!$B$)(B" "$(C0D(B") + + ("$(C$!$C(B" "$(C0E(B") + ("$(C$!$C$!(B" "$(C0F(B") + ("$(C$!$C$$(B" "$(C0G(B") + ("$(C$!$C$'(B" "$(C0H(B") + ("$(C$!$C$)(B" "$(C0I(B") + ("$(C$!$C$)$1(B" "$(C0J(B") + ("$(C$!$C$1(B" "$(C0K(B") + ("$(C$!$C$2(B" "$(C0L(B") + ("$(C$!$C$5(B" "$(C0M(B") + ("$(C$!$C$6(B" "$(C0N(B") + ("$(C$!$C$7(B" "$(C0O(B") + ("$(C$!$C$8(B" "$(C0P(B") + ("$(C$!$C$<(B" "$(C0Q(B") + ("$(C$!$C$=(B" "$(C0R(B") + ("$(C$!$C$>(B" "$(C0S(B") + + ("$(C$!$D(B" "$(C0T(B") + ("$(C$!$D$$(B" "$(C0U(B") + ("$(C$!$D$)(B" "$(C0V(B") + ("$(C$!$D$1(B" "$(C0W(B") + ("$(C$!$D$2(B" "$(C0X(B") + ("$(C$!$D$5(B" "$(C0Y(B") + ("$(C$!$D$6(B" "$(C0Z(B") + ("$(C$!$D$7(B" "$(C0[(B") + + ("$(C$!$E(B" "$(C0\(B") + ("$(C$!$E$!(B" "$(C0](B") + ("$(C$!$E$"(B" "$(C0^(B") + ("$(C$!$E$$(B" "$(C0_(B") + ("$(C$!$E$'(B" "$(C0`(B") + ("$(C$!$E$)(B" "$(C0a(B") + ("$(C$!$E$1(B" "$(C0b(B") + ("$(C$!$E$2(B" "$(C0c(B") + ("$(C$!$E$5(B" "$(C0d(B") + ("$(C$!$E$6(B" "$(C0e(B") + ("$(C$!$E$7(B" "$(C0f(B") + ("$(C$!$E$<(B" "$(C0g(B") + + ("$(C$!$F(B" "$(C0h(B") + ("$(C$!$F$$(B" "$(C0i(B") + ("$(C$!$F$)(B" "$(C0j(B") + ("$(C$!$F$2(B" "$(C0k(B") + ("$(C$!$F$5(B" "$(C0l(B") + + ("$(C$!$G(B" "$(C0m(B") + ("$(C$!$G$!(B" "$(C0n(B") + ("$(C$!$G$$(B" "$(C0o(B") + ("$(C$!$G$'(B" "$(C0p(B") + ("$(C$!$G$)(B" "$(C0q(B") + ("$(C$!$G$)$1(B" "$(C0r(B") + ("$(C$!$G$)$5(B" "$(C0s(B") + ("$(C$!$G$)$>(B" "$(C0t(B") + ("$(C$!$G$1(B" "$(C0u(B") + ("$(C$!$G$2(B" "$(C0v(B") + ("$(C$!$G$5(B" "$(C0w(B") + ("$(C$!$G$7(B" "$(C0x(B") + ("$(C$!$G$8(B" "$(C0y(B") + + ("$(C$!$G$?(B" "$(C0z(B") + ("$(C$!$G$?$!(B" "$(C0{(B") + ("$(C$!$G$?$$(B" "$(C0|(B") + ("$(C$!$G$?$)(B" "$(C0}(B") + ("$(C$!$G$?$)$1(B" "$(C0~(B") + ("$(C$!$G$?$1(B" "$(C1!(B") + ("$(C$!$G$?$2(B" "$(C1"(B") + ("$(C$!$G$?$5(B" "$(C1#(B") + ("$(C$!$G$?$7(B" "$(C1$(B") + + ("$(C$!$G$@(B" "$(C1%(B") + ("$(C$!$G$@$$(B" "$(C1&(B") + ("$(C$!$G$@$)(B" "$(C1'(B") + ("$(C$!$G$@$2(B" "$(C1((B") + ("$(C$!$G$@$6(B" "$(C1)(B") + ("$(C$!$G$@$7(B" "$(C1*(B") + + ("$(C$!$G$S(B" "$(C1+(B") + ("$(C$!$G$S$!(B" "$(C1,(B") + ("$(C$!$G$S$$(B" "$(C1-(B") + ("$(C$!$G$S$)(B" "$(C1.(B") + ("$(C$!$G$S$1(B" "$(C1/(B") + ("$(C$!$G$S$2(B" "$(C10(B") + ("$(C$!$G$S$5(B" "$(C11(B") + ("$(C$!$G$S$7(B" "$(C12(B") + + ("$(C$!$K(B" "$(C13(B") + ("$(C$!$K$$(B" "$(C14(B") + ("$(C$!$K$)(B" "$(C15(B") + ("$(C$!$K$2(B" "$(C16(B") + ("$(C$!$K$5(B" "$(C17(B") + + ("$(C$!$L(B" "$(C18(B") + ("$(C$!$L$!(B" "$(C19(B") + ("$(C$!$L$$(B" "$(C1:(B") + ("$(C$!$L$'(B" "$(C1;(B") + ("$(C$!$L$)(B" "$(C1<(B") + ("$(C$!$L$)$!(B" "$(C1=(B") + ("$(C$!$L$)$1(B" "$(C1>(B") + ("$(C$!$L$)$>(B" "$(C1?(B") + ("$(C$!$L$1(B" "$(C1@(B") + ("$(C$!$L$2(B" "$(C1A(B") + ("$(C$!$L$5(B" "$(C1B(B") + ("$(C$!$L$7(B" "$(C1C(B") + ("$(C$!$L$8(B" "$(C1D(B") + + ("$(C$!$L$C(B" "$(C1E(B") + ("$(C$!$L$C$!(B" "$(C1F(B") + ("$(C$!$L$C$$(B" "$(C1G(B") + ("$(C$!$L$C$)(B" "$(C1H(B") + ("$(C$!$L$C$6(B" "$(C1I(B") + ("$(C$!$L$C$7(B" "$(C1J(B") + + ("$(C$!$L$D(B" "$(C1K(B") + ("$(C$!$L$D$5(B" "$(C1L(B") + + ("$(C$!$L$S(B" "$(C1M(B") + ("$(C$!$L$S$!(B" "$(C1N(B") + ("$(C$!$L$S$$(B" "$(C1O(B") + ("$(C$!$L$S$)(B" "$(C1P(B") + ("$(C$!$L$S$1(B" "$(C1Q(B") + ("$(C$!$L$S$2(B" "$(C1R(B") + ("$(C$!$L$S$5(B" "$(C1S(B") + + ("$(C$!$P(B" "$(C1T(B") + ("$(C$!$P$$(B" "$(C1U(B") + ("$(C$!$P$)(B" "$(C1V(B") + + ("$(C$!$Q(B" "$(C1W(B") + ("$(C$!$Q$!(B" "$(C1X(B") + ("$(C$!$Q$$(B" "$(C1Y(B") + ("$(C$!$Q$'(B" "$(C1Z(B") + ("$(C$!$Q$)(B" "$(C1[(B") + ("$(C$!$Q$)$!(B" "$(C1\(B") + ("$(C$!$Q$1(B" "$(C1](B") + ("$(C$!$Q$2(B" "$(C1^(B") + ("$(C$!$Q$5(B" "$(C1_(B") + ("$(C$!$Q$7(B" "$(C1`(B") + + ("$(C$!$Q$S(B" "$(C1a(B") + + ("$(C$!$S(B" "$(C1b(B") + ("$(C$!$S$!(B" "$(C1c(B") + ("$(C$!$S$$(B" "$(C1d(B") + ("$(C$!$S$'(B" "$(C1e(B") + ("$(C$!$S$)(B" "$(C1f(B") + ("$(C$!$S$)$1(B" "$(C1g(B") + ("$(C$!$S$1(B" "$(C1h(B") + ("$(C$!$S$2(B" "$(C1i(B") + ("$(C$!$S$5(B" "$(C1j(B") + ("$(C$!$S$7(B" "$(C1k(B") + ("$(C$!$S$8(B" "$(C1l(B") + ("$(C$!$S$=(B" "$(C1m(B") + + ("$(C$"$?(B" "$(C1n(B") + ("$(C$"$?$!(B" "$(C1o(B") + ("$(C$"$?$"(B" "$(C1p(B") + ("$(C$"$?$$(B" "$(C1q(B") + ("$(C$"$?$)(B" "$(C1r(B") + ("$(C$"$?$)$1(B" "$(C1s(B") + ("$(C$"$?$1(B" "$(C1t(B") + ("$(C$"$?$2(B" "$(C1u(B") + ("$(C$"$?$5(B" "$(C1v(B") + ("$(C$"$?$6(B" "$(C1w(B") + ("$(C$"$?$7(B" "$(C1x(B") + ("$(C$"$?$<(B" "$(C1y(B") + + ("$(C$"$@(B" "$(C1z(B") + ("$(C$"$@$!(B" "$(C1{(B") + ("$(C$"$@$$(B" "$(C1|(B") + ("$(C$"$@$)(B" "$(C1}(B") + ("$(C$"$@$1(B" "$(C1~(B") + ("$(C$"$@$2(B" "$(C2!(B") + ("$(C$"$@$5(B" "$(C2"(B") + ("$(C$"$@$6(B" "$(C2#(B") + ("$(C$"$@$7(B" "$(C2$(B") + + ("$(C$"$A(B" "$(C2%(B") + ("$(C$"$A$!(B" "$(C2&(B") + ("$(C$"$A$)(B" "$(C2'(B") + + ("$(C$"$C(B" "$(C2((B") + ("$(C$"$C$!(B" "$(C2)(B") + ("$(C$"$C$"(B" "$(C2*(B") + ("$(C$"$C$$(B" "$(C2+(B") + ("$(C$"$C$)(B" "$(C2,(B") + ("$(C$"$C$1(B" "$(C2-(B") + ("$(C$"$C$2(B" "$(C2.(B") + ("$(C$"$C$5(B" "$(C2/(B") + ("$(C$"$C$6(B" "$(C20(B") + ("$(C$"$C$7(B" "$(C21(B") + + ("$(C$"$D(B" "$(C22(B") + ("$(C$"$D$!(B" "$(C23(B") + ("$(C$"$D$$(B" "$(C24(B") + ("$(C$"$D$1(B" "$(C25(B") + ("$(C$"$D$5(B" "$(C26(B") + ("$(C$"$D$7(B" "$(C27(B") + + ("$(C$"$E(B" "$(C28(B") + ("$(C$"$E$$(B" "$(C29(B") + ("$(C$"$E$)(B" "$(C2:(B") + ("$(C$"$E$5(B" "$(C2;(B") + ("$(C$"$E$6(B" "$(C2<(B") + ("$(C$"$E$<(B" "$(C2=(B") + + ("$(C$"$F(B" "$(C2>(B") + + ("$(C$"$G(B" "$(C2?(B") + ("$(C$"$G$!(B" "$(C2@(B") + ("$(C$"$G$$(B" "$(C2A(B") + ("$(C$"$G$$$>(B" "$(C2B(B") + ("$(C$"$G$)(B" "$(C2C(B") + ("$(C$"$G$1(B" "$(C2D(B") + ("$(C$"$G$2(B" "$(C2E(B") + ("$(C$"$G$5(B" "$(C2F(B") + ("$(C$"$G$7(B" "$(C2G(B") + ("$(C$"$G$8(B" "$(C2H(B") + ("$(C$"$G$:(B" "$(C2I(B") + + ("$(C$"$G$?(B" "$(C2J(B") + ("$(C$"$G$?$!(B" "$(C2K(B") + ("$(C$"$G$?$)(B" "$(C2L(B") + ("$(C$"$G$?$6(B" "$(C2M(B") + ("$(C$"$G$?$7(B" "$(C2N(B") + + ("$(C$"$G$@(B" "$(C2O(B") + ("$(C$"$G$@$!(B" "$(C2P(B") + ("$(C$"$G$@$7(B" "$(C2Q(B") + + ("$(C$"$G$S(B" "$(C2R(B") + ("$(C$"$G$S$$(B" "$(C2S(B") + ("$(C$"$G$S$)(B" "$(C2T(B") + ("$(C$"$G$S$1(B" "$(C2U(B") + ("$(C$"$G$S$2(B" "$(C2V(B") + ("$(C$"$G$S$7(B" "$(C2W(B") + + ("$(C$"$K(B" "$(C2X(B") + + ("$(C$"$L(B" "$(C2Y(B") + ("$(C$"$L$!(B" "$(C2Z(B") + ("$(C$"$L$$(B" "$(C2[(B") + ("$(C$"$L$)(B" "$(C2\(B") + ("$(C$"$L$)$>(B" "$(C2](B") + ("$(C$"$L$1(B" "$(C2^(B") + ("$(C$"$L$2(B" "$(C2_(B") + ("$(C$"$L$5(B" "$(C2`(B") + ("$(C$"$L$7(B" "$(C2a(B") + ("$(C$"$L$8(B" "$(C2b(B") + + ("$(C$"$L$C(B" "$(C2c(B") + ("$(C$"$L$C$)(B" "$(C2d(B") + ("$(C$"$L$C$6(B" "$(C2e(B") + ("$(C$"$L$C$7(B" "$(C2f(B") + + ("$(C$"$L$D(B" "$(C2g(B") + ("$(C$"$L$D$!(B" "$(C2h(B") + ("$(C$"$L$D$$(B" "$(C2i(B") + ("$(C$"$L$D$)(B" "$(C2j(B") + ("$(C$"$L$D$1(B" "$(C2k(B") + ("$(C$"$L$D$2(B" "$(C2l(B") + ("$(C$"$L$D$6(B" "$(C2m(B") + + ("$(C$"$L$S(B" "$(C2n(B") + ("$(C$"$L$S$$(B" "$(C2o(B") + ("$(C$"$L$S$)(B" "$(C2p(B") + ("$(C$"$L$S$1(B" "$(C2q(B") + ("$(C$"$L$S$2(B" "$(C2r(B") + + ("$(C$"$P(B" "$(C2s(B") + + ("$(C$"$Q(B" "$(C2t(B") + ("$(C$"$Q$!(B" "$(C2u(B") + ("$(C$"$Q$$(B" "$(C2v(B") + ("$(C$"$Q$$$>(B" "$(C2w(B") + ("$(C$"$Q$)(B" "$(C2x(B") + ("$(C$"$Q$)$1(B" "$(C2y(B") + ("$(C$"$Q$)$>(B" "$(C2z(B") + ("$(C$"$Q$1(B" "$(C2{(B") + ("$(C$"$Q$2(B" "$(C2|(B") + ("$(C$"$Q$5(B" "$(C2}(B") + ("$(C$"$Q$7(B" "$(C2~(B") + ("$(C$"$Q$<(B" "$(C3!(B") + + ("$(C$"$S(B" "$(C3"(B") + ("$(C$"$S$!(B" "$(C3#(B") + ("$(C$"$S$$(B" "$(C3$(B") + ("$(C$"$S$)(B" "$(C3%(B") + ("$(C$"$S$1(B" "$(C3&(B") + ("$(C$"$S$2(B" "$(C3'(B") + ("$(C$"$S$5(B" "$(C3((B") + ("$(C$"$S$7(B" "$(C3)(B") + + ("$(C$$$?(B" "$(C3*(B") + ("$(C$$$?$!(B" "$(C3+(B") + ("$(C$$$?$"(B" "$(C3,(B") + ("$(C$$$?$$(B" "$(C3-(B") + ("$(C$$$?$'(B" "$(C3.(B") + ("$(C$$$?$)(B" "$(C3/(B") + ("$(C$$$?$)$!(B" "$(C30(B") + ("$(C$$$?$)$1(B" "$(C31(B") + ("$(C$$$?$1(B" "$(C32(B") + ("$(C$$$?$2(B" "$(C33(B") + ("$(C$$$?$5(B" "$(C34(B") + ("$(C$$$?$6(B" "$(C35(B") + ("$(C$$$?$7(B" "$(C36(B") + ("$(C$$$?$8(B" "$(C37(B") + ("$(C$$$?$:(B" "$(C38(B") + ("$(C$$$?$<(B" "$(C39(B") + ("$(C$$$?$>(B" "$(C3:(B") + + ("$(C$$$@(B" "$(C3;(B") + ("$(C$$$@$!(B" "$(C3<(B") + ("$(C$$$@$$(B" "$(C3=(B") + ("$(C$$$@$)(B" "$(C3>(B") + ("$(C$$$@$1(B" "$(C3?(B") + ("$(C$$$@$2(B" "$(C3@(B") + ("$(C$$$@$5(B" "$(C3A(B") + ("$(C$$$@$6(B" "$(C3B(B") + ("$(C$$$@$7(B" "$(C3C(B") + + ("$(C$$$A(B" "$(C3D(B") + ("$(C$$$A$!(B" "$(C3E(B") + ("$(C$$$A$$(B" "$(C3F(B") + ("$(C$$$A$)(B" "$(C3G(B") + ("$(C$$$A$1(B" "$(C3H(B") + ("$(C$$$A$7(B" "$(C3I(B") + + ("$(C$$$C(B" "$(C3J(B") + ("$(C$$$C$!(B" "$(C3K(B") + ("$(C$$$C$!$5(B" "$(C3L(B") + ("$(C$$$C$$(B" "$(C3M(B") + ("$(C$$$C$)(B" "$(C3N(B") + ("$(C$$$C$)$1(B" "$(C3O(B") + ("$(C$$$C$)$2(B" "$(C3P(B") + ("$(C$$$C$1(B" "$(C3Q(B") + ("$(C$$$C$2(B" "$(C3R(B") + ("$(C$$$C$5(B" "$(C3S(B") + ("$(C$$$C$6(B" "$(C3T(B") + ("$(C$$$C$7(B" "$(C3U(B") + ("$(C$$$C$>(B" "$(C3V(B") + + ("$(C$$$D(B" "$(C3W(B") + ("$(C$$$D$!(B" "$(C3X(B") + ("$(C$$$D$$(B" "$(C3Y(B") + ("$(C$$$D$)(B" "$(C3Z(B") + ("$(C$$$D$1(B" "$(C3[(B") + ("$(C$$$D$2(B" "$(C3\(B") + ("$(C$$$D$5(B" "$(C3](B") + ("$(C$$$D$6(B" "$(C3^(B") + ("$(C$$$D$7(B" "$(C3_(B") + + ("$(C$$$E(B" "$(C3`(B") + ("$(C$$$E$!(B" "$(C3a(B") + ("$(C$$$E$$(B" "$(C3b(B") + ("$(C$$$E$)(B" "$(C3c(B") + ("$(C$$$E$1(B" "$(C3d(B") + ("$(C$$$E$2(B" "$(C3e(B") + ("$(C$$$E$6(B" "$(C3f(B") + ("$(C$$$E$7(B" "$(C3g(B") + ("$(C$$$E$;(B" "$(C3h(B") + + ("$(C$$$F(B" "$(C3i(B") + ("$(C$$$F$$(B" "$(C3j(B") + + ("$(C$$$G(B" "$(C3k(B") + ("$(C$$$G$!(B" "$(C3l(B") + ("$(C$$$G$$(B" "$(C3m(B") + ("$(C$$$G$)(B" "$(C3n(B") + ("$(C$$$G$)$1(B" "$(C3o(B") + ("$(C$$$G$1(B" "$(C3p(B") + ("$(C$$$G$2(B" "$(C3q(B") + ("$(C$$$G$5(B" "$(C3r(B") + ("$(C$$$G$7(B" "$(C3s(B") + ("$(C$$$G$=(B" "$(C3t(B") + ("$(C$$$G$>(B" "$(C3u(B") + + ("$(C$$$G$?(B" "$(C3v(B") + ("$(C$$$G$?$$(B" "$(C3w(B") + ("$(C$$$G$?$)(B" "$(C3x(B") + ("$(C$$$G$?$6(B" "$(C3y(B") + + ("$(C$$$G$S(B" "$(C3z(B") + ("$(C$$$G$S$$(B" "$(C3{(B") + ("$(C$$$G$S$)(B" "$(C3|(B") + ("$(C$$$G$S$1(B" "$(C3}(B") + ("$(C$$$G$S$2(B" "$(C3~(B") + ("$(C$$$G$S$5(B" "$(C4!(B") + + ("$(C$$$K(B" "$(C4"(B") + ("$(C$$$K$!(B" "$(C4#(B") + ("$(C$$$K$$(B" "$(C4$(B") + ("$(C$$$K$)(B" "$(C4%(B") + ("$(C$$$K$2(B" "$(C4&(B") + ("$(C$$$K$5(B" "$(C4'(B") + ("$(C$$$K$7(B" "$(C4((B") + + ("$(C$$$L(B" "$(C4)(B") + ("$(C$$$L$!(B" "$(C4*(B") + ("$(C$$$L$$(B" "$(C4+(B") + ("$(C$$$L$'(B" "$(C4,(B") + ("$(C$$$L$)(B" "$(C4-(B") + ("$(C$$$L$1(B" "$(C4.(B") + ("$(C$$$L$2(B" "$(C4/(B") + ("$(C$$$L$5(B" "$(C40(B") + ("$(C$$$L$7(B" "$(C41(B") + + ("$(C$$$L$C(B" "$(C42(B") + ("$(C$$$L$C$6(B" "$(C43(B") + + ("$(C$$$L$D(B" "$(C44(B") + + ("$(C$$$L$S(B" "$(C45(B") + ("$(C$$$L$S$$(B" "$(C46(B") + ("$(C$$$L$S$)(B" "$(C47(B") + ("$(C$$$L$S$1(B" "$(C48(B") + ("$(C$$$L$S$2(B" "$(C49(B") + + ("$(C$$$P(B" "$(C4:(B") + ("$(C$$$P$!(B" "$(C4;(B") + ("$(C$$$P$)(B" "$(C4<(B") + ("$(C$$$P$1(B" "$(C4=(B") + ("$(C$$$P$2(B" "$(C4>(B") + ("$(C$$$P$7(B" "$(C4?(B") + + ("$(C$$$Q(B" "$(C4@(B") + ("$(C$$$Q$!(B" "$(C4A(B") + ("$(C$$$Q$$(B" "$(C4B(B") + ("$(C$$$Q$)(B" "$(C4C(B") + ("$(C$$$Q$)$!(B" "$(C4D(B") + ("$(C$$$Q$)$1(B" "$(C4E(B") + ("$(C$$$Q$1(B" "$(C4F(B") + ("$(C$$$Q$2(B" "$(C4G(B") + ("$(C$$$Q$5(B" "$(C4H(B") + ("$(C$$$Q$7(B" "$(C4I(B") + ("$(C$$$Q$8(B" "$(C4J(B") + ("$(C$$$Q$=(B" "$(C4K(B") + + ("$(C$$$Q$S(B" "$(C4L(B") + ("$(C$$$Q$S$$(B" "$(C4M(B") + ("$(C$$$Q$S$)(B" "$(C4N(B") + + ("$(C$$$S(B" "$(C4O(B") + ("$(C$$$S$!(B" "$(C4P(B") + ("$(C$$$S$$(B" "$(C4Q(B") + ("$(C$$$S$)(B" "$(C4R(B") + ("$(C$$$S$)$1(B" "$(C4S(B") + ("$(C$$$S$1(B" "$(C4T(B") + ("$(C$$$S$2(B" "$(C4U(B") + ("$(C$$$S$5(B" "$(C4V(B") + ("$(C$$$S$7(B" "$(C4W(B") + ("$(C$$$S$=(B" "$(C4X(B") + + ("$(C$'$?(B" "$(C4Y(B") + ("$(C$'$?$!(B" "$(C4Z(B") + ("$(C$'$?$"(B" "$(C4[(B") + ("$(C$'$?$$(B" "$(C4\(B") + ("$(C$'$?$'(B" "$(C4](B") + ("$(C$'$?$)(B" "$(C4^(B") + ("$(C$'$?$)$!(B" "$(C4_(B") + ("$(C$'$?$)$1(B" "$(C4`(B") + ("$(C$'$?$)$2(B" "$(C4a(B") + ("$(C$'$?$)$>(B" "$(C4b(B") + ("$(C$'$?$1(B" "$(C4c(B") + ("$(C$'$?$2(B" "$(C4d(B") + ("$(C$'$?$5(B" "$(C4e(B") + ("$(C$'$?$6(B" "$(C4f(B") + ("$(C$'$?$7(B" "$(C4g(B") + ("$(C$'$?$8(B" "$(C4h(B") + ("$(C$'$?$:(B" "$(C4i(B") + ("$(C$'$?$>(B" "$(C4j(B") + + ("$(C$'$@(B" "$(C4k(B") + ("$(C$'$@$!(B" "$(C4l(B") + ("$(C$'$@$$(B" "$(C4m(B") + ("$(C$'$@$)(B" "$(C4n(B") + ("$(C$'$@$1(B" "$(C4o(B") + ("$(C$'$@$2(B" "$(C4p(B") + ("$(C$'$@$5(B" "$(C4q(B") + ("$(C$'$@$6(B" "$(C4r(B") + ("$(C$'$@$7(B" "$(C4s(B") + + ("$(C$'$A(B" "$(C4t(B") + + ("$(C$'$C(B" "$(C4u(B") + ("$(C$'$C$!(B" "$(C4v(B") + ("$(C$'$C$"(B" "$(C4w(B") + ("$(C$'$C$$(B" "$(C4x(B") + ("$(C$'$C$'(B" "$(C4y(B") + ("$(C$'$C$)(B" "$(C4z(B") + ("$(C$'$C$)$1(B" "$(C4{(B") + ("$(C$'$C$)$2(B" "$(C4|(B") + ("$(C$'$C$1(B" "$(C4}(B") + ("$(C$'$C$2(B" "$(C4~(B") + ("$(C$'$C$5(B" "$(C5!(B") + ("$(C$'$C$7(B" "$(C5"(B") + ("$(C$'$C$:(B" "$(C5#(B") + ("$(C$'$C$=(B" "$(C5$(B") + + ("$(C$'$D(B" "$(C5%(B") + ("$(C$'$D$!(B" "$(C5&(B") + ("$(C$'$D$$(B" "$(C5'(B") + ("$(C$'$D$)(B" "$(C5((B") + ("$(C$'$D$1(B" "$(C5)(B") + ("$(C$'$D$2(B" "$(C5*(B") + ("$(C$'$D$5(B" "$(C5+(B") + ("$(C$'$D$6(B" "$(C5,(B") + ("$(C$'$D$7(B" "$(C5-(B") + + ("$(C$'$E(B" "$(C5.(B") + ("$(C$'$E$$(B" "$(C5/(B") + ("$(C$'$E$)(B" "$(C50(B") + ("$(C$'$E$6(B" "$(C51(B") + ("$(C$'$E$7(B" "$(C52(B") + + ("$(C$'$F(B" "$(C53(B") + ("$(C$'$F$$(B" "$(C54(B") + + ("$(C$'$G(B" "$(C55(B") + ("$(C$'$G$!(B" "$(C56(B") + ("$(C$'$G$$(B" "$(C57(B") + ("$(C$'$G$'(B" "$(C58(B") + ("$(C$'$G$)(B" "$(C59(B") + ("$(C$'$G$)$1(B" "$(C5:(B") + ("$(C$'$G$)$5(B" "$(C5;(B") + ("$(C$'$G$1(B" "$(C5<(B") + ("$(C$'$G$2(B" "$(C5=(B") + ("$(C$'$G$5(B" "$(C5>(B") + ("$(C$'$G$7(B" "$(C5?(B") + ("$(C$'$G$:(B" "$(C5@(B") + ("$(C$'$G$<(B" "$(C5A(B") + + ("$(C$'$G$?(B" "$(C5B(B") + ("$(C$'$G$?$$(B" "$(C5C(B") + ("$(C$'$G$?$)(B" "$(C5D(B") + + ("$(C$'$G$@(B" "$(C5E(B") + ("$(C$'$G$@$6(B" "$(C5F(B") + + ("$(C$'$G$S(B" "$(C5G(B") + ("$(C$'$G$S$$(B" "$(C5H(B") + ("$(C$'$G$S$)(B" "$(C5I(B") + ("$(C$'$G$S$1(B" "$(C5J(B") + ("$(C$'$G$S$2(B" "$(C5K(B") + ("$(C$'$G$S$5(B" "$(C5L(B") + + ("$(C$'$K(B" "$(C5M(B") + + ("$(C$'$L(B" "$(C5N(B") + ("$(C$'$L$!(B" "$(C5O(B") + ("$(C$'$L$$(B" "$(C5P(B") + ("$(C$'$L$)(B" "$(C5Q(B") + ("$(C$'$L$1(B" "$(C5R(B") + ("$(C$'$L$2(B" "$(C5S(B") + ("$(C$'$L$5(B" "$(C5T(B") + ("$(C$'$L$7(B" "$(C5U(B") + + ("$(C$'$L$C(B" "$(C5V(B") + ("$(C$'$L$C$6(B" "$(C5W(B") + + ("$(C$'$L$D(B" "$(C5X(B") + ("$(C$'$L$D$7(B" "$(C5Y(B") + + ("$(C$'$L$S(B" "$(C5Z(B") + ("$(C$'$L$S$$(B" "$(C5[(B") + ("$(C$'$L$S$)(B" "$(C5\(B") + ("$(C$'$L$S$2(B" "$(C5](B") + ("$(C$'$L$S$5(B" "$(C5^(B") + ("$(C$'$L$S$7(B" "$(C5_(B") + + ("$(C$'$P(B" "$(C5`(B") + ("$(C$'$P$$(B" "$(C5a(B") + ("$(C$'$P$)(B" "$(C5b(B") + ("$(C$'$P$1(B" "$(C5c(B") + ("$(C$'$P$7(B" "$(C5d(B") + + ("$(C$'$Q(B" "$(C5e(B") + ("$(C$'$Q$!(B" "$(C5f(B") + ("$(C$'$Q$$(B" "$(C5g(B") + ("$(C$'$Q$'(B" "$(C5h(B") + ("$(C$'$Q$)(B" "$(C5i(B") + ("$(C$'$Q$)$1(B" "$(C5j(B") + ("$(C$'$Q$1(B" "$(C5k(B") + ("$(C$'$Q$2(B" "$(C5l(B") + ("$(C$'$Q$5(B" "$(C5m(B") + ("$(C$'$Q$7(B" "$(C5n(B") + + ("$(C$'$Q$S(B" "$(C5o(B") + + ("$(C$'$S(B" "$(C5p(B") + ("$(C$'$S$!(B" "$(C5q(B") + ("$(C$'$S$$(B" "$(C5r(B") + ("$(C$'$S$'(B" "$(C5s(B") + ("$(C$'$S$)(B" "$(C5t(B") + ("$(C$'$S$1(B" "$(C5u(B") + ("$(C$'$S$2(B" "$(C5v(B") + ("$(C$'$S$5(B" "$(C5w(B") + ("$(C$'$S$6(B" "$(C5x(B") + ("$(C$'$S$7(B" "$(C5y(B") + ("$(C$'$S$8(B" "$(C5z(B") + + ("$(C$($?(B" "$(C5{(B") + ("$(C$($?$!(B" "$(C5|(B") + ("$(C$($?$$(B" "$(C5}(B") + ("$(C$($?$)(B" "$(C5~(B") + ("$(C$($?$1(B" "$(C6!(B") + ("$(C$($?$2(B" "$(C6"(B") + ("$(C$($?$5(B" "$(C6#(B") + ("$(C$($?$6(B" "$(C6$(B") + ("$(C$($?$7(B" "$(C6%(B") + ("$(C$($?$>(B" "$(C6&(B") + + ("$(C$($@(B" "$(C6'(B") + ("$(C$($@$!(B" "$(C6((B") + ("$(C$($@$$(B" "$(C6)(B") + ("$(C$($@$)(B" "$(C6*(B") + ("$(C$($@$1(B" "$(C6+(B") + ("$(C$($@$2(B" "$(C6,(B") + ("$(C$($@$5(B" "$(C6-(B") + ("$(C$($@$6(B" "$(C6.(B") + ("$(C$($@$7(B" "$(C6/(B") + + ("$(C$($C(B" "$(C60(B") + ("$(C$($C$!(B" "$(C61(B") + ("$(C$($C$$(B" "$(C62(B") + ("$(C$($C$)(B" "$(C63(B") + ("$(C$($C$)$1(B" "$(C64(B") + ("$(C$($C$)$2(B" "$(C65(B") + ("$(C$($C$1(B" "$(C66(B") + ("$(C$($C$2(B" "$(C67(B") + ("$(C$($C$5(B" "$(C68(B") + ("$(C$($C$6(B" "$(C69(B") + ("$(C$($C$7(B" "$(C6:(B") + ("$(C$($C$>(B" "$(C6;(B") + + ("$(C$($D(B" "$(C6<(B") + ("$(C$($D$!(B" "$(C6=(B") + ("$(C$($D$$(B" "$(C6>(B") + ("$(C$($D$)(B" "$(C6?(B") + ("$(C$($D$1(B" "$(C6@(B") + ("$(C$($D$2(B" "$(C6A(B") + ("$(C$($D$5(B" "$(C6B(B") + ("$(C$($D$6(B" "$(C6C(B") + ("$(C$($D$7(B" "$(C6D(B") + + ("$(C$($E(B" "$(C6E(B") + ("$(C$($E$6(B" "$(C6F(B") + + ("$(C$($G(B" "$(C6G(B") + ("$(C$($G$!(B" "$(C6H(B") + ("$(C$($G$$(B" "$(C6I(B") + ("$(C$($G$)(B" "$(C6J(B") + ("$(C$($G$7(B" "$(C6K(B") + + ("$(C$($G$?(B" "$(C6L(B") + ("$(C$($G$?$)(B" "$(C6M(B") + + ("$(C$($G$@(B" "$(C6N(B") + + ("$(C$($G$S(B" "$(C6O(B") + ("$(C$($G$S$$(B" "$(C6P(B") + + ("$(C$($L(B" "$(C6Q(B") + ("$(C$($L$!(B" "$(C6R(B") + ("$(C$($L$$(B" "$(C6S(B") + ("$(C$($L$)(B" "$(C6T(B") + ("$(C$($L$)$>(B" "$(C6U(B") + ("$(C$($L$1(B" "$(C6V(B") + ("$(C$($L$7(B" "$(C6W(B") + + ("$(C$($L$D(B" "$(C6X(B") + + ("$(C$($L$S(B" "$(C6Y(B") + ("$(C$($L$S$$(B" "$(C6Z(B") + ("$(C$($L$S$)(B" "$(C6[(B") + ("$(C$($L$S$1(B" "$(C6\(B") + ("$(C$($L$S$2(B" "$(C6](B") + ("$(C$($L$S$7(B" "$(C6^(B") + + ("$(C$($Q(B" "$(C6_(B") + ("$(C$($Q$!(B" "$(C6`(B") + ("$(C$($Q$$(B" "$(C6a(B") + ("$(C$($Q$'(B" "$(C6b(B") + ("$(C$($Q$)(B" "$(C6c(B") + ("$(C$($Q$1(B" "$(C6d(B") + ("$(C$($Q$2(B" "$(C6e(B") + ("$(C$($Q$5(B" "$(C6f(B") + + ("$(C$($Q$S(B" "$(C6g(B") + ("$(C$($Q$S$$(B" "$(C6h(B") + ("$(C$($Q$S$)(B" "$(C6i(B") + ("$(C$($Q$S$1(B" "$(C6j(B") + ("$(C$($Q$S$2(B" "$(C6k(B") + + ("$(C$($S(B" "$(C6l(B") + ("$(C$($S$$(B" "$(C6m(B") + ("$(C$($S$)(B" "$(C6n(B") + ("$(C$($S$1(B" "$(C6o(B") + ("$(C$($S$2(B" "$(C6p(B") + ("$(C$($S$5(B" "$(C6q(B") + ("$(C$($S$7(B" "$(C6r(B") + + ("$(C$)$?(B" "$(C6s(B") + ("$(C$)$?$!(B" "$(C6t(B") + ("$(C$)$?$$(B" "$(C6u(B") + ("$(C$)$?$)(B" "$(C6v(B") + ("$(C$)$?$1(B" "$(C6w(B") + ("$(C$)$?$2(B" "$(C6x(B") + ("$(C$)$?$5(B" "$(C6y(B") + ("$(C$)$?$6(B" "$(C6z(B") + ("$(C$)$?$7(B" "$(C6{(B") + ("$(C$)$?$8(B" "$(C6|(B") + ("$(C$)$?$=(B" "$(C6}(B") + ("$(C$)$?$>(B" "$(C6~(B") + + ("$(C$)$@(B" "$(C7!(B") + ("$(C$)$@$!(B" "$(C7"(B") + ("$(C$)$@$$(B" "$(C7#(B") + ("$(C$)$@$)(B" "$(C7$(B") + ("$(C$)$@$1(B" "$(C7%(B") + ("$(C$)$@$2(B" "$(C7&(B") + ("$(C$)$@$5(B" "$(C7'(B") + ("$(C$)$@$6(B" "$(C7((B") + ("$(C$)$@$7(B" "$(C7)(B") + + ("$(C$)$A(B" "$(C7*(B") + ("$(C$)$A$!(B" "$(C7+(B") + ("$(C$)$A$$(B" "$(C7,(B") + ("$(C$)$A$5(B" "$(C7-(B") + ("$(C$)$A$7(B" "$(C7.(B") + + ("$(C$)$C(B" "$(C7/(B") + ("$(C$)$C$!(B" "$(C70(B") + ("$(C$)$C$$(B" "$(C71(B") + ("$(C$)$C$)(B" "$(C72(B") + ("$(C$)$C$1(B" "$(C73(B") + ("$(C$)$C$2(B" "$(C74(B") + ("$(C$)$C$5(B" "$(C75(B") + ("$(C$)$C$6(B" "$(C76(B") + ("$(C$)$C$7(B" "$(C77(B") + ("$(C$)$C$>(B" "$(C78(B") + + ("$(C$)$D(B" "$(C79(B") + ("$(C$)$D$!(B" "$(C7:(B") + ("$(C$)$D$$(B" "$(C7;(B") + ("$(C$)$D$)(B" "$(C7<(B") + ("$(C$)$D$1(B" "$(C7=(B") + ("$(C$)$D$2(B" "$(C7>(B") + ("$(C$)$D$5(B" "$(C7?(B") + ("$(C$)$D$7(B" "$(C7@(B") + + ("$(C$)$E(B" "$(C7A(B") + ("$(C$)$E$!(B" "$(C7B(B") + ("$(C$)$E$$(B" "$(C7C(B") + ("$(C$)$E$)(B" "$(C7D(B") + ("$(C$)$E$1(B" "$(C7E(B") + ("$(C$)$E$2(B" "$(C7F(B") + ("$(C$)$E$5(B" "$(C7G(B") + ("$(C$)$E$6(B" "$(C7H(B") + ("$(C$)$E$7(B" "$(C7I(B") + + ("$(C$)$F(B" "$(C7J(B") + ("$(C$)$F$$(B" "$(C7K(B") + ("$(C$)$F$2(B" "$(C7L(B") + ("$(C$)$F$5(B" "$(C7M(B") + + ("$(C$)$G(B" "$(C7N(B") + ("$(C$)$G$!(B" "$(C7O(B") + ("$(C$)$G$$(B" "$(C7P(B") + ("$(C$)$G$)(B" "$(C7Q(B") + ("$(C$)$G$1(B" "$(C7R(B") + ("$(C$)$G$2(B" "$(C7S(B") + ("$(C$)$G$5(B" "$(C7T(B") + ("$(C$)$G$7(B" "$(C7U(B") + + ("$(C$)$G$?(B" "$(C7V(B") + ("$(C$)$G$?$$(B" "$(C7W(B") + ("$(C$)$G$?$7(B" "$(C7X(B") + + ("$(C$)$G$@$6(B" "$(C7Y(B") + + ("$(C$)$G$S(B" "$(C7Z(B") + ("$(C$)$G$S$$(B" "$(C7[(B") + ("$(C$)$G$S$)(B" "$(C7\(B") + ("$(C$)$G$S$1(B" "$(C7](B") + ("$(C$)$G$S$2(B" "$(C7^(B") + ("$(C$)$G$S$5(B" "$(C7_(B") + ("$(C$)$G$S$7(B" "$(C7`(B") + + ("$(C$)$K(B" "$(C7a(B") + ("$(C$)$K$$(B" "$(C7b(B") + ("$(C$)$K$)(B" "$(C7c(B") + ("$(C$)$K$2(B" "$(C7d(B") + ("$(C$)$K$5(B" "$(C7e(B") + ("$(C$)$K$7(B" "$(C7f(B") + + ("$(C$)$L(B" "$(C7g(B") + ("$(C$)$L$!(B" "$(C7h(B") + ("$(C$)$L$$(B" "$(C7i(B") + ("$(C$)$L$)(B" "$(C7j(B") + ("$(C$)$L$1(B" "$(C7k(B") + ("$(C$)$L$2(B" "$(C7l(B") + ("$(C$)$L$5(B" "$(C7m(B") + ("$(C$)$L$7(B" "$(C7n(B") + + ("$(C$)$L$C(B" "$(C7o(B") + ("$(C$)$L$C$6(B" "$(C7p(B") + + ("$(C$)$L$D(B" "$(C7q(B") + + ("$(C$)$L$S(B" "$(C7r(B") + ("$(C$)$L$S$!(B" "$(C7s(B") + ("$(C$)$L$S$$(B" "$(C7t(B") + ("$(C$)$L$S$)(B" "$(C7u(B") + ("$(C$)$L$S$1(B" "$(C7v(B") + ("$(C$)$L$S$5(B" "$(C7w(B") + ("$(C$)$L$S$7(B" "$(C7x(B") + + ("$(C$)$P(B" "$(C7y(B") + ("$(C$)$P$!(B" "$(C7z(B") + ("$(C$)$P$$(B" "$(C7{(B") + ("$(C$)$P$)(B" "$(C7|(B") + ("$(C$)$P$1(B" "$(C7}(B") + ("$(C$)$P$2(B" "$(C7~(B") + ("$(C$)$P$5(B" "$(C8!(B") + ("$(C$)$P$7(B" "$(C8"(B") + + ("$(C$)$Q(B" "$(C8#(B") + ("$(C$)$Q$!(B" "$(C8$(B") + ("$(C$)$Q$$(B" "$(C8%(B") + ("$(C$)$Q$)(B" "$(C8&(B") + ("$(C$)$Q$1(B" "$(C8'(B") + ("$(C$)$Q$2(B" "$(C8((B") + ("$(C$)$Q$5(B" "$(C8)(B") + ("$(C$)$Q$7(B" "$(C8*(B") + ("$(C$)$Q$8(B" "$(C8+(B") + ("$(C$)$Q$<(B" "$(C8,(B") + ("$(C$)$Q$=(B" "$(C8-(B") + + ("$(C$)$S(B" "$(C8.(B") + ("$(C$)$S$!(B" "$(C8/(B") + ("$(C$)$S$$(B" "$(C80(B") + ("$(C$)$S$)(B" "$(C81(B") + ("$(C$)$S$1(B" "$(C82(B") + ("$(C$)$S$2(B" "$(C83(B") + ("$(C$)$S$5(B" "$(C84(B") + ("$(C$)$S$7(B" "$(C85(B") + + ("$(C$1$?(B" "$(C86(B") + ("$(C$1$?$!(B" "$(C87(B") + ("$(C$1$?$$(B" "$(C88(B") + ("$(C$1$?$$$>(B" "$(C89(B") + ("$(C$1$?$'(B" "$(C8:(B") + ("$(C$1$?$)(B" "$(C8;(B") + ("$(C$1$?$)$!(B" "$(C8<(B") + ("$(C$1$?$)$1(B" "$(C8=(B") + ("$(C$1$?$1(B" "$(C8>(B") + ("$(C$1$?$2(B" "$(C8?(B") + ("$(C$1$?$5(B" "$(C8@(B") + ("$(C$1$?$7(B" "$(C8A(B") + ("$(C$1$?$8(B" "$(C8B(B") + ("$(C$1$?$<(B" "$(C8C(B") + ("$(C$1$?$>(B" "$(C8D(B") + + ("$(C$1$@(B" "$(C8E(B") + ("$(C$1$@$!(B" "$(C8F(B") + ("$(C$1$@$$(B" "$(C8G(B") + ("$(C$1$@$)(B" "$(C8H(B") + ("$(C$1$@$1(B" "$(C8I(B") + ("$(C$1$@$2(B" "$(C8J(B") + ("$(C$1$@$5(B" "$(C8K(B") + ("$(C$1$@$6(B" "$(C8L(B") + ("$(C$1$@$7(B" "$(C8M(B") + ("$(C$1$@$8(B" "$(C8N(B") + + ("$(C$1$A(B" "$(C8O(B") + ("$(C$1$A$!(B" "$(C8P(B") + ("$(C$1$A$)(B" "$(C8Q(B") + ("$(C$1$A$7(B" "$(C8R(B") + + ("$(C$1$C(B" "$(C8S(B") + ("$(C$1$C$!(B" "$(C8T(B") + ("$(C$1$C$$(B" "$(C8U(B") + ("$(C$1$C$)(B" "$(C8V(B") + ("$(C$1$C$)$1(B" "$(C8W(B") + ("$(C$1$C$1(B" "$(C8X(B") + ("$(C$1$C$2(B" "$(C8Y(B") + ("$(C$1$C$5(B" "$(C8Z(B") + ("$(C$1$C$7(B" "$(C8[(B") + ("$(C$1$C$8(B" "$(C8\(B") + ("$(C$1$C$>(B" "$(C8](B") + + ("$(C$1$D(B" "$(C8^(B") + ("$(C$1$D$!(B" "$(C8_(B") + ("$(C$1$D$$(B" "$(C8`(B") + ("$(C$1$D$)(B" "$(C8a(B") + ("$(C$1$D$1(B" "$(C8b(B") + ("$(C$1$D$2(B" "$(C8c(B") + ("$(C$1$D$5(B" "$(C8d(B") + ("$(C$1$D$6(B" "$(C8e(B") + ("$(C$1$D$7(B" "$(C8f(B") + + ("$(C$1$E(B" "$(C8g(B") + ("$(C$1$E$!(B" "$(C8h(B") + ("$(C$1$E$$(B" "$(C8i(B") + ("$(C$1$E$)(B" "$(C8j(B") + ("$(C$1$E$5(B" "$(C8k(B") + ("$(C$1$E$6(B" "$(C8l(B") + ("$(C$1$E$7(B" "$(C8m(B") + ("$(C$1$E$:(B" "$(C8n(B") + + ("$(C$1$F(B" "$(C8o(B") + + ("$(C$1$G(B" "$(C8p(B") + ("$(C$1$G$!(B" "$(C8q(B") + ("$(C$1$G$!$5(B" "$(C8r(B") + ("$(C$1$G$$(B" "$(C8s(B") + ("$(C$1$G$)(B" "$(C8t(B") + ("$(C$1$G$)$1(B" "$(C8u(B") + ("$(C$1$G$1(B" "$(C8v(B") + ("$(C$1$G$2(B" "$(C8w(B") + ("$(C$1$G$5(B" "$(C8x(B") + ("$(C$1$G$7(B" "$(C8y(B") + + ("$(C$1$G$?(B" "$(C8z(B") + ("$(C$1$G$?$$(B" "$(C8{(B") + ("$(C$1$G$?$6(B" "$(C8|(B") + ("$(C$1$G$?$7(B" "$(C8}(B") + + ("$(C$1$G$S(B" "$(C8~(B") + ("$(C$1$G$S$$(B" "$(C9!(B") + ("$(C$1$G$S$)(B" "$(C9"(B") + ("$(C$1$G$S$2(B" "$(C9#(B") + ("$(C$1$G$S$5(B" "$(C9$(B") + ("$(C$1$G$S$7(B" "$(C9%(B") + + ("$(C$1$K(B" "$(C9&(B") + ("$(C$1$K$$(B" "$(C9'(B") + ("$(C$1$K$)(B" "$(C9((B") + ("$(C$1$K$2(B" "$(C9)(B") + ("$(C$1$K$5(B" "$(C9*(B") + + ("$(C$1$L(B" "$(C9+(B") + ("$(C$1$L$!(B" "$(C9,(B") + ("$(C$1$L$"(B" "$(C9-(B") + ("$(C$1$L$$(B" "$(C9.(B") + ("$(C$1$L$'(B" "$(C9/(B") + ("$(C$1$L$)(B" "$(C90(B") + ("$(C$1$L$)$!(B" "$(C91(B") + ("$(C$1$L$)$1(B" "$(C92(B") + ("$(C$1$L$1(B" "$(C93(B") + ("$(C$1$L$2(B" "$(C94(B") + ("$(C$1$L$5(B" "$(C95(B") + ("$(C$1$L$7(B" "$(C96(B") + ("$(C$1$L$<(B" "$(C97(B") + ("$(C$1$L$>(B" "$(C98(B") + + ("$(C$1$L$C(B" "$(C99(B") + ("$(C$1$L$C$$(B" "$(C9:(B") + ("$(C$1$L$C$)(B" "$(C9;(B") + ("$(C$1$L$C$2(B" "$(C9<(B") + ("$(C$1$L$C$5(B" "$(C9=(B") + + ("$(C$1$L$D(B" "$(C9>(B") + + ("$(C$1$L$S(B" "$(C9?(B") + ("$(C$1$L$S$$(B" "$(C9@(B") + ("$(C$1$L$S$)(B" "$(C9A(B") + + ("$(C$1$P(B" "$(C9B(B") + ("$(C$1$P$$(B" "$(C9C(B") + ("$(C$1$P$)(B" "$(C9D(B") + ("$(C$1$P$1(B" "$(C9E(B") + ("$(C$1$P$5(B" "$(C9F(B") + + ("$(C$1$Q(B" "$(C9G(B") + ("$(C$1$Q$$(B" "$(C9H(B") + ("$(C$1$Q$)(B" "$(C9I(B") + ("$(C$1$Q$1(B" "$(C9J(B") + ("$(C$1$Q$5(B" "$(C9K(B") + + ("$(C$1$S(B" "$(C9L(B") + ("$(C$1$S$!(B" "$(C9M(B") + ("$(C$1$S$$(B" "$(C9N(B") + ("$(C$1$S$'(B" "$(C9O(B") + ("$(C$1$S$)(B" "$(C9P(B") + ("$(C$1$S$)$1(B" "$(C9Q(B") + ("$(C$1$S$1(B" "$(C9R(B") + ("$(C$1$S$2(B" "$(C9S(B") + ("$(C$1$S$5(B" "$(C9T(B") + ("$(C$1$S$6(B" "$(C9U(B") + ("$(C$1$S$7(B" "$(C9V(B") + ("$(C$1$S$:(B" "$(C9W(B") + ("$(C$1$S$<(B" "$(C9X(B") + + ("$(C$2$?(B" "$(C9Y(B") + ("$(C$2$?$!(B" "$(C9Z(B") + ("$(C$2$?$!$5(B" "$(C9\(B") + ("$(C$2$?$"(B" "$(C9[(B") + ("$(C$2$?$$(B" "$(C9](B") + ("$(C$2$?$'(B" "$(C9^(B") + ("$(C$2$?$)(B" "$(C9_(B") + ("$(C$2$?$)$!(B" "$(C9`(B") + ("$(C$2$?$)$1(B" "$(C9a(B") + ("$(C$2$?$)$2(B" "$(C9b(B") + ("$(C$2$?$1(B" "$(C9c(B") + ("$(C$2$?$2(B" "$(C9d(B") + ("$(C$2$?$5(B" "$(C9e(B") + ("$(C$2$?$7(B" "$(C9f(B") + ("$(C$2$?$<(B" "$(C9g(B") + + ("$(C$2$@(B" "$(C9h(B") + ("$(C$2$@$!(B" "$(C9i(B") + ("$(C$2$@$$(B" "$(C9j(B") + ("$(C$2$@$)(B" "$(C9k(B") + ("$(C$2$@$1(B" "$(C9l(B") + ("$(C$2$@$2(B" "$(C9m(B") + ("$(C$2$@$5(B" "$(C9n(B") + ("$(C$2$@$6(B" "$(C9o(B") + ("$(C$2$@$7(B" "$(C9p(B") + ("$(C$2$@$<(B" "$(C9q(B") + + ("$(C$2$A(B" "$(C9r(B") + ("$(C$2$A$!(B" "$(C9s(B") + ("$(C$2$A$$(B" "$(C9t(B") + ("$(C$2$A$2(B" "$(C9u(B") + + ("$(C$2$C(B" "$(C9v(B") + ("$(C$2$C$!(B" "$(C9w(B") + ("$(C$2$C$$(B" "$(C9x(B") + ("$(C$2$C$'(B" "$(C9y(B") + ("$(C$2$C$)(B" "$(C9z(B") + ("$(C$2$C$)$1(B" "$(C9{(B") + ("$(C$2$C$1(B" "$(C9|(B") + ("$(C$2$C$2(B" "$(C9}(B") + ("$(C$2$C$5(B" "$(C9~(B") + ("$(C$2$C$7(B" "$(C:!(B") + ("$(C$2$C$8(B" "$(C:"(B") + + ("$(C$2$D(B" "$(C:#(B") + ("$(C$2$D$!(B" "$(C:$(B") + ("$(C$2$D$$(B" "$(C:%(B") + ("$(C$2$D$'(B" "$(C:&(B") + ("$(C$2$D$)(B" "$(C:'(B") + ("$(C$2$D$1(B" "$(C:((B") + ("$(C$2$D$2(B" "$(C:)(B") + ("$(C$2$D$5(B" "$(C:*(B") + ("$(C$2$D$6(B" "$(C:+(B") + ("$(C$2$D$7(B" "$(C:,(B") + + ("$(C$2$E(B" "$(C:-(B") + ("$(C$2$E$!(B" "$(C:.(B") + ("$(C$2$E$$(B" "$(C:/(B") + ("$(C$2$E$)(B" "$(C:0(B") + ("$(C$2$E$2(B" "$(C:1(B") + ("$(C$2$E$5(B" "$(C:2(B") + ("$(C$2$E$6(B" "$(C:3(B") + ("$(C$2$E$7(B" "$(C:4(B") + ("$(C$2$E$<(B" "$(C:5(B") + + ("$(C$2$F(B" "$(C:6(B") + ("$(C$2$F$$(B" "$(C:7(B") + + ("$(C$2$G(B" "$(C:8(B") + ("$(C$2$G$!(B" "$(C:9(B") + ("$(C$2$G$"(B" "$(C::(B") + ("$(C$2$G$$(B" "$(C:;(B") + ("$(C$2$G$)(B" "$(C:<(B") + ("$(C$2$G$1(B" "$(C:=(B") + ("$(C$2$G$2(B" "$(C:>(B") + ("$(C$2$G$5(B" "$(C:?(B") + ("$(C$2$G$7(B" "$(C:@(B") + + ("$(C$2$G$?(B" "$(C:A(B") + ("$(C$2$G$?$$(B" "$(C:B(B") + ("$(C$2$G$?$6(B" "$(C:C(B") + + ("$(C$2$G$@(B" "$(C:D(B") + ("$(C$2$G$@$6(B" "$(C:E(B") + + ("$(C$2$G$S(B" "$(C:F(B") + ("$(C$2$G$S$!(B" "$(C:G(B") + ("$(C$2$G$S$$(B" "$(C:H(B") + ("$(C$2$G$S$)(B" "$(C:I(B") + ("$(C$2$G$S$1(B" "$(C:J(B") + ("$(C$2$G$S$2(B" "$(C:K(B") + + ("$(C$2$K(B" "$(C:L(B") + ("$(C$2$K$$(B" "$(C:M(B") + + ("$(C$2$L(B" "$(C:N(B") + ("$(C$2$L$!(B" "$(C:O(B") + ("$(C$2$L$$(B" "$(C:P(B") + ("$(C$2$L$'(B" "$(C:Q(B") + ("$(C$2$L$)(B" "$(C:R(B") + ("$(C$2$L$)$!(B" "$(C:S(B") + ("$(C$2$L$)$1(B" "$(C:T(B") + ("$(C$2$L$1(B" "$(C:U(B") + ("$(C$2$L$2(B" "$(C:V(B") + ("$(C$2$L$5(B" "$(C:W(B") + ("$(C$2$L$7(B" "$(C:X(B") + ("$(C$2$L$<(B" "$(C:Y(B") + ("$(C$2$L$=(B" "$(C:Z(B") + + ("$(C$2$L$C(B" "$(C:[(B") + ("$(C$2$L$C$)(B" "$(C:\(B") + ("$(C$2$L$C$6(B" "$(C:](B") + + ("$(C$2$L$D(B" "$(C:^(B") + + ("$(C$2$L$S(B" "$(C:_(B") + ("$(C$2$L$S$!(B" "$(C:`(B") + ("$(C$2$L$S$$(B" "$(C:a(B") + ("$(C$2$L$S$)(B" "$(C:b(B") + ("$(C$2$L$S$7(B" "$(C:c(B") + + ("$(C$2$P(B" "$(C:d(B") + ("$(C$2$P$$(B" "$(C:e(B") + ("$(C$2$P$)(B" "$(C:f(B") + ("$(C$2$P$1(B" "$(C:g(B") + ("$(C$2$P$5(B" "$(C:h(B") + ("$(C$2$P$7(B" "$(C:i(B") + + ("$(C$2$Q(B" "$(C:j(B") + ("$(C$2$Q$!(B" "$(C:k(B") + ("$(C$2$Q$$(B" "$(C:l(B") + ("$(C$2$Q$)(B" "$(C:m(B") + ("$(C$2$Q$1(B" "$(C:n(B") + ("$(C$2$Q$2(B" "$(C:o(B") + ("$(C$2$Q$5(B" "$(C:p(B") + + ("$(C$2$S(B" "$(C:q(B") + ("$(C$2$S$!(B" "$(C:r(B") + ("$(C$2$S$$(B" "$(C:s(B") + ("$(C$2$S$)(B" "$(C:t(B") + ("$(C$2$S$)$1(B" "$(C:u(B") + ("$(C$2$S$1(B" "$(C:v(B") + ("$(C$2$S$2(B" "$(C:w(B") + ("$(C$2$S$5(B" "$(C:x(B") + ("$(C$2$S$7(B" "$(C:y(B") + ("$(C$2$S$8(B" "$(C:z(B") + ("$(C$2$S$:(B" "$(C:{(B") + + ("$(C$3$?(B" "$(C:|(B") + ("$(C$3$?$!(B" "$(C:}(B") + ("$(C$3$?$$(B" "$(C:~(B") + ("$(C$3$?$)(B" "$(C;!(B") + ("$(C$3$?$)$1(B" "$(C;"(B") + ("$(C$3$?$1(B" "$(C;#(B") + ("$(C$3$?$2(B" "$(C;$(B") + ("$(C$3$?$5(B" "$(C;%(B") + ("$(C$3$?$6(B" "$(C;&(B") + ("$(C$3$?$7(B" "$(C;'(B") + ("$(C$3$?$>(B" "$(C;((B") + + ("$(C$3$@(B" "$(C;)(B") + ("$(C$3$@$!(B" "$(C;*(B") + ("$(C$3$@$$(B" "$(C;+(B") + ("$(C$3$@$)(B" "$(C;,(B") + ("$(C$3$@$1(B" "$(C;-(B") + ("$(C$3$@$2(B" "$(C;.(B") + ("$(C$3$@$5(B" "$(C;/(B") + ("$(C$3$@$6(B" "$(C;0(B") + ("$(C$3$@$7(B" "$(C;1(B") + + ("$(C$3$A(B" "$(C;2(B") + ("$(C$3$A$!(B" "$(C;3(B") + ("$(C$3$A$1(B" "$(C;4(B") + + ("$(C$3$C(B" "$(C;5(B") + ("$(C$3$C$!(B" "$(C;6(B") + ("$(C$3$C$$(B" "$(C;7(B") + ("$(C$3$C$'(B" "$(C;8(B") + ("$(C$3$C$)(B" "$(C;9(B") + ("$(C$3$C$1(B" "$(C;:(B") + ("$(C$3$C$5(B" "$(C;;(B") + ("$(C$3$C$6(B" "$(C;<(B") + ("$(C$3$C$7(B" "$(C;=(B") + + ("$(C$3$D(B" "$(C;>(B") + ("$(C$3$D$7(B" "$(C;?(B") + + ("$(C$3$E(B" "$(C;@(B") + ("$(C$3$E$!(B" "$(C;A(B") + ("$(C$3$E$1(B" "$(C;B(B") + ("$(C$3$E$2(B" "$(C;C(B") + ("$(C$3$E$5(B" "$(C;D(B") + ("$(C$3$E$6(B" "$(C;E(B") + ("$(C$3$E$7(B" "$(C;F(B") + + ("$(C$3$G(B" "$(C;G(B") + ("$(C$3$G$!(B" "$(C;H(B") + ("$(C$3$G$$(B" "$(C;I(B") + ("$(C$3$G$)(B" "$(C;J(B") + ("$(C$3$G$1(B" "$(C;K(B") + ("$(C$3$G$2(B" "$(C;L(B") + ("$(C$3$G$7(B" "$(C;M(B") + + ("$(C$3$G$S(B" "$(C;N(B") + + ("$(C$3$K(B" "$(C;O(B") + ("$(C$3$K$7(B" "$(C;P(B") + + ("$(C$3$L(B" "$(C;Q(B") + ("$(C$3$L$!(B" "$(C;R(B") + ("$(C$3$L$$(B" "$(C;S(B") + ("$(C$3$L$)(B" "$(C;T(B") + ("$(C$3$L$1(B" "$(C;U(B") + ("$(C$3$L$5(B" "$(C;V(B") + ("$(C$3$L$7(B" "$(C;W(B") + + ("$(C$3$P(B" "$(C;X(B") + ("$(C$3$P$7(B" "$(C;Y(B") + + ("$(C$3$Q(B" "$(C;Z(B") + ("$(C$3$Q$$(B" "$(C;[(B") + ("$(C$3$Q$)(B" "$(C;\(B") + ("$(C$3$Q$1(B" "$(C;](B") + ("$(C$3$Q$2(B" "$(C;^(B") + + ("$(C$3$S(B" "$(C;_(B") + ("$(C$3$S$!(B" "$(C;`(B") + ("$(C$3$S$$(B" "$(C;a(B") + ("$(C$3$S$)(B" "$(C;b(B") + ("$(C$3$S$1(B" "$(C;c(B") + ("$(C$3$S$2(B" "$(C;d(B") + ("$(C$3$S$5(B" "$(C;e(B") + ("$(C$3$S$7(B" "$(C;f(B") + + ("$(C$5$?(B" "$(C;g(B") + ("$(C$5$?$!(B" "$(C;h(B") + ("$(C$5$?$!$5(B" "$(C;i(B") + ("$(C$5$?$$(B" "$(C;j(B") + ("$(C$5$?$'(B" "$(C;k(B") + ("$(C$5$?$)(B" "$(C;l(B") + ("$(C$5$?$)$!(B" "$(C;m(B") + ("$(C$5$?$)$1(B" "$(C;n(B") + ("$(C$5$?$1(B" "$(C;o(B") + ("$(C$5$?$2(B" "$(C;p(B") + ("$(C$5$?$5(B" "$(C;q(B") + ("$(C$5$?$5$6(B" "$(C;r(B") + ("$(C$5$?$7(B" "$(C;s(B") + ("$(C$5$?$<(B" "$(C;t(B") + + ("$(C$5$@(B" "$(C;u(B") + ("$(C$5$@$!(B" "$(C;v(B") + ("$(C$5$@$$(B" "$(C;w(B") + ("$(C$5$@$)(B" "$(C;x(B") + ("$(C$5$@$1(B" "$(C;y(B") + ("$(C$5$@$2(B" "$(C;z(B") + ("$(C$5$@$5(B" "$(C;{(B") + ("$(C$5$@$6(B" "$(C;|(B") + ("$(C$5$@$7(B" "$(C;}(B") + + ("$(C$5$A(B" "$(C;~(B") + ("$(C$5$A$!(B" "$(C(B") + ("$(C$5$D$)(B" "$(C(B") + ("$(C$5$Q$1(B" "$(C=?(B") + ("$(C$5$Q$2(B" "$(C=@(B") + ("$(C$5$Q$5(B" "$(C=A(B") + ("$(C$5$Q$7(B" "$(C=B(B") + + ("$(C$5$S(B" "$(C=C(B") + ("$(C$5$S$!(B" "$(C=D(B") + ("$(C$5$S$$(B" "$(C=E(B") + ("$(C$5$S$'(B" "$(C=F(B") + ("$(C$5$S$)(B" "$(C=G(B") + ("$(C$5$S$)$>(B" "$(C=H(B") + ("$(C$5$S$1(B" "$(C=I(B") + ("$(C$5$S$2(B" "$(C=J(B") + ("$(C$5$S$5(B" "$(C=K(B") + ("$(C$5$S$7(B" "$(C=L(B") + ("$(C$5$S$=(B" "$(C=M(B") + + ("$(C$6$?(B" "$(C=N(B") + ("$(C$6$?$!(B" "$(C=O(B") + ("$(C$6$?$!$5(B" "$(C=P(B") + ("$(C$6$?$$(B" "$(C=Q(B") + ("$(C$6$?$)(B" "$(C=R(B") + ("$(C$6$?$1(B" "$(C=S(B") + ("$(C$6$?$2(B" "$(C=T(B") + ("$(C$6$?$6(B" "$(C=U(B") + ("$(C$6$?$7(B" "$(C=V(B") + ("$(C$6$?$>(B" "$(C=W(B") + + ("$(C$6$@(B" "$(C=X(B") + ("$(C$6$@$!(B" "$(C=Y(B") + ("$(C$6$@$$(B" "$(C=Z(B") + ("$(C$6$@$)(B" "$(C=[(B") + ("$(C$6$@$1(B" "$(C=\(B") + ("$(C$6$@$2(B" "$(C=](B") + ("$(C$6$@$6(B" "$(C=^(B") + ("$(C$6$@$7(B" "$(C=_(B") + + ("$(C$6$A$7(B" "$(C=`(B") + + ("$(C$6$C(B" "$(C=a(B") + ("$(C$6$C$!(B" "$(C=b(B") + ("$(C$6$C$$(B" "$(C=c(B") + ("$(C$6$C$)(B" "$(C=d(B") + ("$(C$6$C$)$2(B" "$(C=e(B") + ("$(C$6$C$1(B" "$(C=f(B") + ("$(C$6$C$2(B" "$(C=g(B") + ("$(C$6$C$6(B" "$(C=h(B") + ("$(C$6$C$7(B" "$(C=i(B") + + ("$(C$6$D(B" "$(C=j(B") + ("$(C$6$D$$(B" "$(C=k(B") + ("$(C$6$D$)(B" "$(C=l(B") + + ("$(C$6$F$$(B" "$(C=m(B") + + ("$(C$6$G(B" "$(C=n(B") + ("$(C$6$G$!(B" "$(C=o(B") + ("$(C$6$G$$(B" "$(C=p(B") + ("$(C$6$G$'(B" "$(C=q(B") + ("$(C$6$G$)(B" "$(C=r(B") + ("$(C$6$G$)$1(B" "$(C=s(B") + ("$(C$6$G$1(B" "$(C=t(B") + ("$(C$6$G$2(B" "$(C=u(B") + ("$(C$6$G$7(B" "$(C=v(B") + + ("$(C$6$G$?(B" "$(C=w(B") + ("$(C$6$G$?$!(B" "$(C=x(B") + ("$(C$6$G$?$$(B" "$(C=y(B") + ("$(C$6$G$?$6(B" "$(C=z(B") + + ("$(C$6$G$@(B" "$(C={(B") + ("$(C$6$G$@$6(B" "$(C=|(B") + + ("$(C$6$G$S(B" "$(C=}(B") + ("$(C$6$G$S$$(B" "$(C=~(B") + ("$(C$6$G$S$)(B" "$(C>!(B") + ("$(C$6$G$S$1(B" "$(C>"(B") + ("$(C$6$G$S$2(B" "$(C>#(B") + + ("$(C$6$K(B" "$(C>$(B") + + ("$(C$6$L(B" "$(C>%(B") + ("$(C$6$L$!(B" "$(C>&(B") + ("$(C$6$L$$(B" "$(C>'(B") + ("$(C$6$L$)(B" "$(C>((B") + ("$(C$6$L$1(B" "$(C>)(B") + ("$(C$6$L$2(B" "$(C>*(B") + ("$(C$6$L$7(B" "$(C>+(B") + + ("$(C$6$L$C(B" "$(C>,(B") + ("$(C$6$L$C$6(B" "$(C>-(B") + + ("$(C$6$L$D(B" "$(C>.(B") + + ("$(C$6$L$S(B" "$(C>/(B") + ("$(C$6$L$S$$(B" "$(C>0(B") + + ("$(C$6$P$7(B" "$(C>1(B") + + ("$(C$6$Q(B" "$(C>2(B") + ("$(C$6$Q$!(B" "$(C>3(B") + ("$(C$6$Q$$(B" "$(C>4(B") + ("$(C$6$Q$)(B" "$(C>5(B") + ("$(C$6$Q$)$1(B" "$(C>6(B") + ("$(C$6$Q$)$>(B" "$(C>7(B") + ("$(C$6$Q$1(B" "$(C>8(B") + ("$(C$6$Q$2(B" "$(C>9(B") + + ("$(C$6$Q$S(B" "$(C>:(B") + ("$(C$6$Q$S$$(B" "$(C>;(B") + ("$(C$6$Q$S$)(B" "$(C><(B") + ("$(C$6$Q$S$1(B" "$(C>=(B") + + ("$(C$6$S(B" "$(C>>(B") + ("$(C$6$S$!(B" "$(C>?(B") + ("$(C$6$S$$(B" "$(C>@(B") + ("$(C$6$S$)(B" "$(C>A(B") + ("$(C$6$S$1(B" "$(C>B(B") + ("$(C$6$S$2(B" "$(C>C(B") + ("$(C$6$S$5(B" "$(C>D(B") + ("$(C$6$S$7(B" "$(C>E(B") + + ("$(C$7$?(B" "$(C>F(B") + ("$(C$7$?$!(B" "$(C>G(B") + ("$(C$7$?$$(B" "$(C>H(B") + ("$(C$7$?$$$8(B" "$(C>I(B") + ("$(C$7$?$$$>(B" "$(C>J(B") + ("$(C$7$?$)(B" "$(C>K(B") + ("$(C$7$?$)$!(B" "$(C>L(B") + ("$(C$7$?$)$1(B" "$(C>M(B") + ("$(C$7$?$)$>(B" "$(C>N(B") + ("$(C$7$?$1(B" "$(C>O(B") + ("$(C$7$?$2(B" "$(C>P(B") + ("$(C$7$?$5(B" "$(C>Q(B") + ("$(C$7$?$6(B" "$(C>R(B") + ("$(C$7$?$7(B" "$(C>S(B") + ("$(C$7$?$<(B" "$(C>T(B") + ("$(C$7$?$=(B" "$(C>U(B") + + ("$(C$7$@(B" "$(C>V(B") + ("$(C$7$@$!(B" "$(C>W(B") + ("$(C$7$@$$(B" "$(C>X(B") + ("$(C$7$@$)(B" "$(C>Y(B") + ("$(C$7$@$1(B" "$(C>Z(B") + ("$(C$7$@$2(B" "$(C>[(B") + ("$(C$7$@$5(B" "$(C>\(B") + ("$(C$7$@$6(B" "$(C>](B") + ("$(C$7$@$7(B" "$(C>^(B") + + ("$(C$7$A(B" "$(C>_(B") + ("$(C$7$A$!(B" "$(C>`(B") + ("$(C$7$A$$(B" "$(C>a(B") + ("$(C$7$A$)(B" "$(C>b(B") + ("$(C$7$A$)$2(B" "$(C>c(B") + ("$(C$7$A$1(B" "$(C>d(B") + ("$(C$7$A$2(B" "$(C>e(B") + ("$(C$7$A$5(B" "$(C>f(B") + ("$(C$7$A$7(B" "$(C>g(B") + ("$(C$7$A$<(B" "$(C>h(B") + ("$(C$7$A$>(B" "$(C>i(B") + + ("$(C$7$B(B" "$(C>j(B") + ("$(C$7$B$$(B" "$(C>k(B") + ("$(C$7$B$)(B" "$(C>l(B") + ("$(C$7$B$2(B" "$(C>m(B") + + ("$(C$7$C(B" "$(C>n(B") + ("$(C$7$C$!(B" "$(C>o(B") + ("$(C$7$C$$(B" "$(C>p(B") + ("$(C$7$C$$$8(B" "$(C>q(B") + ("$(C$7$C$'(B" "$(C>r(B") + ("$(C$7$C$)(B" "$(C>s(B") + ("$(C$7$C$)$!(B" "$(C>t(B") + ("$(C$7$C$)$1(B" "$(C>u(B") + ("$(C$7$C$1(B" "$(C>v(B") + ("$(C$7$C$2(B" "$(C>w(B") + ("$(C$7$C$2$5(B" "$(C>x(B") + ("$(C$7$C$5(B" "$(C>y(B") + ("$(C$7$C$6(B" "$(C>z(B") + ("$(C$7$C$7(B" "$(C>{(B") + ("$(C$7$C$8(B" "$(C>|(B") + ("$(C$7$C$;(B" "$(C>}(B") + ("$(C$7$C$=(B" "$(C>~(B") + + ("$(C$7$D(B" "$(C?!(B") + ("$(C$7$D$!(B" "$(C?"(B") + ("$(C$7$D$$(B" "$(C?#(B") + ("$(C$7$D$)(B" "$(C?$(B") + ("$(C$7$D$1(B" "$(C?%(B") + ("$(C$7$D$2(B" "$(C?&(B") + ("$(C$7$D$5(B" "$(C?'(B") + ("$(C$7$D$7(B" "$(C?((B") + + ("$(C$7$E(B" "$(C?)(B") + ("$(C$7$E$!(B" "$(C?*(B") + ("$(C$7$E$"(B" "$(C?+(B") + ("$(C$7$E$$(B" "$(C?,(B") + ("$(C$7$E$)(B" "$(C?-(B") + ("$(C$7$E$)$1(B" "$(C?.(B") + ("$(C$7$E$)$2(B" "$(C?/(B") + ("$(C$7$E$1(B" "$(C?0(B") + ("$(C$7$E$2(B" "$(C?1(B") + ("$(C$7$E$2$5(B" "$(C?2(B") + ("$(C$7$E$5(B" "$(C?3(B") + ("$(C$7$E$6(B" "$(C?4(B") + ("$(C$7$E$7(B" "$(C?5(B") + ("$(C$7$E$<(B" "$(C?6(B") + ("$(C$7$E$=(B" "$(C?7(B") + ("$(C$7$E$>(B" "$(C?8(B") + + ("$(C$7$F(B" "$(C?9(B") + ("$(C$7$F$$(B" "$(C?:(B") + ("$(C$7$F$)(B" "$(C?;(B") + ("$(C$7$F$1(B" "$(C?<(B") + ("$(C$7$F$2(B" "$(C?=(B") + ("$(C$7$F$5(B" "$(C?>(B") + ("$(C$7$F$6(B" "$(C??(B") + + ("$(C$7$G(B" "$(C?@(B") + ("$(C$7$G$!(B" "$(C?A(B") + ("$(C$7$G$$(B" "$(C?B(B") + ("$(C$7$G$)(B" "$(C?C(B") + ("$(C$7$G$)$!(B" "$(C?D(B") + ("$(C$7$G$)$1(B" "$(C?E(B") + ("$(C$7$G$)$5(B" "$(C?F(B") + ("$(C$7$G$)$>(B" "$(C?G(B") + ("$(C$7$G$1(B" "$(C?H(B") + ("$(C$7$G$2(B" "$(C?I(B") + ("$(C$7$G$5(B" "$(C?J(B") + ("$(C$7$G$7(B" "$(C?K(B") + ("$(C$7$G$:(B" "$(C?L(B") + + ("$(C$7$G$?(B" "$(C?M(B") + ("$(C$7$G$?$!(B" "$(C?N(B") + ("$(C$7$G$?$$(B" "$(C?O(B") + ("$(C$7$G$?$)(B" "$(C?P(B") + ("$(C$7$G$?$1(B" "$(C?Q(B") + ("$(C$7$G$?$2(B" "$(C?R(B") + ("$(C$7$G$?$5(B" "$(C?S(B") + ("$(C$7$G$?$6(B" "$(C?T(B") + ("$(C$7$G$?$7(B" "$(C?U(B") + + ("$(C$7$G$@(B" "$(C?V(B") + ("$(C$7$G$@$!(B" "$(C?W(B") + ("$(C$7$G$@$$(B" "$(C?X(B") + ("$(C$7$G$@$1(B" "$(C?Y(B") + ("$(C$7$G$@$5(B" "$(C?Z(B") + ("$(C$7$G$@$7(B" "$(C?[(B") + + ("$(C$7$G$S(B" "$(C?\(B") + ("$(C$7$G$S$!(B" "$(C?](B") + ("$(C$7$G$S$$(B" "$(C?^(B") + ("$(C$7$G$S$)(B" "$(C?_(B") + ("$(C$7$G$S$1(B" "$(C?`(B") + ("$(C$7$G$S$2(B" "$(C?a(B") + ("$(C$7$G$S$5(B" "$(C?b(B") + ("$(C$7$G$S$7(B" "$(C?c(B") + + ("$(C$7$K(B" "$(C?d(B") + ("$(C$7$K$!(B" "$(C?e(B") + ("$(C$7$K$$(B" "$(C?f(B") + ("$(C$7$K$)(B" "$(C?g(B") + ("$(C$7$K$1(B" "$(C?h(B") + ("$(C$7$K$2(B" "$(C?i(B") + ("$(C$7$K$5(B" "$(C?j(B") + ("$(C$7$K$7(B" "$(C?k(B") + + ("$(C$7$L(B" "$(C?l(B") + ("$(C$7$L$!(B" "$(C?m(B") + ("$(C$7$L$$(B" "$(C?n(B") + ("$(C$7$L$)(B" "$(C?o(B") + ("$(C$7$L$)$!(B" "$(C?p(B") + ("$(C$7$L$)$1(B" "$(C?q(B") + ("$(C$7$L$1(B" "$(C?r(B") + ("$(C$7$L$2(B" "$(C?s(B") + ("$(C$7$L$5(B" "$(C?t(B") + ("$(C$7$L$7(B" "$(C?u(B") + + ("$(C$7$L$C(B" "$(C?v(B") + ("$(C$7$L$C$!(B" "$(C?w(B") + ("$(C$7$L$C$$(B" "$(C?x(B") + ("$(C$7$L$C$)(B" "$(C?y(B") + ("$(C$7$L$C$1(B" "$(C?z(B") + ("$(C$7$L$C$2(B" "$(C?{(B") + ("$(C$7$L$C$6(B" "$(C?|(B") + ("$(C$7$L$C$7(B" "$(C?}(B") + + ("$(C$7$L$D(B" "$(C?~(B") + ("$(C$7$L$D$!(B" "$(C@!(B") + ("$(C$7$L$D$$(B" "$(C@"(B") + ("$(C$7$L$D$)(B" "$(C@#(B") + ("$(C$7$L$D$1(B" "$(C@$(B") + ("$(C$7$L$D$2(B" "$(C@%(B") + ("$(C$7$L$D$7(B" "$(C@&(B") + + ("$(C$7$L$S(B" "$(C@'(B") + ("$(C$7$L$S$!(B" "$(C@((B") + ("$(C$7$L$S$$(B" "$(C@)(B") + ("$(C$7$L$S$)(B" "$(C@*(B") + ("$(C$7$L$S$1(B" "$(C@+(B") + ("$(C$7$L$S$2(B" "$(C@,(B") + ("$(C$7$L$S$5(B" "$(C@-(B") + ("$(C$7$L$S$7(B" "$(C@.(B") + + ("$(C$7$P(B" "$(C@/(B") + ("$(C$7$P$!(B" "$(C@0(B") + ("$(C$7$P$$(B" "$(C@1(B") + ("$(C$7$P$)(B" "$(C@2(B") + ("$(C$7$P$1(B" "$(C@3(B") + ("$(C$7$P$2(B" "$(C@4(B") + ("$(C$7$P$5(B" "$(C@5(B") + ("$(C$7$P$7(B" "$(C@6(B") + ("$(C$7$P$:(B" "$(C@7(B") + + ("$(C$7$Q(B" "$(C@8(B") + ("$(C$7$Q$!(B" "$(C@9(B") + ("$(C$7$Q$$(B" "$(C@:(B") + ("$(C$7$Q$)(B" "$(C@;(B") + ("$(C$7$Q$)$=(B" "$(C@<(B") + ("$(C$7$Q$1(B" "$(C@=(B") + ("$(C$7$Q$2(B" "$(C@>(B") + ("$(C$7$Q$5(B" "$(C@?(B") + ("$(C$7$Q$7(B" "$(C@@(B") + ("$(C$7$Q$8(B" "$(C@A(B") + ("$(C$7$Q$:(B" "$(C@B(B") + ("$(C$7$Q$;(B" "$(C@C(B") + ("$(C$7$Q$<(B" "$(C@D(B") + ("$(C$7$Q$=(B" "$(C@E(B") + ("$(C$7$Q$>(B" "$(C@F(B") + + ("$(C$7$Q$S(B" "$(C@G(B") + ("$(C$7$Q$S$$(B" "$(C@H(B") + ("$(C$7$Q$S$)(B" "$(C@I(B") + ("$(C$7$Q$S$1(B" "$(C@J(B") + ("$(C$7$Q$S$5(B" "$(C@K(B") + + ("$(C$7$S(B" "$(C@L(B") + ("$(C$7$S$!(B" "$(C@M(B") + ("$(C$7$S$$(B" "$(C@N(B") + ("$(C$7$S$)(B" "$(C@O(B") + ("$(C$7$S$)$!(B" "$(C@P(B") + ("$(C$7$S$)$1(B" "$(C@Q(B") + ("$(C$7$S$)$>(B" "$(C@R(B") + ("$(C$7$S$1(B" "$(C@S(B") + ("$(C$7$S$2(B" "$(C@T(B") + ("$(C$7$S$5(B" "$(C@U(B") + ("$(C$7$S$6(B" "$(C@V(B") + ("$(C$7$S$7(B" "$(C@W(B") + ("$(C$7$S$8(B" "$(C@X(B") + ("$(C$7$S$=(B" "$(C@Y(B") + + ("$(C$8$?(B" "$(C@Z(B") + ("$(C$8$?$!(B" "$(C@[(B") + ("$(C$8$?$$(B" "$(C@\(B") + ("$(C$8$?$$$>(B" "$(C@](B") + ("$(C$8$?$'(B" "$(C@^(B") + ("$(C$8$?$)(B" "$(C@_(B") + ("$(C$8$?$)$1(B" "$(C@`(B") + ("$(C$8$?$1(B" "$(C@a(B") + ("$(C$8$?$2(B" "$(C@b(B") + ("$(C$8$?$5(B" "$(C@c(B") + ("$(C$8$?$6(B" "$(C@d(B") + ("$(C$8$?$7(B" "$(C@e(B") + ("$(C$8$?$8(B" "$(C@f(B") + + ("$(C$8$@(B" "$(C@g(B") + ("$(C$8$@$!(B" "$(C@h(B") + ("$(C$8$@$$(B" "$(C@i(B") + ("$(C$8$@$)(B" "$(C@j(B") + ("$(C$8$@$1(B" "$(C@k(B") + ("$(C$8$@$2(B" "$(C@l(B") + ("$(C$8$@$5(B" "$(C@m(B") + ("$(C$8$@$6(B" "$(C@n(B") + ("$(C$8$@$7(B" "$(C@o(B") + + ("$(C$8$A(B" "$(C@p(B") + ("$(C$8$A$!(B" "$(C@q(B") + ("$(C$8$A$$(B" "$(C@r(B") + ("$(C$8$A$$$>(B" "$(C@s(B") + ("$(C$8$A$)(B" "$(C@t(B") + ("$(C$8$A$1(B" "$(C@u(B") + ("$(C$8$A$7(B" "$(C@v(B") + + ("$(C$8$B(B" "$(C@w(B") + ("$(C$8$B$$(B" "$(C@x(B") + ("$(C$8$B$)(B" "$(C@y(B") + + ("$(C$8$C(B" "$(C@z(B") + ("$(C$8$C$!(B" "$(C@{(B") + ("$(C$8$C$$(B" "$(C@|(B") + ("$(C$8$C$)(B" "$(C@}(B") + ("$(C$8$C$)$1(B" "$(C@~(B") + ("$(C$8$C$1(B" "$(CA!(B") + ("$(C$8$C$2(B" "$(CA"(B") + ("$(C$8$C$5(B" "$(CA#(B") + ("$(C$8$C$7(B" "$(CA$(B") + ("$(C$8$C$8(B" "$(CA%(B") + + ("$(C$8$D(B" "$(CA&(B") + ("$(C$8$D$!(B" "$(CA'(B") + ("$(C$8$D$$(B" "$(CA((B") + ("$(C$8$D$)(B" "$(CA)(B") + ("$(C$8$D$1(B" "$(CA*(B") + ("$(C$8$D$2(B" "$(CA+(B") + ("$(C$8$D$5(B" "$(CA,(B") + ("$(C$8$D$7(B" "$(CA-(B") + + ("$(C$8$E(B" "$(CA.(B") + ("$(C$8$E$$(B" "$(CA/(B") + ("$(C$8$E$)(B" "$(CA0(B") + ("$(C$8$E$1(B" "$(CA1(B") + ("$(C$8$E$2(B" "$(CA2(B") + ("$(C$8$E$6(B" "$(CA3(B") + ("$(C$8$E$7(B" "$(CA4(B") + + ("$(C$8$F(B" "$(CA5(B") + + ("$(C$8$G(B" "$(CA6(B") + ("$(C$8$G$!(B" "$(CA7(B") + ("$(C$8$G$$(B" "$(CA8(B") + ("$(C$8$G$)(B" "$(CA9(B") + ("$(C$8$G$)$1(B" "$(CA:(B") + ("$(C$8$G$1(B" "$(CA;(B") + ("$(C$8$G$2(B" "$(CA<(B") + ("$(C$8$G$5(B" "$(CA=(B") + ("$(C$8$G$7(B" "$(CA>(B") + ("$(C$8$G$8(B" "$(CA?(B") + ("$(C$8$G$:(B" "$(CA@(B") + ("$(C$8$G$>(B" "$(CAA(B") + + ("$(C$8$G$?(B" "$(CAB(B") + ("$(C$8$G$?$!(B" "$(CAC(B") + ("$(C$8$G$?$)(B" "$(CAD(B") + ("$(C$8$G$?$2(B" "$(CAE(B") + ("$(C$8$G$?$5(B" "$(CAF(B") + ("$(C$8$G$?$7(B" "$(CAG(B") + + ("$(C$8$G$@(B" "$(CAH(B") + ("$(C$8$G$@$6(B" "$(CAI(B") + ("$(C$8$G$@$7(B" "$(CAJ(B") + + ("$(C$8$G$S(B" "$(CAK(B") + ("$(C$8$G$S$$(B" "$(CAL(B") + ("$(C$8$G$S$)(B" "$(CAM(B") + ("$(C$8$G$S$1(B" "$(CAN(B") + ("$(C$8$G$S$2(B" "$(CAO(B") + ("$(C$8$G$S$5(B" "$(CAP(B") + ("$(C$8$G$S$7(B" "$(CAQ(B") + + ("$(C$8$K(B" "$(CAR(B") + ("$(C$8$K$!(B" "$(CAS(B") + ("$(C$8$K$$(B" "$(CAT(B") + ("$(C$8$K$7(B" "$(CAU(B") + + ("$(C$8$L(B" "$(CAV(B") + ("$(C$8$L$!(B" "$(CAW(B") + ("$(C$8$L$$(B" "$(CAX(B") + ("$(C$8$L$)(B" "$(CAY(B") + ("$(C$8$L$)$!(B" "$(CAZ(B") + ("$(C$8$L$)$1(B" "$(CA[(B") + ("$(C$8$L$1(B" "$(CA\(B") + ("$(C$8$L$2(B" "$(CA](B") + ("$(C$8$L$5(B" "$(CA^(B") + ("$(C$8$L$7(B" "$(CA_(B") + + ("$(C$8$L$C(B" "$(CA`(B") + ("$(C$8$L$C$6(B" "$(CAa(B") + + ("$(C$8$L$D(B" "$(CAb(B") + + ("$(C$8$L$S(B" "$(CAc(B") + ("$(C$8$L$S$!(B" "$(CAd(B") + ("$(C$8$L$S$$(B" "$(CAe(B") + ("$(C$8$L$S$)(B" "$(CAf(B") + ("$(C$8$L$S$1(B" "$(CAg(B") + ("$(C$8$L$S$2(B" "$(CAh(B") + ("$(C$8$L$S$5(B" "$(CAi(B") + + ("$(C$8$P(B" "$(CAj(B") + ("$(C$8$P$$(B" "$(CAk(B") + ("$(C$8$P$)(B" "$(CAl(B") + ("$(C$8$P$1(B" "$(CAm(B") + + ("$(C$8$Q(B" "$(CAn(B") + ("$(C$8$Q$!(B" "$(CAo(B") + ("$(C$8$Q$$(B" "$(CAp(B") + ("$(C$8$Q$)(B" "$(CAq(B") + ("$(C$8$Q$1(B" "$(CAr(B") + ("$(C$8$Q$2(B" "$(CAs(B") + ("$(C$8$Q$5(B" "$(CAt(B") + ("$(C$8$Q$7(B" "$(CAu(B") + + ("$(C$8$S(B" "$(CAv(B") + ("$(C$8$S$!(B" "$(CAw(B") + ("$(C$8$S$$(B" "$(CAx(B") + ("$(C$8$S$'(B" "$(CAy(B") + ("$(C$8$S$)(B" "$(CAz(B") + ("$(C$8$S$)$1(B" "$(CA{(B") + ("$(C$8$S$1(B" "$(CA|(B") + ("$(C$8$S$2(B" "$(CA}(B") + ("$(C$8$S$5(B" "$(CA~(B") + ("$(C$8$S$7(B" "$(CB!(B") + ("$(C$8$S$8(B" "$(CB"(B") + ("$(C$8$S$<(B" "$(CB#(B") + ("$(C$8$S$=(B" "$(CB$(B") + + ("$(C$9$?(B" "$(CB%(B") + ("$(C$9$?$!(B" "$(CB&(B") + ("$(C$9$?$$(B" "$(CB'(B") + ("$(C$9$?$$$>(B" "$(CB((B") + ("$(C$9$?$)(B" "$(CB)(B") + ("$(C$9$?$)$2(B" "$(CB*(B") + ("$(C$9$?$1(B" "$(CB+(B") + ("$(C$9$?$2(B" "$(CB,(B") + ("$(C$9$?$5(B" "$(CB-(B") + ("$(C$9$?$6(B" "$(CB.(B") + ("$(C$9$?$7(B" "$(CB/(B") + + ("$(C$9$@(B" "$(CB0(B") + ("$(C$9$@$!(B" "$(CB1(B") + ("$(C$9$@$$(B" "$(CB2(B") + ("$(C$9$@$)(B" "$(CB3(B") + ("$(C$9$@$1(B" "$(CB4(B") + ("$(C$9$@$2(B" "$(CB5(B") + ("$(C$9$@$5(B" "$(CB6(B") + ("$(C$9$@$6(B" "$(CB7(B") + ("$(C$9$@$7(B" "$(CB8(B") + + ("$(C$9$A(B" "$(CB9(B") + ("$(C$9$A$$(B" "$(CB:(B") + ("$(C$9$A$7(B" "$(CB;(B") + + ("$(C$9$C(B" "$(CB<(B") + ("$(C$9$C$!(B" "$(CB=(B") + ("$(C$9$C$$(B" "$(CB>(B") + ("$(C$9$C$)(B" "$(CB?(B") + ("$(C$9$C$1(B" "$(CB@(B") + ("$(C$9$C$2(B" "$(CBA(B") + ("$(C$9$C$5(B" "$(CBB(B") + ("$(C$9$C$6(B" "$(CBC(B") + ("$(C$9$C$7(B" "$(CBD(B") + + ("$(C$9$D(B" "$(CBE(B") + ("$(C$9$D$7(B" "$(CBF(B") + + ("$(C$9$E(B" "$(CBG(B") + ("$(C$9$E$6(B" "$(CBH(B") + + ("$(C$9$G(B" "$(CBI(B") + ("$(C$9$G$!(B" "$(CBJ(B") + ("$(C$9$G$$(B" "$(CBK(B") + ("$(C$9$G$)(B" "$(CBL(B") + ("$(C$9$G$1(B" "$(CBM(B") + ("$(C$9$G$2(B" "$(CBN(B") + ("$(C$9$G$5(B" "$(CBO(B") + ("$(C$9$G$7(B" "$(CBP(B") + ("$(C$9$G$:(B" "$(CBQ(B") + + ("$(C$9$G$?(B" "$(CBR(B") + ("$(C$9$G$?$!(B" "$(CBS(B") + ("$(C$9$G$?$)(B" "$(CBT(B") + ("$(C$9$G$?$6(B" "$(CBU(B") + + ("$(C$9$G$@(B" "$(CBV(B") + ("$(C$9$G$@$6(B" "$(CBW(B") + + ("$(C$9$G$S(B" "$(CBX(B") + ("$(C$9$G$S$$(B" "$(CBY(B") + ("$(C$9$G$S$)(B" "$(CBZ(B") + ("$(C$9$G$S$1(B" "$(CB[(B") + ("$(C$9$G$S$2(B" "$(CB\(B") + + ("$(C$9$K$7(B" "$(CB](B") + + ("$(C$9$L(B" "$(CB^(B") + ("$(C$9$L$!(B" "$(CB_(B") + ("$(C$9$L$$(B" "$(CB`(B") + ("$(C$9$L$)(B" "$(CBa(B") + ("$(C$9$L$1(B" "$(CBb(B") + ("$(C$9$L$2(B" "$(CBc(B") + ("$(C$9$L$7(B" "$(CBd(B") + + ("$(C$9$L$C(B" "$(CBe(B") + ("$(C$9$L$C$6(B" "$(CBf(B") + ("$(C$9$L$C$7(B" "$(CBg(B") + + ("$(C$9$L$S(B" "$(CBh(B") + + ("$(C$9$P(B" "$(CBi(B") + + ("$(C$9$Q(B" "$(CBj(B") + ("$(C$9$Q$1(B" "$(CBk(B") + ("$(C$9$Q$5(B" "$(CBl(B") + ("$(C$9$Q$7(B" "$(CBm(B") + + ("$(C$9$S(B" "$(CBn(B") + ("$(C$9$S$!(B" "$(CBo(B") + ("$(C$9$S$$(B" "$(CBp(B") + ("$(C$9$S$)(B" "$(CBq(B") + ("$(C$9$S$1(B" "$(CBr(B") + ("$(C$9$S$2(B" "$(CBs(B") + ("$(C$9$S$7(B" "$(CBt(B") + ("$(C$9$S$8(B" "$(CBu(B") + ("$(C$9$S$>(B" "$(CBv(B") + + ("$(C$:$?(B" "$(CBw(B") + ("$(C$:$?$!(B" "$(CBx(B") + ("$(C$:$?$$(B" "$(CBy(B") + ("$(C$:$?$$$>(B" "$(CBz(B") + ("$(C$:$?$)(B" "$(CB{(B") + ("$(C$:$?$1(B" "$(CB|(B") + ("$(C$:$?$2(B" "$(CB}(B") + ("$(C$:$?$5(B" "$(CB~(B") + ("$(C$:$?$6(B" "$(CC!(B") + ("$(C$:$?$7(B" "$(CC"(B") + ("$(C$:$?$8(B" "$(CC#(B") + + ("$(C$:$@(B" "$(CC$(B") + ("$(C$:$@$!(B" "$(CC%(B") + ("$(C$:$@$$(B" "$(CC&(B") + ("$(C$:$@$)(B" "$(CC'(B") + ("$(C$:$@$1(B" "$(CC((B") + ("$(C$:$@$2(B" "$(CC)(B") + ("$(C$:$@$5(B" "$(CC*(B") + ("$(C$:$@$6(B" "$(CC+(B") + ("$(C$:$@$7(B" "$(CC,(B") + + ("$(C$:$A(B" "$(CC-(B") + ("$(C$:$A$$(B" "$(CC.(B") + ("$(C$:$A$$$>(B" "$(CC/(B") + ("$(C$:$A$)(B" "$(CC0(B") + ("$(C$:$A$1(B" "$(CC1(B") + ("$(C$:$A$7(B" "$(CC2(B") + + ("$(C$:$C(B" "$(CC3(B") + ("$(C$:$C$!(B" "$(CC4(B") + ("$(C$:$C$$(B" "$(CC5(B") + ("$(C$:$C$)(B" "$(CC6(B") + ("$(C$:$C$1(B" "$(CC7(B") + ("$(C$:$C$2(B" "$(CC8(B") + ("$(C$:$C$5(B" "$(CC9(B") + ("$(C$:$C$6(B" "$(CC:(B") + ("$(C$:$C$7(B" "$(CC;(B") + + ("$(C$:$D(B" "$(CC<(B") + ("$(C$:$D$!(B" "$(CC=(B") + ("$(C$:$D$$(B" "$(CC>(B") + ("$(C$:$D$)(B" "$(CC?(B") + ("$(C$:$D$1(B" "$(CC@(B") + ("$(C$:$D$2(B" "$(CCA(B") + ("$(C$:$D$5(B" "$(CCB(B") + ("$(C$:$D$7(B" "$(CCC(B") + + ("$(C$:$E(B" "$(CCD(B") + ("$(C$:$E$$(B" "$(CCE(B") + ("$(C$:$E$6(B" "$(CCF(B") + + ("$(C$:$F(B" "$(CCG(B") + ("$(C$:$F$$(B" "$(CCH(B") + ("$(C$:$F$7(B" "$(CCI(B") + + ("$(C$:$G(B" "$(CCJ(B") + ("$(C$:$G$!(B" "$(CCK(B") + ("$(C$:$G$$(B" "$(CCL(B") + ("$(C$:$G$)(B" "$(CCM(B") + ("$(C$:$G$1(B" "$(CCN(B") + ("$(C$:$G$2(B" "$(CCO(B") + ("$(C$:$G$5(B" "$(CCP(B") + ("$(C$:$G$7(B" "$(CCQ(B") + + ("$(C$:$G$?(B" "$(CCR(B") + ("$(C$:$G$?$$(B" "$(CCS(B") + ("$(C$:$G$?$)(B" "$(CCT(B") + ("$(C$:$G$?$7(B" "$(CCU(B") + + ("$(C$:$G$S(B" "$(CCV(B") + ("$(C$:$G$S$$(B" "$(CCW(B") + ("$(C$:$G$S$)(B" "$(CCX(B") + ("$(C$:$G$S$1(B" "$(CCY(B") + ("$(C$:$G$S$2(B" "$(CCZ(B") + ("$(C$:$G$S$5(B" "$(CC[(B") + ("$(C$:$G$S$7(B" "$(CC\(B") + + ("$(C$:$K(B" "$(CC](B") + ("$(C$:$K$1(B" "$(CC^(B") + + ("$(C$:$L(B" "$(CC_(B") + ("$(C$:$L$!(B" "$(CC`(B") + ("$(C$:$L$$(B" "$(CCa(B") + ("$(C$:$L$)(B" "$(CCb(B") + ("$(C$:$L$1(B" "$(CCc(B") + ("$(C$:$L$2(B" "$(CCd(B") + ("$(C$:$L$5(B" "$(CCe(B") + ("$(C$:$L$7(B" "$(CCf(B") + + ("$(C$:$L$C(B" "$(CCg(B") + ("$(C$:$L$C$6(B" "$(CCh(B") + + ("$(C$:$L$D(B" "$(CCi(B") + ("$(C$:$L$D$$(B" "$(CCj(B") + + ("$(C$:$L$S(B" "$(CCk(B") + ("$(C$:$L$S$$(B" "$(CCl(B") + ("$(C$:$L$S$)(B" "$(CCm(B") + ("$(C$:$L$S$1(B" "$(CCn(B") + ("$(C$:$L$S$2(B" "$(CCo(B") + ("$(C$:$L$S$5(B" "$(CCp(B") + ("$(C$:$L$S$7(B" "$(CCq(B") + + ("$(C$:$P(B" "$(CCr(B") + ("$(C$:$P$$(B" "$(CCs(B") + ("$(C$:$P$)(B" "$(CCt(B") + ("$(C$:$P$1(B" "$(CCu(B") + ("$(C$:$P$7(B" "$(CCv(B") + + ("$(C$:$Q(B" "$(CCw(B") + ("$(C$:$Q$!(B" "$(CCx(B") + ("$(C$:$Q$$(B" "$(CCy(B") + ("$(C$:$Q$)(B" "$(CCz(B") + ("$(C$:$Q$1(B" "$(CC{(B") + ("$(C$:$Q$2(B" "$(CC|(B") + ("$(C$:$Q$5(B" "$(CC}(B") + ("$(C$:$Q$7(B" "$(CC~(B") + + ("$(C$:$S(B" "$(CD!(B") + ("$(C$:$S$!(B" "$(CD"(B") + ("$(C$:$S$$(B" "$(CD#(B") + ("$(C$:$S$'(B" "$(CD$(B") + ("$(C$:$S$)(B" "$(CD%(B") + ("$(C$:$S$)$!(B" "$(CD&(B") + ("$(C$:$S$1(B" "$(CD'(B") + ("$(C$:$S$2(B" "$(CD((B") + ("$(C$:$S$5(B" "$(CD)(B") + ("$(C$:$S$7(B" "$(CD*(B") + + ("$(C$;$?(B" "$(CD+(B") + ("$(C$;$?$!(B" "$(CD,(B") + ("$(C$;$?$$(B" "$(CD-(B") + ("$(C$;$?$)(B" "$(CD.(B") + ("$(C$;$?$1(B" "$(CD/(B") + ("$(C$;$?$2(B" "$(CD0(B") + ("$(C$;$?$5(B" "$(CD1(B") + ("$(C$;$?$7(B" "$(CD2(B") + + ("$(C$;$@(B" "$(CD3(B") + ("$(C$;$@$!(B" "$(CD4(B") + ("$(C$;$@$$(B" "$(CD5(B") + ("$(C$;$@$)(B" "$(CD6(B") + ("$(C$;$@$1(B" "$(CD7(B") + ("$(C$;$@$2(B" "$(CD8(B") + ("$(C$;$@$5(B" "$(CD9(B") + ("$(C$;$@$6(B" "$(CD:(B") + ("$(C$;$@$7(B" "$(CD;(B") + + ("$(C$;$A(B" "$(CD<(B") + ("$(C$;$A$!(B" "$(CD=(B") + ("$(C$;$A$7(B" "$(CD>(B") + + ("$(C$;$C(B" "$(CD?(B") + ("$(C$;$C$!(B" "$(CD@(B") + ("$(C$;$C$$(B" "$(CDA(B") + ("$(C$;$C$'(B" "$(CDB(B") + ("$(C$;$C$)(B" "$(CDC(B") + ("$(C$;$C$1(B" "$(CDD(B") + ("$(C$;$C$2(B" "$(CDE(B") + ("$(C$;$C$5(B" "$(CDF(B") + ("$(C$;$C$6(B" "$(CDG(B") + ("$(C$;$C$7(B" "$(CDH(B") + + ("$(C$;$D(B" "$(CDI(B") + ("$(C$;$D$!(B" "$(CDJ(B") + ("$(C$;$D$$(B" "$(CDK(B") + ("$(C$;$D$)(B" "$(CDL(B") + ("$(C$;$D$1(B" "$(CDM(B") + ("$(C$;$D$2(B" "$(CDN(B") + ("$(C$;$D$5(B" "$(CDO(B") + ("$(C$;$D$7(B" "$(CDP(B") + + ("$(C$;$E(B" "$(CDQ(B") + ("$(C$;$E$$(B" "$(CDR(B") + ("$(C$;$E$)(B" "$(CDS(B") + ("$(C$;$E$1(B" "$(CDT(B") + ("$(C$;$E$2(B" "$(CDU(B") + ("$(C$;$E$5(B" "$(CDV(B") + ("$(C$;$E$6(B" "$(CDW(B") + ("$(C$;$E$7(B" "$(CDX(B") + + ("$(C$;$F(B" "$(CDY(B") + + ("$(C$;$G(B" "$(CDZ(B") + ("$(C$;$G$!(B" "$(CD[(B") + ("$(C$;$G$$(B" "$(CD\(B") + ("$(C$;$G$)(B" "$(CD](B") + ("$(C$;$G$1(B" "$(CD^(B") + ("$(C$;$G$2(B" "$(CD_(B") + ("$(C$;$G$5(B" "$(CD`(B") + ("$(C$;$G$7(B" "$(CDa(B") + + ("$(C$;$G$?(B" "$(CDb(B") + ("$(C$;$G$?$!(B" "$(CDc(B") + ("$(C$;$G$?$$(B" "$(CDd(B") + ("$(C$;$G$?$)(B" "$(CDe(B") + ("$(C$;$G$?$1(B" "$(CDf(B") + ("$(C$;$G$?$7(B" "$(CDg(B") + + ("$(C$;$G$@(B" "$(CDh(B") + ("$(C$;$G$@$7(B" "$(CDi(B") + + ("$(C$;$G$S(B" "$(CDj(B") + ("$(C$;$G$S$)(B" "$(CDk(B") + + ("$(C$;$K(B" "$(CDl(B") + + ("$(C$;$L(B" "$(CDm(B") + ("$(C$;$L$!(B" "$(CDn(B") + ("$(C$;$L$)(B" "$(CDp(B") + ("$(C$;$L$1(B" "$(CDq(B") + ("$(C$;$L$2(B" "$(CDr(B") + ("$(C$;$L$5(B" "$(CDs(B") + ("$(C$;$L$7(B" "$(CDt(B") + + ("$(C$;$L$C(B" "$(CDu(B") + ("$(C$;$L$C$$(B" "$(CDv(B") + ("$(C$;$L$C$)(B" "$(CDw(B") + ("$(C$;$L$C$7(B" "$(CDx(B") + + ("$(C$;$L$D(B" "$(CDy(B") + ("$(C$;$L$D$7(B" "$(CDz(B") + + ("$(C$;$L$S(B" "$(CD{(B") + ("$(C$;$L$S$!(B" "$(CD|(B") + ("$(C$;$L$S$$(B" "$(CD}(B") + ("$(C$;$L$S$)(B" "$(CD~(B") + ("$(C$;$L$S$1(B" "$(CE!(B") + ("$(C$;$L$S$2(B" "$(CE"(B") + ("$(C$;$L$S$5(B" "$(CE#(B") + ("$(C$;$L$S$7(B" "$(CE$(B") + + ("$(C$;$P(B" "$(CE%(B") + ("$(C$;$P$$(B" "$(CE&(B") + ("$(C$;$P$)(B" "$(CE'(B") + ("$(C$;$P$1(B" "$(CE((B") + + ("$(C$;$Q(B" "$(CE)(B") + ("$(C$;$Q$!(B" "$(CE*(B") + ("$(C$;$Q$$(B" "$(CE+(B") + ("$(C$;$Q$)(B" "$(CE,(B") + ("$(C$;$Q$1(B" "$(CE-(B") + ("$(C$;$Q$2(B" "$(CE.(B") + ("$(C$;$Q$7(B" "$(CE/(B") + + ("$(C$;$S(B" "$(CE0(B") + ("$(C$;$S$!(B" "$(CE1(B") + ("$(C$;$S$$(B" "$(CE2(B") + ("$(C$;$S$)(B" "$(CE3(B") + ("$(C$;$S$1(B" "$(CE4(B") + ("$(C$;$S$2(B" "$(CE5(B") + ("$(C$;$S$5(B" "$(CE6(B") + ("$(C$;$S$7(B" "$(CE7(B") + + ("$(C$<$?(B" "$(CE8(B") + ("$(C$<$?$!(B" "$(CE9(B") + ("$(C$<$?$$(B" "$(CE:(B") + ("$(C$<$?$)(B" "$(CE;(B") + ("$(C$<$?$)$!(B" "$(CE<(B") + ("$(C$<$?$1(B" "$(CE=(B") + ("$(C$<$?$2(B" "$(CE>(B") + ("$(C$<$?$5(B" "$(CE?(B") + ("$(C$<$?$6(B" "$(CE@(B") + ("$(C$<$?$7(B" "$(CEA(B") + + ("$(C$<$@(B" "$(CEB(B") + ("$(C$<$@$!(B" "$(CEC(B") + ("$(C$<$@$$(B" "$(CED(B") + ("$(C$<$@$)(B" "$(CEE(B") + ("$(C$<$@$1(B" "$(CEF(B") + ("$(C$<$@$2(B" "$(CEG(B") + ("$(C$<$@$5(B" "$(CEH(B") + ("$(C$<$@$6(B" "$(CEI(B") + ("$(C$<$@$7(B" "$(CEJ(B") + + ("$(C$<$A(B" "$(CEK(B") + ("$(C$<$A$7(B" "$(CEL(B") + + ("$(C$<$C(B" "$(CEM(B") + ("$(C$<$C$!(B" "$(CEN(B") + ("$(C$<$C$$(B" "$(CEO(B") + ("$(C$<$C$)(B" "$(CEP(B") + ("$(C$<$C$)$1(B" "$(CEQ(B") + ("$(C$<$C$1(B" "$(CER(B") + ("$(C$<$C$2(B" "$(CES(B") + ("$(C$<$C$5(B" "$(CET(B") + ("$(C$<$C$6(B" "$(CEU(B") + ("$(C$<$C$7(B" "$(CEV(B") + + ("$(C$<$D(B" "$(CEW(B") + ("$(C$<$D$!(B" "$(CEX(B") + ("$(C$<$D$$(B" "$(CEY(B") + ("$(C$<$D$)(B" "$(CEZ(B") + ("$(C$<$D$1(B" "$(CE[(B") + ("$(C$<$D$2(B" "$(CE\(B") + ("$(C$<$D$5(B" "$(CE](B") + ("$(C$<$D$7(B" "$(CE^(B") + + ("$(C$<$E(B" "$(CE_(B") + ("$(C$<$E$$(B" "$(CE`(B") + ("$(C$<$E$6(B" "$(CEa(B") + + ("$(C$<$F(B" "$(CEb(B") + ("$(C$<$F$$(B" "$(CEc(B") + + ("$(C$<$G(B" "$(CEd(B") + ("$(C$<$G$!(B" "$(CEe(B") + ("$(C$<$G$$(B" "$(CEf(B") + ("$(C$<$G$)(B" "$(CEg(B") + ("$(C$<$G$1(B" "$(CEh(B") + ("$(C$<$G$2(B" "$(CEi(B") + ("$(C$<$G$5(B" "$(CEj(B") + ("$(C$<$G$7(B" "$(CEk(B") + ("$(C$<$G$=(B" "$(CEl(B") + + ("$(C$<$G$?(B" "$(CEm(B") + ("$(C$<$G$?$$(B" "$(CEn(B") + + ("$(C$<$G$@(B" "$(CEo(B") + + ("$(C$<$G$S(B" "$(CEp(B") + ("$(C$<$G$S$$(B" "$(CEq(B") + ("$(C$<$G$S$5(B" "$(CEr(B") + ("$(C$<$G$S$7(B" "$(CEs(B") + + ("$(C$<$K(B" "$(CEt(B") + + ("$(C$<$L(B" "$(CEu(B") + ("$(C$<$L$!(B" "$(CEv(B") + ("$(C$<$L$$(B" "$(CEw(B") + ("$(C$<$L$)(B" "$(CEx(B") + ("$(C$<$L$1(B" "$(CEy(B") + ("$(C$<$L$2(B" "$(CEz(B") + ("$(C$<$L$5(B" "$(CE{(B") + ("$(C$<$L$7(B" "$(CE|(B") + + ("$(C$<$L$C(B" "$(CE}(B") + ("$(C$<$L$C$6(B" "$(CE~(B") + + ("$(C$<$L$D(B" "$(CF!(B") + + ("$(C$<$L$S(B" "$(CF"(B") + ("$(C$<$L$S$!(B" "$(CF#(B") + ("$(C$<$L$S$$(B" "$(CF$(B") + ("$(C$<$L$S$)(B" "$(CF%(B") + ("$(C$<$L$S$1(B" "$(CF&(B") + ("$(C$<$L$S$2(B" "$(CF'(B") + ("$(C$<$L$S$7(B" "$(CF((B") + + ("$(C$<$P(B" "$(CF)(B") + ("$(C$<$P$$(B" "$(CF*(B") + ("$(C$<$P$)(B" "$(CF+(B") + ("$(C$<$P$1(B" "$(CF,(B") + ("$(C$<$P$7(B" "$(CF-(B") + + ("$(C$<$Q(B" "$(CF.(B") + ("$(C$<$Q$!(B" "$(CF/(B") + ("$(C$<$Q$$(B" "$(CF0(B") + ("$(C$<$Q$'(B" "$(CF1(B") + ("$(C$<$Q$)(B" "$(CF2(B") + ("$(C$<$Q$)$1(B" "$(CF3(B") + ("$(C$<$Q$1(B" "$(CF4(B") + ("$(C$<$Q$2(B" "$(CF5(B") + ("$(C$<$Q$5(B" "$(CF6(B") + + ("$(C$<$Q$S(B" "$(CF7(B") + ("$(C$<$Q$S$$(B" "$(CF8(B") + ("$(C$<$Q$S$)(B" "$(CF9(B") + ("$(C$<$Q$S$1(B" "$(CF:(B") + ("$(C$<$Q$S$2(B" "$(CF;(B") + + ("$(C$<$S(B" "$(CF<(B") + ("$(C$<$S$!(B" "$(CF=(B") + ("$(C$<$S$$(B" "$(CF>(B") + ("$(C$<$S$)(B" "$(CF?(B") + ("$(C$<$S$1(B" "$(CF@(B") + ("$(C$<$S$2(B" "$(CFA(B") + ("$(C$<$S$5(B" "$(CFB(B") + ("$(C$<$S$7(B" "$(CFC(B") + + ("$(C$=$?(B" "$(CFD(B") + ("$(C$=$?$!(B" "$(CFE(B") + ("$(C$=$?$"(B" "$(CFF(B") + ("$(C$=$?$$(B" "$(CFG(B") + ("$(C$=$?$)(B" "$(CFH(B") + ("$(C$=$?$)$1(B" "$(CFI(B") + ("$(C$=$?$1(B" "$(CFJ(B") + ("$(C$=$?$2(B" "$(CFK(B") + ("$(C$=$?$5(B" "$(CFL(B") + ("$(C$=$?$6(B" "$(CFM(B") + ("$(C$=$?$7(B" "$(CFN(B") + ("$(C$=$?$<(B" "$(CFO(B") + + ("$(C$=$@(B" "$(CFP(B") + ("$(C$=$@$!(B" "$(CFQ(B") + ("$(C$=$@$$(B" "$(CFR(B") + ("$(C$=$@$)(B" "$(CFS(B") + ("$(C$=$@$1(B" "$(CFT(B") + ("$(C$=$@$2(B" "$(CFU(B") + ("$(C$=$@$5(B" "$(CFV(B") + ("$(C$=$@$6(B" "$(CFW(B") + ("$(C$=$@$7(B" "$(CFX(B") + + ("$(C$=$A(B" "$(CFY(B") + ("$(C$=$A$!(B" "$(CFZ(B") + + ("$(C$=$C(B" "$(CF[(B") + ("$(C$=$C$!(B" "$(CF\(B") + ("$(C$=$C$$(B" "$(CF](B") + ("$(C$=$C$1(B" "$(CF_(B") + ("$(C$=$C$2(B" "$(CF`(B") + ("$(C$=$C$5(B" "$(CFa(B") + ("$(C$=$C$6(B" "$(CFb(B") + ("$(C$=$C$7(B" "$(CFc(B") + + ("$(C$=$D(B" "$(CFd(B") + ("$(C$=$D$!(B" "$(CFe(B") + ("$(C$=$D$$(B" "$(CFf(B") + ("$(C$=$D$)(B" "$(CFg(B") + ("$(C$=$D$1(B" "$(CFh(B") + ("$(C$=$D$2(B" "$(CFi(B") + ("$(C$=$D$5(B" "$(CFj(B") + ("$(C$=$D$7(B" "$(CFk(B") + + ("$(C$=$E(B" "$(CFl(B") + ("$(C$=$E$$(B" "$(CFm(B") + ("$(C$=$E$)(B" "$(CFn(B") + ("$(C$=$E$1(B" "$(CFo(B") + ("$(C$=$E$2(B" "$(CFp(B") + ("$(C$=$E$6(B" "$(CFq(B") + ("$(C$=$E$7(B" "$(CFr(B") + + ("$(C$=$F(B" "$(CFs(B") + ("$(C$=$F$)(B" "$(CFt(B") + ("$(C$=$F$2(B" "$(CFu(B") + ("$(C$=$F$5(B" "$(CFv(B") + + ("$(C$=$G(B" "$(CFw(B") + ("$(C$=$G$!(B" "$(CFx(B") + ("$(C$=$G$$(B" "$(CFy(B") + ("$(C$=$G$)(B" "$(CFz(B") + ("$(C$=$G$1(B" "$(CF{(B") + ("$(C$=$G$2(B" "$(CF|(B") + ("$(C$=$G$5(B" "$(CF}(B") + ("$(C$=$G$7(B" "$(CF~(B") + + ("$(C$=$G$?(B" "$(CG!(B") + ("$(C$=$G$?$7(B" "$(CG"(B") + + ("$(C$=$G$S(B" "$(CG#(B") + ("$(C$=$G$S$$(B" "$(CG$(B") + + ("$(C$=$K(B" "$(CG%(B") + ("$(C$=$K$$(B" "$(CG&(B") + ("$(C$=$K$)(B" "$(CG'(B") + ("$(C$=$K$2(B" "$(CG((B") + ("$(C$=$K$5(B" "$(CG)(B") + + ("$(C$=$L(B" "$(CG*(B") + ("$(C$=$L$!(B" "$(CG+(B") + ("$(C$=$L$$(B" "$(CG,(B") + ("$(C$=$L$'(B" "$(CG-(B") + ("$(C$=$L$)(B" "$(CG.(B") + ("$(C$=$L$)$1(B" "$(CG/(B") + ("$(C$=$L$1(B" "$(CG0(B") + ("$(C$=$L$2(B" "$(CG1(B") + ("$(C$=$L$5(B" "$(CG2(B") + ("$(C$=$L$7(B" "$(CG3(B") + + ("$(C$=$L$C(B" "$(CG4(B") + ("$(C$=$L$C$7(B" "$(CG5(B") + + ("$(C$=$L$S(B" "$(CG6(B") + ("$(C$=$L$S$$(B" "$(CG7(B") + ("$(C$=$L$S$)(B" "$(CG8(B") + ("$(C$=$L$S$1(B" "$(CG9(B") + ("$(C$=$L$S$5(B" "$(CG:(B") + + ("$(C$=$P(B" "$(CG;(B") + ("$(C$=$P$$(B" "$(CG<(B") + ("$(C$=$P$)(B" "$(CG=(B") + ("$(C$=$P$1(B" "$(CG>(B") + ("$(C$=$P$5(B" "$(CG?(B") + ("$(C$=$P$7(B" "$(CG@(B") + + ("$(C$=$Q(B" "$(CGA(B") + ("$(C$=$Q$$(B" "$(CGB(B") + ("$(C$=$Q$)(B" "$(CGC(B") + ("$(C$=$Q$1(B" "$(CGD(B") + ("$(C$=$Q$2(B" "$(CGE(B") + ("$(C$=$Q$5(B" "$(CGF(B") + + ("$(C$=$S(B" "$(CGG(B") + ("$(C$=$S$!(B" "$(CGH(B") + ("$(C$=$S$$(B" "$(CGI(B") + ("$(C$=$S$)(B" "$(CGJ(B") + ("$(C$=$S$1(B" "$(CGK(B") + ("$(C$=$S$2(B" "$(CGL(B") + ("$(C$=$S$5(B" "$(CGM(B") + ("$(C$=$S$7(B" "$(CGN(B") + + ("$(C$>$?(B" "$(CGO(B") + ("$(C$>$?$!(B" "$(CGP(B") + ("$(C$>$?$$(B" "$(CGQ(B") + ("$(C$>$?$)(B" "$(CGR(B") + ("$(C$>$?$)$<(B" "$(CGS(B") + ("$(C$>$?$1(B" "$(CGT(B") + ("$(C$>$?$2(B" "$(CGU(B") + ("$(C$>$?$5(B" "$(CGV(B") + ("$(C$>$?$7(B" "$(CGW(B") + + ("$(C$>$@(B" "$(CGX(B") + ("$(C$>$@$!(B" "$(CGY(B") + ("$(C$>$@$$(B" "$(CGZ(B") + ("$(C$>$@$)(B" "$(CG[(B") + ("$(C$>$@$1(B" "$(CG\(B") + ("$(C$>$@$2(B" "$(CG](B") + ("$(C$>$@$5(B" "$(CG^(B") + ("$(C$>$@$6(B" "$(CG_(B") + ("$(C$>$@$7(B" "$(CG`(B") + + ("$(C$>$A(B" "$(CGa(B") + ("$(C$>$A$7(B" "$(CGb(B") + + ("$(C$>$C(B" "$(CGc(B") + ("$(C$>$C$!(B" "$(CGd(B") + ("$(C$>$C$$(B" "$(CGe(B") + ("$(C$>$C$)(B" "$(CGf(B") + ("$(C$>$C$)$1(B" "$(CGg(B") + ("$(C$>$C$1(B" "$(CGh(B") + ("$(C$>$C$2(B" "$(CGi(B") + ("$(C$>$C$5(B" "$(CGj(B") + ("$(C$>$C$7(B" "$(CGk(B") + + ("$(C$>$D(B" "$(CGl(B") + ("$(C$>$D$!(B" "$(CGm(B") + ("$(C$>$D$$(B" "$(CGn(B") + ("$(C$>$D$)(B" "$(CGo(B") + ("$(C$>$D$1(B" "$(CGp(B") + ("$(C$>$D$2(B" "$(CGq(B") + ("$(C$>$D$5(B" "$(CGr(B") + ("$(C$>$D$7(B" "$(CGs(B") + + ("$(C$>$E(B" "$(CGt(B") + ("$(C$>$E$!(B" "$(CGu(B") + ("$(C$>$E$$(B" "$(CGv(B") + ("$(C$>$E$)(B" "$(CGw(B") + ("$(C$>$E$1(B" "$(CGx(B") + ("$(C$>$E$2(B" "$(CGy(B") + ("$(C$>$E$5(B" "$(CGz(B") + ("$(C$>$E$6(B" "$(CG{(B") + ("$(C$>$E$7(B" "$(CG|(B") + + ("$(C$>$F(B" "$(CG}(B") + ("$(C$>$F$$(B" "$(CG~(B") + ("$(C$>$F$)(B" "$(CH!(B") + ("$(C$>$F$2(B" "$(CH"(B") + + ("$(C$>$G(B" "$(CH#(B") + ("$(C$>$G$!(B" "$(CH$(B") + ("$(C$>$G$$(B" "$(CH%(B") + ("$(C$>$G$)(B" "$(CH&(B") + ("$(C$>$G$)$<(B" "$(CH'(B") + ("$(C$>$G$1(B" "$(CH((B") + ("$(C$>$G$2(B" "$(CH)(B") + ("$(C$>$G$5(B" "$(CH*(B") + ("$(C$>$G$7(B" "$(CH+(B") + ("$(C$>$G$<(B" "$(CH,(B") + + ("$(C$>$G$?(B" "$(CH-(B") + ("$(C$>$G$?$!(B" "$(CH.(B") + ("$(C$>$G$?$$(B" "$(CH/(B") + ("$(C$>$G$?$)(B" "$(CH0(B") + ("$(C$>$G$?$5(B" "$(CH1(B") + ("$(C$>$G$?$7(B" "$(CH2(B") + + ("$(C$>$G$@(B" "$(CH3(B") + ("$(C$>$G$@$!(B" "$(CH4(B") + ("$(C$>$G$@$$(B" "$(CH5(B") + ("$(C$>$G$@$5(B" "$(CH6(B") + ("$(C$>$G$@$7(B" "$(CH7(B") + + ("$(C$>$G$S(B" "$(CH8(B") + ("$(C$>$G$S$!(B" "$(CH9(B") + ("$(C$>$G$S$$(B" "$(CH:(B") + ("$(C$>$G$S$)(B" "$(CH;(B") + ("$(C$>$G$S$2(B" "$(CH<(B") + ("$(C$>$G$S$5(B" "$(CH=(B") + ("$(C$>$G$S$7(B" "$(CH>(B") + + ("$(C$>$K(B" "$(CH?(B") + ("$(C$>$K$$(B" "$(CH@(B") + ("$(C$>$K$)(B" "$(CHA(B") + ("$(C$>$K$2(B" "$(CHB(B") + ("$(C$>$K$5(B" "$(CHC(B") + + ("$(C$>$L(B" "$(CHD(B") + ("$(C$>$L$!(B" "$(CHE(B") + ("$(C$>$L$$(B" "$(CHF(B") + ("$(C$>$L$)(B" "$(CHG(B") + ("$(C$>$L$)$<(B" "$(CHH(B") + ("$(C$>$L$1(B" "$(CHI(B") + ("$(C$>$L$5(B" "$(CHJ(B") + ("$(C$>$L$7(B" "$(CHK(B") + + ("$(C$>$L$C(B" "$(CHL(B") + ("$(C$>$L$C$$(B" "$(CHM(B") + ("$(C$>$L$C$)(B" "$(CHN(B") + ("$(C$>$L$C$1(B" "$(CHO(B") + ("$(C$>$L$C$7(B" "$(CHP(B") + + ("$(C$>$L$D(B" "$(CHQ(B") + ("$(C$>$L$D$!(B" "$(CHR(B") + ("$(C$>$L$D$$(B" "$(CHS(B") + ("$(C$>$L$D$)(B" "$(CHT(B") + ("$(C$>$L$D$7(B" "$(CHU(B") + + ("$(C$>$L$S(B" "$(CHV(B") + ("$(C$>$L$S$!(B" "$(CHW(B") + ("$(C$>$L$S$$(B" "$(CHX(B") + ("$(C$>$L$S$)(B" "$(CHY(B") + ("$(C$>$L$S$1(B" "$(CHZ(B") + ("$(C$>$L$S$2(B" "$(CH[(B") + ("$(C$>$L$S$5(B" "$(CH\(B") + ("$(C$>$L$S$7(B" "$(CH](B") + + ("$(C$>$P(B" "$(CH^(B") + ("$(C$>$P$!(B" "$(CH_(B") + ("$(C$>$P$$(B" "$(CH`(B") + ("$(C$>$P$)(B" "$(CHa(B") + ("$(C$>$P$1(B" "$(CHb(B") + ("$(C$>$P$5(B" "$(CHc(B") + ("$(C$>$P$7(B" "$(CHd(B") + + ("$(C$>$Q(B" "$(CHe(B") + ("$(C$>$Q$!(B" "$(CHf(B") + ("$(C$>$Q$$(B" "$(CHg(B") + ("$(C$>$Q$$$>(B" "$(CHh(B") + ("$(C$>$Q$'(B" "$(CHi(B") + ("$(C$>$Q$)(B" "$(CHj(B") + ("$(C$>$Q$)$!(B" "$(CHk(B") + ("$(C$>$Q$1(B" "$(CHl(B") + ("$(C$>$Q$2(B" "$(CHm(B") + ("$(C$>$Q$5(B" "$(CHn(B") + ("$(C$>$Q$7(B" "$(CHo(B") + ("$(C$>$Q$<(B" "$(CHp(B") + + ("$(C$>$Q$S(B" "$(CHq(B") + ("$(C$>$Q$S$$(B" "$(CHr(B") + ("$(C$>$Q$S$)(B" "$(CHs(B") + ("$(C$>$Q$S$1(B" "$(CHt(B") + ("$(C$>$Q$S$2(B" "$(CHu(B") + ("$(C$>$Q$S$7(B" "$(CHv(B") + + ("$(C$>$S(B" "$(CHw(B") + ("$(C$>$S$!(B" "$(CHx(B") + ("$(C$>$S$$(B" "$(CHy(B") + ("$(C$>$S$)(B" "$(CHz(B") + ("$(C$>$S$1(B" "$(CH{(B") + ("$(C$>$S$2(B" "$(CH|(B") + ("$(C$>$S$5(B" "$(CH}(B") + ("$(C$>$S$7(B" "$(CH~(B")) + + (dolist (ascii '(("1" . "$(C#1(B") ("2" . "$(C#2(B") ("3" . "$(C#3(B") ("4" . "$(C#4(B") + ("5" . "$(C#5(B") ("6" . "$(C#6(B") ("7" . "$(C#7(B") ("8" . "$(C#8(B") + ("9" . "$(C#9(B") ("0" . "$(C#0(B") + (" " . "$(C!!(B") ("!" . "$(C#!(B") ("@" . "$(C#@(B") ("#" . "$(C##(B") + ("$" . "$(C#$(B") ("%" . "$(C#%(B") ("^" . "$(C#^(B") ("&" . "$(C#&(B") + ("*" . "$(C#*(B") ("(" . "$(C#((B") (")" . "$(C#)(B") + ("-" . "$(C#-(B") ("=" . "$(C#=(B") ("`" . "$(C#`(B") ("\\" . "$(C#\(B") + ("|" . "$(C#|(B") ("_" . "$(C#_(B") ("+" . "$(C#+(B") ("~" . "$(C#~(B") + ("[" . "$(C!8(B") ("]" . "$(C!9(B") ("{" . "$(C#{(B") ("}" . "$(C#}(B") + (":" . "$(C#:(B") (";" . "$(C#;(B") ("\"" . "$(C#"(B") ("'" . "$(C#'(B") + ("<" . "$(C#<(B") (">" . "$(C#>(B") ("?" . "$(C#?(B") ("/" . "$(C#/(B") + ("," . "$(C#,(B") ("." . "$(C#.(B") + ("a" . "$(C#a(B") ("b" . "$(C#b(B") ("c" . "$(C#c(B") ("d" . "$(C#d(B") + ("e" . "$(C#e(B") ("f" . "$(C#f(B") ("g" . "$(C#g(B") ("h" . "$(C#h(B") + ("i" . "$(C#i(B") ("j" . "$(C#j(B") ("k" . "$(C#k(B") ("l" . "$(C#l(B") + ("m" . "$(C#m(B") ("n" . "$(C#n(B") ("o" . "$(C#o(B") ("p" . "$(C#p(B") + ("q" . "$(C#q(B") ("r" . "$(C#r(B") ("s" . "$(C#s(B") ("t" . "$(C#t(B") + ("u" . "$(C#u(B") ("v" . "$(C#v(B") ("w" . "$(C#w(B") ("x" . "$(C#x(B") + ("y" . "$(C#y(B") ("z" . "$(C#z(B") + ("A" . "$(C#A(B") ("B" . "$(C#B(B") ("C" . "$(C#C(B") ("D" . "$(C#D(B") + ("E" . "$(C#E(B") ("F" . "$(C#F(B") ("G" . "$(C#G(B") ("H" . "$(C#H(B") + ("I" . "$(C#I(B") ("J" . "$(C#J(B") ("K" . "$(C#K(B") ("L" . "$(C#L(B") + ("M" . "$(C#M(B") ("N" . "$(C#N(B") ("O" . "$(C#O(B") ("P" . "$(C#P(B") + ("Q" . "$(C#Q(B") ("R" . "$(C#R(B") ("S" . "$(C#S(B") ("T" . "$(C#T(B") + ("U" . "$(C#U(B") ("V" . "$(C#V(B") ("W" . "$(C#W(B") ("X" . "$(C#X(B") + ("Y" . "$(C#Y(B") ("Z" . "$(C#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule (concat its-pankak-escape in) in) + (its-defrule (concat its-jeonkak-escape in) out)))) + +(define-its-state-machine-append its-hangul-map + (its-defrule "[" its-hangul-open-bracket) + (its-defrule "]" its-hangul-close-bracket) + (its-defrule "." its-hangul-period) + (its-defrule "," its-hangul-comma) + + (if its-hangul-enable-jeonkak-alphabet + (progn + (its-defrule "1" "$(C#1(B") (its-defrule "2" "$(C#2(B") + (its-defrule "3" "$(C#3(B") (its-defrule "4" "$(C#4(B") + (its-defrule "5" "$(C#5(B") (its-defrule "6" "$(C#6(B") + (its-defrule "7" "$(C#7(B") (its-defrule "8" "$(C#8(B") + (its-defrule "9" "$(C#9(B") (its-defrule "0" "$(C#0(B") + (its-defrule "!" "$(C#!(B") (its-defrule "@" "$(C#@(B") + (its-defrule "#" "$(C##(B") (its-defrule "$" "$(C#$(B") + (its-defrule "%" "$(C#%(B") (its-defrule "^" "$(C#^(B") + (its-defrule "&" "$(C#&(B") (its-defrule "*" "$(C#*(B") + (its-defrule "(" "$(C#((B") (its-defrule ")" "$(C#)(B") + (its-defrule "-" "$(C#-(B") (its-defrule "~" "$(C#~(B") + (its-defrule "=" "$(C#=(B") (its-defrule "`" "$(C#`(B") + (its-defrule "\\" "$(C#\(B") (its-defrule "|" "$(C#|(B") + (its-defrule "_" "$(C#_(B") (its-defrule "+" "$(C#+(B") + (its-defrule "{" "$(C#{(B") (its-defrule "}" "$(C#}(B") + (its-defrule ":" "$(C#:(B") (its-defrule ";" "$(C#;(B") + (its-defrule "\"" "$(C#"(B") (its-defrule "'" "$(C#'(B") + (its-defrule "<" "$(C#<(B") (its-defrule ">" "$(C#>(B") + (its-defrule "?" "$(C#?(B") (its-defrule "/" "$(C#/(B")) + (progn + (its-defrule "1" "1") (its-defrule "2" "2") + (its-defrule "3" "3") (its-defrule "4" "4") + (its-defrule "5" "5") (its-defrule "6" "6") + (its-defrule "7" "7") (its-defrule "8" "8") + (its-defrule "9" "9") (its-defrule "0" "0") + (its-defrule "!" "!") (its-defrule "@" "@") + (its-defrule "#" "#") (its-defrule "$" "$") + (its-defrule "%" "%") (its-defrule "^" "^") + (its-defrule "&" "&") (its-defrule "*" "*") + (its-defrule "(" "(") (its-defrule ")" ")") + (its-defrule "-" "-") (its-defrule "~" "~") + (its-defrule "=" "=") (its-defrule "`" "`") + (its-defrule "\\" "\\") (its-defrule "|" "|") + (its-defrule "_" "_") (its-defrule "+" "+") + (its-defrule "{" "{") (its-defrule "}" "}") + (its-defrule ":" ":") (its-defrule ";" ";") + (its-defrule "\"" "\"") (its-defrule "'" "'") + (its-defrule "<" "<") (its-defrule ">" ">") + (its-defrule "?" "?") (its-defrule "/" "/")))) + +(provide 'its/hangul) diff --git a/its/hankata.el b/its/hankata.el new file mode 100644 index 0000000..73618f2 --- /dev/null +++ b/its/hankata.el @@ -0,0 +1,291 @@ +;;; its/hankata.el --- Hnakaku Katakana Input in Egg Input Method Architecture + +;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. +;; Licensed to the Free Software Foundation. + +;; Author: Satoru Tomura + +;; Maintainer: TOMURA Satoru + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: +;; +;; Symbol input is desined by jiro@math.keio.ac.jp (TANAKA Jiro) +;; This file is based on the rules of its/kata.el in Mule-2.3 distribution. +;; + +;;; Code: + +(eval-when-compile + (require 'its) + (require 'cl)) + +(eval-when (compile) + (defconst its-compaction-enable t)) + +(defvar its-han-kata-enable-double-n nil "*Enable \"nn\" input for \"$B%s(B\" ") +(defvar its-han-kata-enable-zenkaku-alphabet t "*Enable Zenkaku alphabet") +(defvar its-han-kata-period "(I!(B" "*$B%T%j%*%I(B") ; ". " "$B!%(B" +(defvar its-han-kata-comma "(I$(B" "*$B%3%s%^(B") ; ", " "$B!$(B" +(defvar its-han-kata-open-bracket "(I"(B" "*[") ; "$B!N(B" +(defvar its-han-kata-close-bracket "(I#(B" "*]") ; "$B!O(B" +(defvar its-han-kata-horizontal "(I0(B" "*-") ; "$B!](B" + +(define-its-state-machine its-han-kata-map + "roma-han-kata" "(I11(B" Japanese + "Map for Romaji-Hankaku-Katakana translation. (Japanese)" + + (defconst its-hankaku-escape "~") ;; Escape character to Hankaku inputs + + (its-defrule-select-mode-temporally "q" downcase) + +;;; k k +;;; kk $B%C(Bk +;;; kka $B%C%+(B +;;; +;;; kkk $B%C(Bk DING! + + (its-defrule "tch" "(I/(B" -2) + +;;; $B!V%s!W$NF~NO(B + + (dolist (q1 '("b" "m" "p")) + (its-defrule (concat "m" q1) "(I](B" -1)) + + (its-defrule* "n" "(I](B") + (its-defrule "n'" "(I](B") + (its-defrule "N" "(I](B") + + (let ((small '"x" )) + (its-defrule (concat small "a") "(I'(B") + (its-defrule (concat small "i") "(I((B") + (its-defrule (concat small "u") "(I)(B") + (its-defrule (concat small "e") "(I*(B") + (its-defrule (concat small "o") "(I+(B") + (its-defrule (concat small "ya") "(I,(B") + (its-defrule (concat small "yu") "(I-(B") + (its-defrule (concat small "yo") "(I.(B") + (its-defrule (concat small "tu") "(I/(B") + (its-defrule (concat small "tsu") "(I/(B") + (its-defrule (concat small "wa") "(I\(B") + ) + + (its-defrule "a" "(I1(B") + (its-defrule "i" "(I2(B") + (its-defrule "u" "(I3(B") + (its-defrule "e" "(I4(B") + (its-defrule "o" "(I5(B") + + (dolist (k '(("ka" "(I6(B") ("ki" "(I7(B") ("ku" "(I8(B") ("ke" "(I9(B") ("ko" "(I:(B") + ("kya" "(I7,(B") ("kyu" "(I7-(B") ("kye" "(I7*(B") ("kyo" "(I7.(B"))) + (its-defrule (car k) (cadr k)) + (its-defrule (concat "k" (car k)) (concat "(I/(B" (cadr k)))) + (its-defoutput "kk" "(I/(Bk") + (its-defoutput "kky" "(I/(Bky") + + (dolist (s '(("sa" "(I;(B") ("si" "(I<(B") ("su" "(I=(B") ("se" "(I>(B") ("so" "(I?(B") + ("sya" "(I<,(B") ("syu" "(I<-(B") ("sye" "(I<*(B") ("syo" "(I<.(B") + ("sha" "(I<,(B") ("shi" "(I<(B") ("shu" "(I<-(B") ("she" "(I<*(B") + ("sho" "(I<.(B"))) + (its-defrule (car s) (cadr s)) + (its-defrule (concat "s" (car s)) (concat "(I/(B" (cadr s)))) + (its-defoutput "ss" "(I/(Bs") + (its-defoutput "ssy" "(I/(Bsy") + (its-defoutput "ssh" "(I/(Bsh") + + (dolist (T '(("ta" "(I@(B") ("ti" "(IA(B") ("tu" "(IB(B") ("te" "(IC(B") ("to" "(ID(B") + ("tya" "(IA,(B") ("tyi" "(IC((B") ("tyu" "(IA-(B") ("tye" "(IA*(B") + ("tyo" "(IA.(B") ("tsu" "(IB(B"))) + (its-defrule (car T) (cadr T)) + (its-defrule (concat "t" (car T)) (concat "(I/(B" (cadr T)))) + (its-defoutput "tt" "(I/(Bt") + (its-defoutput "tty" "(I/(Bty") + (its-defoutput "tts" "(I/(Bts") + + (dolist (c '(("cha" "(IA,(B") ("chi" "(IA(B") ("chu" "(IA-(B") + ("che" "(IA*(B") ("cho" "(IA.(B"))) + (its-defrule (car c) (cadr c)) + (its-defrule (concat "c" (car c)) (concat "(I/(B" (cadr c)))) + (its-defoutput "cc" "(I/(Bc") + (its-defoutput "cch" "(I/(Bch") + + (dolist (h '(("ha" "(IJ(B") ("hi" "(IK(B") ("hu" "(IL(B") ("he" "(IM(B") ("ho" "(IN(B") + ("hya" "(IK,(B") ("hyu" "(IK-(B") ("hye" "(IK*(B") ("hyo" "(IK.(B"))) + (its-defrule (car h) (cadr h)) + (its-defrule (concat "h" (car h)) (concat "(I/(B" (cadr h)))) + (its-defoutput "hh" "(I/(Bh") + (its-defoutput "hhy" "(I/(Bhy") + + (dolist (f '(("fa" "(IL'(B") ("fi" "(IL((B") ("fu" "(IL(B") ("fe" "(IL*(B") + ("fo" "(IL+(B"))) + (its-defrule (car f) (cadr f)) + (its-defrule (concat "f" (car f)) (concat "(I/(B" (cadr f)))) + (its-defoutput "ff" "(I/(Bf") + + (dolist (r '(("ra" "(IW(B") ("ri" "(IX(B") ("ru" "(IY(B") ("re" "(IZ(B") ("ro" "(I[(B") + ("rya" "(IX,(B") ("ryu" "(IX-(B") ("rye" "(IX*(B") ("ryo" "(IX.(B"))) + (its-defrule (car r) (cadr r)) + (its-defrule (concat "r" (car r)) (concat "(I/(B" (cadr r)))) + (its-defoutput "rr" "(I/(Br") + (its-defoutput "rry" "(I/(Bry") + + (dolist (l '(("la" "(IW(B") ("li" "(IX(B") ("lu" "(IY(B") ("le" "(IZ(B") ("lo" "(I[(B") + ("lya" "(IX,(B") ("lyu" "(IX-(B") ("lye" "(IX*(B") ("lyo" "(IX.(B"))) + (its-defrule (car l) (cadr l)) + (its-defrule (concat "l" (car l)) (concat "(I/(B" (cadr l)))) + (its-defoutput "ll" "(I/(Bl") + (its-defoutput "lly" "(I/(Bly") + + (dolist (g '(("ga" "(I6^(B") ("gi" "(I7^(B") ("gu" "(I8^(B") ("ge" "(I9^(B") ("go" "(I:^(B") + ("gya" "(I7^,(B") ("gyu" "(I7^-(B") ("gye" "(I7^*(B") ("gyo" "(I7^.(B"))) + (its-defrule (car g) (cadr g)) + (its-defrule (concat "g" (car g)) (concat "(I/(B" (cadr g)))) + (its-defoutput "gg" "(I/(Bg") + (its-defoutput "ggy" "(I/(Bgy") + + (dolist (z '(("za" "(I;^(B") ("zi" "(I<^(B") ("zu" "(I=^(B") ("ze" "(I>^(B") ("zo" "(I?^(B") + ("zya" "(I<^,(B") ("zyu" "(I<^-(B") ("zye" "(I<^*(B") ("zyo" "(I<^.(B"))) + (its-defrule (car z) (cadr z)) + (its-defrule (concat "z" (car z)) (concat "(I/(B" (cadr z)))) + (its-defoutput "zz" "(I/(Bz") + (its-defoutput "zzy" "(I/(Bzy") + + (dolist (j '(("ja" "(I<^,(B") ("ji" "(I<^(B") ("ju" "(I<^-(B") ("je" "(I<^*(B") + ("jo" "(I<^.(B") ("jya" "(I<^,(B") ("jyu" "(I<^-(B") ("jye" "(I<^*(B") + ("jyo" "(I<^.(B"))) + (its-defrule (car j) (cadr j)) + (its-defrule (concat "j" (car j)) (concat "(I/(B" (cadr j)))) + (its-defoutput "jj" "(I/(Bj") + (its-defoutput "jjy" "(I/(Bjy") + + (dolist (d '(("da" "(I@^(B") ("di" "(IA^(B") ("du" "(IB^(B") ("de" "(IC^(B") ("do" "(ID^(B") + ("dya" "(IA^,(B") ("dyi" "(IC^((B") ("dyu" "(IA^-(B") ("dye" "(IA^*(B") + ("dyo" "(IA^.(B"))) + (its-defrule (car d) (cadr d)) + (its-defrule (concat "d" (car d)) (concat "(I/(B" (cadr d)))) + (its-defoutput "dd" "(I/(Bd") + (its-defoutput "ddy" "(I/(Bdy") + + (dolist (b '(("ba" "(IJ^(B") ("bi" "(IK^(B") ("bu" "(IL^(B") ("be" "(IM^(B") ("bo" "(IN^(B") + ("bya" "(IK^,(B") ("byu" "(IK^-(B") ("bye" "(IK^*(B") ("byo" "(IK^.(B"))) + (its-defrule (car b) (cadr b)) + (its-defrule (concat "b" (car b)) (concat "(I/(B" (cadr b)))) + (its-defoutput "bb" "(I/(Bb") + (its-defoutput "bby" "(I/(Bby") + + (dolist (p '(("pa" "(IJ_(B") ("pi" "(IK_(B") ("pu" "(IL_(B") ("pe" "(IM_(B") ("po" "(IN_(B") + ("pya" "(IK_,(B") ("pyu" "(IK_-(B") ("pye" "(IK_*(B") ("pyo" "(IK_.(B"))) + (its-defrule (car p) (cadr p)) + (its-defrule (concat "p" (car p)) (concat "(I/(B" (cadr p)))) + (its-defoutput "pp" "(I/(Bp") + (its-defoutput "ppy" "(I/(Bpy") + + (dolist (v '(("va" "(I3^'(B") ("vi" "(I3^((B") ("vu" "(I3^(B") ("ve" "(I3^*(B") + ("vo" "(I3^+(B"))) + (its-defrule (car v) (cadr v)) + (its-defrule (concat "v" (car v)) (concat "(I/(B" (cadr v)))) + (its-defoutput "vv" "(I/(Bv") + + (its-defrule "ma" "(IO(B") + (its-defrule "mi" "(IP(B") + (its-defrule "mu" "(IQ(B") + (its-defrule "me" "(IR(B") + (its-defrule "mo" "(IS(B") + (its-defrule "mya" "(IP,(B") + (its-defrule "myu" "(IP-(B") + (its-defrule "mye" "(IP*(B") + (its-defrule "myo" "(IP.(B") + (its-defrule "ya" "(IT(B") + (its-defrule "yi" "(I2(B") + (its-defrule "yu" "(IU(B") + (its-defrule "yo" "(IV(B") + (its-defrule "ye" "(I2*(B") + (its-defrule "wa" "(I\(B") + (its-defrule "wi" "(I((B") + (its-defrule "wu" "(I3(B") + (its-defrule "we" "(I*(B") + (its-defrule "wo" "(I&(B") + + (its-defrule "kwa" "(I8\(B") + (its-defrule "kwi" "(I8((B") + (its-defrule "kwu" "(I8(B") + (its-defrule "kwe" "(I8*(B") + (its-defrule "kwo" "(I8+(B") + (its-defrule "gwa" "(I8^\(B") + (its-defrule "gwi" "(I8^((B") + (its-defrule "gwu" "(I8^(B") + (its-defrule "gwe" "(I8^*(B") + (its-defrule "gwo" "(I8^+(B") + (its-defrule "tsa" "(IB'(B") + (its-defrule "tsi" "(IB((B") + (its-defrule "tse" "(IB*(B") + (its-defrule "tso" "(IB+(B") + + (its-defrule "na" "(IE(B") + (its-defrule "ni" "(IF(B") + (its-defrule "nu" "(IG(B") + (its-defrule "ne" "(IH(B") + (its-defrule "no" "(II(B") + (its-defrule "nya" "(IF,(B") + (its-defrule "nyu" "(IF-(B") + (its-defrule "nye" "(IF*(B") + (its-defrule "nyo" "(IF.(B") + + (its-defrule "xti" "(IC((B") + (its-defrule "xdi" "(IC^((B") + (its-defrule "xdu" "(ID^)(B") + (its-defrule "xde" "(IC^*(B") + (its-defrule "xdo" "(ID^+(B") + (its-defrule "xwi" "(I3((B") + (its-defrule "xwe" "(I3*(B") + (its-defrule "xwo" "(I3+(B") + +;;; +;;; Symbol inputs +;;; + + (dolist (digit '( "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" )) + (its-defrule (concat its-hankaku-escape digit) digit)) + + (dolist (symbol '( " " "!" "@" "#" "$" "%" "^" "&" "*" "(" ")" + "-" "=" "`" "\\" "|" "_" "+" "~" "[" "]" "{" "}" + ":" ";" "\"" "'" "<" ">" "?" "/" "," "." )) + (its-defrule (concat its-hankaku-escape symbol) symbol)) + + (dolist (downcase '("a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" + "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z")) + (its-defrule (concat its-hankaku-escape downcase) downcase)) + + (dolist (upcase '("A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" + "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z")) + (its-defrule (concat its-hankaku-escape upcase) upcase))) + +(define-its-state-machine-append its-han-kata-map + (if its-han-kata-enable-double-n + (its-defrule "nn" "(I](B")) + + (its-defrule "-" its-han-kata-horizontal) + (its-defrule "[" its-han-kata-open-bracket) + (its-defrule "]" its-han-kata-close-bracket) + (its-defrule "." its-han-kata-period) + (its-defrule "," its-han-kata-comma) + ) + +(provide 'its/hankata) +;;; its/kata.el ends here. diff --git a/its/hira.el b/its/hira.el new file mode 100644 index 0000000..502c362 --- /dev/null +++ b/its/hira.el @@ -0,0 +1,494 @@ +;;; its/hira.el --- Hiragana Input in Egg Input Method Architecture + +;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. +;; Licensed to the Free Software Foundation. + +;; Author: Satoru Tomura +;; jiro@math.keio.ac.jp (TANAKA Jiro) + +;; Maintainer: TOMURA Satoru + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: +;; +;; Symbol input is desined by jiro@math.keio.ac.jp (TANAKA Jiro) +;; This file is based on the rules of its/hira.el in Mule-2.3 distribution. +;; + +;;; Code: + +(eval-when-compile + (require 'its) + (require 'cl)) + +(eval-when (compile) + (defconst its-compaction-enable t)) + +(defvar its-hira-enable-zenkaku-alphabet + (if (boundp 'its-enable-fullwidth-alphabet) + its-enable-fullwidth-alphabet + t) + "*Enable Zenkaku alphabet") + +(defvar its-hira-enable-double-n nil "*Enable \"nn\" input for \"$B$s(B\" ") +(defvar its-hira-period "$B!#(B" "*$B%T%j%*%I(B") ; ". " "$B!%(B" +(defvar its-hira-comma "$B!"(B" "*$B%3%s%^(B") ; ", " "$B!$(B" +(defvar its-hira-open-bracket "$B!V(B" "*[") ; "$B!N(B" +(defvar its-hira-close-bracket "$B!W(B" "*]") ; "$B!O(B" +(defvar its-hira-horizontal "$B!<(B" "*-") ; "$B!](B" + +(define-its-state-machine its-hira-map + "roma-kana" "$B$"(B" Japanese + "Map for Romaji-Hiragana translation. (Japanese)" + + (defconst its-zenkaku-escape "Z") ;; Escape character to Zenkaku inputs + (defconst its-hankaku-escape "~") ;; Escape character to Hankaku inputs + + (its-defrule-select-mode-temporally "q" downcase) + (its-defrule-select-mode-temporally "Q" zenkaku-downcase) + +;;; k k +;;; kk $B$C(Bk +;;; kka $B$C$+(B +;;; +;;; kkk $B$C(Bk DING! + + (its-defrule "tch" "$B$C(B" -2) + +;;; $B!V$s!W$NF~NO(B + + (dolist (q1 '("b" "m" "p")) + (its-defrule (concat "m" q1) "$B$s(B" -1)) + + (its-defrule* "n" "$B$s(B") + (its-defrule "n'" "$B$s(B") + (its-defrule "N" "$B$s(B") + + (let ((small '"x" )) + (its-defrule (concat small "a") "$B$!(B") + (its-defrule (concat small "i") "$B$#(B") + (its-defrule (concat small "u") "$B$%(B") + (its-defrule (concat small "e") "$B$'(B") + (its-defrule (concat small "o") "$B$)(B") + (its-defrule (concat small "ya") "$B$c(B") + (its-defrule (concat small "yu") "$B$e(B") + (its-defrule (concat small "yo") "$B$g(B") + (its-defrule (concat small "tu") "$B$C(B") + (its-defrule (concat small "tsu") "$B$C(B") + (its-defrule (concat small "wa") "$B$n(B") + ) + + (its-defrule "a" "$B$"(B") + (its-defrule "i" "$B$$(B") + (its-defrule "u" "$B$&(B") + (its-defrule "e" "$B$((B") + (its-defrule "o" "$B$*(B") + + (dolist (k '(("ka" "$B$+(B") ("ki" "$B$-(B") ("ku" "$B$/(B") ("ke" "$B$1(B") ("ko" "$B$3(B") + ("kya" "$B$-$c(B") ("kyu" "$B$-$e(B") ("kye" "$B$-$'(B") ("kyo" "$B$-$g(B"))) + (its-defrule (car k) (cadr k)) + (its-defrule (concat "k" (car k)) (concat "$B$C(B" (cadr k)))) + (its-defoutput "kk" "$B$C(Bk") + (its-defoutput "kky" "$B$C(Bky") + + (dolist (s '(("sa" "$B$5(B") ("si" "$B$7(B") ("su" "$B$9(B") ("se" "$B$;(B") ("so" "$B$=(B") + ("sya" "$B$7$c(B") ("syu" "$B$7$e(B") ("sye" "$B$7$'(B") ("syo" "$B$7$g(B") + ("sha" "$B$7$c(B") ("shi" "$B$7(B") ("shu" "$B$7$e(B") ("she" "$B$7$'(B") + ("sho" "$B$7$g(B"))) + (its-defrule (car s) (cadr s)) + (its-defrule (concat "s" (car s)) (concat "$B$C(B" (cadr s)))) + (its-defoutput "ss" "$B$C(Bs") + (its-defoutput "ssy" "$B$C(Bsy") + (its-defoutput "ssh" "$B$C(Bsh") + + (dolist (T '(("ta" "$B$?(B") ("ti" "$B$A(B") ("tu" "$B$D(B") ("te" "$B$F(B") ("to" "$B$H(B") + ("tya" "$B$A$c(B") ("tyi" "$B$F$#(B") ("tyu" "$B$A$e(B") ("tye" "$B$A$'(B") + ("tyo" "$B$A$g(B") ("tsu" "$B$D(B"))) + (its-defrule (car T) (cadr T)) + (its-defrule (concat "t" (car T)) (concat "$B$C(B" (cadr T)))) + (its-defoutput "tt" "$B$C(Bt") + (its-defoutput "tty" "$B$C(Bty") + (its-defoutput "tts" "$B$C(Bts") + + (dolist (c '(("cha" "$B$A$c(B") ("chi" "$B$A(B") ("chu" "$B$A$e(B") + ("che" "$B$A$'(B") ("cho" "$B$A$g(B"))) + (its-defrule (car c) (cadr c)) + (its-defrule (concat "c" (car c)) (concat "$B$C(B" (cadr c)))) + (its-defoutput "cc" "$B$C(Bc") + (its-defoutput "cch" "$B$C(Bch") + + (dolist (h '(("ha" "$B$O(B") ("hi" "$B$R(B") ("hu" "$B$U(B") ("he" "$B$X(B") ("ho" "$B$[(B") + ("hya" "$B$R$c(B") ("hyu" "$B$R$e(B") ("hye" "$B$R$'(B") ("hyo" "$B$R$g(B"))) + (its-defrule (car h) (cadr h)) + (its-defrule (concat "h" (car h)) (concat "$B$C(B" (cadr h)))) + (its-defoutput "hh" "$B$C(Bh") + (its-defoutput "hhy" "$B$C(Bhy") + + (dolist (f '(("fa" "$B$U$!(B") ("fi" "$B$U$#(B") ("fu" "$B$U(B") ("fe" "$B$U$'(B") + ("fo" "$B$U$)(B"))) + (its-defrule (car f) (cadr f)) + (its-defrule (concat "f" (car f)) (concat "$B$C(B" (cadr f)))) + (its-defoutput "ff" "$B$C(Bf") + + (dolist (r '(("ra" "$B$i(B") ("ri" "$B$j(B") ("ru" "$B$k(B") ("re" "$B$l(B") ("ro" "$B$m(B") + ("rya" "$B$j$c(B") ("ryu" "$B$j$e(B") ("rye" "$B$j$'(B") ("ryo" "$B$j$g(B"))) + (its-defrule (car r) (cadr r)) + (its-defrule (concat "r" (car r)) (concat "$B$C(B" (cadr r)))) + (its-defoutput "rr" "$B$C(Br") + (its-defoutput "rry" "$B$C(Bry") + + (dolist (l '(("la" "$B$i(B") ("li" "$B$j(B") ("lu" "$B$k(B") ("le" "$B$l(B") ("lo" "$B$m(B") + ("lya" "$B$j$c(B") ("lyu" "$B$j$e(B") ("lye" "$B$j$'(B") ("lyo" "$B$j$g(B"))) + (its-defrule (car l) (cadr l)) + (its-defrule (concat "l" (car l)) (concat "$B$C(B" (cadr l)))) + (its-defoutput "ll" "$B$C(Bl") + (its-defoutput "lly" "$B$C(Bly") + + (dolist (g '(("ga" "$B$,(B") ("gi" "$B$.(B") ("gu" "$B$0(B") ("ge" "$B$2(B") ("go" "$B$4(B") + ("gya" "$B$.$c(B") ("gyu" "$B$.$e(B") ("gye" "$B$.$'(B") ("gyo" "$B$.$g(B"))) + (its-defrule (car g) (cadr g)) + (its-defrule (concat "g" (car g)) (concat "$B$C(B" (cadr g)))) + (its-defoutput "gg" "$B$C(Bg") + (its-defoutput "ggy" "$B$C(Bgy") + + (dolist (z '(("za" "$B$6(B") ("zi" "$B$8(B") ("zu" "$B$:(B") ("ze" "$B$<(B") ("zo" "$B$>(B") + ("zya" "$B$8$c(B") ("zyu" "$B$8$e(B") ("zye" "$B$8$'(B") ("zyo" "$B$8$g(B"))) + (its-defrule (car z) (cadr z)) + (its-defrule (concat "z" (car z)) (concat "$B$C(B" (cadr z)))) + (its-defoutput "zz" "$B$C(Bz") + (its-defoutput "zzy" "$B$C(Bzy") + + (dolist (j '(("ja" "$B$8$c(B") ("ji" "$B$8(B") ("ju" "$B$8$e(B") ("je" "$B$8$'(B") + ("jo" "$B$8$g(B") ("jya" "$B$8$c(B") ("jyu" "$B$8$e(B") ("jye" "$B$8$'(B") + ("jyo" "$B$8$g(B"))) + (its-defrule (car j) (cadr j)) + (its-defrule (concat "j" (car j)) (concat "$B$C(B" (cadr j)))) + (its-defoutput "jj" "$B$C(Bj") + (its-defoutput "jjy" "$B$C(Bjy") + + (dolist (d '(("da" "$B$@(B") ("di" "$B$B(B") ("du" "$B$E(B") ("de" "$B$G(B") ("do" "$B$I(B") + ("dya" "$B$B$c(B") ("dyi" "$B$G$#(B") ("dyu" "$B$B$e(B") ("dye" "$B$B$'(B") + ("dyo" "$B$B$g(B"))) + (its-defrule (car d) (cadr d)) + (its-defrule (concat "d" (car d)) (concat "$B$C(B" (cadr d)))) + (its-defoutput "dd" "$B$C(Bd") + (its-defoutput "ddy" "$B$C(Bdy") + + (dolist (b '(("ba" "$B$P(B") ("bi" "$B$S(B") ("bu" "$B$V(B") ("be" "$B$Y(B") ("bo" "$B$\(B") + ("bya" "$B$S$c(B") ("byu" "$B$S$e(B") ("bye" "$B$S$'(B") ("byo" "$B$S$g(B"))) + (its-defrule (car b) (cadr b)) + (its-defrule (concat "b" (car b)) (concat "$B$C(B" (cadr b)))) + (its-defoutput "bb" "$B$C(Bb") + (its-defoutput "bby" "$B$C(Bby") + + (dolist (p '(("pa" "$B$Q(B") ("pi" "$B$T(B") ("pu" "$B$W(B") ("pe" "$B$Z(B") ("po" "$B$](B") + ("pya" "$B$T$c(B") ("pyu" "$B$T$e(B") ("pye" "$B$T$'(B") ("pyo" "$B$T$g(B"))) + (its-defrule (car p) (cadr p)) + (its-defrule (concat "p" (car p)) (concat "$B$C(B" (cadr p)))) + (its-defoutput "pp" "$B$C(Bp") + (its-defoutput "ppy" "$B$C(Bpy") + + (dolist (v '(("va" "$B%t$!(B") ("vi" "$B%t$#(B") ("vu" "$B%t(B") ("ve" "$B%t$'(B") + ("vo" "$B%t$)(B"))) + (its-defrule (car v) (cadr v)) + (its-defrule (concat "v" (car v)) (concat "$B$C(B" (cadr v)))) + (its-defoutput "vv" "$B$C(Bv") + + (its-defrule "ma" "$B$^(B") + (its-defrule "mi" "$B$_(B") + (its-defrule "mu" "$B$`(B") + (its-defrule "me" "$B$a(B") + (its-defrule "mo" "$B$b(B") + (its-defrule "mya" "$B$_$c(B") + (its-defrule "myu" "$B$_$e(B") + (its-defrule "mye" "$B$_$'(B") + (its-defrule "myo" "$B$_$g(B") + (its-defrule "ya" "$B$d(B") + (its-defrule "yi" "$B$$(B") + (its-defrule "yu" "$B$f(B") + (its-defrule "yo" "$B$h(B") + (its-defrule "ye" "$B$$$'(B") + (its-defrule "wa" "$B$o(B") + (its-defrule "wi" "$B$p(B") + (its-defrule "wu" "$B$&(B") + (its-defrule "we" "$B$q(B") + (its-defrule "wo" "$B$r(B") + + (its-defrule "kwa" "$B$/$n(B") + (its-defrule "kwi" "$B$/$#(B") + (its-defrule "kwu" "$B$/(B") + (its-defrule "kwe" "$B$/$'(B") + (its-defrule "kwo" "$B$/$)(B") + (its-defrule "gwa" "$B$0$n(B") + (its-defrule "gwi" "$B$0$#(B") + (its-defrule "gwu" "$B$0(B") + (its-defrule "gwe" "$B$0$'(B") + (its-defrule "gwo" "$B$0$)(B") + (its-defrule "tsa" "$B$D$!(B") + (its-defrule "tsi" "$B$D$#(B") + (its-defrule "tse" "$B$D$'(B") + (its-defrule "tso" "$B$D$)(B") + + (its-defrule "na" "$B$J(B") + (its-defrule "ni" "$B$K(B") + (its-defrule "nu" "$B$L(B") + (its-defrule "ne" "$B$M(B") + (its-defrule "no" "$B$N(B") + (its-defrule "nya" "$B$K$c(B") + (its-defrule "nyu" "$B$K$e(B") + (its-defrule "nye" "$B$K$'(B") + (its-defrule "nyo" "$B$K$g(B") + + (its-defrule "xka" "$B%u(B") + (its-defrule "xke" "$B%v(B") + (its-defrule "xti" "$B$F$#(B") + (its-defrule "xdi" "$B$G$#(B") + (its-defrule "xdu" "$B$I$%(B") + (its-defrule "xde" "$B$G$'(B") + (its-defrule "xdo" "$B$I$)(B") + (its-defrule "xwi" "$B$&$#(B") + (its-defrule "xwe" "$B$&$'(B") + (its-defrule "xwo" "$B$&$)(B") + +;;; +;;; Zenkaku inputs +;;; + + (its-defrule (concat its-zenkaku-escape "0") "$B#0(B") + (its-defrule (concat its-zenkaku-escape "1") "$B#1(B") + (its-defrule (concat its-zenkaku-escape "2") "$B#2(B") + (its-defrule (concat its-zenkaku-escape "3") "$B#3(B") + (its-defrule (concat its-zenkaku-escape "4") "$B#4(B") + (its-defrule (concat its-zenkaku-escape "5") "$B#5(B") + (its-defrule (concat its-zenkaku-escape "6") "$B#6(B") + (its-defrule (concat its-zenkaku-escape "7") "$B#7(B") + (its-defrule (concat its-zenkaku-escape "8") "$B#8(B") + (its-defrule (concat its-zenkaku-escape "9") "$B#9(B") + + (its-defrule (concat its-zenkaku-escape "A") "$B#A(B") + (its-defrule (concat its-zenkaku-escape "B") "$B#B(B") + (its-defrule (concat its-zenkaku-escape "C") "$B#C(B") + (its-defrule (concat its-zenkaku-escape "D") "$B#D(B") + (its-defrule (concat its-zenkaku-escape "E") "$B#E(B") + (its-defrule (concat its-zenkaku-escape "F") "$B#F(B") + (its-defrule (concat its-zenkaku-escape "G") "$B#G(B") + (its-defrule (concat its-zenkaku-escape "H") "$B#H(B") + (its-defrule (concat its-zenkaku-escape "I") "$B#I(B") + (its-defrule (concat its-zenkaku-escape "J") "$B#J(B") + (its-defrule (concat its-zenkaku-escape "K") "$B#K(B") + (its-defrule (concat its-zenkaku-escape "L") "$B#L(B") + (its-defrule (concat its-zenkaku-escape "M") "$B#M(B") + (its-defrule (concat its-zenkaku-escape "N") "$B#N(B") + (its-defrule (concat its-zenkaku-escape "O") "$B#O(B") + (its-defrule (concat its-zenkaku-escape "P") "$B#P(B") + (its-defrule (concat its-zenkaku-escape "Q") "$B#Q(B") + (its-defrule (concat its-zenkaku-escape "R") "$B#R(B") + (its-defrule (concat its-zenkaku-escape "S") "$B#S(B") + (its-defrule (concat its-zenkaku-escape "T") "$B#T(B") + (its-defrule (concat its-zenkaku-escape "U") "$B#U(B") + (its-defrule (concat its-zenkaku-escape "V") "$B#V(B") + (its-defrule (concat its-zenkaku-escape "W") "$B#W(B") + (its-defrule (concat its-zenkaku-escape "X") "$B#X(B") + (its-defrule (concat its-zenkaku-escape "Y") "$B#Y(B") + (its-defrule (concat its-zenkaku-escape "Z") "$B#Z(B") + + (its-defrule (concat its-zenkaku-escape "a") "$B#a(B") + (its-defrule (concat its-zenkaku-escape "b") "$B#b(B") + (its-defrule (concat its-zenkaku-escape "c") "$B#c(B") + (its-defrule (concat its-zenkaku-escape "d") "$B#d(B") + (its-defrule (concat its-zenkaku-escape "e") "$B#e(B") + (its-defrule (concat its-zenkaku-escape "f") "$B#f(B") + (its-defrule (concat its-zenkaku-escape "g") "$B#g(B") + (its-defrule (concat its-zenkaku-escape "h") "$B#h(B") + (its-defrule (concat its-zenkaku-escape "i") "$B#i(B") + (its-defrule (concat its-zenkaku-escape "j") "$B#j(B") + (its-defrule (concat its-zenkaku-escape "k") "$B#k(B") + (its-defrule (concat its-zenkaku-escape "l") "$B#l(B") + (its-defrule (concat its-zenkaku-escape "m") "$B#m(B") + (its-defrule (concat its-zenkaku-escape "n") "$B#n(B") + (its-defrule (concat its-zenkaku-escape "o") "$B#o(B") + (its-defrule (concat its-zenkaku-escape "p") "$B#p(B") + (its-defrule (concat its-zenkaku-escape "q") "$B#q(B") + (its-defrule (concat its-zenkaku-escape "r") "$B#r(B") + (its-defrule (concat its-zenkaku-escape "s") "$B#s(B") + (its-defrule (concat its-zenkaku-escape "t") "$B#t(B") + (its-defrule (concat its-zenkaku-escape "u") "$B#u(B") + (its-defrule (concat its-zenkaku-escape "v") "$B#v(B") + (its-defrule (concat its-zenkaku-escape "w") "$B#w(B") + (its-defrule (concat its-zenkaku-escape "x") "$B#x(B") + (its-defrule (concat its-zenkaku-escape "y") "$B#y(B") + (its-defrule (concat its-zenkaku-escape "z") "$B#z(B") + + (its-defrule (concat its-zenkaku-escape " ") "$B!!(B") + (its-defrule (concat its-zenkaku-escape "!") "$B!*(B") + (its-defrule (concat its-zenkaku-escape "@") "$B!w(B") + (its-defrule (concat its-zenkaku-escape "#") "$B!t(B") + (its-defrule (concat its-zenkaku-escape "$") "$B!p(B") + (its-defrule (concat its-zenkaku-escape "%") "$B!s(B") + (its-defrule (concat its-zenkaku-escape "^") "$B!0(B") + (its-defrule (concat its-zenkaku-escape "&") "$B!u(B") + (its-defrule (concat its-zenkaku-escape "*") "$B!v(B") + (its-defrule (concat its-zenkaku-escape "(") "$B!J(B") + (its-defrule (concat its-zenkaku-escape ")") "$B!K(B") + (its-defrule (concat its-zenkaku-escape "-") "$B!](B") + (its-defrule (concat its-zenkaku-escape "=") "$B!a(B") + (its-defrule (concat its-zenkaku-escape "`") "$B!.(B") + (its-defrule (concat its-zenkaku-escape "\\") "$B!o(B") + (its-defrule (concat its-zenkaku-escape "|") "$B!C(B") + (its-defrule (concat its-zenkaku-escape "_") "$B!2(B") + (its-defrule (concat its-zenkaku-escape "+") "$B!\(B") + (its-defrule (concat its-zenkaku-escape "~") "$B!1(B") + (its-defrule (concat its-zenkaku-escape "[") "$B!N(B") + (its-defrule (concat its-zenkaku-escape "]") "$B!O(B") + (its-defrule (concat its-zenkaku-escape "{") "$B!P(B") + (its-defrule (concat its-zenkaku-escape "}") "$B!Q(B") + (its-defrule (concat its-zenkaku-escape ":") "$B!'(B") + (its-defrule (concat its-zenkaku-escape ";") "$B!((B") + (its-defrule (concat its-zenkaku-escape "\"") "$B!I(B") + (its-defrule (concat its-zenkaku-escape "'") "$B!G(B") + (its-defrule (concat its-zenkaku-escape "<") "$B!c(B") + (its-defrule (concat its-zenkaku-escape ">") "$B!d(B") + (its-defrule (concat its-zenkaku-escape "?") "$B!)(B") + (its-defrule (concat its-zenkaku-escape "/") "$B!?(B") + (its-defrule (concat its-zenkaku-escape ",") "$B!$(B") + (its-defrule (concat its-zenkaku-escape ".") "$B!%(B") + +;;; +;;; Hankaku inputs +;;; + + (dolist (digit '( "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" )) + (its-defrule (concat its-hankaku-escape digit) digit)) + + (dolist (symbol '( " " "!" "@" "#" "$" "%" "^" "&" "*" "(" ")" + "-" "=" "`" "\\" "|" "_" "+" "~" "[" "]" "{" "}" + ":" ";" "\"" "'" "<" ">" "?" "/" "," "." )) + (its-defrule (concat its-hankaku-escape symbol) symbol)) + + (dolist (downcase '("a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" + "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z")) + (its-defrule (concat its-hankaku-escape downcase) downcase)) + + (dolist (upcase '("A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" + "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z")) + (its-defrule (concat its-hankaku-escape upcase) upcase)) + +;; SYMBOL Input + (its-defrule "z1" "$B!{(B") (its-defrule "z!" "$B!|(B") + (its-defrule "z2" "$B"&(B") (its-defrule "z@" "$B"'(B") + (its-defrule "z3" "$B"$(B") (its-defrule "z#" "$B"%(B") + (its-defrule "z4" "$B""(B") (its-defrule "z$" "$B"#(B") + (its-defrule "z5" "$B!~(B") (its-defrule "z%" "$B"!(B") + (its-defrule "z6" "$B!y(B") (its-defrule "z^" "$B!z(B") + (its-defrule "z7" "$B!}(B") (its-defrule "z&" "$B!r(B") + (its-defrule "z8" "$B!q(B") (its-defrule "z*" "$B!_(B") + (its-defrule "z9" "$B!i(B") (its-defrule "z(" "$B!Z(B") + (its-defrule "z0" "$B!j(B") (its-defrule "z)" "$B![(B") + (its-defrule "z-" "$B!A(B") (its-defrule "z_" "$B!h(B") + (its-defrule "z=" "$B!b(B") (its-defrule "z+" "$B!^(B") + (its-defrule "z\\" "$B!@(B") (its-defrule "z|" "$B!B(B") + (its-defrule "z`" "$B!-(B") (its-defrule "z~" "$B!/(B") + + (its-defrule "zq" "$B!T(B") (its-defrule "zQ" "$B!R(B") + (its-defrule "zw" "$B!U(B") (its-defrule "zW" "$B!S(B") + ; e + (its-defrule "zr" "$B!9(B") (its-defrule "zR" "$B!8(B") + (its-defrule "zt" "$B!:(B") (its-defrule "zT" "$B!x(B") + ; y u i o + (its-defrule "zp" "$B")(B") (its-defrule "zP" "$B",(B") + (its-defrule "z[" "$B!X(B") (its-defrule "z{" "$B!L(B") + (its-defrule "z]" "$B!Y(B") (its-defrule "z}" "$B!M(B") + + ; a + (its-defrule "zs" "$B!3(B") (its-defrule "zS" "$B!4(B") + (its-defrule "zd" "$B!5(B") (its-defrule "zD" "$B!6(B") + (its-defrule "zf" "$B!7(B") (its-defrule "zF" "$B"*(B") + (its-defrule "zg" "$B!>(B") (its-defrule "zG" "$B!=(B") + (its-defrule "zh" "$B"+(B") + (its-defrule "zj" "$B"-(B") + (its-defrule "zk" "$B",(B") + (its-defrule "zl" "$B"*(B") + (its-defrule "z;" "$B!+(B") (its-defrule "z:" "$B!,(B") + (its-defrule "z\'" "$B!F(B") (its-defrule "z\"" "$B!H(B") + + ; z + (its-defrule "zx" ":-") (its-defrule "zX" ":-)") + (its-defrule "zc" "$B!;(B") (its-defrule "zC" "$B!n(B") + (its-defrule "zv" "$B"((B") (its-defrule "zV" "$B!`(B") + (its-defrule "zb" "$B!k(B") (its-defrule "zB" "$B"+(B") + (its-defrule "zn" "$B!l(B") (its-defrule "zN" "$B"-(B") + (its-defrule "zm" "$B!m(B") (its-defrule "zM" "$B".(B") + (its-defrule "z," "$B!E(B") (its-defrule "z<" "$B!e(B") + (its-defrule "z." "$B!D(B") (its-defrule "z>" "$B!f(B") + (its-defrule "z/" "$B!&(B") (its-defrule "z?" "$B!g(B") + ) + +(define-its-state-machine-append its-hira-map + (if its-hira-enable-double-n + (its-defrule "nn" "$B$s(B")) + + (its-defrule "-" its-hira-horizontal) + (its-defrule "[" its-hira-open-bracket) + (its-defrule "]" its-hira-close-bracket) + (its-defrule "." its-hira-period) + (its-defrule "," its-hira-comma) + + (if its-hira-enable-zenkaku-alphabet + (progn + (its-defrule "1" "$B#1(B") (its-defrule "2" "$B#2(B") + (its-defrule "3" "$B#3(B") (its-defrule "4" "$B#4(B") + (its-defrule "5" "$B#5(B") (its-defrule "6" "$B#6(B") + (its-defrule "7" "$B#7(B") (its-defrule "8" "$B#8(B") + (its-defrule "9" "$B#9(B") (its-defrule "0" "$B#0(B") + (its-defrule "!" "$B!*(B") (its-defrule "@" "$B!w(B") + (its-defrule "#" "$B!t(B") (its-defrule "$" "$B!p(B") + (its-defrule "%" "$B!s(B") (its-defrule "^" "$B!0(B") + (its-defrule "&" "$B!u(B") (its-defrule "*" "$B!v(B") + (its-defrule "(" "$B!J(B") (its-defrule ")" "$B!K(B") + (its-defrule "=" "$B!a(B") (its-defrule "`" "$B!.(B") + (its-defrule "\\" "$B!o(B") (its-defrule "|" "$B!C(B") + (its-defrule "_" "$B!2(B") (its-defrule "+" "$B!\(B") + (its-defrule "{" "$B!P(B") (its-defrule "}" "$B!Q(B") + (its-defrule ":" "$B!'(B") (its-defrule ";" "$B!((B") + (its-defrule "\"" "$B!I(B") (its-defrule "'" "$B!G(B") + (its-defrule "<" "$B!c(B") (its-defrule ">" "$B!d(B") + (its-defrule "?" "$B!)(B") (its-defrule "/" "$B!?(B")) + (progn + (its-defrule "1" "1") (its-defrule "2" "2") + (its-defrule "3" "3") (its-defrule "4" "4") + (its-defrule "5" "5") (its-defrule "6" "6") + (its-defrule "7" "7") (its-defrule "8" "8") + (its-defrule "9" "9") (its-defrule "0" "0") + (its-defrule "!" "!") (its-defrule "@" "@") + (its-defrule "#" "#") (its-defrule "$" "$") + (its-defrule "%" "%") (its-defrule "^" "^") + (its-defrule "&" "&") (its-defrule "*" "*") + (its-defrule "(" "(") (its-defrule ")" ")") + (its-defrule "=" "=") (its-defrule "`" "`") + (its-defrule "\\" "\\") (its-defrule "|" "|") + (its-defrule "_" "_") (its-defrule "+" "+") + (its-defrule "{" "{") (its-defrule "}" "}") + (its-defrule ":" ":") (its-defrule ";" ";") + (its-defrule "\"" "\"") (its-defrule "'" "'") + (its-defrule "<" "<") (its-defrule ">" ">") + (its-defrule "?" "?") (its-defrule "/" "/"))) + ) + +(provide 'its/hira) +;;; its/hira.el ends here. diff --git a/its/jeonkak.el b/its/jeonkak.el new file mode 100644 index 0000000..2775e3b --- /dev/null +++ b/its/jeonkak.el @@ -0,0 +1,111 @@ +;;; its/jeonkak.el --- Jeonkak ASCII Input in Egg Input Method Architecture + +;; Copyright (C) 1999,2000 PFU LIMITED + +;; Author: KATAYAMA Yoshio + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: +;; +;; Symbol input is desined by jiro@math.keio.ac.jp (TANAKA Jiro) +;; This file is based on the rules of its/hira.el in Mule-2.3 distribution. +;; + +;;; Code: + + + +(eval-when-compile + (require 'its)) + +(define-its-state-machine its-jeonkak-up-map + "jeonkak-upcase" "$(C#A(B" Korean + "Map for jeonkak-upcase input." + + (dolist (ascii '(("1" . "$(C#1(B") ("2" . "$(C#2(B") ("3" . "$(C#3(B") ("4" . "$(C#4(B") + ("5" . "$(C#5(B") ("6" . "$(C#6(B") ("7" . "$(C#7(B") ("8" . "$(C#8(B") + ("9" . "$(C#9(B") ("0" . "$(C#0(B") + (" " . "$(C!!(B") ("!" . "$(C#!(B") ("@" . "$(C#@(B") ("#" . "$(C##(B") + ("$" . "$(C#$(B") ("%" . "$(C#%(B") ("^" . "$(C#^(B") ("&" . "$(C#&(B") + ("*" . "$(C#*(B") ("(" . "$(C#((B") (")" . "$(C#)(B") + ("-" . "$(C#-(B") ("=" . "$(C#=(B") ("`" . "$(C#`(B") ("\\" . "$(C#\(B") + ("|" . "$(C#|(B") ("_" . "$(C#_(B") ("+" . "$(C#+(B") ("~" . "$(C#~(B") + ("[" . "$(C!8(B") ("]" . "$(C!9(B") ("{" . "$(C#{(B") ("}" . "$(C#}(B") + (":" . "$(C#:(B") (";" . "$(C#;(B") ("\"" . "$(C#"(B") ("'" . "$(C#'(B") + ("<" . "$(C#<(B") (">" . "$(C#>(B") ("?" . "$(C#?(B") ("/" . "$(C#/(B") + ("," . "$(C#,(B") ("." . "$(C#.(B") + ("a" . "$(C#A(B") ("b" . "$(C#B(B") ("c" . "$(C#C(B") ("d" . "$(C#D(B") + ("e" . "$(C#E(B") ("f" . "$(C#F(B") ("g" . "$(C#G(B") ("h" . "$(C#H(B") + ("i" . "$(C#I(B") ("j" . "$(C#J(B") ("k" . "$(C#K(B") ("l" . "$(C#L(B") + ("m" . "$(C#M(B") ("n" . "$(C#N(B") ("o" . "$(C#O(B") ("p" . "$(C#P(B") + ("q" . "$(C#Q(B") ("r" . "$(C#R(B") ("s" . "$(C#S(B") ("t" . "$(C#T(B") + ("u" . "$(C#U(B") ("v" . "$(C#V(B") ("w" . "$(C#W(B") ("x" . "$(C#X(B") + ("y" . "$(C#Y(B") ("z" . "$(C#Z(B") + ("A" . "$(C#A(B") ("B" . "$(C#B(B") ("C" . "$(C#C(B") ("D" . "$(C#D(B") + ("E" . "$(C#E(B") ("F" . "$(C#F(B") ("G" . "$(C#G(B") ("H" . "$(C#H(B") + ("I" . "$(C#I(B") ("J" . "$(C#J(B") ("K" . "$(C#K(B") ("L" . "$(C#L(B") + ("M" . "$(C#M(B") ("N" . "$(C#N(B") ("O" . "$(C#O(B") ("P" . "$(C#P(B") + ("Q" . "$(C#Q(B") ("R" . "$(C#R(B") ("S" . "$(C#S(B") ("T" . "$(C#T(B") + ("U" . "$(C#U(B") ("V" . "$(C#V(B") ("W" . "$(C#W(B") ("X" . "$(C#X(B") + ("Y" . "$(C#Y(B") ("Z" . "$(C#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule in out)))) + +(define-its-state-machine-append its-jeonkak-up-map) + +(define-its-state-machine its-jeonkak-down-map + "jeonkak-downcase" "$(C#a(B" Korean + "Map for jeonkak-downcase input." + + (dolist (ascii '(("1" . "$(C#1(B") ("2" . "$(C#2(B") ("3" . "$(C#3(B") ("4" . "$(C#4(B") + ("5" . "$(C#5(B") ("6" . "$(C#6(B") ("7" . "$(C#7(B") ("8" . "$(C#8(B") + ("9" . "$(C#9(B") ("0" . "$(C#0(B") + (" " . "$(C!!(B") ("!" . "$(C#!(B") ("@" . "$(C#@(B") ("#" . "$(C##(B") + ("$" . "$(C#$(B") ("%" . "$(C#%(B") ("^" . "$(C#^(B") ("&" . "$(C#&(B") + ("*" . "$(C#*(B") ("(" . "$(C#((B") (")" . "$(C#)(B") + ("-" . "$(C#-(B") ("=" . "$(C#=(B") ("`" . "$(C#`(B") ("\\" . "$(C#\(B") + ("|" . "$(C#|(B") ("_" . "$(C#_(B") ("+" . "$(C#+(B") ("~" . "$(C#~(B") + ("[" . "$(C!8(B") ("]" . "$(C!9(B") ("{" . "$(C#{(B") ("}" . "$(C#}(B") + (":" . "$(C#:(B") (";" . "$(C#;(B") ("\"" . "$(C#"(B") ("'" . "$(C#'(B") + ("<" . "$(C#<(B") (">" . "$(C#>(B") ("?" . "$(C#?(B") ("/" . "$(C#/(B") + ("," . "$(C#,(B") ("." . "$(C#.(B") + ("a" . "$(C#a(B") ("b" . "$(C#b(B") ("c" . "$(C#c(B") ("d" . "$(C#d(B") + ("e" . "$(C#e(B") ("f" . "$(C#f(B") ("g" . "$(C#g(B") ("h" . "$(C#h(B") + ("i" . "$(C#i(B") ("j" . "$(C#j(B") ("k" . "$(C#k(B") ("l" . "$(C#l(B") + ("m" . "$(C#m(B") ("n" . "$(C#n(B") ("o" . "$(C#o(B") ("p" . "$(C#p(B") + ("q" . "$(C#q(B") ("r" . "$(C#r(B") ("s" . "$(C#s(B") ("t" . "$(C#t(B") + ("u" . "$(C#u(B") ("v" . "$(C#v(B") ("w" . "$(C#w(B") ("x" . "$(C#x(B") + ("y" . "$(C#y(B") ("z" . "$(C#z(B") + ("A" . "$(C#A(B") ("B" . "$(C#B(B") ("C" . "$(C#C(B") ("D" . "$(C#D(B") + ("E" . "$(C#E(B") ("F" . "$(C#F(B") ("G" . "$(C#G(B") ("H" . "$(C#H(B") + ("I" . "$(C#I(B") ("J" . "$(C#J(B") ("K" . "$(C#K(B") ("L" . "$(C#L(B") + ("M" . "$(C#M(B") ("N" . "$(C#N(B") ("O" . "$(C#O(B") ("P" . "$(C#P(B") + ("Q" . "$(C#Q(B") ("R" . "$(C#R(B") ("S" . "$(C#S(B") ("T" . "$(C#T(B") + ("U" . "$(C#U(B") ("V" . "$(C#V(B") ("W" . "$(C#W(B") ("X" . "$(C#X(B") + ("Y" . "$(C#Y(B") ("Z" . "$(C#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule in out)))) + +(define-its-state-machine-append its-jeonkak-down-map) + +(provide 'its/jeonkak) diff --git a/its/kata.el b/its/kata.el new file mode 100644 index 0000000..28e1dcd --- /dev/null +++ b/its/kata.el @@ -0,0 +1,494 @@ +;;; its/kata.el --- Katakana Input in Egg Input Method Architecture + +;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. +;; Licensed to the Free Software Foundation. + +;; Author: Satoru Tomura +;; jiro@math.keio.ac.jp (TANAKA Jiro) + +;; Maintainer: TOMURA Satoru + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: +;; +;; Symbol input is desined by jiro@math.keio.ac.jp (TANAKA Jiro) +;; This file is based on the rules of its/hira.el in Mule-2.3 distribution. +;; + +;;; Code: + +(eval-when-compile + (require 'its) + (require 'cl)) + +(eval-when (compile) + (defconst its-compaction-enable t)) + +(defvar its-kata-enable-zenkaku-alphabet + (if (boundp 'its-enable-fullwidth-alphabet) + its-enable-fullwidth-alphabet + t) + "*Enable Zenkaku alphabet") + +(defvar its-kata-enable-double-n nil "*Enable \"nn\" input for \"$B%s(B\" ") +(defvar its-kata-period "$B!#(B" "*$B%T%j%*%I(B") ; ". " "$B!%(B" +(defvar its-kata-comma "$B!"(B" "*$B%3%s%^(B") ; ", " "$B!$(B" +(defvar its-kata-open-bracket "$B!V(B" "*[") ; "$B!N(B" +(defvar its-kata-close-bracket "$B!W(B" "*]") ; "$B!O(B" +(defvar its-kata-horizontal "$B!<(B" "*-") ; "$B!](B" + +(define-its-state-machine its-kata-map + "roma-kata" "$B%"(B" Japanese + "Map for Romaji-Katakana translation. (Japanese)" + + (defconst its-zenkaku-escape "Z") ;; Escape character to Zenkaku inputs + (defconst its-hankaku-escape "~") ;; Escape character to Hankaku inputs + + (its-defrule-select-mode-temporally "q" downcase) + (its-defrule-select-mode-temporally "Q" zenkaku-downcase) + +;;; k k +;;; kk $B%C(Bk +;;; kka $B%C%+(B +;;; +;;; kkk $B%C(Bk DING! + + (its-defrule "tch" "$B%C(B" -2) + +;;; $B!V%s!W$NF~NO(B + + (dolist (q1 '("b" "m" "p")) + (its-defrule (concat "m" q1) "$B%s(B" -1)) + + (its-defrule* "n" "$B%s(B") + (its-defrule "n'" "$B%s(B") + (its-defrule "N" "$B%s(B") + + (let ((small '"x" )) + (its-defrule (concat small "a") "$B%!(B") + (its-defrule (concat small "i") "$B%#(B") + (its-defrule (concat small "u") "$B%%(B") + (its-defrule (concat small "e") "$B%'(B") + (its-defrule (concat small "o") "$B%)(B") + (its-defrule (concat small "ya") "$B%c(B") + (its-defrule (concat small "yu") "$B%e(B") + (its-defrule (concat small "yo") "$B%g(B") + (its-defrule (concat small "tu") "$B%C(B") + (its-defrule (concat small "tsu") "$B%C(B") + (its-defrule (concat small "wa") "$B%n(B") + ) + + (its-defrule "a" "$B%"(B") + (its-defrule "i" "$B%$(B") + (its-defrule "u" "$B%&(B") + (its-defrule "e" "$B%((B") + (its-defrule "o" "$B%*(B") + + (dolist (k '(("ka" "$B%+(B") ("ki" "$B%-(B") ("ku" "$B%/(B") ("ke" "$B%1(B") ("ko" "$B%3(B") + ("kya" "$B%-%c(B") ("kyu" "$B%-%e(B") ("kye" "$B%-%'(B") ("kyo" "$B%-%g(B"))) + (its-defrule (car k) (cadr k)) + (its-defrule (concat "k" (car k)) (concat "$B%C(B" (cadr k)))) + (its-defoutput "kk" "$B%C(Bk") + (its-defoutput "kky" "$B%C(Bky") + + (dolist (s '(("sa" "$B%5(B") ("si" "$B%7(B") ("su" "$B%9(B") ("se" "$B%;(B") ("so" "$B%=(B") + ("sya" "$B%7%c(B") ("syu" "$B%7%e(B") ("sye" "$B%7%'(B") ("syo" "$B%7%g(B") + ("sha" "$B%7%c(B") ("shi" "$B%7(B") ("shu" "$B%7%e(B") ("she" "$B%7%'(B") + ("sho" "$B%7%g(B"))) + (its-defrule (car s) (cadr s)) + (its-defrule (concat "s" (car s)) (concat "$B%C(B" (cadr s)))) + (its-defoutput "ss" "$B%C(Bs") + (its-defoutput "ssy" "$B%C(Bsy") + (its-defoutput "ssh" "$B%C(Bsh") + + (dolist (T '(("ta" "$B%?(B") ("ti" "$B%A(B") ("tu" "$B%D(B") ("te" "$B%F(B") ("to" "$B%H(B") + ("tya" "$B%A%c(B") ("tyi" "$B%F%#(B") ("tyu" "$B%A%e(B") ("tye" "$B%A%'(B") + ("tyo" "$B%A%g(B") ("tsu" "$B%D(B"))) + (its-defrule (car T) (cadr T)) + (its-defrule (concat "t" (car T)) (concat "$B%C(B" (cadr T)))) + (its-defoutput "tt" "$B%C(Bt") + (its-defoutput "tty" "$B%C(Bty") + (its-defoutput "tts" "$B%C(Bts") + + (dolist (c '(("cha" "$B%A%c(B") ("chi" "$B%A(B") ("chu" "$B%A%e(B") + ("che" "$B%A%'(B") ("cho" "$B%A%g(B"))) + (its-defrule (car c) (cadr c)) + (its-defrule (concat "c" (car c)) (concat "$B%C(B" (cadr c)))) + (its-defoutput "cc" "$B%C(Bc") + (its-defoutput "cch" "$B%C(Bch") + + (dolist (h '(("ha" "$B%O(B") ("hi" "$B%R(B") ("hu" "$B%U(B") ("he" "$B%X(B") ("ho" "$B%[(B") + ("hya" "$B%R%c(B") ("hyu" "$B%R%e(B") ("hye" "$B%R%'(B") ("hyo" "$B%R%g(B"))) + (its-defrule (car h) (cadr h)) + (its-defrule (concat "h" (car h)) (concat "$B%C(B" (cadr h)))) + (its-defoutput "hh" "$B%C(Bh") + (its-defoutput "hhy" "$B%C(Bhy") + + (dolist (f '(("fa" "$B%U%!(B") ("fi" "$B%U%#(B") ("fu" "$B%U(B") ("fe" "$B%U%'(B") + ("fo" "$B%U%)(B"))) + (its-defrule (car f) (cadr f)) + (its-defrule (concat "f" (car f)) (concat "$B%C(B" (cadr f)))) + (its-defoutput "ff" "$B%C(Bf") + + (dolist (r '(("ra" "$B%i(B") ("ri" "$B%j(B") ("ru" "$B%k(B") ("re" "$B%l(B") ("ro" "$B%m(B") + ("rya" "$B%j%c(B") ("ryu" "$B%j%e(B") ("rye" "$B%j%'(B") ("ryo" "$B%j%g(B"))) + (its-defrule (car r) (cadr r)) + (its-defrule (concat "r" (car r)) (concat "$B%C(B" (cadr r)))) + (its-defoutput "rr" "$B%C(Br") + (its-defoutput "rry" "$B%C(Bry") + + (dolist (l '(("la" "$B%i(B") ("li" "$B%j(B") ("lu" "$B%k(B") ("le" "$B%l(B") ("lo" "$B%m(B") + ("lya" "$B%j%c(B") ("lyu" "$B%j%e(B") ("lye" "$B%j%'(B") ("lyo" "$B%j%g(B"))) + (its-defrule (car l) (cadr l)) + (its-defrule (concat "l" (car l)) (concat "$B%C(B" (cadr l)))) + (its-defoutput "ll" "$B%C(Bl") + (its-defoutput "lly" "$B%C(Bly") + + (dolist (g '(("ga" "$B%,(B") ("gi" "$B%.(B") ("gu" "$B%0(B") ("ge" "$B%2(B") ("go" "$B%4(B") + ("gya" "$B%.%c(B") ("gyu" "$B%.%e(B") ("gye" "$B%.%'(B") ("gyo" "$B%.%g(B"))) + (its-defrule (car g) (cadr g)) + (its-defrule (concat "g" (car g)) (concat "$B%C(B" (cadr g)))) + (its-defoutput "gg" "$B%C(Bg") + (its-defoutput "ggy" "$B%C(Bgy") + + (dolist (z '(("za" "$B%6(B") ("zi" "$B%8(B") ("zu" "$B%:(B") ("ze" "$B%<(B") ("zo" "$B%>(B") + ("zya" "$B%8%c(B") ("zyu" "$B%8%e(B") ("zye" "$B%8%'(B") ("zyo" "$B%8%g(B"))) + (its-defrule (car z) (cadr z)) + (its-defrule (concat "z" (car z)) (concat "$B%C(B" (cadr z)))) + (its-defoutput "zz" "$B%C(Bz") + (its-defoutput "zzy" "$B%C(Bzy") + + (dolist (j '(("ja" "$B%8%c(B") ("ji" "$B%8(B") ("ju" "$B%8%e(B") ("je" "$B%8%'(B") + ("jo" "$B%8%g(B") ("jya" "$B%8%c(B") ("jyu" "$B%8%e(B") ("jye" "$B%8%'(B") + ("jyo" "$B%8%g(B"))) + (its-defrule (car j) (cadr j)) + (its-defrule (concat "j" (car j)) (concat "$B%C(B" (cadr j)))) + (its-defoutput "jj" "$B%C(Bj") + (its-defoutput "jjy" "$B%C(Bjy") + + (dolist (d '(("da" "$B%@(B") ("di" "$B%B(B") ("du" "$B%E(B") ("de" "$B%G(B") ("do" "$B%I(B") + ("dya" "$B%B%c(B") ("dyi" "$B%G%#(B") ("dyu" "$B%B%e(B") ("dye" "$B%B%'(B") + ("dyo" "$B%B%g(B"))) + (its-defrule (car d) (cadr d)) + (its-defrule (concat "d" (car d)) (concat "$B%C(B" (cadr d)))) + (its-defoutput "dd" "$B%C(Bd") + (its-defoutput "ddy" "$B%C(Bdy") + + (dolist (b '(("ba" "$B%P(B") ("bi" "$B%S(B") ("bu" "$B%V(B") ("be" "$B%Y(B") ("bo" "$B%\(B") + ("bya" "$B%S%c(B") ("byu" "$B%S%e(B") ("bye" "$B%S%'(B") ("byo" "$B%S%g(B"))) + (its-defrule (car b) (cadr b)) + (its-defrule (concat "b" (car b)) (concat "$B%C(B" (cadr b)))) + (its-defoutput "bb" "$B%C(Bb") + (its-defoutput "bby" "$B%C(Bby") + + (dolist (p '(("pa" "$B%Q(B") ("pi" "$B%T(B") ("pu" "$B%W(B") ("pe" "$B%Z(B") ("po" "$B%](B") + ("pya" "$B%T%c(B") ("pyu" "$B%T%e(B") ("pye" "$B%T%'(B") ("pyo" "$B%T%g(B"))) + (its-defrule (car p) (cadr p)) + (its-defrule (concat "p" (car p)) (concat "$B%C(B" (cadr p)))) + (its-defoutput "pp" "$B%C(Bp") + (its-defoutput "ppy" "$B%C(Bpy") + + (dolist (v '(("va" "$B%t%!(B") ("vi" "$B%t%#(B") ("vu" "$B%t(B") ("ve" "$B%t%'(B") + ("vo" "$B%t%)(B"))) + (its-defrule (car v) (cadr v)) + (its-defrule (concat "v" (car v)) (concat "$B%C(B" (cadr v)))) + (its-defoutput "vv" "$B%C(Bv") + + (its-defrule "ma" "$B%^(B") + (its-defrule "mi" "$B%_(B") + (its-defrule "mu" "$B%`(B") + (its-defrule "me" "$B%a(B") + (its-defrule "mo" "$B%b(B") + (its-defrule "mya" "$B%_%c(B") + (its-defrule "myu" "$B%_%e(B") + (its-defrule "mye" "$B%_%'(B") + (its-defrule "myo" "$B%_%g(B") + (its-defrule "ya" "$B%d(B") + (its-defrule "yi" "$B%$(B") + (its-defrule "yu" "$B%f(B") + (its-defrule "yo" "$B%h(B") + (its-defrule "ye" "$B%$%'(B") + (its-defrule "wa" "$B%o(B") + (its-defrule "wi" "$B%p(B") + (its-defrule "wu" "$B%&(B") + (its-defrule "we" "$B%q(B") + (its-defrule "wo" "$B%r(B") + + (its-defrule "kwa" "$B%/%n(B") + (its-defrule "kwi" "$B%/%#(B") + (its-defrule "kwu" "$B%/(B") + (its-defrule "kwe" "$B%/%'(B") + (its-defrule "kwo" "$B%/%)(B") + (its-defrule "gwa" "$B%0%n(B") + (its-defrule "gwi" "$B%0%#(B") + (its-defrule "gwu" "$B%0(B") + (its-defrule "gwe" "$B%0%'(B") + (its-defrule "gwo" "$B%0%)(B") + (its-defrule "tsa" "$B%D%!(B") + (its-defrule "tsi" "$B%D%#(B") + (its-defrule "tse" "$B%D%'(B") + (its-defrule "tso" "$B%D%)(B") + + (its-defrule "na" "$B%J(B") + (its-defrule "ni" "$B%K(B") + (its-defrule "nu" "$B%L(B") + (its-defrule "ne" "$B%M(B") + (its-defrule "no" "$B%N(B") + (its-defrule "nya" "$B%K%c(B") + (its-defrule "nyu" "$B%K%e(B") + (its-defrule "nye" "$B%K%'(B") + (its-defrule "nyo" "$B%K%g(B") + + (its-defrule "xka" "$B%u(B") + (its-defrule "xke" "$B%v(B") + (its-defrule "xti" "$B%F%#(B") + (its-defrule "xdi" "$B%G%#(B") + (its-defrule "xdu" "$B%I%%(B") + (its-defrule "xde" "$B%G%'(B") + (its-defrule "xdo" "$B%I%)(B") + (its-defrule "xwi" "$B%&%#(B") + (its-defrule "xwe" "$B%&%'(B") + (its-defrule "xwo" "$B%&%)(B") + +;;; +;;; Zenkaku inputs +;;; + + (its-defrule (concat its-zenkaku-escape "0") "$B#0(B") + (its-defrule (concat its-zenkaku-escape "1") "$B#1(B") + (its-defrule (concat its-zenkaku-escape "2") "$B#2(B") + (its-defrule (concat its-zenkaku-escape "3") "$B#3(B") + (its-defrule (concat its-zenkaku-escape "4") "$B#4(B") + (its-defrule (concat its-zenkaku-escape "5") "$B#5(B") + (its-defrule (concat its-zenkaku-escape "6") "$B#6(B") + (its-defrule (concat its-zenkaku-escape "7") "$B#7(B") + (its-defrule (concat its-zenkaku-escape "8") "$B#8(B") + (its-defrule (concat its-zenkaku-escape "9") "$B#9(B") + + (its-defrule (concat its-zenkaku-escape "A") "$B#A(B") + (its-defrule (concat its-zenkaku-escape "B") "$B#B(B") + (its-defrule (concat its-zenkaku-escape "C") "$B#C(B") + (its-defrule (concat its-zenkaku-escape "D") "$B#D(B") + (its-defrule (concat its-zenkaku-escape "E") "$B#E(B") + (its-defrule (concat its-zenkaku-escape "F") "$B#F(B") + (its-defrule (concat its-zenkaku-escape "G") "$B#G(B") + (its-defrule (concat its-zenkaku-escape "H") "$B#H(B") + (its-defrule (concat its-zenkaku-escape "I") "$B#I(B") + (its-defrule (concat its-zenkaku-escape "J") "$B#J(B") + (its-defrule (concat its-zenkaku-escape "K") "$B#K(B") + (its-defrule (concat its-zenkaku-escape "L") "$B#L(B") + (its-defrule (concat its-zenkaku-escape "M") "$B#M(B") + (its-defrule (concat its-zenkaku-escape "N") "$B#N(B") + (its-defrule (concat its-zenkaku-escape "O") "$B#O(B") + (its-defrule (concat its-zenkaku-escape "P") "$B#P(B") + (its-defrule (concat its-zenkaku-escape "Q") "$B#Q(B") + (its-defrule (concat its-zenkaku-escape "R") "$B#R(B") + (its-defrule (concat its-zenkaku-escape "S") "$B#S(B") + (its-defrule (concat its-zenkaku-escape "T") "$B#T(B") + (its-defrule (concat its-zenkaku-escape "U") "$B#U(B") + (its-defrule (concat its-zenkaku-escape "V") "$B#V(B") + (its-defrule (concat its-zenkaku-escape "W") "$B#W(B") + (its-defrule (concat its-zenkaku-escape "X") "$B#X(B") + (its-defrule (concat its-zenkaku-escape "Y") "$B#Y(B") + (its-defrule (concat its-zenkaku-escape "Z") "$B#Z(B") + + (its-defrule (concat its-zenkaku-escape "a") "$B#a(B") + (its-defrule (concat its-zenkaku-escape "b") "$B#b(B") + (its-defrule (concat its-zenkaku-escape "c") "$B#c(B") + (its-defrule (concat its-zenkaku-escape "d") "$B#d(B") + (its-defrule (concat its-zenkaku-escape "e") "$B#e(B") + (its-defrule (concat its-zenkaku-escape "f") "$B#f(B") + (its-defrule (concat its-zenkaku-escape "g") "$B#g(B") + (its-defrule (concat its-zenkaku-escape "h") "$B#h(B") + (its-defrule (concat its-zenkaku-escape "i") "$B#i(B") + (its-defrule (concat its-zenkaku-escape "j") "$B#j(B") + (its-defrule (concat its-zenkaku-escape "k") "$B#k(B") + (its-defrule (concat its-zenkaku-escape "l") "$B#l(B") + (its-defrule (concat its-zenkaku-escape "m") "$B#m(B") + (its-defrule (concat its-zenkaku-escape "n") "$B#n(B") + (its-defrule (concat its-zenkaku-escape "o") "$B#o(B") + (its-defrule (concat its-zenkaku-escape "p") "$B#p(B") + (its-defrule (concat its-zenkaku-escape "q") "$B#q(B") + (its-defrule (concat its-zenkaku-escape "r") "$B#r(B") + (its-defrule (concat its-zenkaku-escape "s") "$B#s(B") + (its-defrule (concat its-zenkaku-escape "t") "$B#t(B") + (its-defrule (concat its-zenkaku-escape "u") "$B#u(B") + (its-defrule (concat its-zenkaku-escape "v") "$B#v(B") + (its-defrule (concat its-zenkaku-escape "w") "$B#w(B") + (its-defrule (concat its-zenkaku-escape "x") "$B#x(B") + (its-defrule (concat its-zenkaku-escape "y") "$B#y(B") + (its-defrule (concat its-zenkaku-escape "z") "$B#z(B") + + (its-defrule (concat its-zenkaku-escape " ") "$B!!(B") + (its-defrule (concat its-zenkaku-escape "!") "$B!*(B") + (its-defrule (concat its-zenkaku-escape "@") "$B!w(B") + (its-defrule (concat its-zenkaku-escape "#") "$B!t(B") + (its-defrule (concat its-zenkaku-escape "$") "$B!p(B") + (its-defrule (concat its-zenkaku-escape "%") "$B!s(B") + (its-defrule (concat its-zenkaku-escape "^") "$B!0(B") + (its-defrule (concat its-zenkaku-escape "&") "$B!u(B") + (its-defrule (concat its-zenkaku-escape "*") "$B!v(B") + (its-defrule (concat its-zenkaku-escape "(") "$B!J(B") + (its-defrule (concat its-zenkaku-escape ")") "$B!K(B") + (its-defrule (concat its-zenkaku-escape "-") "$B!](B") + (its-defrule (concat its-zenkaku-escape "=") "$B!a(B") + (its-defrule (concat its-zenkaku-escape "`") "$B!.(B") + (its-defrule (concat its-zenkaku-escape "\\") "$B!o(B") + (its-defrule (concat its-zenkaku-escape "|") "$B!C(B") + (its-defrule (concat its-zenkaku-escape "_") "$B!2(B") + (its-defrule (concat its-zenkaku-escape "+") "$B!\(B") + (its-defrule (concat its-zenkaku-escape "~") "$B!1(B") + (its-defrule (concat its-zenkaku-escape "[") "$B!N(B") + (its-defrule (concat its-zenkaku-escape "]") "$B!O(B") + (its-defrule (concat its-zenkaku-escape "{") "$B!P(B") + (its-defrule (concat its-zenkaku-escape "}") "$B!Q(B") + (its-defrule (concat its-zenkaku-escape ":") "$B!'(B") + (its-defrule (concat its-zenkaku-escape ";") "$B!((B") + (its-defrule (concat its-zenkaku-escape "\"") "$B!I(B") + (its-defrule (concat its-zenkaku-escape "'") "$B!G(B") + (its-defrule (concat its-zenkaku-escape "<") "$B!c(B") + (its-defrule (concat its-zenkaku-escape ">") "$B!d(B") + (its-defrule (concat its-zenkaku-escape "?") "$B!)(B") + (its-defrule (concat its-zenkaku-escape "/") "$B!?(B") + (its-defrule (concat its-zenkaku-escape ",") "$B!$(B") + (its-defrule (concat its-zenkaku-escape ".") "$B!%(B") + +;;; +;;; Hankaku inputs +;;; + + (dolist (digit '( "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" )) + (its-defrule (concat its-hankaku-escape digit) digit)) + + (dolist (symbol '( " " "!" "@" "#" "$" "%" "^" "&" "*" "(" ")" + "-" "=" "`" "\\" "|" "_" "+" "~" "[" "]" "{" "}" + ":" ";" "\"" "'" "<" ">" "?" "/" "," "." )) + (its-defrule (concat its-hankaku-escape symbol) symbol)) + + (dolist (downcase '("a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" + "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z")) + (its-defrule (concat its-hankaku-escape downcase) downcase)) + + (dolist (upcase '("A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" + "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z")) + (its-defrule (concat its-hankaku-escape upcase) upcase)) + +;; SYMBOL Input + (its-defrule "z1" "$B!{(B") (its-defrule "z!" "$B!|(B") + (its-defrule "z2" "$B"&(B") (its-defrule "z@" "$B"'(B") + (its-defrule "z3" "$B"$(B") (its-defrule "z#" "$B"%(B") + (its-defrule "z4" "$B""(B") (its-defrule "z$" "$B"#(B") + (its-defrule "z5" "$B!~(B") (its-defrule "z%" "$B"!(B") + (its-defrule "z6" "$B!y(B") (its-defrule "z^" "$B!z(B") + (its-defrule "z7" "$B!}(B") (its-defrule "z&" "$B!r(B") + (its-defrule "z8" "$B!q(B") (its-defrule "z*" "$B!_(B") + (its-defrule "z9" "$B!i(B") (its-defrule "z(" "$B!Z(B") + (its-defrule "z0" "$B!j(B") (its-defrule "z)" "$B![(B") + (its-defrule "z-" "$B!A(B") (its-defrule "z_" "$B!h(B") + (its-defrule "z=" "$B!b(B") (its-defrule "z+" "$B!^(B") + (its-defrule "z\\" "$B!@(B") (its-defrule "z|" "$B!B(B") + (its-defrule "z`" "$B!-(B") (its-defrule "z~" "$B!/(B") + + (its-defrule "zq" "$B!T(B") (its-defrule "zQ" "$B!R(B") + (its-defrule "zw" "$B!U(B") (its-defrule "zW" "$B!S(B") + ; e + (its-defrule "zr" "$B!9(B") (its-defrule "zR" "$B!8(B") + (its-defrule "zt" "$B!:(B") (its-defrule "zT" "$B!x(B") + ; y u i o + (its-defrule "zp" "$B")(B") (its-defrule "zP" "$B",(B") + (its-defrule "z[" "$B!X(B") (its-defrule "z{" "$B!L(B") + (its-defrule "z]" "$B!Y(B") (its-defrule "z}" "$B!M(B") + + ; a + (its-defrule "zs" "$B!3(B") (its-defrule "zS" "$B!4(B") + (its-defrule "zd" "$B!5(B") (its-defrule "zD" "$B!6(B") + (its-defrule "zf" "$B!7(B") (its-defrule "zF" "$B"*(B") + (its-defrule "zg" "$B!>(B") (its-defrule "zG" "$B!=(B") + (its-defrule "zh" "$B"+(B") + (its-defrule "zj" "$B"-(B") + (its-defrule "zk" "$B",(B") + (its-defrule "zl" "$B"*(B") + (its-defrule "z;" "$B!+(B") (its-defrule "z:" "$B!,(B") + (its-defrule "z\'" "$B!F(B") (its-defrule "z\"" "$B!H(B") + + ; z + (its-defrule "zx" ":-") (its-defrule "zX" ":-)") + (its-defrule "zc" "$B!;(B") (its-defrule "zC" "$B!n(B") + (its-defrule "zv" "$B"((B") (its-defrule "zV" "$B!`(B") + (its-defrule "zb" "$B!k(B") (its-defrule "zB" "$B"+(B") + (its-defrule "zn" "$B!l(B") (its-defrule "zN" "$B"-(B") + (its-defrule "zm" "$B!m(B") (its-defrule "zM" "$B".(B") + (its-defrule "z," "$B!E(B") (its-defrule "z<" "$B!e(B") + (its-defrule "z." "$B!D(B") (its-defrule "z>" "$B!f(B") + (its-defrule "z/" "$B!&(B") (its-defrule "z?" "$B!g(B") + ) + +(define-its-state-machine-append its-kata-map + (if its-kata-enable-double-n + (its-defrule "nn" "$B%s(B")) + + (its-defrule "-" its-kata-horizontal) + (its-defrule "[" its-kata-open-bracket) + (its-defrule "]" its-kata-close-bracket) + (its-defrule "." its-kata-period) + (its-defrule "," its-kata-comma) + + (if its-kata-enable-zenkaku-alphabet + (progn + (its-defrule "1" "$B#1(B") (its-defrule "2" "$B#2(B") + (its-defrule "3" "$B#3(B") (its-defrule "4" "$B#4(B") + (its-defrule "5" "$B#5(B") (its-defrule "6" "$B#6(B") + (its-defrule "7" "$B#7(B") (its-defrule "8" "$B#8(B") + (its-defrule "9" "$B#9(B") (its-defrule "0" "$B#0(B") + (its-defrule "!" "$B!*(B") (its-defrule "@" "$B!w(B") + (its-defrule "#" "$B!t(B") (its-defrule "$" "$B!p(B") + (its-defrule "%" "$B!s(B") (its-defrule "^" "$B!0(B") + (its-defrule "&" "$B!u(B") (its-defrule "*" "$B!v(B") + (its-defrule "(" "$B!J(B") (its-defrule ")" "$B!K(B") + (its-defrule "=" "$B!a(B") (its-defrule "`" "$B!.(B") + (its-defrule "\\" "$B!o(B") (its-defrule "|" "$B!C(B") + (its-defrule "_" "$B!2(B") (its-defrule "+" "$B!\(B") + (its-defrule "{" "$B!P(B") (its-defrule "}" "$B!Q(B") + (its-defrule ":" "$B!'(B") (its-defrule ";" "$B!((B") + (its-defrule "\"" "$B!I(B") (its-defrule "'" "$B!G(B") + (its-defrule "<" "$B!c(B") (its-defrule ">" "$B!d(B") + (its-defrule "?" "$B!)(B") (its-defrule "/" "$B!?(B")) + (progn + (its-defrule "1" "1") (its-defrule "2" "2") + (its-defrule "3" "3") (its-defrule "4" "4") + (its-defrule "5" "5") (its-defrule "6" "6") + (its-defrule "7" "7") (its-defrule "8" "8") + (its-defrule "9" "9") (its-defrule "0" "0") + (its-defrule "!" "!") (its-defrule "@" "@") + (its-defrule "#" "#") (its-defrule "$" "$") + (its-defrule "%" "%") (its-defrule "^" "^") + (its-defrule "&" "&") (its-defrule "*" "*") + (its-defrule "(" "(") (its-defrule ")" ")") + (its-defrule "=" "=") (its-defrule "`" "`") + (its-defrule "\\" "\\") (its-defrule "|" "|") + (its-defrule "_" "_") (its-defrule "+" "+") + (its-defrule "{" "{") (its-defrule "}" "}") + (its-defrule ":" ":") (its-defrule ";" ";") + (its-defrule "\"" "\"") (its-defrule "'" "'") + (its-defrule "<" "<") (its-defrule ">" ">") + (its-defrule "?" "?") (its-defrule "/" "/"))) + ) + +(provide 'its/kata) +;;; its/kata.el ends here. diff --git a/its/pinyin.el b/its/pinyin.el new file mode 100644 index 0000000..1fb9df3 --- /dev/null +++ b/its/pinyin.el @@ -0,0 +1,434 @@ +;;; its/pinyin.el --- Pinyin Input in Egg Input Method Architecture + +;; Copyright (C) 1999,2000 PFU LIMITED + +;; Author: KATAYAMA Yoshio + +;; Maintainer: TOMURA Satoru  + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + + +;;; Code: + +(eval-when-compile + (require 'its) + (require 'cl)) + +(eval-when (compile) + (defconst its-compaction-enable t)) + +(defvar its-pinyin-cn-enable-quanjioao-alphabet + (if (boundp 'its-enable-fullwidth-alphabet) + its-enable-fullwidth-alphabet + t) + "*Enable Quanjiao alphabet") + +(defvar its-pinyin-cn-open-braket "$A!8(B" "*[") ; "$A#[(B" +(defvar its-pinyin-cn-close-braket "$A!9(B" "*]") ; "$A#](B" + +(defvar its-pinyin-tw-enable-quanjioao-alphabet + (if (boundp 'its-enable-fullwidth-alphabet) + its-enable-fullwidth-alphabet + t) + "*Enable Quanjiao alphabet") + +(defvar its-pinyin-tw-open-braket "$(G!V(B" "*[") ; "$(G!b(B " +(defvar its-pinyin-tw-close-braket "$(G!W(B" "*]") ; "$(G!c(B" + +(eval-when-compile + (defun its-prev-terminal-state (state-list) + (while (and state-list + (null (its-get-next-state (car state-list) -1))) + (setq state-list (cdr state-list))) + (car state-list)) + + (defun its-define-qingsheng (shengmu yunmu &optional s y) + (let ((input (concat shengmu yunmu)) + (output (concat (if s s (capitalize shengmu)) (if y y yunmu) "(0@(B")) + state term-state) + (setq state (its-defrule* input output)) + (its-make-next-state state ? output) + (its-make-next-state state ?0 output) + (setq term-state (its-prev-terminal-state its-parent-states)) + (if term-state + (let ((back (- (length (its-get-keyseq term-state)) (length input))) + (output (its-get-output (its-get-next-state term-state -1))) + (parents its-parent-states)) + (while (null (eq (car parents) term-state)) + (its-make-next-state (car parents) -1 output (1+ back)) + (its-defrule-otherwise (car parents) output nil back) + (setq back (1+ back) + parents (cdr parents))))) + state)) + + (defmacro its-do-sisheng-table (list) + `(progn + ,@(mapcar (lambda (syl) + `(its-define-sisheng ,@syl)) + list))) + + (defmacro its-define-sisheng (shengmu yunmu) + `(let ((qing (nth 5 ,yunmu)) (y (car ,yunmu)) + (ss (list ,@shengmu)) s cs state i) + (while ss + (setq s (car ss) + ss (cdr ss) + cs (capitalize s) + state (its-define-qingsheng s y cs qing)) + (its-make-next-state state ?1 (concat cs (nth 1 ,yunmu) "(0@(B")) + (its-make-next-state state ?2 (concat cs (nth 2 ,yunmu) "(0@(B")) + (its-make-next-state state ?3 (concat cs (nth 3 ,yunmu) "(0@(B")) + (its-make-next-state state ?4 (concat cs (nth 4 ,yunmu) "(0@(B"))))) + + (defmacro its-define-pinyin-table () + '(let ((- "") (B "b") (C "c") (D "d") (F "f") (G "g") (H "h") + (J "j") (K "k") (L "l") (M "m") (N "n") (P "p") (Q "q") + (R "r") (S "s") (T "t") (W "w") (X "x") (Y "y") (Z "z") + (CH "ch") (SH "sh") (ZH "zh") + + (A '("a" "(0!(B" "(0"(B" "(0#(B" "(0$(B" "a" )) + (AI '("ai" "(0!(Bi" "(0"(Bi" "(0#(Bi" "(0$(Bi" "ai" )) + (AN '("an" "(0!(Bn" "(0"(Bn" "(0#(Bn" "(0$(Bn" "an" )) + (ANG '("ang" "(0!(Bng" "(0"(Bng" "(0#(Bng" "(0$(Bng" "ang" )) + (AO '("ao" "(0!(Bo" "(0"(Bo" "(0#(Bo" "(0$(Bo" "ao" )) + (E '("e" "(0%(B" "(0&(B" "(0'(B" "(0((B" "e" )) + (EI '("ei" "(0%(Bi" "(0&(Bi" "(0'(Bi" "(0((Bi" "ei" )) + (EN '("en" "(0%(Bn" "(0&(Bn" "(0'(Bn" "(0((Bn" "en" )) + (ENG '("eng" "(0%(Bng" "(0&(Bng" "(0'(Bng" "(0((Bng" "eng" )) + (ER '("er" "(0%(Br" "(0&(Br" "(0'(Br" "(0((Br" "er" )) + (I '("i" "(0)(B" "(0*(B" "(0+(B" "(0,(B" "i" )) + (IA '("ia" "i(0!(B" "i(0"(B" "i(0#(B" "i(0$(B" "ia" )) + (IAN '("ian" "i(0!(Bn" "i(0"(Bn" "i(0#(Bn" "i(0$(Bn" "ian" )) + (IANG '("iang" "i(0!(Bng" "i(0"(Bng" "i(0#(Bng" "i(0$(Bng" "iang")) + (IAO '("iao" "i(0!(Bo" "i(0"(Bo" "i(0#(Bo" "i(0$(Bo" "iao" )) + (IE '("ie" "i(0%(B" "i(0&(B" "i(0'(B" "i(0((B" "ie" )) + (IN '("in" "(0)(Bn" "(0*(Bn" "(0+(Bn" "(0,(Bn" "in" )) + (ING '("ing" "(0)(Bng" "(0*(Bng" "(0+(Bng" "(0,(Bng" "ing" )) + (IONG '("iong" "i(0-(Bng" "i(0.(Bng" "i(0/(Bng" "i(00(Bng" "iong")) + (IU '("iu" "i(01(B" "i(02(B" "i(03(B" "i(04(B" "iu" )) + (O '("o" "(0-(B" "(0.(B" "(0/(B" "(00(B" "o" )) + (ONG '("ong" "(0-(Bng" "(0.(Bng" "(0/(Bng" "(00(Bng" "ong" )) + (OU '("ou" "(0-(Bu" "(0.(Bu" "(0/(Bu" "(00(Bu" "ou" )) + (U '("u" "(01(B" "(02(B" "(03(B" "(04(B" "u" )) + (V '("v" "(05(B" "(06(B" "(07(B" "(08(B" "(09(B" )) + (UA '("ua" "u(0!(B" "u(0"(B" "u(0#(B" "u(0$(B" "ua" )) + (UAI '("uai" "u(0!(Bi" "u(0"(Bi" "u(0#(Bi" "u(0$(Bi" "uai" )) + (UAN '("uan" "u(0!(Bn" "u(0"(Bn" "u(0#(Bn" "u(0$(Bn" "uan" )) + (UANG '("uang" "u(0!(Bng" "u(0"(Bng" "u(0#(Bng" "u(0$(Bng" "uang")) + (UE '("ue" "u(0%(B" "u(0&(B" "u(0'(B" "u(0((B" "ue" )) + (VE '("ve" "(09%(B" "(09&(B" "(09'(B" "(09((B" "(09(Be" )) + (UI '("ui" "u(0)(B" "u(0*(B" "u(0+(B" "u(0,(B" "ui" )) + (UN '("un" "(01(Bn" "(02(Bn" "(03(Bn" "(04(Bn" "un" )) + (UO '("uo" "u(0-(B" "u(0.(B" "u(0/(B" "u(00(B" "uo" ))) + + (its-define-qingsheng "hm" "") + (its-define-qingsheng "hng" "") + (its-defrule* "m" "m(0@(B") + (its-defrule "m0" "m(0@(B") + (its-defrule* "n" "n(0@(B") + (its-defrule "n0" "n(0@(B") + (its-defrule "n2" "(0=@(B") + (its-defrule "n3" "(0>@(B") + (its-defrule "n4" "(0?@(B") + (its-define-qingsheng "" "ng") + + (its-do-sisheng-table + (((- B C D F G H K L M N P S T W Y Z CH SH ZH ) A) + ((- B C D G H K L M N P S T W Z CH SH ZH ) AI) + ((- B C D F G H K L M N P R S T W Y Z CH SH ZH ) AN) + ((- B C D F G H K L M N P R S T W Y Z CH SH ZH ) ANG) + ((- B C D G H K L M N P R S T Y Z CH SH ZH ) AO) + ((- C D G H K L M N R S T Y Z CH SH ZH ) E) + ((- B C D F G H K L M N P T W Z SH ZH ) EI) + ((- B C D F G H K M N P R S W Z CH SH ZH ) EN) + ((- B C D F G H K L M N P R S T W Z CH SH ZH ) ENG) + ((- ) ER) + (( B C D J L M N P Q R S T X Y Z CH SH ZH ) I) + (( D J L Q X ) IA) + (( B D J L M N P Q T X ) IAN) + (( J L N Q X ) IANG) + (( B D J L M N P Q T X ) IAO) + (( B D J L M N P Q T X ) IE) + (( B J L M N P Q X Y ) IN) + (( B D J L M N P Q T X Y ) ING) + (( J Q X ) IONG) + (( D J L M N Q X ) IU) + ((- B F L M P W Y ) O) + (( C D G H K L N R S T Y Z CH ZH ) ONG) + ((- C D F G H K L M N P R S T Y Z CH SH ZH ) OU) + (( B C D F G H J K L M N P Q R S T W X Y Z CH SH ZH ) U) + (( L N ) V) + (( G H K R CH SH ZH ) UA) + (( G H K CH SH ZH ) UAI) + (( C D G H J K L N Q R S T X Y Z CH SH ZH ) UAN) + (( G H K CH SH ZH ) UANG) + (( J Q X Y ) UE) + (( L N ) VE) + (( C D G H K R S T Z CH SH ZH ) UI) + (( C D G H J K L Q R S T X Y Z CH SH ZH ) UN) + (( C D G H K L N R S T Z CH SH ZH ) UO) + + ((J Q X) (cons "a" (cdr IA ))) + ((J Q X) (cons "ai" (cdr IA ))) + ((J Q X) (cons "an" (cdr IAN ))) + ((J Q X) (cons "ang" (cdr IANG))) + ((J Q X) (cons "ao" (cdr IAO ))) + ((J Q X) (cons "e" (cdr IE ))) + ((J Q X) (cons "ei" (cdr IE ))) + ((J Q X) (cons "en" (cdr IN ))) + ((J Q X) (cons "eng" (cdr ING ))) + ((J Q X) (cons "ou" (cdr IU )))))))) + +(define-its-state-machine its-pinyin-cn-map + "pinyin-cn" "$AF4(BG" Chinese-GB + "Map for Pinyin input. (Chinese-GB)" + + (defconst its-quanjiao-escape "Z") + (defconst its-banjiao-escape "X") + + (its-defrule-select-mode-temporally "B" downcase) + (its-defrule-select-mode-temporally "Q" quanjiao-downcase-cn) + + (its-define-pinyin-table) + (its-defrule "b " "$A2;(B") + (its-defrule "c " "$A2E(B") + (its-defrule "ch " "$A3v(B") + (its-defrule "d " "$A5D(B") + (its-defrule "f " "$A74(B") + (its-defrule "g " "$A8v(B") + (its-defrule "h " "$A:M(B") + (its-defrule "i " "$AR;(B") + (its-defrule "j " "$A>M(B") + (its-defrule "k " "$A?I(B") + (its-defrule "l " "$AAK(B") + (its-defrule "m " "$AC?(B") + (its-defrule "n " "$ADj(B") + (its-defrule "p " "$AEz(B") + (its-defrule "q " "$AH%(B") + (its-defrule "r " "$AHU(B") + (its-defrule "s " "$AJG(B") + (its-defrule "sh " "$AIO(B") + (its-defrule "t " "$AK{(B") + (its-defrule "w " "$ANR(B") + (its-defrule "x " "$AOr(B") + (its-defrule "y " "$ASV(B") + (its-defrule "z " "$ATZ(B") + (its-defrule "zh " "$AWE(B") + + (dolist (ascii '(("0" . "$A#0(B") ("1" . "$A#1(B") ("2" . "$A#2(B") ("3" . "$A#3(B") + ("4" . "$A#4(B") ("5" . "$A#5(B") ("6" . "$A#6(B") ("7" . "$A#7(B") + ("8" . "$A#8(B") ("9" . "$A#9(B") + (" " . "$A!!(B") ("!" . "$A#!(B") ("@" . "$A#@(B") ("#" . "$A##(B") + ("$" . "$A!g(B") ("%" . "$A#%(B") ("^" . "$A#^(B") ("&" . "$A#&(B") + ("*" . "$A#*(B") ("(" . "$A#((B") (")" . "$A#)(B") + ("-" . "$A#-(B") ("=" . "$A#=(B") ("`" . "$A#`(B") ("\\" . "$A#\(B") + ("|" . "$A#|(B") ("_" . "$A#_(B") ("+" . "$A#+(B") ("~" . "$A!+(B") + ("[" . "$A#[(B") ("]" . "$A#](B") ("{" . "$A#{(B") ("}" . "$A#}(B") + (":" . "$A#:(B") (";" . "$A#;(B") ("\"" . "$A#"(B") ("'" . "$A#'(B") + ("<" . "$A#<(B") (">" . "$A#>(B") ("?" . "$A#?(B") ("/" . "$A#/(B") + ("," . "$A#,(B") ("." . "$A#.(B") + ("a" . "$A#a(B") ("b" . "$A#b(B") ("c" . "$A#c(B") ("d" . "$A#d(B") + ("e" . "$A#e(B") ("f" . "$A#f(B") ("g" . "$A#g(B") ("h" . "$A#h(B") + ("i" . "$A#i(B") ("j" . "$A#j(B") ("k" . "$A#k(B") ("l" . "$A#l(B") + ("m" . "$A#m(B") ("n" . "$A#n(B") ("o" . "$A#o(B") ("p" . "$A#p(B") + ("q" . "$A#q(B") ("r" . "$A#r(B") ("s" . "$A#s(B") ("t" . "$A#t(B") + ("u" . "$A#u(B") ("v" . "$A#v(B") ("w" . "$A#w(B") ("x" . "$A#x(B") + ("y" . "$A#y(B") ("z" . "$A#z(B") + ("A" . "$A#A(B") ("B" . "$A#B(B") ("C" . "$A#C(B") ("D" . "$A#D(B") + ("E" . "$A#E(B") ("F" . "$A#F(B") ("G" . "$A#G(B") ("H" . "$A#H(B") + ("I" . "$A#I(B") ("J" . "$A#J(B") ("K" . "$A#K(B") ("L" . "$A#L(B") + ("M" . "$A#M(B") ("N" . "$A#N(B") ("O" . "$A#O(B") ("P" . "$A#P(B") + ("Q" . "$A#Q(B") ("R" . "$A#R(B") ("S" . "$A#S(B") ("T" . "$A#T(B") + ("U" . "$A#U(B") ("V" . "$A#V(B") ("W" . "$A#W(B") ("X" . "$A#X(B") + ("Y" . "$A#Y(B") ("Z" . "$A#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule (concat its-banjiao-escape in) in) + (its-defrule (concat its-quanjiao-escape in) out))) + + (its-defrule "," "$A#,(B") + (its-defrule "." "$A!#(B") + (its-defrule "/" "$A!"(B") + (its-defrule ":" "$A#:(B") + (its-defrule ";" "$A#;(B") + (its-defrule "?" "$A#?(B") + (its-defrule "!" "$A#!(B")) + +(define-its-state-machine its-pinyin-tw-map + "pinyin-tw" "$(GQ;(BC" Chinese-CNS + "Map for Pinyin input." + + (defconst its-quanjiao-escape "Z") + (defconst its-banjiao-escape "X") + + (its-defrule-select-mode-temporally "B" downcase) + (its-defrule-select-mode-temporally "Q" quanjiao-downcase-tw) + + (its-define-pinyin-table) + (its-defrule "b " "$(GDb(B") + (its-defrule "c " "$(GD_(B") + (its-defrule "ch " "$(GEx(B") + (its-defrule "d " "$(GN{(B") + (its-defrule "f " "$(GE0(B") + (its-defrule "g " "$(GT6(B") + (its-defrule "h " "$(GLO(B") + (its-defrule "i " "$(GD!(B") + (its-defrule "j " "$(G^s(B") + (its-defrule "k " "$(GF+(B") + (its-defrule "l " "$(GD'(B") + (its-defrule "m " "$(GJd(B") + (its-defrule "n " "$(GH!(B") + (its-defrule "p " "$(GJG(B") + (its-defrule "q " "$(GF*(B") + (its-defrule "r " "$(GEJ(B") + (its-defrule "s " "$(GQR(B") + (its-defrule "sh " "$(GD8(B") + (its-defrule "t " "$(GEl(B") + (its-defrule "w " "$(GJ<(B") + (its-defrule "x " "$(GGW(B") + (its-defrule "y " "$(GD4(B") + (its-defrule "z " "$(GGc(B") + (its-defrule "zh " "$(Gaa(B") + + (dolist (ascii '(("0" . "$(G$!(B") ("1" . "$(G$"(B") ("2" . "$(G$#(B") ("3" . "$(G$$(B") + ("4" . "$(G$%(B") ("5" . "$(G$&(B") ("6" . "$(G$'(B") ("7" . "$(G$((B") + ("8" . "$(G$)(B") ("9" . "$(G$*(B") + (" " . "$(G!!(B") ("!" . "$(G!*(B") ("@" . "$(G"i(B") ("#" . "$(G!l(B") + ("$" . "$(G"c(B") ("%" . "$(G"h(B") ("^" . "$(G!T(B") ("&" . "$(G!m(B") + ("*" . "$(G!n(B") ("(" . "$(G!>(B") (")" . "$(G!?(B") + ("-" . "$(G"1(B") ("=" . "$(G"8(B") ("`" . "$(G!j(B") ("\\" . "$(G"`(B") + ("|" . "$(G"^(B") ("_" . "$(G"%(B") ("+" . "$(G"0(B") ("~" . "$(G"D(B") + ("[" . "$(G!b(B") ("]" . "$(G!c(B") ("{" . "$(G!B(B") ("}" . "$(G!C(B") + (":" . "$(G!((B") (";" . "$(G!'(B") ("\"" . "$(G!i(B") ("'" . "$(G!k(B") + ("<" . "$(G"6(B") (">" . "$(G"7(B") ("?" . "$(G!)(B") ("/" . "$(G"_(B") + ("," . "$(G!"(B") ("." . "$(G!%(B") + ("a" . "$(G$[(B") ("b" . "$(G$\(B") ("c" . "$(G$](B") ("d" . "$(G$^(B") + ("e" . "$(G$_(B") ("f" . "$(G$`(B") ("g" . "$(G$a(B") ("h" . "$(G$b(B") + ("i" . "$(G$c(B") ("j" . "$(G$d(B") ("k" . "$(G$e(B") ("l" . "$(G$f(B") + ("m" . "$(G$g(B") ("n" . "$(G$h(B") ("o" . "$(G$i(B") ("p" . "$(G$j(B") + ("q" . "$(G$k(B") ("r" . "$(G$l(B") ("s" . "$(G$m(B") ("t" . "$(G$n(B") + ("u" . "$(G$o(B") ("v" . "$(G$p(B") ("w" . "$(G$q(B") ("x" . "$(G$r(B") + ("y" . "$(G$s(B") ("z" . "$(G$t(B") + ("A" . "$(G$A(B") ("B" . "$(G$B(B") ("C" . "$(G$C(B") ("D" . "$(G$D(B") + ("E" . "$(G$E(B") ("F" . "$(G$F(B") ("G" . "$(G$G(B") ("H" . "$(G$H(B") + ("I" . "$(G$I(B") ("J" . "$(G$J(B") ("K" . "$(G$K(B") ("L" . "$(G$L(B") + ("M" . "$(G$M(B") ("N" . "$(G$N(B") ("O" . "$(G$O(B") ("P" . "$(G$P(B") + ("Q" . "$(G$Q(B") ("R" . "$(G$R(B") ("S" . "$(G$S(B") ("T" . "$(G$T(B") + ("U" . "$(G$U(B") ("V" . "$(G$V(B") ("W" . "$(G$W(B") ("X" . "$(G$X(B") + ("Y" . "$(G$Y(B") ("Z" . "$(G$Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule (concat its-banjiao-escape in) in) + (its-defrule (concat its-quanjiao-escape in) out))) + + (its-defrule "," "$(G!"(B") + (its-defrule "." "$(G!$(B") + (its-defrule "/" "$(G!#(B") + (its-defrule ":" "$(G!((B") + (its-defrule ";" "$(G!'(B") + (its-defrule "?" "$(G!)(B") + (its-defrule "!" "$(G!*(B")) + +(define-its-state-machine-append its-pinyin-cn-map + (its-defrule "[" its-pinyin-cn-open-braket) + (its-defrule "]" its-pinyin-cn-close-braket) + + (if its-pinyin-cn-enable-quanjioao-alphabet + (progn + (its-defrule "1" "$A#1(B") (its-defrule "2" "$A#2(B") + (its-defrule "3" "$A#3(B") (its-defrule "4" "$A#4(B") + (its-defrule "5" "$A#5(B") (its-defrule "6" "$A#6(B") + (its-defrule "7" "$A#7(B") (its-defrule "8" "$A#8(B") + (its-defrule "9" "$A#9(B") (its-defrule "0" "$A#0(B") + (its-defrule "@" "$A#@(B") + (its-defrule "#" "$A##(B") (its-defrule "$" "$A!g(B") + (its-defrule "%" "$A#%(B") (its-defrule "^" "$A#^(B") + (its-defrule "&" "$A#&(B") (its-defrule "*" "$A#*(B") + (its-defrule "(" "$A#((B") (its-defrule ")" "$A#)(B") + (its-defrule "-" "$A#-(B") (its-defrule "~" "$A!+(B") + (its-defrule "=" "$A#=(B") (its-defrule "`" "$A#`(B") + (its-defrule "\\" "$A#\(B") (its-defrule "|" "$A#|(B") + (its-defrule "_" "$A#_(B") (its-defrule "+" "$A#+(B") + (its-defrule "{" "$A#{(B") (its-defrule "}" "$A#}(B") + (its-defrule "\"" "$A#"(B") (its-defrule "'" "$A#'(B") + (its-defrule "<" "$A#<(B") (its-defrule ">" "$A#>(B")) + (progn + (its-defrule "1" "1") (its-defrule "2" "2") + (its-defrule "3" "3") (its-defrule "4" "4") + (its-defrule "5" "5") (its-defrule "6" "6") + (its-defrule "7" "7") (its-defrule "8" "8") + (its-defrule "9" "9") (its-defrule "0" "0") + (its-defrule "@" "@") + (its-defrule "#" "#") (its-defrule "$" "$") + (its-defrule "%" "%") (its-defrule "^" "^") + (its-defrule "&" "&") (its-defrule "*" "*") + (its-defrule "(" "(") (its-defrule ")" ")") + (its-defrule "-" "-") (its-defrule "~" "~") + (its-defrule "=" "=") (its-defrule "`" "`") + (its-defrule "\\" "\\") (its-defrule "|" "|") + (its-defrule "_" "_") (its-defrule "+" "+") + (its-defrule "{" "{") (its-defrule "}" "}") + (its-defrule "\"" "\"") (its-defrule "'" "'") + (its-defrule "<" "<") (its-defrule ">" ">")))) + +(define-its-state-machine-append its-pinyin-tw-map + (its-defrule "[" its-pinyin-tw-open-braket) + (its-defrule "]" its-pinyin-tw-close-braket) + + (if its-pinyin-tw-enable-quanjioao-alphabet + (progn + (its-defrule "1" "$(G$"(B") (its-defrule "2" "$(G$#(B") + (its-defrule "3" "$(G$$(B") (its-defrule "4" "$(G$%(B") + (its-defrule "5" "$(G$&(B") (its-defrule "6" "$(G$'(B") + (its-defrule "7" "$(G$((B") (its-defrule "8" "$(G$)(B") + (its-defrule "9" "$(G$*(B") (its-defrule "0" "$(G$!(B") + (its-defrule "@" "$(G"i(B") + (its-defrule "#" "$(G!l(B") (its-defrule "$" "$(G"c(B") + (its-defrule "%" "$(G"h(B") (its-defrule "^" "$(G!T(B") + (its-defrule "&" "$(G!m(B") (its-defrule "*" "$(G!n(B") + (its-defrule "(" "$(G!>(B") (its-defrule ")" "$(G!?(B") + (its-defrule "-" "$(G"1(B") (its-defrule "~" "$(G"D(B") + (its-defrule "=" "$(G"8(B") (its-defrule "`" "$(G!j(B") + (its-defrule "\\" "$(G"b(B") (its-defrule "|" "$(G"^(B") + (its-defrule "_" "$(G"%(B") (its-defrule "+" "$(G"0(B") + (its-defrule "{" "$(G!B(B") (its-defrule "}" "$(G!C(B") + (its-defrule "\"" "$(G!i(B") (its-defrule "'" "$(G!k(B") + (its-defrule "<" "$(G"6(B") (its-defrule ">" "$(G"7(B")) + (progn + (its-defrule "1" "1") (its-defrule "2" "2") + (its-defrule "3" "3") (its-defrule "4" "4") + (its-defrule "5" "5") (its-defrule "6" "6") + (its-defrule "7" "7") (its-defrule "8" "8") + (its-defrule "9" "9") (its-defrule "0" "0") + (its-defrule "@" "@") + (its-defrule "#" "#") (its-defrule "$" "$") + (its-defrule "%" "%") (its-defrule "^" "^") + (its-defrule "&" "&") (its-defrule "*" "*") + (its-defrule "(" "(") (its-defrule ")" ")") + (its-defrule "-" "-") (its-defrule "~" "~") + (its-defrule "=" "=") (its-defrule "`" "`") + (its-defrule "\\" "\\") (its-defrule "|" "|") + (its-defrule "_" "_") (its-defrule "+" "+") + (its-defrule "{" "{") (its-defrule "}" "}") + (its-defrule "\"" "\"") (its-defrule "'" "'") + (its-defrule "<" "<") (its-defrule ">" ">")))) + +(provide 'its/pinyin) diff --git a/its/quanjiao.el b/its/quanjiao.el new file mode 100644 index 0000000..a127083 --- /dev/null +++ b/its/quanjiao.el @@ -0,0 +1,179 @@ +;;; its/quanjiao.el --- Quanjiao ASCII Input in Egg Input Method Architecture + +;; Copyright (C) 1999,2000 PFU LIMITED + +;; Author: KATAYAMA Yoshio + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: +;; +;; Symbol input is desined by jiro@math.keio.ac.jp (TANAKA Jiro) +;; This file is based on the rules of its/hira.el in Mule-2.3 distribution. +;; + +;;; Code: + +(eval-when-compile + (require 'its)) + +(define-its-state-machine its-quanjiao-up-cn-map + "quanjiao-upcase-cn" "$A#A(B" Chinese-GB + "Map for quanjiao-upcase input. (Chinese-GB)" + + (dolist (ascii '(("0" . "$A#0(B") ("1" . "$A#1(B") ("2" . "$A#2(B") ("3" . "$A#3(B") + ("4" . "$A#4(B") ("5" . "$A#5(B") ("6" . "$A#6(B") ("7" . "$A#7(B") + ("8" . "$A#8(B") ("9" . "$A#9(B") + (" " . "$A!!(B") ("!" . "$A#!(B") ("@" . "$A#@(B") ("#" . "$A##(B") + ("$" . "$A!g(B") ("%" . "$A#%(B") ("^" . "$A#^(B") ("&" . "$A#&(B") + ("*" . "$A#*(B") ("(" . "$A#((B") (")" . "$A#)(B") + ("-" . "$A#-(B") ("=" . "$A#=(B") ("`" . "$A#`(B") ("\\" . "$A#\(B") + ("|" . "$A#|(B") ("_" . "$A#_(B") ("+" . "$A#+(B") ("~" . "$A!+(B") + ("[" . "$A#[(B") ("]" . "$A#](B") ("{" . "$A#{(B") ("}" . "$A#}(B") + (":" . "$A#:(B") (";" . "$A#;(B") ("\"" . "$A#"(B") ("'" . "$A#'(B") + ("<" . "$A#<(B") (">" . "$A#>(B") ("?" . "$A#?(B") ("/" . "$A#/(B") + ("," . "$A#,(B") ("." . "$A#.(B") + ("a" . "$A#A(B") ("b" . "$A#B(B") ("c" . "$A#C(B") ("d" . "$A#D(B") + ("e" . "$A#E(B") ("f" . "$A#F(B") ("g" . "$A#G(B") ("h" . "$A#H(B") + ("i" . "$A#I(B") ("j" . "$A#J(B") ("k" . "$A#K(B") ("l" . "$A#L(B") + ("m" . "$A#M(B") ("n" . "$A#N(B") ("o" . "$A#O(B") ("p" . "$A#P(B") + ("q" . "$A#Q(B") ("r" . "$A#R(B") ("s" . "$A#S(B") ("t" . "$A#T(B") + ("u" . "$A#U(B") ("v" . "$A#V(B") ("w" . "$A#W(B") ("x" . "$A#X(B") + ("y" . "$A#Y(B") ("z" . "$A#Z(B") + ("A" . "$A#A(B") ("B" . "$A#B(B") ("C" . "$A#C(B") ("D" . "$A#D(B") + ("E" . "$A#E(B") ("F" . "$A#F(B") ("G" . "$A#G(B") ("H" . "$A#H(B") + ("I" . "$A#I(B") ("J" . "$A#J(B") ("K" . "$A#K(B") ("L" . "$A#L(B") + ("M" . "$A#M(B") ("N" . "$A#N(B") ("O" . "$A#O(B") ("P" . "$A#P(B") + ("Q" . "$A#Q(B") ("R" . "$A#R(B") ("S" . "$A#S(B") ("T" . "$A#T(B") + ("U" . "$A#U(B") ("V" . "$A#V(B") ("W" . "$A#W(B") ("X" . "$A#X(B") + ("Y" . "$A#Y(B") ("Z" . "$A#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule in out)))) + +(define-its-state-machine-append its-quanjiao-up-cn-map) + +(define-its-state-machine its-quanjiao-down-cn-map + "quanjiao-downcase-cn" "$A#a(B" Chinese-GB + "Map for quanjiao-downcase input. (Chinese-GB)" + + (dolist (ascii '(("0" . "$A#0(B") ("1" . "$A#1(B") ("2" . "$A#2(B") ("3" . "$A#3(B") + ("4" . "$A#4(B") ("5" . "$A#5(B") ("6" . "$A#6(B") ("7" . "$A#7(B") + ("8" . "$A#8(B") ("9" . "$A#9(B") + (" " . "$A!!(B") ("!" . "$A#!(B") ("@" . "$A#@(B") ("#" . "$A##(B") + ("$" . "$A!g(B") ("%" . "$A#%(B") ("^" . "$A#^(B") ("&" . "$A#&(B") + ("*" . "$A#*(B") ("(" . "$A#((B") (")" . "$A#)(B") + ("-" . "$A#-(B") ("=" . "$A#=(B") ("`" . "$A#`(B") ("\\" . "$A#\(B") + ("|" . "$A#|(B") ("_" . "$A#_(B") ("+" . "$A#+(B") ("~" . "$A!+(B") + ("[" . "$A#[(B") ("]" . "$A#](B") ("{" . "$A#{(B") ("}" . "$A#}(B") + (":" . "$A#:(B") (";" . "$A#;(B") ("\"" . "$A#"(B") ("'" . "$A#'(B") + ("<" . "$A#<(B") (">" . "$A#>(B") ("?" . "$A#?(B") ("/" . "$A#/(B") + ("," . "$A#,(B") ("." . "$A#.(B") + ("a" . "$A#a(B") ("b" . "$A#b(B") ("c" . "$A#c(B") ("d" . "$A#d(B") + ("e" . "$A#e(B") ("f" . "$A#f(B") ("g" . "$A#g(B") ("h" . "$A#h(B") + ("i" . "$A#i(B") ("j" . "$A#j(B") ("k" . "$A#k(B") ("l" . "$A#l(B") + ("m" . "$A#m(B") ("n" . "$A#n(B") ("o" . "$A#o(B") ("p" . "$A#p(B") + ("q" . "$A#q(B") ("r" . "$A#r(B") ("s" . "$A#s(B") ("t" . "$A#t(B") + ("u" . "$A#u(B") ("v" . "$A#v(B") ("w" . "$A#w(B") ("x" . "$A#x(B") + ("y" . "$A#y(B") ("z" . "$A#z(B") + ("A" . "$A#A(B") ("B" . "$A#B(B") ("C" . "$A#C(B") ("D" . "$A#D(B") + ("E" . "$A#E(B") ("F" . "$A#F(B") ("G" . "$A#G(B") ("H" . "$A#H(B") + ("I" . "$A#I(B") ("J" . "$A#J(B") ("K" . "$A#K(B") ("L" . "$A#L(B") + ("M" . "$A#M(B") ("N" . "$A#N(B") ("O" . "$A#O(B") ("P" . "$A#P(B") + ("Q" . "$A#Q(B") ("R" . "$A#R(B") ("S" . "$A#S(B") ("T" . "$A#T(B") + ("U" . "$A#U(B") ("V" . "$A#V(B") ("W" . "$A#W(B") ("X" . "$A#X(B") + ("Y" . "$A#Y(B") ("Z" . "$A#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule in out)))) + +(define-its-state-machine-append its-quanjiao-down-cn-map) + +(define-its-state-machine its-quanjiao-up-tw-map + "quanjiao-upcase-tw" "$(G$A(B" Chinese-CNS + "Map for quanjiao-upcase input. (Chinese-CNS)" + + (dolist (ascii '(("0" . "$(G$!(B") ("1" . "$(G$"(B") ("2" . "$(G$#(B") ("3" . "$(G$$(B") + ("4" . "$(G$%(B") ("5" . "$(G$&(B") ("6" . "$(G$'(B") ("7" . "$(G$((B") + ("8" . "$(G$)(B") ("9" . "$(G$*(B") + (" " . "$(G!!(B") ("!" . "$(G!*(B") ("@" . "$(G"i(B") ("#" . "$(G!l(B") + ("$" . "$(G"c(B") ("%" . "$(G"h(B") ("^" . "$(G!T(B") ("&" . "$(G!m(B") + ("*" . "$(G!n(B") ("(" . "$(G!>(B") (")" . "$(G!?(B") + ("-" . "$(G"1(B") ("=" . "$(G"8(B") ("`" . "$(G!j(B") ("\\" . "$(G"b(B") + ("|" . "$(G"^(B") ("_" . "$(G"%(B") ("+" . "$(G"0(B") ("~" . "$(G"D(B") + ("[" . "$(G!b(B") ("]" . "$(G!c(B") ("{" . "$A#{(B") ("}" . "$(G!a(B") + (":" . "$(G!((B") (";" . "$(G!'(B") ("\"" . "$(G!i(B") ("'" . "$(G!k(B") + ("<" . "$(G"6(B") (">" . "$(G"7(B") ("?" . "$(G!)(B") ("/" . "$(G"a(B") + ("," . "$(G!"(B") ("." . "$(G!%(B") + ("a" . "$(G$A(B") ("b" . "$(G$B(B") ("c" . "$(G$C(B") ("d" . "$(G$D(B") + ("e" . "$(G$E(B") ("f" . "$(G$F(B") ("g" . "$(G$G(B") ("h" . "$(G$H(B") + ("i" . "$(G$I(B") ("j" . "$(G$J(B") ("k" . "$(G$K(B") ("l" . "$(G$L(B") + ("m" . "$(G$M(B") ("n" . "$(G$N(B") ("o" . "$(G$O(B") ("p" . "$(G$P(B") + ("q" . "$(G$Q(B") ("r" . "$(G$R(B") ("s" . "$(G$S(B") ("t" . "$(G$T(B") + ("u" . "$(G$U(B") ("v" . "$(G$V(B") ("w" . "$(G$W(B") ("x" . "$(G$X(B") + ("y" . "$(G$Y(B") ("z" . "$(G$Z(B") + ("A" . "$(G$A(B") ("B" . "$(G$B(B") ("C" . "$(G$C(B") ("D" . "$(G$D(B") + ("E" . "$(G$E(B") ("F" . "$(G$F(B") ("G" . "$(G$G(B") ("H" . "$(G$H(B") + ("I" . "$(G$I(B") ("J" . "$(G$J(B") ("K" . "$(G$K(B") ("L" . "$(G$L(B") + ("M" . "$(G$M(B") ("N" . "$(G$N(B") ("O" . "$(G$O(B") ("P" . "$(G$P(B") + ("Q" . "$(G$Q(B") ("R" . "$(G$R(B") ("S" . "$(G$S(B") ("T" . "$(G$T(B") + ("U" . "$(G$U(B") ("V" . "$(G$V(B") ("W" . "$(G$W(B") ("X" . "$(G$X(B") + ("Y" . "$(G$Y(B") ("Z" . "$(G$Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule in out)))) + +(define-its-state-machine-append its-quanjiao-up-tw-map) + +(define-its-state-machine its-quanjiao-down-tw-map + "quanjiao-downcase-tw" "$(G$[(B" Chinese-CNS + "Map for quanjiao-downcase input. (Chinese-CNS)" + + (dolist (ascii '(("0" . "$(G$!(B") ("1" . "$(G$"(B") ("2" . "$(G$#(B") ("3" . "$(G$$(B") + ("4" . "$(G$%(B") ("5" . "$(G$&(B") ("6" . "$(G$'(B") ("7" . "$(G$((B") + ("8" . "$(G$)(B") ("9" . "$(G$*(B") + (" " . "$(G!!(B") ("!" . "$(G!*(B") ("@" . "$(G"i(B") ("#" . "$(G!l(B") + ("$" . "$(G"c(B") ("%" . "$(G"h(B") ("^" . "$(G!T(B") ("&" . "$(G!m(B") + ("*" . "$(G!n(B") ("(" . "$(G!>(B") (")" . "$(G!?(B") + ("-" . "$(G"1(B") ("=" . "$(G"8(B") ("`" . "$(G!j(B") ("\\" . "$(G"`(B") + ("|" . "$(G"^(B") ("_" . "$(G"%(B") ("+" . "$(G"0(B") ("~" . "$(G"D(B") + ("[" . "$(G!b(B") ("]" . "$(G!c(B") ("{" . "$(G!B(B") ("}" . "$(G!C(B") + (":" . "$(G!((B") (";" . "$(G!'(B") ("\"" . "$(G!i(B") ("'" . "$(G!k(B") + ("<" . "$(G"6(B") (">" . "$(G"7(B") ("?" . "$(G!)(B") ("/" . "$(G"_(B") + ("," . "$(G!"(B") ("." . "$(G!%(B") + ("a" . "$(G$[(B") ("b" . "$(G$\(B") ("c" . "$(G$](B") ("d" . "$(G$^(B") + ("e" . "$(G$_(B") ("f" . "$(G$`(B") ("g" . "$(G$a(B") ("h" . "$(G$b(B") + ("i" . "$(G$c(B") ("j" . "$(G$d(B") ("k" . "$(G$e(B") ("l" . "$(G$f(B") + ("m" . "$(G$g(B") ("n" . "$(G$h(B") ("o" . "$(G$i(B") ("p" . "$(G$j(B") + ("q" . "$(G$k(B") ("r" . "$(G$l(B") ("s" . "$(G$m(B") ("t" . "$(G$n(B") + ("u" . "$(G$o(B") ("v" . "$(G$p(B") ("w" . "$(G$q(B") ("x" . "$(G$r(B") + ("y" . "$(G$s(B") ("z" . "$(G$t(B") + ("A" . "$(G$A(B") ("B" . "$(G$B(B") ("C" . "$(G$C(B") ("D" . "$(G$D(B") + ("E" . "$(G$E(B") ("F" . "$(G$F(B") ("G" . "$(G$G(B") ("H" . "$(G$H(B") + ("I" . "$(G$I(B") ("J" . "$(G$J(B") ("K" . "$(G$K(B") ("L" . "$(G$L(B") + ("M" . "$(G$M(B") ("N" . "$(G$N(B") ("O" . "$(G$O(B") ("P" . "$(G$P(B") + ("Q" . "$(G$Q(B") ("R" . "$(G$R(B") ("S" . "$(G$S(B") ("T" . "$(G$T(B") + ("U" . "$(G$U(B") ("V" . "$(G$V(B") ("W" . "$(G$W(B") ("X" . "$(G$X(B") + ("Y" . "$(G$Y(B") ("Z" . "$(G$Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule in out)))) + +(define-its-state-machine-append its-quanjiao-down-tw-map) + +(provide 'its/quanjiao) diff --git a/its/thai.el b/its/thai.el new file mode 100644 index 0000000..1a1f6cb --- /dev/null +++ b/its/thai.el @@ -0,0 +1,145 @@ +;;; its/thai.el --- Inputting Thai characters in Egg Input Method Architecture + +;; Copyright (C) 1999,2000 PFU LIMITED + +;; Author: KATAYAMA Yoshio + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + + +;;; Code: + + +(eval-when-compile + (require 'its) + (require 'cl)) + +(eval-when (compile) + (defconst its-compaction-enable t)) + +(eval-when-compile + (defmacro define-its-thai-keymap (&rest rule) + (let (input output type list) + (while rule + (setq input (car (car rule)) + output (nth 1 (car rule)) + type (nth 2 (car rule)) + rule (cdr rule) + list (cons `(its-defrule ,input ,output) list)) + (if type + (setq list (cons `(setq ,type (cons (cons ,input ,output) ,type)) + list)))) + `(let (consonant vowel tone) + ,@list + (its-thai-composit consonant vowel tone)))) + + (defun its-thai-composit (consonant vowel tone) + (let (keyseq output) + (while consonant + (setq keyseq (car (car consonant)) + output (cdr (car consonant)) + consonant (cdr consonant)) + (its-thai-add-vowel keyseq output vowel tone) + (its-thai-add-tone keyseq output tone)))) + + (defun its-thai-add-vowel (keyseq output vowel tone) + (let (next-keyseq next-output) + (while vowel + (setq next-keyseq (concat keyseq (car (car vowel))) + next-output (concat output (cdr (car vowel))) + vowel (cdr vowel)) + (its-defrule next-keyseq (compose-string next-output)) + (its-thai-add-tone next-keyseq next-output tone)))) + + (defun its-thai-add-tone (keyseq output tone) + (let (next-keyseq next-output) + (while tone + (setq next-keyseq (concat keyseq (car (car tone))) + next-output (concat output (cdr (car tone))) + tone (cdr tone)) + (its-defrule next-keyseq (compose-string next-output)))))) + +;; Thai Kesmanee keyboard support. + +(define-its-state-machine its-thai-kesmanee-map + "kesmanee" ",T!!(B" Thai + "Map for Thai Kesmanee input method with TIS620 keyboard. (Thai)" + + (define-its-thai-keymap + ("1" ",TE(B" consonant) ("!" "#") + ("2" "/") ("@" ",Tq(B") + ("3" "_") ("#" ",Tr(B") + ("4" ",T@(B" consonant) ("$" ",Ts(B") + ("5" ",T6(B" consonant) ("%" ",Tt(B") + ("6" ",TX(B" vowel) ("^" ",TY(B" vowel) + ("7" ",TV(B" vowel) ("&" "0,TQi(B1" vowel) + ("8" ",T$(B" consonant) ("*" ",Tu(B") + ("9" ",T5(B" consonant) ("(" ",Tv(B") + ("0" ",T((B" consonant) (")" ",Tw(B") + ("-" ",T"(B" consonant) ("_" ",Tx(B") + ("=" ",T*(B" consonant) ("+" ",Ty(B") + ("\\" ",T_(B") ("|" ",To(B") + ("`" ",T#(B" consonant) ("~" ",T%(B" consonant) + + ("q" ",Tf(B") ("Q" ",Tp(B") + ("w" ",Td(B") ("W" "\"") + ("e" ",TS(B") ("E" ",T.(B" consonant) + ("r" ",T>(B" consonant) ("R" ",T1(B" consonant) + ("T" ",T8(B" consonant) ("t" ",TP(B") + ("y" ",TQ(B" vowel) ("Y" ",Tm(B" tone) + ("u" ",TU(B" vowel) ("U" ",Tj(B" tone) + ("i" ",TC(B" consonant) ("I" ",T3(B" consonant) + ("o" ",T9(B" consonant) ("O" ",TO(B") + ("p" ",TB(B" consonant) ("P" ",T-(B" consonant) + ("[" ",T:(B" consonant) ("{" ",T0(B" consonant) + ("]" ",TE(B" consonant) ("}" ",") + + ("a" ",T?(B" consonant) ("A" ",TD(B") + ("s" ",TK(B" consonant) ("S" ",T&(B" consonant) + ("d" ",T!(B" consonant) ("D" ",T/(B" consonant) + ("f" ",T4(B" consonant) ("F" ",Tb(B") + ("g" ",T`(B") ("G" ",T,(B" consonant) + ("h" ",Ti(B" tone) ("H" ",Tg(B" vowel) + ("j" ",Th(B" tone) ("J" ",Tk(B" tone) + ("k" ",TR(B") ("K" ",TI(B" consonant) + ("l" ",TJ(B" consonant) ("L" ",TH(B" consonant) + (";" ",TG(B" consonant) (":" ",T+(B" consonant) + ("'" ",T'(B" consonant) ("\"" ",TF(B") + + ("z" ",T<(B" consonant) ("Z" "(") + ("x" ",T;(B" consonant) ("X" ")") + ("c" ",Ta(B") ("C" ",T)(B" consonant) + ("v" ",TM(B" consonant) ("V" ",TN(B" consonant) + ("b" ",TT(B" vowel) ("B" ",TZ(B" vowel) + ("n" ",TW(B" vowel) ("N" ",Tl(B" tone) + ("m" ",T7(B" consonant) ("M" ",Tn(B" vowel) + ("," ",TA(B" consonant) ("<" ",T2(B" consonant) + ("." ",Tc(B") (">" ",TL(B" consonant) + ("/" ",T=(B" consonant) ("?" "?"))) + +(define-its-state-machine-append its-thai-kesmanee-map) + +(provide 'its/thai) + +;;; its/thai.el ends here diff --git a/its/zenkaku.el b/its/zenkaku.el new file mode 100644 index 0000000..a5ccff9 --- /dev/null +++ b/its/zenkaku.el @@ -0,0 +1,109 @@ +;;; its/zenkau.el --- Zenkaku ASCII Input in Egg Input Method Architecture + +;; Copyright (C) 1999,2000 PFU LIMITED + +;; Author: KATAYAMA Yoshio + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: +;; +;; Symbol input is desined by jiro@math.keio.ac.jp (TANAKA Jiro) +;; This file is based on the rules of its/hira.el in Mule-2.3 distribution. +;; + +;;; Code: + +(eval-when-compile + (require 'its)) + +(define-its-state-machine its-zenkaku-up-map + "zenkaku-upcase" "$B#A(B" Japanese + "Map for zenkaku-upcase input." + + (dolist (ascii '(("0" . "$B#0(B") ("1" . "$B#1(B") ("2" . "$B#2(B") ("3" . "$B#3(B") + ("4" . "$B#4(B") ("5" . "$B#5(B") ("6" . "$B#6(B") ("7" . "$B#7(B") + ("8" . "$B#8(B") ("9" . "$B#9(B") + (" " . "$B!!(B") ("!" . "$B!*(B") ("@" . "$B!w(B") ("#" . "$B!t(B") + ("$" . "$B!p(B") ("%" . "$B!s(B") ("^" . "$B!0(B") ("&" . "$B!u(B") + ("*" . "$B!v(B") ("(" . "$B!J(B") (")" . "$B!K(B") + ("-" . "$B!](B") ("=" . "$B!a(B") ("`" . "$B!.(B") ("\\" . "$B!@(B") + ("|" . "$B!C(B") ("_" . "$B!2(B") ("+" . "$B!\(B") ("~" . "$B!A(B") + ("[" . "$B!N(B") ("]" . "$B!O(B") ("{" . "$B!P(B") ("}" . "$B!Q(B") + (":" . "$B!'(B") (";" . "$B!((B") ("\"" . "$B!I(B") ("'" . "$B!-(B") + ("<" . "$B!c(B") (">" . "$B!d(B") ("?" . "$B!)(B") ("/" . "$B!?(B") + ("," . "$B!$(B") ("." . "$B!%(B") + ("a" . "$B#A(B") ("b" . "$B#B(B") ("c" . "$B#C(B") ("d" . "$B#D(B") + ("e" . "$B#E(B") ("f" . "$B#F(B") ("g" . "$B#G(B") ("h" . "$B#H(B") + ("i" . "$B#I(B") ("j" . "$B#J(B") ("k" . "$B#K(B") ("l" . "$B#L(B") + ("m" . "$B#M(B") ("n" . "$B#N(B") ("o" . "$B#O(B") ("p" . "$B#P(B") + ("q" . "$B#Q(B") ("r" . "$B#R(B") ("s" . "$B#S(B") ("t" . "$B#T(B") + ("u" . "$B#U(B") ("v" . "$B#V(B") ("w" . "$B#W(B") ("x" . "$B#X(B") + ("y" . "$B#Y(B") ("z" . "$B#Z(B") + ("A" . "$B#A(B") ("B" . "$B#B(B") ("C" . "$B#C(B") ("D" . "$B#D(B") + ("E" . "$B#E(B") ("F" . "$B#F(B") ("G" . "$B#G(B") ("H" . "$B#H(B") + ("I" . "$B#I(B") ("J" . "$B#J(B") ("K" . "$B#K(B") ("L" . "$B#L(B") + ("M" . "$B#M(B") ("N" . "$B#N(B") ("O" . "$B#O(B") ("P" . "$B#P(B") + ("Q" . "$B#Q(B") ("R" . "$B#R(B") ("S" . "$B#S(B") ("T" . "$B#T(B") + ("U" . "$B#U(B") ("V" . "$B#V(B") ("W" . "$B#W(B") ("X" . "$B#X(B") + ("Y" . "$B#Y(B") ("Z" . "$B#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule in out)))) + +(define-its-state-machine-append its-zenkaku-up-map) + +(define-its-state-machine its-zenkaku-down-map + "zenkaku-downcase" "$B#a(B" Japanese + "Map for zenkaku-downcase input." + + (dolist (ascii '(("0" . "$B#0(B") ("1" . "$B#1(B") ("2" . "$B#2(B") ("3" . "$B#3(B") + ("4" . "$B#4(B") ("5" . "$B#5(B") ("6" . "$B#6(B") ("7" . "$B#7(B") + ("8" . "$B#8(B") ("9" . "$B#9(B") + (" " . "$B!!(B") ("!" . "$B!*(B") ("@" . "$B!w(B") ("#" . "$B!t(B") + ("$" . "$B!p(B") ("%" . "$B!s(B") ("^" . "$B!0(B") ("&" . "$B!u(B") + ("*" . "$B!v(B") ("(" . "$B!J(B") (")" . "$B!K(B") + ("-" . "$B!](B") ("=" . "$B!a(B") ("`" . "$B!.(B") ("\\" . "$B!@(B") + ("|" . "$B!C(B") ("_" . "$B!2(B") ("+" . "$B!\(B") ("~" . "$B!A(B") + ("[" . "$B!N(B") ("]" . "$B!O(B") ("{" . "$B!P(B") ("}" . "$B!Q(B") + (":" . "$B!'(B") (";" . "$B!((B") ("\"" . "$B!I(B") ("'" . "$B!-(B") + ("<" . "$B!c(B") (">" . "$B!d(B") ("?" . "$B!)(B") ("/" . "$B!?(B") + ("," . "$B!$(B") ("." . "$B!%(B") + ("a" . "$B#a(B") ("b" . "$B#b(B") ("c" . "$B#c(B") ("d" . "$B#d(B") + ("e" . "$B#e(B") ("f" . "$B#f(B") ("g" . "$B#g(B") ("h" . "$B#h(B") + ("i" . "$B#i(B") ("j" . "$B#j(B") ("k" . "$B#k(B") ("l" . "$B#l(B") + ("m" . "$B#m(B") ("n" . "$B#n(B") ("o" . "$B#o(B") ("p" . "$B#p(B") + ("q" . "$B#q(B") ("r" . "$B#r(B") ("s" . "$B#s(B") ("t" . "$B#t(B") + ("u" . "$B#u(B") ("v" . "$B#v(B") ("w" . "$B#w(B") ("x" . "$B#x(B") + ("y" . "$B#y(B") ("z" . "$B#z(B") + ("A" . "$B#A(B") ("B" . "$B#B(B") ("C" . "$B#C(B") ("D" . "$B#D(B") + ("E" . "$B#E(B") ("F" . "$B#F(B") ("G" . "$B#G(B") ("H" . "$B#H(B") + ("I" . "$B#I(B") ("J" . "$B#J(B") ("K" . "$B#K(B") ("L" . "$B#L(B") + ("M" . "$B#M(B") ("N" . "$B#N(B") ("O" . "$B#O(B") ("P" . "$B#P(B") + ("Q" . "$B#Q(B") ("R" . "$B#R(B") ("S" . "$B#S(B") ("T" . "$B#T(B") + ("U" . "$B#U(B") ("V" . "$B#V(B") ("W" . "$B#W(B") ("X" . "$B#X(B") + ("Y" . "$B#Y(B") ("Z" . "$B#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule in out)))) + +(define-its-state-machine-append its-zenkaku-down-map) + +(provide 'its/zenkaku) diff --git a/its/zhuyin.el b/its/zhuyin.el new file mode 100644 index 0000000..09ee3a3 --- /dev/null +++ b/its/zhuyin.el @@ -0,0 +1,295 @@ +;;; its/zhuyin.el --- Zhuyin Input in Egg Input Method Architecture + +;; Copyright (C) 1999,2000 PFU LIMITED + +;; Author: KATAYAMA Yoshio + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + + +;;; Code: + + +(eval-when-compile + (require 'its) + (require 'cl)) + +(eval-when (compile) + (defconst its-compaction-enable t)) + +(defvar its-zhuyin-cn-enable-quanjioao-alphabet + (if (boundp 'its-enable-fullwidth-alphabet) + its-enable-fullwidth-alphabet + t) + "*Enable Quanjiao alphabet") + +(defvar its-zhuyin-cn-open-braket "$A!8(B" "*[") ; "$A#[(B" +(defvar its-zhuyin-cn-close-braket "$A!9(B" "*]") ; "$A#](B" + +(defvar its-zhuyin-tw-enable-quanjioao-alphabet + (if (boundp 'its-enable-fullwidth-alphabet) + its-enable-fullwidth-alphabet + t) + "*Enable Quanjiao alphabet") + +(defvar its-zhuyin-tw-open-braket "$(G!V(B" "*[") ; "$(G!b(B " +(defvar its-zhuyin-tw-close-braket "$(G!W(B" "*]") ; "$(G!c(B" + +(eval-when-compile + (defmacro its-do-zhuyin-table (list) + `(progn + ,@(mapcar (lambda (syl) `(its-define-zhuyin ,@syl)) + list))) + + (defmacro its-define-zhuyin (shengmu yunmu1 &optional yunmu2 qingsheng) + `(let ((s (list ,@shengmu)) + (yi (concat (car ,yunmu1) (car ,yunmu2))) + (yo (concat (nth 1 ,yunmu1) (nth 1 ,yunmu2))) + (tone ,(if qingsheng "(0A(B" "(0@(B")) + in out out1 state) + (while s + (setq in (concat (car (car s)) yi) + out (concat (nth 1 (car s)) yo) + out1 (concat out tone) + state (its-defrule* in out1 out) + s (cdr s)) + (its-defrule (concat in " ") out1) + ,@(if (null qingsheng) + '((its-make-next-state state ?1 (concat out "(0A(B")) + (its-make-next-state state ?2 (concat out "(0B(B")) + (its-make-next-state state ?3 (concat out "(0C(B")) + (its-make-next-state state ?4 (concat out "(0D(B"))))))) + + (defmacro its-define-zhuyin-table () + '(let ((- '("" "")) + (B '("b" "(0E(B")) (P '("p" "(0F(B")) (M '("m" "(0G(B")) (F '("f" "(0H(B")) + (D '("d" "(0I(B")) (T '("t" "(0J(B")) (N '("n" "(0K(B")) (L '("l" "(0L(B")) + (G '("v" "(0M(B")) (K '("k" "(0N(B")) (H '("h" "(0O(B")) + (J '("g" "(0P(B")) (Q '("7" "(0Q(B")) (X '("c" "(0R(B")) + (ZH '("," "(0S(B")) (CH '("." "(0T(B")) (SH '("/" "(0U(B")) (R '("j" "(0V(B")) + (Z '(";" "(0W(B")) (C '(":" "(0X(B")) (S '("s" "(0Y(B")) + + (A '("a" "(0Z(B")) (O '("o" "(0[(B")) (e '("r" "(0\(B")) (E '("w" "(0](B")) + (AI '("i" "(0^(B")) (EI '("q" "(0_(B")) (AO '("z" "(0`(B")) + (AN '("8" "(0b(B")) (EN '("9" "(0c(B")) (ANG '("0" "(0d(B")) (ENG '("-" "(0e(B")) + (ER '("^" "(0f(B")) (OU '("y" "(0a(B")) + (I '("e" "(0g(B")) (U '("x" "(0h(B")) (V '("u" "(0i(B"))) + + (its-define-zhuyin (- H) M nil t) + (its-define-zhuyin (- H) '("@" "@") nil t) + (its-define-zhuyin (- ) N nil t) + + (its-do-zhuyin-table + ((( ZH CH SH R Z C S ) -) + ((- B P M F D T N L G K H ZH CH SH Z C S ) A) + ((- B P M F L ) O) + ((- M D T N L G K H ZH CH SH R Z C S ) e) + ((- B P M D T N L G K H ZH CH SH Z C S ) AI) + ((- B P M F D T N L G K H ZH SH Z C ) EI) + ((- B P M D T N L G K H ZH CH SH R Z C S ) AO) + ((- B P M F D T N L G K H ZH CH SH R Z C S ) AN) + ((- B P M F D N G K H ZH CH SH R Z C S ) EN) + ((- B P M F D T N L G K H ZH CH SH R Z C S ) ANG) + ((- B P M F D T N L G K H ZH CH SH R Z C S ) ENG) + ((- ) ER) + ((- P M F D T N L G K H ZH CH SH R Z C S ) OU) + ((- B P M D T N L J Q X ) I) + ((- D L J Q X ) I A) + ((- ) I O) + ((- B P M D T N L J Q X ) I E) + ((- B P M D T N L J Q X ) I AO) + ((- M D N L J Q X ) I OU) + ((- B P M D T N L J Q X ) I AN) + ((- B P M N L J Q X ) I EN) + ((- N L J Q X ) I ANG) + ((- B P M D T N L J Q X ) I ENG) + ((- B P M F D T N L G K H ZH CH SH R Z C S ) U) + ((- G K H ZH CH SH R ) U A) + ((- D T N L G K H ZH CH SH R Z C S ) U O) + ((- G K H ZH CH SH ) U AI) + ((- D T G K H ZH CH SH R Z C S ) U EI) + ((- D T N L G K H ZH CH SH R Z C S ) U AN) + ((- D T L G K H ZH CH SH R Z C S ) U EN) + ((- G K H ZH CH SH ) U ANG) + ((- D T N L G K H ZH CH R Z C S ) U ENG) + ((- N L J Q X ) V) + ((- N L J Q X ) V E) + ((- J Q X ) V AN) + ((- J Q X ) V EN) + ((- J Q X ) V ENG))) + + (mapcar (lambda (s) (its-defoutput (car s) (nth 1 s))) + (list B P M F D T N L G K H J Q X)) + + (its-defrule (concat (car N) 2) (concat (nth 1 N) "(0B(B")) + (its-defrule (concat (car N) 3) (concat (nth 1 N) "(0C(B")) + (its-defrule (concat (car N) 4) (concat (nth 1 N) "(0D(B"))))) + +(define-its-state-machine its-zhuyin-cn-map + "zhuyin-cn" "$AW"(BG" Chinese-GB + "Map for Zhuyin input. (Chinese-GB)" + + (defconst its-quanjiao-escape "Z") + (defconst its-banjiao-escape "X") + + (its-defrule-select-mode-temporally "B" downcase) + (its-defrule-select-mode-temporally "Q" quanjiao-downcase-cn) + + (its-define-zhuyin-table) + (dolist (ascii '(("0" . "$A#0(B") ("1" . "$A#1(B") ("2" . "$A#2(B") ("3" . "$A#3(B") + ("4" . "$A#4(B") ("5" . "$A#5(B") ("6" . "$A#6(B") ("7" . "$A#7(B") + ("8" . "$A#8(B") ("9" . "$A#9(B") + (" " . "$A!!(B") ("!" . "$A#!(B") ("@" . "$A#@(B") ("#" . "$A##(B") + ("$" . "$A!g(B") ("%" . "$A#%(B") ("^" . "$A#^(B") ("&" . "$A#&(B") + ("*" . "$A#*(B") ("(" . "$A#((B") (")" . "$A#)(B") + ("-" . "$A#-(B") ("=" . "$A#=(B") ("`" . "$A#`(B") ("\\" . "$A#\(B") + ("|" . "$A#|(B") ("_" . "$A#_(B") ("+" . "$A#+(B") ("~" . "$A!+(B") + ("[" . "$A#[(B") ("]" . "$A#](B") ("{" . "$A#{(B") ("}" . "$A#}(B") + (":" . "$A#:(B") (";" . "$A#;(B") ("\"" . "$A#"(B") ("'" . "$A#'(B") + ("<" . "$A#<(B") (">" . "$A#>(B") ("?" . "$A#?(B") ("/" . "$A#/(B") + ("," . "$A#,(B") ("." . "$A#.(B") + ("a" . "$A#a(B") ("b" . "$A#b(B") ("c" . "$A#c(B") ("d" . "$A#d(B") + ("e" . "$A#e(B") ("f" . "$A#f(B") ("g" . "$A#g(B") ("h" . "$A#h(B") + ("i" . "$A#i(B") ("j" . "$A#j(B") ("k" . "$A#k(B") ("l" . "$A#l(B") + ("m" . "$A#m(B") ("n" . "$A#n(B") ("o" . "$A#o(B") ("p" . "$A#p(B") + ("q" . "$A#q(B") ("r" . "$A#r(B") ("s" . "$A#s(B") ("t" . "$A#t(B") + ("u" . "$A#u(B") ("v" . "$A#v(B") ("w" . "$A#w(B") ("x" . "$A#x(B") + ("y" . "$A#y(B") ("z" . "$A#z(B") + ("A" . "$A#A(B") ("B" . "$A#B(B") ("C" . "$A#C(B") ("D" . "$A#D(B") + ("E" . "$A#E(B") ("F" . "$A#F(B") ("G" . "$A#G(B") ("H" . "$A#H(B") + ("I" . "$A#I(B") ("J" . "$A#J(B") ("K" . "$A#K(B") ("L" . "$A#L(B") + ("M" . "$A#M(B") ("N" . "$A#N(B") ("O" . "$A#O(B") ("P" . "$A#P(B") + ("Q" . "$A#Q(B") ("R" . "$A#R(B") ("S" . "$A#S(B") ("T" . "$A#T(B") + ("U" . "$A#U(B") ("V" . "$A#V(B") ("W" . "$A#W(B") ("X" . "$A#X(B") + ("Y" . "$A#Y(B") ("Z" . "$A#Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule (concat its-banjiao-escape in) in) + (its-defrule (concat its-quanjiao-escape in) out))) + + (its-defrule "<" "$A#,(B") + (its-defrule ">" "$A!#(B") + (its-defrule "?" "$A!"(B")) + +(define-its-state-machine its-zhuyin-tw-map + "zhuyin-tw" "$(GNC(BC" Chinese-CNS + "Map for Zhuyin input." + + (defconst its-quanjiao-escape "Z") + (defconst its-banjiao-escape "X") + + (its-defrule-select-mode-temporally "B" downcase) + (its-defrule-select-mode-temporally "Q" quanjiao-downcase-tw) + + (its-define-zhuyin-table) + (dolist (ascii '(("0" . "$(G$!(B") ("1" . "$(G$"(B") ("2" . "$(G$#(B") ("3" . "$(G$$(B") + ("4" . "$(G$%(B") ("5" . "$(G$&(B") ("6" . "$(G$'(B") ("7" . "$(G$((B") + ("8" . "$(G$)(B") ("9" . "$(G$*(B") + (" " . "$(G!!(B") ("!" . "$(G!*(B") ("@" . "$(G"i(B") ("#" . "$(G!l(B") + ("$" . "$(G"c(B") ("%" . "$(G"h(B") ("^" . "$(G!T(B") ("&" . "$(G!m(B") + ("*" . "$(G!n(B") ("(" . "$(G!>(B") (")" . "$(G!?(B") + ("-" . "$(G"1(B") ("=" . "$(G"8(B") ("`" . "$(G!j(B") ("\\" . "$(G"`(B") + ("|" . "$(G"^(B") ("_" . "$(G"%(B") ("+" . "$(G"0(B") ("~" . "$(G"D(B") + ("[" . "$(G!b(B") ("]" . "$(G!c(B") ("{" . "$(G!B(B") ("}" . "$(G!C(B") + (":" . "$(G!((B") (";" . "$(G!'(B") ("\"" . "$(G!i(B") ("'" . "$(G!k(B") + ("<" . "$(G"6(B") (">" . "$(G"7(B") ("?" . "$(G!)(B") ("/" . "$(G"_(B") + ("," . "$(G!"(B") ("." . "$(G!%(B") + ("a" . "$(G$[(B") ("b" . "$(G$\(B") ("c" . "$(G$](B") ("d" . "$(G$^(B") + ("e" . "$(G$_(B") ("f" . "$(G$`(B") ("g" . "$(G$a(B") ("h" . "$(G$b(B") + ("i" . "$(G$c(B") ("j" . "$(G$d(B") ("k" . "$(G$e(B") ("l" . "$(G$f(B") + ("m" . "$(G$g(B") ("n" . "$(G$h(B") ("o" . "$(G$i(B") ("p" . "$(G$j(B") + ("q" . "$(G$k(B") ("r" . "$(G$l(B") ("s" . "$(G$m(B") ("t" . "$(G$n(B") + ("u" . "$(G$o(B") ("v" . "$(G$p(B") ("w" . "$(G$q(B") ("x" . "$(G$r(B") + ("y" . "$(G$s(B") ("z" . "$(G$t(B") + ("A" . "$(G$A(B") ("B" . "$(G$B(B") ("C" . "$(G$C(B") ("D" . "$(G$D(B") + ("E" . "$(G$E(B") ("F" . "$(G$F(B") ("G" . "$(G$G(B") ("H" . "$(G$H(B") + ("I" . "$(G$I(B") ("J" . "$(G$J(B") ("K" . "$(G$K(B") ("L" . "$(G$L(B") + ("M" . "$(G$M(B") ("N" . "$(G$N(B") ("O" . "$(G$O(B") ("P" . "$(G$P(B") + ("Q" . "$(G$Q(B") ("R" . "$(G$R(B") ("S" . "$(G$S(B") ("T" . "$(G$T(B") + ("U" . "$(G$U(B") ("V" . "$(G$V(B") ("W" . "$(G$W(B") ("X" . "$(G$X(B") + ("Y" . "$(G$Y(B") ("Z" . "$(G$Z(B"))) + (let ((in (car ascii)) (out (cdr ascii))) + (its-defrule (concat its-banjiao-escape in) in) + (its-defrule (concat its-quanjiao-escape in) out))) + + (its-defrule "<" "$(G!"(B") + (its-defrule ">" "$(G!$(B") + (its-defrule "?" "$(G!#(B")) + +(define-its-state-machine-append its-zhuyin-cn-map + (its-defrule "[" its-zhuyin-cn-open-braket) + (its-defrule "]" its-zhuyin-cn-close-braket) + +(if its-zhuyin-cn-enable-quanjioao-alphabet + (progn + (its-defrule "#" "$A##(B") (its-defrule "$" "$A!g(B") + (its-defrule "%" "$A#%(B") + (its-defrule "&" "$A#&(B") (its-defrule "*" "$A#*(B") + (its-defrule "(" "$A#((B") (its-defrule ")" "$A#)(B") + (its-defrule "~" "$A!+(B") + (its-defrule "=" "$A#=(B") (its-defrule "`" "$A#`(B") + (its-defrule "\\" "$A#\(B") (its-defrule "|" "$A#|(B") + (its-defrule "_" "$A#_(B") (its-defrule "+" "$A#+(B") + (its-defrule "{" "$A#{(B") (its-defrule "}" "$A#}(B") + (its-defrule "\"" "$A#"(B") (its-defrule "'" "$A#'(B")) + (progn + (its-defrule "#" "#") (its-defrule "$" "$") + (its-defrule "%" "%") + (its-defrule "&" "&") (its-defrule "*" "*") + (its-defrule "(" "(") (its-defrule ")" ")") + (its-defrule "~" "~") + (its-defrule "=" "=") (its-defrule "`" "`") + (its-defrule "\\" "\\") (its-defrule "|" "|") + (its-defrule "_" "_") (its-defrule "+" "+") + (its-defrule "{" "{") (its-defrule "}" "}") + (its-defrule "\"" "\"") (its-defrule "'" "'")))) + +(define-its-state-machine-append its-zhuyin-tw-map + (its-defrule "[" its-zhuyin-tw-open-braket) + (its-defrule "]" its-zhuyin-tw-close-braket) + + (if its-zhuyin-tw-enable-quanjioao-alphabet + (progn + (its-defrule "#" "$(G!l(B") (its-defrule "$" "$(G"c(B") + (its-defrule "%" "$(G"h(B") + (its-defrule "&" "$(G!m(B") (its-defrule "*" "$(G!n(B") + (its-defrule "(" "$(G!>(B") (its-defrule ")" "$(G!?(B") + (its-defrule "~" "$(G"D(B") + (its-defrule "=" "$(G"8(B") (its-defrule "`" "$(G!j(B") + (its-defrule "\\" "$(G"`(B") (its-defrule "|" "$(G"^(B") + (its-defrule "_" "$(G"%(B") (its-defrule "+" "$(G"0(B") + (its-defrule "{" "$(G!B(B") (its-defrule "}" "$(G!C(B") + (its-defrule "\"" "$(G!i(B") (its-defrule "'" "$(G!k(B")) + (progn + (its-defrule "#" "#") (its-defrule "$" "$") + (its-defrule "%" "%") + (its-defrule "&" "&") (its-defrule "*" "*") + (its-defrule "(" "(") (its-defrule ")" ")") + (its-defrule "~" "~") + (its-defrule "=" "=") (its-defrule "`" "`") + (its-defrule "\\" "\\") (its-defrule "|" "|") + (its-defrule "_" "_") (its-defrule "+" "+") + (its-defrule "{" "{") (its-defrule "}" "}") + (its-defrule "\"" "\"") (its-defrule "'" "'")))) + +(provide 'its/zhuyin) diff --git a/leim-list-egg.el b/leim-list-egg.el new file mode 100644 index 0000000..ac70a92 --- /dev/null +++ b/leim-list-egg.el @@ -0,0 +1,84 @@ +;;; leim-list-egg.el --- Egg setup for leim API + +;; Copyright (C) 1999, 2000 Free Software Foundation, Inc + +;; Author: NIIBE Yutaka +;; KATAYAMA Yoshio + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;;; Code: + +;;; leim-list-egg.el --- Egg setup for leim API +;;; CAUTION: Don't delete the above line. + +(autoload 'egg-activate-wnn "egg/wnn" "Activate Wnn backend of Tamagotchy." t) +(autoload 'egg-activate-sj3 "egg/sj3" "Activate SJ3 backend of Tamagotchy." t) + +(register-input-method + "japanese-egg-wnn" "Japanese" 'egg-activate-wnn + "$B$"(B.." "Romaji -> Hiragana -> Kanji&Kana" + 'its-select-hiragana) + +(register-input-method + "japanese-egg-sj3" "Japanese" 'egg-activate-sj3 + "$B$"(B.." "Romaji -> Hiragana -> Kanji&Kana" + 'its-select-hiragana) + +(register-input-method + "chinese-gb-egg-wnn-py" "Chinese-GB" 'egg-activate-wnn + "$AF4(BG" "Pinyin -> Simplified Hanzi" + 'its-select-pinyin-cn) + +(register-input-method + "chinese-gb-egg-wnn-zy" "Chinese-GB" 'egg-activate-wnn + "$AW"(BG" "Zhunyin -> Simplified Hanzi" + 'its-select-zhuyin-cn) + +(register-input-method + "chinese-gb-egg-wnn-qm" "Chinese-GB" 'egg-activate-wnn + "$AG.(B" "QianMa Simplified Hanzi inputmethod" + 'its-select-qianma) + +(register-input-method + "chinese-gb-egg-wnn-wb" "Chinese-GB" 'egg-activate-wnn + "$ANe(B" "WuBi Simplified Hanzi inputmethod" + 'its-select-wubi) + +(register-input-method + "chinese-cns-egg-wnn-py" "Chinese-CNS" 'egg-activate-wnn + "$(GQ;(BC" "Pinyin -> Traditional Hanzi" + 'its-select-pinyin-tw) + +(register-input-method + "chinese-cns-egg-wnn-zy" "Chinese-CNS" 'egg-activate-wnn + "$(GNC(BC" "Zhunyin -> Traditional Hanzi" + 'its-select-zhuyin-tw) + +(register-input-method + "korean-egg-wnn" "Korean" 'egg-activate-wnn + "$(CGQ(B" "Hangul -> Hanja" + 'its-select-hangul) + +(autoload 'egg-mode "egg" "Toggle EGG mode." t) diff --git a/menudiag.el b/menudiag.el new file mode 100644 index 0000000..50d50b8 --- /dev/null +++ b/menudiag.el @@ -0,0 +1,507 @@ +;;; menudiag.el --- Minibuffer Menu System + +;; Copyright (C) 1999, 2000 Free Software Foundation, Inc + +;; Author: NIIBE Yutaka + +;; Maintainer: TOMURA Satoru + +;; Keywords: mule, multilingual, input method + +;; This file is part of EGG. + +;; EGG 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 version 2, or (at your option) +;; any later version. + +;; EGG 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: +;; Inspired by the menu subsystem of EGG V3.0 +;; +;; Completely different implementation, using keymap and recursive edit. + +;;; Code: + +;; +;; Data structure of MENU +;; +;; ::= ( menu ) +;; ::= STRING +;; ::= ( ... ) +;; ::= | ( . ) +;; +;; ::= | INTEGER | STRING (Must *NOT* cons cell) +;; +;; +; +;; +;; ::= ( ... ) +;; ::= ( ... ) +;; + +(defgroup menudiag nil + "Input Translation System of Tamagotchy" + :group 'egg) + +(defcustom menudiag-select-without-return nil + "*Number keys not only goes the item, but also select the item, if non-NIL." + :group 'menudiag :type 'boolean) + +(defvar menudiag-mode-map + (let ((map (make-sparse-keymap)) + ch) + (setq ch ?0) + (while (<= ch ?9) + (define-key map (char-to-string ch) 'menudiag-goto-item) + (setq ch (1+ ch))) + (setq ch ?a) + (while (<= ch ?z) + (define-key map (char-to-string ch) 'menudiag-goto-item) + (setq ch (1+ ch))) + (setq ch ?A) + (while (<= ch ?Z) + (define-key map (char-to-string ch) 'menudiag-goto-item) + (setq ch (1+ ch))) + (define-key map "\C-a" 'menudiag-beginning-of-line) + (define-key map "\C-e" 'menudiag-end-of-line) + (define-key map "\M-<" 'menudiag-beginning-of-items) + (define-key map "\M->" 'menudiag-end-of-items) + (define-key map "\C-f" 'menudiag-forward-item) + (define-key map "\C-b" 'menudiag-backward-item) + (define-key map "\C-n" 'menudiag-next-line) + (define-key map "\C-p" 'menudiag-previous-line) + (define-key map "\C-]" 'menudiag-exit) + (define-key map "\C-g" 'menudiag-exit-one-level) + (define-key map "\C-l" 'menudiag-redraw) + (define-key map "\C-m" 'menudiag-select-this-item) + (define-key map "?" 'menudiag-list-other-window) + (define-key map [return] 'menudiag-select-this-item) + (define-key map [left] 'menudiag-backward-item) + (define-key map [right] 'menudiag-forward-item) + (define-key map [up] 'menudiag-previous-line) + (define-key map [down] 'menudiag-next-line) + (define-key map [menudiag-continuation] 'menudiag-follow-continuation) + (define-key map [t] 'undefined) + map) + "Keymap for MENU.") + +(defun menudiag-menu-p (item) + (and (consp item) (eq 'menu (car item)))) + +(defun menudiag-item-string (item) + (if (stringp item) + item + (format "%s" (car item)))) + +(defun menudiag-item-value (item) + (if (stringp item) + item + (cdr item))) + +(defsubst menudiag-item-width (item) + (+ 4 (string-width (menudiag-item-string item)))) + +(defvar menudiag-window-conf nil) + +(defun menudiag-make-selection-list (item-list line-width) + (let ((l nil) + (line nil) + (width 0) + (i 0)) + (while item-list + (let* ((item (car item-list)) + (item-width (menudiag-item-width item))) + (if (and line (or (>= (+ width item-width) line-width) + (>= i 36))) + (setq l (cons (reverse line) l) + line nil + width 0 + i 0)) + (setq line (cons item line) + width (+ width (menudiag-item-width item)) + i (1+ i) + item-list (cdr item-list)))) + (if line + (reverse (cons (reverse line) l)) + (reverse l)))) + +;; Entry function +(defun menudiag-select (menu &optional menudiag-continuation return-contin) + (let ((enable-recursive-minibuffers t) + value done) + (setq menudiag-window-conf nil) + (if menudiag-continuation + (setq unread-command-events (cons 'menudiag-continuation + unread-command-events))) + (if (not return-contin) + (setq value t)) + (menudiag-select-internal menu) + (if (eq done t) + value + (signal 'quit "")))) + +;; Entry function +(defun menudiag-get-value (continuation) + (menudiag-item-value (nth (1- (length continuation)) continuation))) + +(defun menudiag-follow-continuation () + (interactive) + (let ((item (car menudiag-continuation))) + (setq menudiag-continuation (cdr menudiag-continuation)) + (if menudiag-continuation + (setq unread-command-events (cons 'menudiag-continuation + unread-command-events))) + (if (eq item 'menudiag-list-all) + (menudiag-list-other-window) + (let ((in-loop t)) + (while in-loop + (if (eq item (nth pos-in-line line)) + (setq in-loop nil) + (menudiag-forward-item) + (if (and (= linepos 0) (= pos-in-line 0)) + (error "no such item: %s" (menudiag-item-string item)))))) + (let ((v (menudiag-item-value item))) + (if (menudiag-menu-p v) + (unwind-protect + (progn + (menudiag-select-internal v) + (menudiag-redraw)) + (if (consp value) + (setq value (cons item value))) + (if done (menudiag-exit-minibuffer)))))))) + +(defun menudiag-select-internal (menu) + (let* ((minibuf-prompt (nth 1 menu)) + (current-items (nth 2 menu)) + (selection-list + (menudiag-make-selection-list current-items + (- (window-width (minibuffer-window)) + (string-width minibuf-prompt)))) + (line (car selection-list)) + (minibuf-contents + (menudiag-make-menu-formatted-string line))) + (let ((linepos 0) + (pos-in-line 0)) + (read-from-minibuffer minibuf-prompt + (cons minibuf-contents 3) + menudiag-mode-map)))) + +(defun menudiag-make-menu-formatted-string (item-list) + (let ((i -1)) + (mapconcat + (function (lambda (item) + (setq i (1+ i)) + (format " %c.%s" (menudiag-item-num-to-char i) + (menudiag-item-string item)))) + item-list ""))) + + +;; ITEM No --> Character +(defun menudiag-item-num-to-char (num) + (let ((char)) + (cond ((<= num 9) + (setq char (+ ?0 num))) + (t + (setq char (+ ?a (- num 10)))) + ) + char)) + +;; Character --> ITEM No +(defun menudiag-char-to-item-num (char) + (let ((num)) + (cond ((and (<= ?0 ch) (<= ch ?9)) + (setq num (- ch ?0))) + ((and (<= ?a ch) (<= ch ?z)) + (setq num (+ 10 (- ch ?a)))) + ((and (<= ?A ch) (<= ch ?Z)) + (setq num (+ 10 (- ch ?A)))) + (t (setq num 1000))) + num)) + +(defun menudiag-goto-item () + (interactive) + (let ((ch last-command-char) + (n 0)) + (setq n (menudiag-char-to-item-num ch)) + (if (>= n (length line)) + (error "No such item") + (menudiag-goto-item-internal n) + (if menudiag-select-without-return + (menudiag-select-this-item))))) + +(defun menudiag-goto-item-internal (n) + (let ((old-pos-in-line pos-in-line) + (p 3) + (i 0)) + (setq pos-in-line n) + (while (< i pos-in-line) + (setq p (+ p (length (menudiag-item-string (nth i line))) 4)) + (setq i (1+ i))) + (goto-char p))) + +(defun menudiag-beginning-of-items () + (interactive) + (menudiag-goto-line 0) + (menudiag-beginning-of-line)) + +(defun menudiag-end-of-items () + (interactive) + (menudiag-goto-line (1- (length selection-list))) + (menudiag-end-of-line)) + +(defun menudiag-beginning-of-line () + (interactive) + (menudiag-goto-item-internal 0)) + +(defun menudiag-end-of-line () + (interactive) + (menudiag-goto-item-internal (1- (length line)))) + +;; Should retain compatibility. Must. +;; +;;(defun menudiag-forward-item () +;; (interactive) +;; (if (< pos-in-line (1- (length line))) +;; (menudiag-goto-item-internal (1+ pos-in-line)) +;; (if (>= linepos (1- (length selection-list))) +;; (signal 'end-of-buffer "") +;; (menudiag-goto-line (1+ linepos)) +;; (menudiag-beginning-of-line)))) +;; +;;(defun menudiag-backward-item () +;; (interactive) +;; (if (< 0 pos-in-line) +;; (menudiag-goto-item-internal (1- pos-in-line)) +;; (if (< linepos 1) +;; (signal 'beginning-of-buffer "") +;; (menudiag-goto-line (1- linepos)) +;; (menudiag-end-of-line)))) +;; +;;(defun menudiag-goto-line (n) +;; (if (or (>= n (length selection-list)) (< n 0)) +;; (ding) +;; (setq line (nth n selection-list) +;; linepos n) +;; (delete-region (point-min) (point-max)) +;; (insert (menudiag-make-menu-formatted-string line)))) +;; + +(defun menudiag-forward-item () + (interactive) + (if (< pos-in-line (1- (length line))) + (menudiag-goto-item-internal (1+ pos-in-line)) + (if (>= linepos (1- (length selection-list))) + (menudiag-goto-line 0) + (menudiag-goto-line (1+ linepos))) + (menudiag-beginning-of-line))) + +(defun menudiag-backward-item () + (interactive) + (if (< 0 pos-in-line) + (menudiag-goto-item-internal (1- pos-in-line)) + (if (< linepos 1) + (menudiag-goto-line (1- (length selection-list))) + (menudiag-goto-line (1- linepos))) + (menudiag-end-of-line))) + +(defun menudiag-goto-line (n) + (cond + ((>= n (length selection-list)) + (setq n 0)) + ((< n 0) + (setq n (1- (length selection-list))))) + (setq line (nth n selection-list) + linepos n) + (delete-region (point-min) (point-max)) + (insert (menudiag-make-menu-formatted-string line))) + +(defun menudiag-next-line () + (interactive) + (menudiag-goto-line (1+ linepos)) + (if (< pos-in-line (length line)) + (menudiag-goto-item-internal pos-in-line) + (menudiag-end-of-line))) + +(defun menudiag-previous-line () + (interactive) + (menudiag-goto-line (1- linepos)) + (if (< pos-in-line (length line)) + (menudiag-goto-item-internal pos-in-line) + (menudiag-end-of-line))) + +(defun menudiag-redraw () + (interactive) + (menudiag-goto-line linepos) + (menudiag-goto-item-internal pos-in-line)) + +(defun menudiag-exit-one-level () + (interactive) + (menudiag-exit-minibuffer)) + +(defun menudiag-exit () + (interactive) + (setq done 'quit) + (menudiag-exit-minibuffer)) + +(defun menudiag-select-this-item () + (interactive) + (let* ((item (nth pos-in-line line)) + (v (menudiag-item-value item))) + (if (menudiag-menu-p v) + (unwind-protect + (progn + (menudiag-restore-window) + (menudiag-select-internal v) + (menudiag-redraw)) + (if (consp value) + (setq value (cons item value))) + (if done (menudiag-exit-minibuffer))) + (if (eq value t) + (setq value (menudiag-item-value item)) + (setq value (cons item nil))) + (setq done t) + (menudiag-exit-minibuffer)))) + +(defconst menudiag-selection-map + (let ((map (make-sparse-keymap))) + (define-key map [right] 'next-completion) + (define-key map [left] 'previous-completion) + (define-key map "\r" 'menudiag-choose-item) + (define-key map [mouse-2] 'menudiag-mouse-choose-item) + map)) + +(defvar menudiag-selection-buffer nil) +(make-variable-buffer-local 'menudiag-selection-buffer) +(put 'menudiag-selection-buffer 'permanent-local t) + +(defvar menudiag-selection-main-buffer nil) +(make-variable-buffer-local 'menudiag-selection-main-buffer) +(put 'menudiag-selection-main-buffer 'permanent-local t) + +(defun menudiag-selection-mode () + (interactive) + (kill-all-local-variables) + (make-local-variable 'inhibit-read-only) + (setq buffer-read-only t + inhibit-read-only nil) + (use-local-map menudiag-selection-map) + (setq mode-name "Menudiag Selection") + (setq major-mode 'menudiag-selection-mode)) + +(defun menudiag-max-item-width (item-list) + (let ((max 0)) + (while item-list + (setq max (max max (menudiag-item-width (car item-list))) + item-list (cdr item-list))) + max)) + +(defun menudiag-buffer-show-function () + (let* ((items current-items) + (digits (length (concat (length items)))) + (columns (max 1 (/ (window-width (minibuffer-window)) + (+ digits (menudiag-max-item-width items))))) + (width (/ (window-width (minibuffer-window)) columns)) + (col 0) (n 0) str) + (insert " ") + (while items + (setq p (point) + str (format (concat "%" digits "d. %s") + n (menudiag-item-string (car items)))) + (insert str) + (set-text-properties p (point) '(mouse-face highlight)) + (setq col (1+ col) + n (1+ n) + items (cdr items)) + (if items + (if (/= col columns) + (insert (make-string (- width (string-width str)) ?\ )) + (insert "\n ") + (setq col 0)))) + (goto-char (point-min)) + (set-buffer-modified-p nil) + (menudiag-selection-mode))) + +(defun menudiag-buffer-name (prompt) + (let ((len (1- (length prompt)))) + (if (= (aref prompt len) ?:) (substring prompt 0 len) prompt))) + +(defun menudiag-list-other-window () + (interactive) + (let ((temp-buffer-show-hook 'menudiag-buffer-show-function) + (main-buf (current-buffer))) + (setq menudiag-window-conf (current-window-configuration)) + (with-output-to-temp-buffer (menudiag-buffer-name minibuf-prompt) + (setq menudiag-selection-buffer standard-output)) + (set-buffer menudiag-selection-buffer) + (setq menudiag-selection-main-buffer main-buf))) + +(defun menudiag-choose-item () + (interactive) + (let ((org-buf menudiag-selection-main-buffer) + (sel-buf (current-buffer)) + (item-list selection-list) + (l 0) + tmp-buf n) + (with-temp-buffer + (setq tmp-buf (current-buffer)) + (set-buffer sel-buf) + (setq completion-reference-buffer tmp-buf) + (choose-completion) + (set-buffer tmp-buf) + (setq n (string-to-int (buffer-string)))) + (pop-to-buffer org-buf) + (while (and item-list (>= (- n (length (car item-list))) 0)) + (setq l (1+ l) + n (- n (length (car item-list))) + item-list (cdr item-list))) + (menudiag-goto-line l) + (menudiag-goto-item-internal n) + (menudiag-select-this-item))) + +(defun menudiag-mouse-choose-item (event) + (interactive "e") + (set-buffer (window-buffer (car (nth 1 event)))) + (let ((org-buf menudiag-selection-main-buffer) + (sel-buf (current-buffer)) + (item-list selection-list) + (l 0) + tmp-buf n) + (with-temp-buffer + (setq tmp-buf (current-buffer)) + (set-buffer sel-buf) + (setq completion-reference-buffer tmp-buf) + (mouse-choose-completion event) + (set-buffer tmp-buf) + (setq n (string-to-int (buffer-string)))) + (pop-to-buffer org-buf) + (while (and item-list (>= (- n (length (car item-list))) 0)) + (setq l (1+ l) + n (- n (length (car item-list))) + item-list (cdr item-list))) + (menudiag-goto-line l) + (menudiag-goto-item-internal n) + (menudiag-select-this-item))) + +(defun menudiag-restore-window () + (if menudiag-window-conf + (progn + (set-window-configuration menudiag-window-conf) + (setq menudiag-window-conf nil) + (kill-buffer menudiag-selection-buffer)))) + +(defun menudiag-exit-minibuffer () + (and menudiag-window-conf (menudiag-restore-window)) + (exit-minibuffer)) + +(provide 'menudiag) +;;; menudiag.el ends here.