--- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/ChangeLog.emcws 2007-06-03 23:21:07 +0000 @@ -0,0 +1,988 @@ +2005-12-14 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/wnn-egg.el (egg:error): Recognize that "0:BAD ERRORNO!!! " + is not an error. This is no more than a tentative measure, should + be fixed radically. See the comment. + +2005-12-12 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/busyu.el (busyu-input): Use string-to-number instead of + string-to-int. + (kakusuu-input): Ditto. + + * lisp/canna.el (canna:select-window-hook): Bind + canna:*japanese-mode-in-minibuffer* when compiling. + (canna-functional-insert-command): Remove XEmacs code. + (canna:display-candidates): Comment out the useless section. + (cancel-undo-boundary): Eval-and-compile. + + * lisp/egg.el (egg-version-update): Use string-to-number instead + of string-to-int. + (roma-kanji-region): Use while loop instead of replace-regexp. + (its:minibuffer-local-completion-map): Use defvar instead of + defconst. + (its:minibuffer-local-must-match-map): Ditto. + + * lisp/isearch-ext.el (isearch-minibuffer-exit-egg): Remove Mule + code. + (isearch-fep-canna): Fbind canna:quit-canna-mode when compiling. + (isearch-fep-prompt-canna): Bind canna:*initialized* and + canna:*kanji-mode-string* when compiling. + (isearch-minibuffer-setup-canna): Bind canna:*japanese-mode*, + canna:*japanese-mode-in-minibuffer*, and canna:*fence-mode* when + compiling. + (isearch-minibuffer-exit-canna): Remove Mule code. + (isearch-fep-read-quail): Ditto. + + * lisp/sj3-client.el (sj3-server-open): Use string-to-number + instead of string-to-int. + + * lisp/sj3-egg.el (diced-end-of-buffer): Use goto-char instead of + end-of-buffer. + + * lisp/wnn-egg.el (wnn-server-type, cwnn-zhuyin): Eval-and-compile. + (egg:msg-get): Move backward. + (set-wnn-param): Use string-to-number instead of string-to-int. + (bunsetu-kouho-suu, bunsetu-kouho-list, bunsetu-kouho-number): + Undef functions which might have been defined in sj3-egg.el. + (wnn7-set-boin-kabusoku, wnn7-set-shiin-choka, wnn7-set-n-choka, + wnn7-set-nihongo-kosei, wnn7-henkan-synonym): Move backward. + (henkan-insert-kouho, henkan-region-internal): Undef functions + which might have been defined in sj3-egg.el. + (henkan-insert-kouho, egg:bunsetu-face-on): Move forward. + (henkan-region, gyaku-henkan-region): Move backward. + (set-egg-henkan-mode-format): Undef function which might have been + defined in sj3-egg.el. + (henkan-select-kouho): Ditto. + +2005-11-15 Katsumi Yamaoka <yamaoka@jpl.org> + + * src/canna.c (Fcanna_henkan_next): Follow that `struct Lisp_Cons' + has been changed in 2005-11-15. See src/ChangeLog. + +2004-08-31 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/its/han-kata.el: Autoload japan-util instead of to require it. + + * lisp/loadup.el: Don't load language/japan-util. + +2004-08-30 Katsumi Yamaoka <yamaoka@jpl.org> + + * Makefile.in (install-arch-indep): Put the .nosearch file into + the ${lispdir}/its subdirectory. + + * lisp/its/han-kata.el (zenkaku-escape): Define. + + * lisp/loadup.el: Load language/japan-util and its/han-kata. + + * lisp/sj3-client.el (sj3-server-open): Use + set-process-query-on-exit-flag instead of + process-kill-without-query. + (sj3-server-henkan-kouho): Remove useless code. + (sj3-put-kata): Use japanese-katakana instead of make-char. + + * lisp/egg.el (mode-line-egg-mode): Use defvar instead of defconst. + (egg:*fence-open*, egg:*fence-close*, egg:*fence-face*): Ditto. + (egg:*fence-open-in-cont*, egg:*fence-close-in-cont*): Ditto. + (egg:*fence-face-in-cont*): Ditto. + (set-egg-fence-mode-format-in-cont): Fix the broken line. + (fence-mode-esc-map): Suppose lookup-key won't return a keymap. + (fence-mode-map): Define the escape key as well as the \e key as + fence-mode-esc-map. + + * lisp/sj3-egg.el (sj3-host-name): Bind it when compiling. + (egg:*bunsetu-face*): Use defvar instead of defconst. + (egg:*bunsetu-kugiri*, egg:*henkan-face*): Ditto. + (egg:*henkan-open*, egg:*henkan-close*): Ditto. + (henkan-mode-esc-map): Suppose lookup-key won't return a keymap. + (henkan-mode-map): Define the escape key as well as the \e key as + henkan-mode-esc-map. + +2003-12-13 AIDA Shinra <shinra@j10n.org> + + * src/canna.c: Canna 3.7 Wide character API adaptation. + X-Ml-Name: emcws-bugs #784 + http://canna.sourceforge.jp/canna37patches/ + + * lisp/version.el (emcws-version): 20031213. + +2003-06-23 Katsumi Yamaoka <yamaoka@jpl.org> + + * configure.in: Move -lwnn and -lcanna checks backward. + +2003-05-07 Masahiko KIMOTO <kimoto@ohnolab.org> + + * src/wnnfns.c (Fwnn_nihongo_kosei): Turn ``#Include "mt_jlib.h"'' + out of the function definition. + +2003-02-12 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/canna.el (canna:insert-preedit): Fix the face position when + `canna-underline' is non-nil. + +2002-10-12 AMAGAI yoshiji <amagai-a@nue.org> + + * src/canna.c (Fcanna_touroku_string): use STRING_BYTES. + (Fcanna_store_yomi): use STRING_BYTES. + (Fcanna_parse): use STRING_BYTES. + (Fcanna_henkan_begin): use STRING_BYTES. + (mule_strlen): use STRING_BYTES. + Refer to the patch on emacs-canna for GNU Emacs 20 with dl, + (1993, 2000). Thanks to MORIOKA Tomohiko <morioka@jaist.ac.jp>. + +2002-04-16 Katsumi Yamaoka <yamaoka@jpl.org> + + * configure.in: Add config header templates to the symbols CANNA, + CANNA2, CANNA_MULE, C_SWITCH_CANNA, C_SWITCH_WNN, LD_SWITCH_CANNA, + LD_SWITCH_CANNA_AUX, LD_SWITCH_WNN, LIBS_MULE, SJ3 and WNN; + Move definitions for CANNA2, CANNA_MULE, CANNA_PURESIZE, EGG, + EGG_PURESIZE, SJ3_PURESIZE and WNN_PURESIZE from src/config.in. + * configure: Regenerated. + * src/config.in: Regenerated. + +2002-02-06 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/canna.el (display-minibuffer-mode-in-minibuffer): Default + to t; don't modify the value. + (canna:minibuffer-preprompt-overlay): New variable. + (canna:select-window-hook): Delete a preprompt overlay; clear the + value of `canna:minibuffer-preprompt-overlay' when exiting from + minibuffer. + (canna:minibuffer-setup-hook): Always define. + (anna:minibuffer-exit-hook): Always define. + (mode-line-canna-mode-update): Use an overlay to show a preprompt + string in the minibuffer. + +2002-01-31 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/wnn-egg.el (diced-mode-esc-map): Removed; move key + definitions to `diced-mode-map'. + (diced-mode-map): Don't invalidate undefined keys. + (read-current-its-string): Rewrote. + + * lisp/sj3-egg.el (diced-mode-esc-map): Removed; move key + definitions to `diced-mode-map'. + (diced-mode-map): Don't invalidate undefined keys. + (edit-dict): Open server if it is disconnected. + (edit-dict-item): Fmakunbound. + (toroku-region): Open server if it is disconnected. + + * lisp/egg.el (egg:read-kanji-string): Rewrote. + (egg:read-hiragana-string): Rewrote. + (egg:*minibuffer-local-hiragana-map*): Invalidate C-x prefix keys, + meta prefix keys and key(s) for the command `toggle-egg-mode'. + (egg:minibuffer-exit-function): Delete a preprompt overlay; clear + the value of `egg:minibuffer-preprompt-overlay'. + (egg:minibuffer-setup-function): Don't clear the value of + `egg:minibuffer-preprompt-overlay'. + +2002-01-28 IWAMA Yoshihiko <iwama@t3.rim.or.jp> + + * lisp/sj3-client.el (sj3-get-4byte): Made it work on 64-bit + systems. + +2002-01-19 Kazuhito Ichimura <t@wakaba.com> + + * lisp/egg.el (egg:minibuffer-preprompt-overlay): New internal + variable. + (egg:minibuffer-setup-function): Clear it. + (mode-line-egg-mode-update): Use an overlay to show a preprompt + string in the minibuffer. + +2002-01-18 Katsumi Yamaoka <yamaoka@jpl.org> + + * configure.in (rename): Replaced --enable-rename=no with + --disable-rename in the help string. + * configure: Regenerated. + + * lisp/egg.el (display-minibuffer-mode-in-minibuffer): Use `defvar' + instead of `defconst' to define it. + (mode-line-egg-mode-in-minibuffer-as-before): New variable. + (egg:minibuffer-setup-function): Keep the value of + `mode-line-egg-mode-in-minibuffer' in + `mode-line-egg-mode-in-minibuffer-as-before'. + (egg:minibuffer-exit-function): Reset the value of + `display-minibuffer-mode'; restore the value of + `mode-line-egg-mode-in-minibuffer' from + `mode-line-egg-mode-in-minibuffer-as-before'. + (egg:minibuffer-preprompt): Use `defvar' instead of `defconst' to + define it. + (mode-line-egg-mode-update): Manipulate a prompt string directly + in the minibuffer. + (egg:select-window-hook, egg:minibuffer-exit-function, + mode-line-egg-mode-update): Don't use `minibuffer-preprompt'. + +2002-01-17 Katsumi Yamaoka <yamaoka@jpl.org> + + * Makefile.in (EMACSFULL): Made it to be substitutable by + configure. + + * configure.in (rename): Invert the logic that renaming emacs to + emcws is the default. Users can inhibit renaming by using the + option --enable-rename=no. + * configure: Regenerated. + +2002-01-05 Kazuhito Ichimura <t@wakaba.com> + + * Makefile.in (EMACS): Made it to be substitutable by configure. + (EMACS_POSTFIX): New variable. + (install-arch-dep): Replaced emcws with $(EMACS). + (install-arch-indep): Replaced -emcws with $(EMACS_POSTFIX). + (install-leim): Specify INSTALLDIR. + (mkdir): Replaced -emcws with $(EMACS_POSTFIX). + (uninstall): Replaced -emcws with $(EMACS_POSTFIX); replaced emcws + with $(EMACS). + + * configure.in (TopLevel): Replaced -emcws with $(EMACS_POSTFIX). + (TopLevel): Don't modify the file leim/Makefile.in. + (rename): New option --enable-rename. + (emcws, emcws_postfix): Added substitutions. + (wnn): Integrated wnn4 and wnn6 into it. + (wnn4, wnn6): Removed. + * configure: Regenerated. + + * lisp/eggrc-wnn (wnn7-jserver-setup): New function. + (TopLevel): Call `wnn7-jserver-setup' if Wnn7 server is available. + + * lisp/loadup.el (TopLevel): Don't load egg. + + * lisp/mule-inst.el (load-necessary-files): Don't load + international/quail. + + * lisp/wnn-egg.el (is-wnn7-server): New function. + (wnn7-set-boin-kabusoku): New function. + (wnn7-set-shiin-choka): New function. + (wnn7-set-n-choka): New function. + (wnn7-set-nihongo-kosei): New function. + (wnn7-henkan-synonym): New function. + + * src/config.in (WNN4, WNN6): Removed. + + * src/wnnfns.c (TopLevel): Don't include cplib.h for Wnn7. + (Fwnn_dict_list): Use JSERVER_VERSION instead of WNN6. + (Fwnn_begin_henkan): Make it work with Wnn7; Use JSERVER_VERSION + instead of WNN6. + (Fwnn_bunsetu_henkou): Use JSERVER_VERSION instead of WNN6. + (Fwnn_inspect): Made it work with Wnn7. + (Fwnn_bunsetu_kanji): Ditto. + (Fwnn_bunsetu_yomi): Ditto. + (Fwnn_hindo_update): Use JSERVER_VERSION instead of WNN6. + (Fwnn_word_toroku): Made it work with Wnn7. + (Fwnn_dict_search): Ditto. + (Fwnn_get_msg): Made it work with Wnn7. + (Fwnn_hinsi_number): Use JSERVER_VERSION instead of WNN6. + (Fwnn_okuri_flag): Made it work correctly. + (Fwnn_numeric): Ditto. + (Fwnn_alphabet): Ditto. + (Fwnn_symbol): Ditto. + (Fwnn_boin_kabusoku): New function for Wnn7. + (Fwnn_shiin_choka): Ditto. + (Fwnn_n_choka): Ditto. + (Fwnn_nihongo_kosei): Ditto. + (Fwnn_server_synonym): Ditto. + (syms_of_wnn): Use JSERVER_VERSION instead of WNN6; made it work + with Wnn7. + (w2m): Made it work with Wnn7. + (w2y): Don't define it for Wnn7. + (yes_or_no): Made it work correctly. + +2002-01-17 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/mule-inst.el (load-necessary-files): Load loadup.el. + + * src/alloc.c (NSTATICS): Increased to 1280. + +2001-12-17 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/mule-inst.el (load-necessary-files): Load "derived" before + "textmodes/text-mode". + +2001-12-04 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/wnn-client.el (jd_udp): Fix typo. + (jd_reconv): Comment out. + (wnn-server-open, wnn-command-reset): Replace `buffer-flush-undo' + with `buffer-disable-undo'; Don't handle Nemacs stuff. + + * lisp/sj3-egg.el (get-sj3-host-name): Use `symbol-value' to refer + the variable `sj3serv-host-name'. + + * lisp/isearch-ext.el (isearch-exit-minibuffer-quail): Use + `symbol-value' to refer `quail-current-key' or `quail-current-str'. + (isearch-fep-read-quail): Use `set' instead of `setq' to set the + value of `disable-undo'. + (isearch-minibuffer-exit-canna): Ditto. + (isearch-minibuffer-exit-egg): Ditto. + + * lisp/canna.el (canna-cc-mode-hook, canna-c-electric-brace, + canna-c-electric-semi&comma, canna-c-electric-colon): New + functions for the CC modes. + (canna-c-mode-hook): Use `symbol-value' to refer `c-mode-map'. + (electric-c-brace, electric-c-semi, electric-c-terminator): + Autoload "c-mode" for the functions when compiling. + (canna): Use `symbol-value' to refer `hilit-background-mode'. + (canna:quit-canna-mode): Use `set' instead of `setq' to set the + value of `disable-undo'. + (canna:enter-canna-mode): Ditto. + (canna:create-mode-line): Use `set' or `symbol-value' for the + variable `modeline-format'; use `set-default' or `default-value' + for the variable `default-modeline-format'. + (select-window-hook): Use `set' or `symbol-value' for it. + (canna-dl-handle): Use `eval' to call `dynamic-call' or + `dynamic-link'. + (self-insert-internal, get-frame-background-mode, event-key): + Defalias to `ignore' if the feature `xemacs' is not provided. + + * lisp/busyu.el (busyu-break-string): Simplified. + +2001-11-14 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/mule-inst.el (load-necessary-files): Load + "progmodes/compile" before "bytecomp.el". + +2001-10-24 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/isearch-ext.el: Don't require `quail'. + +2001-10-02 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/startup.el (command-line): Cancel the last change to add + leim directory to `load-path'. + +2001-09-04 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/sj3-client.el: Remove `wnn-egg:kill-emacs-function' from + `kill-emacs-hook'. + (sj3-egg:kill-emacs-function): New function. + (kill-emacs): Don't redefine it. Use `kill-emacs-hook' instead. + + * lisp/wnn-client.el (*wnn-do-auto-save-dict*): Removed. + (do-auto-save): Removed. + (kill-emacs): Removed. + + * lisp/wnn-egg.el (set-kserver-host-name): Use `defalias' instead + of `fset'. + (set-cserver-host-name): Ditto. + (set-jserver-host-name): Ditto. + + * lisp/sj3-egg.el (get-sj3serv-host-name): Use `defalias' instead + of `fset'. + + * lisp/egg.el (si:minibuffer-completion-help): Removed. + (si:all-completions): Removed. + +2001-09-03 Katsumi Yamaoka <yamaoka@jpl.org> + + * Makefile.in (${srcdir}/configure): Ignore an error even if + autoconf does not exist (Note: patch might make configure.in + newer than configure). + +2001-09-01 Makoto Fujiwara <makoto@ki.nu> + + * configure: Regenerated (synch with 21.0.105). + +2001-08-30 Katsumi Yamaoka <yamaoka@jpl.org> + + * configure: Regenerated. + +2001-08-30 Makoto Fujiwara <makoto@ki.nu> + + * configure.in: Look for the LEIM package in ${srcdir}/leim/ + instead of leim/ for the use of VPATH; modify the way to check + whether the file ${srcdir}/leim/Makefile.in is the real thing. + +2001-08-29 Makoto Fujiwara <makoto@ki.nu> + + * src/Makefile.in (bytecomp): Use ./emacs instead of + ${srcdir}/emacs for the use of VPATH. + +2001-07-13 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/mule-inst.el (load-necessary-files): Load "derived" before + "replace.el". + +2001-06-22 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/startup.el (normal-top-level): Add leim directory to + `load-path' if it is possible. + + * configure: Regenerate. + + * configure.in: Modify the file leim/Makefile.in to set the value + of `INSTALLDIR' to "${datadir}/emacs/${version}-emcws/leim" if the + file is originated from the LEIM package. + (locallisppath): Don't include leim directory if the LEIM package + does not exist. + + * leim/Makefile.in: Don't modify it when patching. + +2001-05-09 Katsumi Yamaoka <yamaoka@jpl.org> + +* Note that the name of Emacs executable and the version specific +* directory names have changed as such as follows: +* +* /usr/local/bin/emacs-VERSION -> /usr/local/bin/emcws-VERSION +* /usr/local/bin/emacs -> /usr/local/bin/emcws +* /usr/local/libexec/emacs/VERSION/ -> /usr/local/libexec/emacs/VERSION-emcws/ +* /usr/local/share/emacs/VERSION/ -> /usr/local/share/emacs/VERSION-emcws/ +* +* You don't have to use the patch named emcws-VERSION-rename.patch.gz. +* It is now useless. + + * leim/Makefile.in (INSTALLDIR): Replace the directory name + "${version}" with "${version}-emcws". + +2001-04-11 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/startup.el (fancy-splash-tail): Fold a version string if it + is longer than the window width. + + * lisp/egg.el (its:all-completions): Remove too much `if'. + + * configure: Regenerated. + + * configure.in (docdir, archlibdir, etcdir, locallisppath, lispdir): + Replace the directory name "${version}" with "${version}-emcws". + + * Makefile.in (uninstall): Remove "emcws-${version}" instead of + "emacs-${version}". + (uninstall, mkdir, install-arch-dep): Replace the directory name + "${version}" with "${version}-emcws". + (install-arch-dep): Replace the executable file name + "emacs-${version}" with "emcws-${version}". + (EMACS): Replace the value "emacs" with "emcws". + +2001-02-07 HIROSE yuuji <yuuji@ac.gentei.org> + + * lisp/canna.el (canna): Use TTY colors if Emacs 21+ or XEmacs is + running. + (canna:attribute-alist): Add TTY colors. + (canna-background-mode): New variable. + +2001-01-30 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/textmodes/picture.el (picture-insert-string): Don't use + `char-bytes'. + +2001-01-26 Katsumi Yamaoka <yamaoka@jpl.org> + + * src/wnnfns.c (EGG_TIMEOUT): Set it to 0 instead of 5 in order to + inhibit SIGALRM. It is needed for Wnn6 on Solaris. + +2001-01-25 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/textmodes/picture.el (picture-mode): Don't refer to the + value of `self-insert-after-hook' if it is not bound. + (self-insert-after-hook): Bind it for byte-compiler. + (picture-insert-string): Replace `delete-text-in-column' with + `picture-delete-text-in-column'; replace `sref' with `aref'. + (picture-delete-text-in-column): New function imported from egg.el. + + * lisp/sj3-egg.el (get-sj3-host-name): Use "localhost" by default. + * lisp/wnn-egg.el (open-wnn-if-disconnected): Ditto. + (set-kwnn-host-name): Ditto. + (set-cwnn-host-name): Ditto. + (set-wnn-host-name): Ditto. + +2001-01-24 Katsumi Yamaoka <yamaoka@jpl.org> + + * src/Makefile.in (lisp): Add ${lispsource}textmodes/picture.elc. + + * lisp/canna.el (canna:insert-fixed): Set `canna:*region-start*' + and `canna:*region-end*' to the region of inserted kakutei string. + (TopLevel): Substitute `self-insert-command', + `completion-separator-self-insert-command' and + `completion-separator-self-insert-autofilling' with + `canna-self-insert-command' if the feature `picture' is provided. + + * lisp/textmodes/picture.el (picture-mode-map): Substitute + `self-insert-command', `completion-separator-self-insert-command' + and `completion-separator-self-insert-autofilling' with + `canna-self-insert-command' if the feature `canna' is provided. + (picture-mode): Make `self-insert-after-hook' buffer-local. + +1989-09-17 Kenichi Handa <handa@etl.go.jp> + + * lisp/textmodes/picture.el + (picture-mode-old-self-insert-after-hook): Bind it. + (picture-mode): Save the value of `self-insert-after-hook' in the + buffer-local variable `picture-mode-old-self-insert-after-hook'; + set `self-insert-after-hook' to `picture-insert-after-hook'. + (picture-mode-exit): Restore the value of `self-insert-after-hook'. + +1989-09-07 Kenichi Handa <handa@etl.go.jp> + + * lisp/textmodes/picture.el (picture-movement-wnw): New function. + (picture-movement-ene): New function. + (picture-movement-wsw): New function. + (picture-movement-ese): New function. + (picture-insert-after-hook): New function. + (picture-insert-string): New function. + (picture-mode-map): Substitute `self-insert-command', + `completion-separator-self-insert-command' and + `completion-separator-self-insert-autofilling' with + `egg-self-insert-command' if `EGG' is available; define keys as + `picture-insert-string', `picture-movement-wnw', + `picture-movement-ene', `picture-movement-wsw' and + `picture-movement-ese'. + +2001-01-19 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/canna.el (canna-minibuffer-mode-map): Define [backspace] and + [delete] as [?\C-h]. + (canna-mode-map): Ditto. + +2000-12-09 HIROSE yuuji <yuuji@ac.gentei.org> + + * lisp/canna.el: Update. + +2000-12-11 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/wnn-egg.el: Use `dolist' instead of `mapcar'. + * lisp/sj3-egg.el: Ditto. + * lisp/egg.el: Ditto. + + * lisp/egg-keymap.el: Replace `set-file-coding-system' with + `set-buffer-file-coding-system'. + +2000-10-05 Katsumi Yamaoka <yamaoka@jpl.org> + + * egg.el (dolist): Removed. + (for-each*): Removed. + (for-each): Removed. + +2000-06-22 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/canna.el (canna-mode-map): Define [backspace] and [delete] + as [?\C-h]. + +2000-06-07 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/isearch-ext.el: Revert the last change of 1999-08-16; use + `require' with an arg `quail' instead of the use of `load'. + + * lisp/mule-inst.el (load-necessary-files): Load "timer", "frame" + and "international/quail" for compiling isearch-ext.el; load + "emacs-lisp/cl-macs" before "emacs-lisp/bytecomp.el"; load + "emacs-lisp/cl" before "simple"; load "emacs-lisp/backquote" + before "bindings". + + * configure.in, lisp/startup.el, src/config.in, src/emacs.c, + src/xfaces.c, src/xfns.c, src/xterm.c, src/xterm.h: Don't modify + for the line spacing feature. It's already supported in Emacs 21. + +2000-06-02 Katsumi Yamaoka <yamaoka@jpl.org> + + * src/xfns.c (x-create-frame): Set the default value of + "LineSpacing" to number 0. + (x_set_line_spacing): Treat the arg as an integer. + + * src/emacs.c (main): Add "--line-spacing" to the help message. + +2000-06-01 Makoto Fujiwara <makoto@ki.nu> + + * lisp/version.el: move the line provide emcws to the end, add + defconft emcws-version. + +2000-05-25 Makoto Fujiwara <makoto@ki.nu> + + * src/alloc.c: Set NSTATICS to 1024. + +2000-05-22 Katsumi Yamaoka <yamaoka@jpl.org> + + * src/xfns.c: Rename "line space" with "line spacing". + + * configure.in, src/config.in, src/xfaces.c, src/xterm.c, + src/xterm.h: Enable the line spacing feature at all times. + + * lisp/startup.el (command-line-x-option-alist): Rename + "line-space" with "line-spacing"; replace `x-handle-switch' with + `x-handle-numeric-switch' for the options "-lsp" and + "--line-spacing". + +2000-02-09 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/isearch-ext.el (isearch-fep-canna): Call + `canna:quit-canna-mode' after searching is done. + +2000-01-07 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/version.el (emcws): Provide as a feature. + +1999-12-10 TSUCHIYA Masatoshi <tsuchiya@pine.kuee.kyoto-u.ac.jp> + + * configure.in: Work for "without-*" options. + + * src/config.in: Rearrange the order of `LINESPACE'. + +1999-12-10 TSUCHIYA Masatoshi <tsuchiya@pine.kuee.kyoto-u.ac.jp> + + * configure.in, lisp/startup.el(command-line-x-option-alist), + src/config.in, src/xfaces.c(frame_update_line_height), + src/xfns.c(Qline_space,x_set_line_space,x-create-frame), + src/xterm.c(dumpglyphs,x_new_font), src/xterm.h(x_output): + Add line space feature, ported from Mule-2.3 based on Emacs-19.34. + +1999-11-10 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/busyu.el: New file imported from Mule 2.3@19.34. + +1999-08-16 Katsumi Yamaoka <yamaoka@jpl.org> + + * src/Makefile.in (lisp): Add ${lispsource}isearch-ext.elc. + + * lisp/loadup.el (TopLevel): Load isearch-ext. + + * lisp/isearch-ext.el (TopLevel): Uncomment defining fep keys; use + `load' with arg "international/quail" instead of `require' at the + compile time. + + * lisp/its/kanainput.el: Rename from katainput.el. + +1999-08-10 IIJIMA 'Delmonta' Hiromitsu <L94102@mail.ecc.u-tokyo.ac.jp> + + * lisp/its/katainput.el: Fix usage. + +1999-07-29 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/sj3-egg.el (diced-mode-esc-map) Rearrange key definitions. + (henkan-mode-map): Ditto. + (diced-mode-esc-map): Restore keymap. + (henkan-mode-esc-map): Ditto. + + * lisp/wnn-egg.el (diced-mode-esc-map) Rearrange key definitions. + (henkan-mode-map): Ditto. + (diced-mode-esc-map): Restore keymap. + (henkan-mode-esc-map): Ditto. + + * lisp/egg.el (fence-mode-map): Rearrange key definitions. + (fence-mode-esc-map): Restore keymap. + +1999-07-15 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/wnn-egg.el (henkan-mode-map): Use `substitute-key-definition' + instead of defining each keys with `define-key'. + * lisp/sj3-egg.el (henkan-mode-map): Ditto. + * lisp/egg.el (egg:*minibuffer-local-hiragana-map*, fence-mode-map, + global-map): Ditto. + + * lisp/egg.el (fence-mode-esc-map): Abolish keymap. + (minibuffer-local-menu-map): No need to define [kp-0] .. [kp-9] + because they are defined as ascii chars in simple.el. + + * lisp/wnn-egg.el (diced-mode-map, henkan-mode-map): Inherit the + binding of `function-key-map' with the default binding `undefined'. + * lisp/sj3-egg.el (diced-mode-map, henkan-mode-map): Ditto. + * lisp/egg.el (fence-mode-map, minibuffer-local-menu-map): Ditto. + + * lisp/wnn-egg.el (diced-mode-esc-map, henkan-mode-esc-map): Abolish + keymap. + * lisp/sj3-egg.el (diced-mode-esc-map, henkan-mode-esc-map): Ditto. + +1999-07-13 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/wnn-egg.el (diced-mode-esc-map): Use it for the meta-prefix + map of `diced-mode-map'. + (henkan-mode-esc-map, henkan-mode-map): Don't bother to define + each keys as `undefined'; use `make-sparse-keymap' instead of + `make-keymap'. + (egg:bunsetu-face-on): Removed the char-boundary stuff. + (sai-henkan, henkan-region-internal): Don't use `disable-undo'. + + * lisp/sj3-egg.el (diced-mode-esc-map): Use it for the meta-prefix + map of `diced-mode-map'. + (henkan-mode-esc-map, henkan-mode-map): Don't bother to define + each keys as `undefined'; use `make-sparse-keymap' instead of + `make-keymap'; define the default binding as `undefined'. + + * lisp/egg.el (fence-mode-esc-map, fence-mode-map): Don't bother to + define each keys as `undefined'; use `make-sparse-keymap' + instead of `make-keymap'. + +1999-07-12 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/egg.el (menu:goto-nth-element): Don't use + `event-to-character'. + + * lisp/sj3-egg.el (henkan-quit): Sync up with the last change of + lisp/wnn-egg.el. + (henkan-kakutei): Ditto. + +1999-07-11 Masahiro MURATA <muse@ba2.so-net.ne.jp> + + * lisp/wnn-egg.el (henkan-quit): go back to fence mode after the + henkan-quit. + +1999-07-10 Takeshi Yamada <yamada@cslab.kecl.ntt.co.jp> + + * lisp/egg.el (fence-exit-mode): Exit from fence-mode-map before + delete-region calls are made, otherwise undesirable deadlock can + happen when delete-region is somehow failed. + + * lisp/wnn-egg.el (henkan-kakutei): Exit from hekan-mode-map and + fence-mode-map before delete-region calls are made, otherwise + undesirable deadlock can happen when delete-region is somehow + failed. + (henkan-kakutei-first-char): Ditto. + +1999-07-01 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/egg.el (menu:goto-nth-element): Use `event-to-character' + insted of `event-key' for allowing keys [kp-0] .. [kp-9]. + (minibuffer-local-menu-map): Add definitions for some keys. + +1999-06-18 Takeshi Yamada <yamada@cslab.kecl.ntt.co.jp> + + * lisp/egg.el (egg:cancel-undo-boundary): new function + borrowed from canna.el. original cancel-undo-boundary was + in mule2.3. + (egg-self-insert-command): consecutive 20 self-insert + commands are treated as a single undo chunk as is done in + the original self-insert-command. + +1999-06-17 Takeshi Yamada <yamada@cslab.kecl.ntt.co.jp> + + * lisp/egg.el (menu:select-from-menu): menu handling parts are + completely rewritten by adopting codes originally submitted by + YAMAMOTO Mitsuharu <mituharu@is.s.u-tokyo.ac.jp> to the + mule-jp mailing list back in 1995. The menu keymap is no more + hard coded! + + * lisp/egg.el some obsolete regular expressions are deleted. + +1999-06-17 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/sj3-egg.el (diced-add): Use `egg:read-kanji-string' and + `egg:read-hiragana-string' instead of `read-kanji-string' or + `read-hiragana-string'. + (toroku-region): Use `egg:read-hiragana-string' instead of + `read-hiragana-string'. + + * lisp/egg.el (egg:read-kanji-string): Renamed from + `read-kanji-string'. + (egg:read-hiragana-string): Renamed from `read-hiragana-string' + because it was duplicated with Quail's function of the same name. + (egg:quit-egg-mode): Neglect `disable-undo'. + (enter-fence-mode): Ditto. + (its:simulate-input): Don't use `char-bytes' because it always + return 1. + (its-defrule**): Ditto. + (menu:select-from-menu): Don't use `save-selected-window'. + +1999-06-15 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/sj3-egg.el (henkan-quit): Bug-fix - fence string remained + and `buffer-undo-list' become t in henkan-quit after henkan-region. + +1999-06-13 Masahiro MURATA <muse@ba2.so-net.ne.jp> + + * lisp/egg.el (TopLevel): Make `egg-buffer-modified-flag' + buffer-local. + * lisp/egg.el (suspend-undo): Bug-fix - buffer-modified-p don't + go back to unmodified when undo. Don't set buffer-undo-list to t. + (resume-undo-list): Ditto. + (menu:select-from-menu): Add save-selected-window before + save-window-excursion. Add "?\ " to menu:select-next-item. + * lisp/wnn-egg.el (henkan-quit): Bug-fix - fence string remained + and `buffer-undo-list' become t in henkan-quit after henkan-region. + (sai-henkan): Moved `suspend-undo' after delete-region. + +1999-05-21 Keisuke Mori <ksk@ntts.com> + + * src/wnnfns.c (wnn-server-open) [WINDOWSNT]: Call init_winsock. + See http://www.kt.rim.or.jp/~ksk/Meadow/indexj.html for more + information. + +1999-03-15 Katsumi Yamaoka <yamaoka@jpl.org> + + * ChangeLog.emcws: New file. + +1999-03-13 Takeshi YAMADA <yamada@cslab.kecl.ntt.co.jp> + + * lisp/egg.el (egg:fence-face-on): Install `egg:*fence-face*' to + the existing `egg:*fence-overlay*' correctly whenever it is + changed. + + * lisp/wnn-egg.el (set-egg-henkan-mode-format): Handle the case + when open or close is nil correctly. + +1999-03-10 Takeshi YAMADA <yamada@cslab.kecl.ntt.co.jp> + + * lisp/egg-jsymbol.el (make-jis-first-level-code-alist): Replace + obsolete code by `make-char'. + (make-jis-second-level-code-alist): Ditto. + (make-jis-hojo-kanji-code-alist):Ditto. + (make-all-jis-code-alist): Ditto. + +1999-03-04 Takeshi YAMADA <yamada@cslab.kecl.ntt.co.jp> + + * lisp/egg-sj3.el (henkan-region-internal): Bug fix - + `henkan-region' didn't work. + +1999-03-02 Takeshi YAMADA <yamada@cslab.kecl.ntt.co.jp> + + * lib-src/blessmail: Removed. + +1999-03-02 Masahiro MURATA <muse@ba2.so-net.ne.jp> + + * lisp/egg.el (TopLevel): Make `egg-buffer-undo-list' buffer-local. + +1999-02-28 Masahiro MURATA <muse@ba2.so-net.ne.jp> + + * lisp/egg.el (suspend-undo): New function to save the + `buffer-undo-list' and bind it to t. + (enter-fence-mode): Use it. + (resume-undo-list): New function to restore the saved + `buffer-undo-list'. + (fence-exit-internal): Use it. + (egg-buffer-undo-list): New variable for the saved + `buffer-undo-list'. + + * lisp/wnn-egg.el (henkan-kakutei-first-char): Use + `resume-undo-list'. + (henkan-kakutei): Ditto. + (sai-henkan): Use `suspend-undo', `resume-undo-list'. + (henkan-region-internal): Ditto. + + * lisp/sj3-egg.el (henkan-kakutei): Use `resume-undo-list'. + (henkan-region-internal): Use `suspend-undo'. + +1998-12-22 Kaoru Nakajima <knak@ceres.dti.ne.jp> + + * lisp/canna.el (TopLevel): Enclose `(defadvice undo ...)' with + `eval'. + + * lisp/loadup.el (TopLevel): Don't load "canna". Use `autoload' + instead. + +1998-11-18 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/sj3-client.el (sj3-server-henkan-next): Bug fix - store the + one of forgotten converted japanese string in `sj3-result-buffer'. + +1998-11-11 Yoshitsugu Mito <mit@nines.nec.co.jp> + + * lisp/canna.el: Fast undo (from emacs-20.3+canna-9.diff.gz). + +1998-11-02 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/sj3-client.el (sj3-server-open): Generate + `sj3-server-buffer' explicitly. + +1998-10-22 Takeshi YAMADA <yamada@cslab.kecl.ntt.co.jp> + + * lisp/sj3-egg.el: Make `henkan-mode-in-use' buffer-local. + * lisp/egg.el: Make `henkan-mode-in-use' buffer-local. + * lisp/sj3-egg.el (henkan-region-internal): Bug fix - wrong logic + at `unwind-protect'. + +1998-10-16 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/sj3-egg.el (henkan-mode-map): Add some key definitions. + * lisp/sj3-egg.el (egg:henkan-mode-in-use): Use + `minor-mode-map-alist' instead of local-map. + + * lisp/egg.el (egg:*local-map-backup*): Abolished. + * lisp/sj3-egg.el (egg:*local-map-backup*): Abolished. + +1998-10-11 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/sj3-client.el (sj3-server-open): Set `sj3-server-buffer' as + unibyte. + + * lisp/sj3-client.el: Minimize diffs from original. + * lisp/sj3-egg.el: Ditto. + +1998-10-10 Takeshi YAMADA <yamada@cslab.kecl.ntt.co.jp> + + * lisp/wnn-egg.el: Make `egg:henkan-mode-in-use' buffer-local. + +1998-10-10 Takeshi YAMADA <yamada@cslab.kecl.ntt.co.jp> + + * lisp/canna.elc, lisp/wnn-egg.elc, lisp/egg.elc ,lisp/sj3-egg.elc, + lisp/sj3-client.elc: Removed. + * configure.in, configure: Has -with-sj3, and outside of source + tree. + +1998-10-05 Katsumi Yamaoka <yamaoka@jpl.org> + + * lisp/sj3-egg.el, lisp/sj3-client.el: New files. + + * lisp/egg.el: Modified for sj3. + +1998-10-05 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in, configure: Fix Linux _crypt problem. + +1998-09-22 Makoto Fujiwara <makoto@ki.nu> + + * src/path.h: Removed. + * lib-src/Makefile: Removed. + +1998-09-21 Makoto Fujiwara <makoto@ki.nu>, + Oki Masaru <oki@yk.rim.or.jp> + + * src/Makefile.in: Do not show sj3*elc not found message. + +1998-09-21 Kaoru Nakajima <knak@ceres.dti.ne.jp> + + * lisp/canna.el (canna-touroku-region): emacs-20.3+canna-7.diff + +1998-09-20 Kaoru Nakajima <knak@ceres.dti.ne.jp> + + * lisp/canna.el (canna-henkan-region): emacs-20.3+canna-6.diff + +1998-09-19 Kaoru Nakajima <knak@ceres.dti.ne.jp> + + * lisp/canna.el: Don't use `canna:*local-map-backup*'. + +1998-09-19 Kaoru Nakajima <knak@ceres.dti.ne.jp> + + * lisp/canna.el: Wide character no kazoe kata ga 20.3 kara henkou ni + nattatame; wide character no kazoe kata ga 20.3 kara kawatta tame; + 166602 Sep 19 06:05 emacs-20.3+canna-3.diff + +1998-09-19 Masahiro MURATA <muse@ba2.so-net.ne.jp> + + * lisp/canna.el: cf. X-Sequence: installer 2991; + emacs-20.2-canna.el-muse2.patch (cf. X-Sequence: installer 3120) + +1998-09-19 Kazu Yamamoto <kazu@iijlab.net> + + * lisp/canna.el, lisp/egg.el, lisp/wnn-egg.el: + property/overlay/local-map -> overlay + | + v + minor-mode-map-alist/use-local-map/global-map; + cf. mew-1.93/patches/ + 4531 Jul 9 22:16 00readme.jis + 6207 Jul 9 22:16 canna.el-19.34.patch + 5205 Jul 9 22:16 egg.el-19.34.patch + +1998-09-17 Kaoru Nakajima <knak@ceres.dti.ne.jp> + + * cf. http://www.ceres.dti.ne.jp/~knak/emacs.html#emacs-20.3+canna; + 165474 Sep 11 01:11 emacs-20.3+canna.diff + +1998-09-17 Kunihiro Ishiguro <kunihiro@zebra.org> + + * cf. ftp://ftp.zebra.org/pub/emacs/emacs-20.3-wnn6-rel2.tar.gz + +1998-09-17 Oki Masaru <oki@yk.rim.or.jp> + + * cf. http://www.yk.rim.or.jp/~oki/emacs-20.html + +1998-09-17 Masahiro MURATA <muse@ba2.so-net.ne.jp> + + * cf. http://www.ki.nu/software/emacs-20/canna.el-patch + +1998-09-17 Makoto Fujiwara <makoto@ki.nu> + + * lisp/can-n-egg.el, lisp/canna.el, lisp/egg-jsymbol.el, + lisp/egg-keymap.el, lisp/egg.el, lisp/eggrc-sj3, lisp/eggrc-v41, + lisp/eggrc-wnn, lisp/isearch-ext.el, lisp/its/han-kata.el, + lisp/its/hankaku.el, lisp/its/hira.el, lisp/its/kata.el, + lisp/its/katainput.el, lisp/its/zenkaku.el, lisp/mule-inst.el, + lisp/sj3-client.el, lisp/sj3-egg.el, lisp/wnn-client.el, + lisp/wnn-egg.el, src/canna.c, src/wnnfns.c: New files. + --- emacs-22.1/Makefile.in~ 2007-05-14 14:56:28 +0000 +++ emacs-22.1/Makefile.in 2007-06-03 23:21:07 +0000 @@ -241,8 +241,9 @@ TRANSFORM = @program_transform_name@ # What emacs should be called when installed. -EMACS = `echo emacs${EXEEXT} | sed '$(TRANSFORM)'` -EMACSFULL = `echo emacs-${version}${EXEEXT} | sed '$(TRANSFORM)'` +EMACS = `echo @emcws@${EXEEXT} | sed '$(TRANSFORM)'` +EMACS_POSTFIX = @emcws_postfix@ +EMACSFULL = `echo @emcws@-${version}${EXEEXT} | sed '$(TRANSFORM)'` # Subdirectories to make recursively. `lisp' is not included # because the compiled lisp files are part of the distribution. @@ -316,8 +317,10 @@ AUTOCONF_INPUTS = @MAINT@ $(srcdir)/configure.in $(srcdir)/m4/getopt.m4 +# EMCWS CHANGE: As patch might make configure.in newer than configure and +# user might not have autoconf, leading `-' is needed to ignore an error. $(srcdir)/configure: $(AUTOCONF_INPUTS) - cd ${srcdir} && autoconf + -cd ${srcdir} && autoconf $(srcdir)/src/config.in: $(srcdir)/src/stamp-h.in @true @@ -454,15 +457,18 @@ done) ; \ done -rm -f $(DESTDIR)${lispdir}/subdirs.el + if [ -d $(DESTDIR)${lispdir}/its ]; \ + then touch $(DESTDIR)${lispdir}/its/.nosearch; \ + fi $(srcdir)/update-subdirs $(DESTDIR)${lispdir} - if [ -f $(DESTDIR)${datadir}/emacs/${version}/site-lisp/subdirs.el ]; \ + if [ -f $(DESTDIR)${datadir}/emacs/${version}$(EMACS_POSTFIX)/site-lisp/subdirs.el ]; \ then true; \ else \ (echo "(if (fboundp 'normal-top-level-add-subdirs-to-load-path)"; \ echo " (normal-top-level-add-subdirs-to-load-path))") \ - > $(DESTDIR)${datadir}/emacs/${version}/site-lisp/subdirs.el; \ + > $(DESTDIR)${datadir}/emacs/${version}$(EMACS_POSTFIX)/site-lisp/subdirs.el; \ fi - chmod a+r $(DESTDIR)${datadir}/emacs/${version}/site-lisp/subdirs.el + chmod a+r $(DESTDIR)${datadir}/emacs/${version}$(EMACS_POSTFIX)/site-lisp/subdirs.el -if [ -f $(DESTDIR)${datadir}/emacs/site-lisp/subdirs.el ]; \ then true; \ else \ @@ -541,7 +547,7 @@ ### `install-arch-indep'. People who extracted LEIM files after they ### insalled Emacs itself can install only LEIM files by this target. install-leim: leim/Makefile mkdir - cd leim; $(MAKE) install + cd leim; $(MAKE) INSTALLDIR=${datadir}/emacs/${version}$(EMACS_POSTFIX)/leim install ### Build Emacs and install it, stripping binaries while installing them. install-strip: @@ -559,7 +565,7 @@ $(srcdir)/mkinstalldirs ${COPYDESTS} $(DESTDIR)${infodir} $(DESTDIR)${man1dir} \ $(DESTDIR)${bindir} $(DESTDIR)${docdir} $(DESTDIR)${libexecdir} \ $(DESTDIR)${datadir}/emacs/site-lisp \ - $(DESTDIR)${datadir}/emacs/${version}/site-lisp \ + $(DESTDIR)${datadir}/emacs/${version}$(EMACS_POSTFIX)/site-lisp \ $(DESTDIR)`echo ${locallisppath} | sed 's,:, $(DESTDIR),g'` ### Delete all the installed files that the `install' target would @@ -580,14 +586,14 @@ * ) rm -rf $${dir} ;; \ esac ; \ case $${dir} in \ - $(DESTDIR)${datadir}/emacs/${version}/* ) \ - rm -rf $(DESTDIR)${datadir}/emacs/${version} \ + $(DESTDIR)${datadir}/emacs/${version}$(EMACS_POSTFIX)/* ) \ + rm -rf $(DESTDIR)${datadir}/emacs/${version}$(EMACS_POSTFIX)\ ;; \ esac ; \ fi ; \ done (cd $(DESTDIR)${archlibdir} && rm -f fns-*) - -rm -rf $(DESTDIR)${libexecdir}/emacs/${version} + -rm -rf $(DESTDIR)${libexecdir}/emacs/${version}$(EMACS_POSTFIX) (cd $(DESTDIR)${infodir} && \ for elt in $(INFO_FILES); do \ $(INSTALL_INFO) --remove --info-dir=. $$elt; \ --- emacs-22.1/configure.in~ 2007-05-25 12:43:29 +0000 +++ emacs-22.1/configure.in 2007-06-03 23:21:07 +0000 @@ -31,13 +31,14 @@ dnl --program-transform-name options AC_ARG_PROGRAM -lispdir='${datadir}/emacs/${version}/lisp' -locallisppath='${datadir}/emacs/${version}/site-lisp:'\ +lispdir='${datadir}/emacs/${version}$(EMACS_POSTFIX)/lisp' +locallisppath='${datadir}/emacs/${version}$(EMACS_POSTFIX)/site-lisp:'\ '${datadir}/emacs/site-lisp' -lisppath='${locallisppath}:${lispdir}:${datadir}/emacs/${version}/leim' -etcdir='${datadir}/emacs/${version}/etc' -archlibdir='${libexecdir}/emacs/${version}/${configuration}' -docdir='${datadir}/emacs/${version}/etc' +lisppath='${locallisppath}:${lispdir}'\ +':${datadir}/emacs/${version}$(EMACS_POSTFIX)/leim' +etcdir='${datadir}/emacs/${version}$(EMACS_POSTFIX)/etc' +archlibdir='${libexecdir}/emacs/${version}$(EMACS_POSTFIX)/${configuration}' +docdir='${datadir}/emacs/${version}$(EMACS_POSTFIX)/etc' gamedir='${localstatedir}/games/emacs' gameuser=games @@ -77,6 +78,35 @@ AC_ARG_WITH(sound, [ --without-sound don't compile with sound support]) +AC_ARG_ENABLE(rename, +[ --disable-rename do not rename emacs to emcws]) +if test "${enable_rename}" = "no"; then + emcws='emacs' emcws_postfix= +else + emcws='emcws' emcws_postfix='-emcws' +fi +AC_SUBST(emcws) +AC_SUBST(emcws_postfix) +AC_ARG_WITH(wnn, +[ --with-wnn use Wnn library to input Japanese or Chinese], +[with_wnn=${withval}]) +AC_ARG_WITH(wnn-includes, +[ --with-wnn-includes=DIR search for WNN header files in DIR]) +AC_ARG_WITH(wnn-libraries, +[ --with-wnn-libraries=DIR search for WNN libraries in DIR]) +AC_ARG_WITH(sj3, +[ --with-sj3 support SJ3], +[ case "${withval}" in + y | yes ) AC_DEFINE(SJ3) ;; + esac +]) +AC_ARG_WITH(canna, +[ --with-canna support CANNA]) +AC_ARG_WITH(canna-includes, +[ --with-canna-includes=DIR search for CANNA header files in DIR]) +AC_ARG_WITH(canna-libraries, +[ --with-canna-libraries=DIR search for CANNA libraries in DIR]) + dnl This should be the last --with option, because --with-x is dnl added later on when we find the path of X, and it's best to dnl keep them together visually. @@ -2833,6 +2863,42 @@ dnl Fixme: Use AC_FUNC_MEMCMP since memcmp is used. (Needs libobj replacement.) +case "${with_wnn}" in + y | yes ) + AC_DEFINE(WNN) + test -n "${with_wnn_includes}" && C_SWITCH_WNN="-I${with_wnn_includes}" + if test -n "${with_wnn_libraries}" ; then + if test -d ${with_wnn_libraries} ; then + LD_SWITCH_WNN="-L${with_wnn_libraries}" + LIBS_MULE="${LIBS_MULE} -lwnn" + else + LIBS_MULE="${LIBS_MULE} ${with_wnn_libraries}" + fi + else + LIBS_MULE="${LIBS_MULE} -lwnn" + fi + AC_CHECK_LIB(crypt, crypt, LIBS_MULE="$LIBS_MULE -lcrypt") + ;; +esac + +case "${with_canna}" in + y | yes ) + AC_DEFINE(CANNA) + test -n "${with_canna_includes}" && C_SWITCH_CANNA="-I${with_canna_includes}" + if test -n "${with_canna_libraries}" ; then + if test -d ${with_canna_libraries} ; then + LD_SWITCH_CANNA="-L${with_canna_libraries}" + LD_SWITCH_CANNA_AUX="-R${with_canna_libraries}" + LIBS_MULE="${LIBS_MULE} -lcanna" + else + LIBS_MULE="${LIBS_MULE} ${with_canna_libraries}" + fi + else + LIBS_MULE="${LIBS_MULE} -lcanna" + fi + ;; +esac + # Set up the CFLAGS for real compilation, so we can substitute it. CFLAGS="$REAL_CFLAGS" CPPFLAGS="$REAL_CPPFLAGS" @@ -2906,6 +2972,27 @@ AC_DEFINE_UNQUOTED(UNEXEC_SRC, ${UNEXEC_SRC}, [Define to the unexec source file name.]) +AC_DEFINE_UNQUOTED(LIBS_MULE, ${LIBS_MULE}) +AC_DEFINE_UNQUOTED(C_SWITCH_WNN, ${C_SWITCH_WNN}) +AC_DEFINE_UNQUOTED(LD_SWITCH_WNN, ${LD_SWITCH_WNN}) +AC_DEFINE_UNQUOTED(C_SWITCH_CANNA, ${C_SWITCH_CANNA}) +AC_DEFINE_UNQUOTED(LD_SWITCH_CANNA, ${LD_SWITCH_CANNA}) +AC_DEFINE_UNQUOTED(LD_SWITCH_CANNA_AUX, ${LD_SWITCH_CANNA_AUX}) + +AH_TEMPLATE(LIBS_MULE, [special library for Mule]) + +AH_TEMPLATE(WNN, [flag whether to use Wnn]) +AH_TEMPLATE(C_SWITCH_WNN, [compile switch for Wnn]) +AH_TEMPLATE(LD_SWITCH_WNN, [link switch for Wnn]) +AH_TEMPLATE(SJ3, [flag whether to use sj3]) +AH_TEMPLATE(CANNA, [flag whether to use Canna]) +AH_TEMPLATE(CANNA_MULE, [flag whether to use Canna on Mule]) +AH_TEMPLATE(CANNA2, [flag whether to use Canna2]) +AH_TEMPLATE(C_SWITCH_CANNA, [compile switch for Canna]) +AH_TEMPLATE(LD_SWITCH_CANNA, [link switch for Canna]) +AH_TEMPLATE(LD_SWITCH_CANNA_AUX, + [link switch for Canna if -R option is needed]) + if test "${HAVE_X_WINDOWS}" = "yes" ; then AC_DEFINE(HAVE_X_WINDOWS, 1, [Define to 1 if you want to use the X window system.]) @@ -3219,6 +3306,34 @@ #define BCMP memcmp #endif +#ifdef WNN +# define EGG +# define WNN_PURESIZE 30000 +#else /* not WNN */ +# define WNN_PURESIZE 0 +#endif /* not WNN */ + +#ifdef SJ3 +# define EGG +# define SJ3_PURESIZE 38000 +#else /* not SJ3 */ +# define SJ3_PURESIZE 0 +#endif /* not SJ3 */ + +#ifdef EGG +# define EGG_PURESIZE 32000 +#else /* not EGG */ +# define EGG_PURESIZE 0 +#endif /* not EGG */ + +#ifdef CANNA +# define CANNA2 +# define CANNA_MULE +# define CANNA_PURESIZE 18000 +#else /* not CANNA */ +# define CANNA_PURESIZE 0 +#endif /* not CANNA */ + #endif /* EMACS_CONFIG_H */ /* --- emacs-22.1/configure~ 2007-05-25 12:43:29 +0000 +++ emacs-22.1/configure 2007-06-03 23:21:07 +0000 @@ -653,6 +653,8 @@ build_alias host_alias target_alias +emcws +emcws_postfix MAINT build build_cpu @@ -1313,6 +1315,7 @@ Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-rename do not rename emacs to emcws --enable-carbon-app[=DIR] [DIR=/Application] specify install directory for Emacs.app on Mac OS X --enable-asserts compile code with asserts enabled @@ -1332,6 +1335,13 @@ --with-kerberos5 support Kerberos version 5 authenticated POP --with-hesiod support Hesiod to get the POP server host --without-sound don't compile with sound support + --with-wnn use Wnn library to input Japanese or Chinese + --with-wnn-includes=DIR search for WNN header files in DIR + --with-wnn-libraries=DIR search for WNN libraries in DIR + --with-sj3 support SJ3 + --with-canna support CANNA + --with-canna-includes=DIR search for CANNA header files in DIR + --with-canna-libraries=DIR search for CANNA libraries in DIR --with-x-toolkit=KIT use an X toolkit (KIT = yes/lucid/athena/motif/gtk/no) --with-xpm use -lXpm for displaying XPM images @@ -1800,13 +1810,14 @@ rm -f conftest.sed -lispdir='${datadir}/emacs/${version}/lisp' -locallisppath='${datadir}/emacs/${version}/site-lisp:'\ +lispdir='${datadir}/emacs/${version}$(EMACS_POSTFIX)/lisp' +locallisppath='${datadir}/emacs/${version}$(EMACS_POSTFIX)/site-lisp:'\ '${datadir}/emacs/site-lisp' -lisppath='${locallisppath}:${lispdir}:${datadir}/emacs/${version}/leim' -etcdir='${datadir}/emacs/${version}/etc' -archlibdir='${libexecdir}/emacs/${version}/${configuration}' -docdir='${datadir}/emacs/${version}/etc' +lisppath='${locallisppath}:${lispdir}'\ +':${datadir}/emacs/${version}$(EMACS_POSTFIX)/leim' +etcdir='${datadir}/emacs/${version}$(EMACS_POSTFIX)/etc' +archlibdir='${libexecdir}/emacs/${version}$(EMACS_POSTFIX)/${configuration}' +docdir='${datadir}/emacs/${version}$(EMACS_POSTFIX)/etc' gamedir='${localstatedir}/games/emacs' gameuser=games @@ -1886,6 +1897,67 @@ fi +# Check whether --enable-rename was given. +if test "${enable_rename+set}" = set; then + enableval=$enable_rename; +fi + +if test "${enable_rename}" = "no"; then + emcws='emacs' emcws_postfix= +else + emcws='emcws' emcws_postfix='-emcws' +fi + + + +# Check whether --with-wnn was given. +if test "${with_wnn+set}" = set; then + withval=$with_wnn; with_wnn=${withval} +fi + + +# Check whether --with-wnn-includes was given. +if test "${with_wnn_includes+set}" = set; then + withval=$with_wnn_includes; +fi + + +# Check whether --with-wnn-libraries was given. +if test "${with_wnn_libraries+set}" = set; then + withval=$with_wnn_libraries; +fi + + +# Check whether --with-sj3 was given. +if test "${with_sj3+set}" = set; then + withval=$with_sj3; case "${withval}" in + y | yes ) cat >>confdefs.h <<\_ACEOF +#define SJ3 1 +_ACEOF + ;; + esac + +fi + + +# Check whether --with-canna was given. +if test "${with_canna+set}" = set; then + withval=$with_canna; +fi + + +# Check whether --with-canna-includes was given. +if test "${with_canna_includes+set}" = set; then + withval=$with_canna_includes; +fi + + +# Check whether --with-canna-libraries was given. +if test "${with_canna_libraries+set}" = set; then + withval=$with_canna_libraries; +fi + + # Check whether --with-x-toolkit was given. if test "${with_x_toolkit+set}" = set; then @@ -22923,6 +22995,112 @@ +case "${with_wnn}" in + y | yes ) + cat >>confdefs.h <<\_ACEOF +#define WNN 1 +_ACEOF + + test -n "${with_wnn_includes}" && C_SWITCH_WNN="-I${with_wnn_includes}" + if test -n "${with_wnn_libraries}" ; then + if test -d ${with_wnn_libraries} ; then + LD_SWITCH_WNN="-L${with_wnn_libraries}" + LIBS_MULE="${LIBS_MULE} -lwnn" + else + LIBS_MULE="${LIBS_MULE} ${with_wnn_libraries}" + fi + else + LIBS_MULE="${LIBS_MULE} -lwnn" + fi + { echo "$as_me:$LINENO: checking for crypt in -lcrypt" >&5 +echo $ECHO_N "checking for crypt in -lcrypt... $ECHO_C" >&6; } +if test "${ac_cv_lib_crypt_crypt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcrypt $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char crypt (); +int +main () +{ +return crypt (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_crypt_crypt=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_crypt_crypt=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_crypt_crypt" >&5 +echo "${ECHO_T}$ac_cv_lib_crypt_crypt" >&6; } +if test $ac_cv_lib_crypt_crypt = yes; then + LIBS_MULE="$LIBS_MULE -lcrypt" +fi + + ;; +esac + +case "${with_canna}" in + y | yes ) + cat >>confdefs.h <<\_ACEOF +#define CANNA 1 +_ACEOF + + test -n "${with_canna_includes}" && C_SWITCH_CANNA="-I${with_canna_includes}" + if test -n "${with_canna_libraries}" ; then + if test -d ${with_canna_libraries} ; then + LD_SWITCH_CANNA="-L${with_canna_libraries}" + LD_SWITCH_CANNA_AUX="-R${with_canna_libraries}" + LIBS_MULE="${LIBS_MULE} -lcanna" + else + LIBS_MULE="${LIBS_MULE} ${with_canna_libraries}" + fi + else + LIBS_MULE="${LIBS_MULE} -lcanna" + fi + ;; +esac + # Set up the CFLAGS for real compilation, so we can substitute it. CFLAGS="$REAL_CFLAGS" CPPFLAGS="$REAL_CPPFLAGS" @@ -23013,6 +23191,55 @@ _ACEOF +cat >>confdefs.h <<_ACEOF +#define LIBS_MULE ${LIBS_MULE} +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define C_SWITCH_WNN ${C_SWITCH_WNN} +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define LD_SWITCH_WNN ${LD_SWITCH_WNN} +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define C_SWITCH_CANNA ${C_SWITCH_CANNA} +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define LD_SWITCH_CANNA ${LD_SWITCH_CANNA} +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define LD_SWITCH_CANNA_AUX ${LD_SWITCH_CANNA_AUX} +_ACEOF + + + + + + + + + + + + + + + + + + + + + + + + + + if test "${HAVE_X_WINDOWS}" = "yes" ; then cat >>confdefs.h <<\_ACEOF @@ -23831,6 +24058,8 @@ build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim +emcws!$emcws$ac_delim +emcws_postfix!$emcws_postfix$ac_delim MAINT!$MAINT$ac_delim build!$build$ac_delim build_cpu!$build_cpu$ac_delim @@ -23889,8 +24118,6 @@ bitmapdir!$bitmapdir$ac_delim gamedir!$gamedir$ac_delim gameuser!$gameuser$ac_delim -c_switch_system!$c_switch_system$ac_delim -c_switch_machine!$c_switch_machine$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -23932,6 +24159,8 @@ ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +c_switch_system!$c_switch_system$ac_delim +c_switch_machine!$c_switch_machine$ac_delim LD_SWITCH_X_SITE!$LD_SWITCH_X_SITE$ac_delim LD_SWITCH_X_SITE_AUX!$LD_SWITCH_X_SITE_AUX$ac_delim C_SWITCH_X_SITE!$C_SWITCH_X_SITE$ac_delim @@ -23942,7 +24171,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 8; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 10; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/busyu.el 2007-06-03 23:21:07 +0000 @@ -0,0 +1,2729 @@ +;; This file is part of Egg on Mule (Multilingual Environment) + +;; Egg is distributed in the forms of patches to GNU +;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC +;; LICENSE which is distributed along with GNU Emacs by the +;; Free Software Foundation. + +;; 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 EMACS GENERAL PUBLIC LICENSE for +;; more details. + +;; You should have received a copy of the GNU EMACS GENERAL +;; PUBLIC LICENSE along with Nemacs; see the file COPYING. +;; If not, write to the Free Software Foundation, 675 Mass +;; Ave, Cambridge, MA 02139, USA. + +;;; +;;; busyu.el +;;; + +;;; Written by Toshiaki Shingu (shingu@cpr.canon.co.jp) +;;; 92.7.24 modified by T.Shingu +;;; busyu-input and kakusuu-input is re-written. +;;; 92.8.24 modified by T.Shingu +;;; Bub busyu-input fixed. +;;; 92.9.17 modified by K.Handa <handa@etl.go.jp> +;;; All tables are defined directly (not by marcro). +;;; 92.9.20 modified by T.Enami <enami@sys.ptg.sony.co.jp> +;;; In busyu-input, unnecessary mapcar avoided. +;;; 92.9.30 modified for Mule Ver.0.9.6 by T.Mitani <mit@huie.hokudai.ac.jp> +;;; In busyu-input and kakusuu-input, bugs in kakusuu check fixed. + +;;; The tables of bushu (部首) and kakusuu (画数) are copied from: +;;; 『漢字辞書 「kan君」 Ver1.0』 +;;; with slight modifications at: +;;; ("ぼう(个,中など)" . "ぼう") +;;; ("やまいだれ(疔,疚など)" . "やまいだれ") +;;; ("しんにゅう(辷,辺)" . "しんにゅう") +;;; ("ぐうのあし(禹,禺,禽)" . "ぐうのあし") +;;; In addition to the notice at the head of this file (bushu.el), +;;; you should also obey the document below to copy or destribute +;;; these tables. The document is the one attached to the original. +;;; +;************************************************************************** +; +; 漢字辞書 「kan君」 Ver1.0 +; H3,10,20 +;************************************************************************** +; +;/1.はじめに/ +; +; 現在の日本語FEPで部首変換といているのは、第二水準のもののみといったものが +;多く、完全にカバーしているものは見あたりません。そこで、第一水準、第二水準とも +;部首変換と総画数の変換ができれば便利ではない思い作り上げました。 +;このデータは、多くの日本語フロントエンドプロセッサに対応しています。 +;このデータを作成するには、JGAWKが必要です。 +; +; +;/2.出力形式/ +; +;・日本語FEP 一括で辞書登録できるテキストファイルを出力します。 +; +; ATOK7 (株)ジャストシステム +; 松茸V3 (株)管理工学研究所 +; WX2+(WXP) エーアイソフト(株) +; VJE-β (株)バックス +; DFJ (株)デジタル・ファーム +; +; 注意) +; ・WX2+のタイプはフリーウェア版のWXPにも対応しております。 +; ・VJE-βは単体では、登録できません。 +; 同社から販売されている「VJE-Tools」をお使い下さい。 +; +; +;/3.ファイルの内容/ +; +;README.DOC このドキメント +;KAN .COM データ作成用プログラム +;KANMAN.TXT TEL.BATのコマンドリファレンスシート +;KANADV.TXT アドバイスシート(実行前に必ず読んで下さい) +;BUSYU .TXT 部首読み対応シート +;KANJI .DAT 漢字辞書データ +;REPORT.TXT ユーザー登録用紙 +; +; +;/4.使用方法/ +; +;・用意する物 +; +;このデータ作成するには、JGAWKが必要です。雑誌にも時々付いていますので +;お持ちの方は多いと思われます。大きなネットでも大体アップロードされています。 +;91年10月現在、主なネットの所在は次のとおりです。 +; +;NIFTY-Serve FGALAP LIB:7 53 JGAWK29.LZH GNUawk2.11.1+2.9MSDOS漢字版 +;ASCII-NET pcs pool msdos 2174 JGA_EXE.ISH GNU awk 2.11.1+2 MSDOS版の +; 漢字対応版の.exeとマニュアル +; msdos 3655 JGA_29.ISH jgawk 2.11.1 + 2.0 → +2.9 +; (JGA_EXE.LZH の差分ファイル) +;・使い方 +; +;A>KAN (リターン) +; +;で、簡単なパラメータの説明がでてきます。 +;詳しい説明は、付属の KANMAN.TXT に書いてあります。 +; +;たとえば、ATOK7場合は次のようになります。 +; +;A>KAN ATOK B 1 @ +; +;ATOK ATOK7用 +;B 総画数変換辞書を出力 +;1 第一水準のみを出力 +;@ 読みに@が付けられる +; +;以上を実行すると、KAN.TXTというファイルができます。 +;各FEP、データベースの登録方法は、各マニュアルを参考下さい。 +;辞書登録ならば、「一括辞書登録」「辞書併合」などの箇所に書いてあります。 +; +; +;/5.ユーザ登録につて(無償)/ +; +; いろいろの方に質問や指摘、アイデイアいただきありがとうございました。データが +;間違っていた場合は、こちらまでお知らせくだされば幸いです。質問なども付属の登録 +;用紙をお使いください。ユーザ登録のメールを受け取った場合は、1,2週間以内に折 +;り返しご返事のメールを差し上げます。万一メールがこない場合は、お問い合わせ下さ +;い。 +; +;また、次の事項に付いてご了解願います。 +; +;・この登録は、一般的なユーザ登録と違い、お互いに権利や義務は存在いたしません。 +;・私が、皆様方にデータ作成のお手伝いをお願いした場合は、お忙しい方は仕方があり +; ませんがなるべくご協力下さるようお願いいたします。 +;・このデータによって生じたいかなる事故については責任を負いかねます。 +;・データの更新に努めますが、諸処の事情により滞る場合があります。 +;・問い合わせなどにはなるべくご返事いたします。返事が1週間以上無い場合は、忙し +; いか忘れている場合です。申し訳ございませんが再度お送り下さい。 +; +; +;/6.転載、紹介、販売などについて/ +; +;<転載> +; 他のネットへの転載は許可しますが、転載者は必ずユーザ登録を行なって下さい。 +;データの更新時には、最新版をアップロードするように心がけて下さい。 +; データの変更は混乱を招きますので、なるべくこのままの形でアップして下さい。 +;もし、変更する場合は一度ご連絡下さい。 +; 同時にアップロードされている下記のファイルも一緒に登録してください。 +; +;・郵便番号簿 ZIP91A.LZH ・市外局番簿 TEL91A.LZH ・漢字辞書 KANJIDIC.LZH +; +;<紹介> +; 雑誌等の紹介や収録に付いては、更新などで新たに公開しているものが紹介されない +;可能性がありますので一度ご連絡下さい。フロッピーなどの収録時には、現時点での、 +;修正版を提供いたします。 +; +;<販売> +;営利目的でこのデータを取り込んだソフトの販売については一度ご連絡下さい。 +;基本的に了解いたします。詳しいことは、改めて問い合わせ下さい。 +; +; +;/7.連絡先/ +; +;メールは下記までお送りください。 +; +;ASCII-NET(PCS) pcs35011 +;NIFTY-Serve NAG01423 +;PC-VAN GLG93462 +;日経MIX tadashi +;MASTER-NET CAG741 +;************************************************************************** + +(defvar busyu-table + '[0 ; ignore + (("一" . "いち") ; 1 + ("ぼう(个,中など)" . "ぼう") + ("丶" . "てん") + ("丿" . "の") + ("乙" . "おつ") + ("亅" . "はねぼう") + ) + (("二" . "に") ; 2 + ("亠" . "なべふた") + ("人" . "ひと") + ("儿" . "ひとあし") + ("入" . "いる") + ("八" . "はち") + ("冂" . "えんがまえ") + ("冖" . "わかんむり") + ("冫" . "にすい") + ("几" . "つくえ") + ("凵" . "うけばこ") + ("刀" . "かたな") + ("力" . "ちから") + ("勹" . "つつみがまえ") + ("匕" . "さじのひ") + ("匚" . "はこがまえ") + ("匸" . "かくしがまえ") + ("十" . "じゅう") + ("卜" . "ぼくのと") + ("卩" . "ふしづくり") + ("厂" . "がんだれ") + ("厶" . "む") + ("又" . "また") + ) + (("口(くち)" . "くち") ; 3 + ("囗(くにがまえ)" . "くにがまえ") + ("土" . "つち") + ("士" . "さむらい") + ("夂" . "ふゆがしら") + ("夊" . "すいにょう") + ("夕" . "ゆうべ") + ("大" . "だい") + ("女" . "おんな") + ("子" . "こ") + ("宀" . "うかんむり") + ("寸" . "すん") + ("小" . "ちいさい") + ("尢" . "まげあし") + ("尸" . "しかばね") + ("屮" . "てつ") + ("山" . "やま") + ("巛" . "まがりがわ") + ("工" . "たくみ") + ("己" . "おのれ") + ("巾" . "はば") + ("干" . "ほす") + ("幺" . "いとがしら") + ("广" . "まだれ") + ("廴" . "えんにょう") + ("廾" . "にじゅうあし") + ("弋" . "しきがまえ") + ("弓" . "ゆみ") + ("彑" . "けいがしら") + ("彡" . "さんづくり") + ("彳" . "ぎょうにんべん") + ) + (("心" . "こころ") ; 4 + ("戈" . "かのほこ") + ("戸" . "とびらのと") + ("手" . "て") + ("支" . "じゅうまた") + ("攴" . "とまた") + ("文" . "ぶん") + ("斗" . "とます") + ("斤" . "きん") + ("方" . "ほう") + ("旡" . "すでのつくり") + ("日" . "にち") + ("曰" . "ひらび") + ("月" . "つき") + ("木" . "き") + ("欠" . "かける") + ("止" . "とめる") + ("歹" . "いちた") + ("殳" . "るまた") + ("毋" . "なかれ") + ("比" . "くらべるひ") + ("毛" . "け") + ("氏" . "うじ") + ("气" . "きがまえ") + ("水" . "みず") + ("火" . "ひ") + ("爪" . "つめ") + ("父" . "ちち") + ("爻" . "めめ") + ("爿" . "しょうへん") + ("片" . "かた") + ("牙" . "きば") + ("牛" . "うし") + ("犬" . "いぬ") + ) + (("玄" . "げん") ; 5 + ("玉" . "たま") + ("瓜" . "うり") + ("瓦" . "かわら") + ("甘" . "あまい") + ("生" . "うまれる") + ("用" . "もちいる") + ("田" . "た") + ("疋" . "ひき") + ("やまいだれ(疔,疚など)" . "やまいだれ") + ("癶" . "はつがしら") + ("白" . "しろ") + ("皮" . "ひのかわら") + ("皿" . "さら") + ("目" . "め") + ("矛" . "むのほこ") + ("矢" . "や") + ("石" . "いし") + ("示" . "しめす") + ("ぐうのあし(禹,禺,禽)" . "ぐうのあし") + ("禾" . "のぎ") + ("穴" . "あな") + ("立" . "たつ") + ) + (("竹" . "たけ") ; 6 + ("米" . "こめ") + ("糸" . "いと") + ("缶" . "ほとぎ") + ("网" . "あみがしら") + ("羊" . "ひつじ") + ("羽" . "はね") + ("老" . "おい") + ("而" . "しかして") + ("耒" . "らいすき") + ("耳" . "みみ") + ("聿" . "ふでづくり") + ("肉" . "にく") + ("臣" . "しん") + ("自" . "みずから") + ("至" . "いたる") + ("臼" . "うす") + ("舌" . "した") + ("舛" . "ます") + ("舟" . "ふね") + ("艮" . "こん") + ("色" . "いろ") + ("艸" . "くさ") + ("虍" . "とらがしら") + ("虫" . "むし") + ("血" . "ち") + ("行" . "ぎょう") + ("衣" . "ころも") + ("襾" . "にし") + ) + (("見" . "みる") ; 7 + ("角" . "つの") + ("言" . "ことば") + ("谷" . "たに") + ("豆" . "まめ") + ("豕" . "いのこ") + ("豸" . "むじな") + ("貝" . "かい") + ("赤" . "あか") + ("走" . "はしる") + ("足" . "あし") + ("身" . "み") + ("車" . "くるま") + ("辛" . "からい") + ("辰" . "しんのたつ") + ("しんにゅう(辷,辺)" . "しんにゅう") + ("邑" . "むら") + ("酉" . "さけのとり") + ("釆" . "のごめ") + ("里" . "さと") + ) + (("金" . "かね") ; 8 + ("長" . "ながい") + ("門" . "もん") + ("阜" . "ぎふのふ") + ("隶" . "れいづくり") + ("隹" . "ふるとり") + ("雨" . "あめ") + ("青" . "あお") + ("非" . "あらず") + ) + (("面" . "めん") ; 9 + ("革" . "かくのかわ") + ("韋" . "なめしがわ") + ("韭" . "にら") + ("音" . "おと") + ("頁" . "おおがい") + ("風" . "かぜ") + ("飛" . "とぶ") + ("食" . "しょく") + ("首" . "くび") + ("香" . "においこう") + ) + (("馬" . "うま") ; 10 + ("骨" . "ほね") + ("高" . "たかい") + ("髟" . "かみがしら") + ("鬥" . "とうがまえ") + ("鬯" . "ちょう") + ("鬲" . "かく") + ("鬼" . "おに") + ) + (("魚" . "うお") ; 11 + ("鳥" . "とり") + ("鹵" . "ろ") + ("鹿" . "しか") + ("麦" . "むぎ") + ("麻" . "あさ") + ) + (("黄" . "きいろ") ; 12 + ("黍" . "きび") + ("黒" . "くろ") + ("黹" . "ふつ") + ) + (("黽" . "べん") ; 13 + ("鼎" . "かなえ") + ("鼓" . "つづみ") + ("鼠" . "ねずみ") + ) + (("鼻" . "はな") ; 14 + ("齊" . "せい") + ) + (("齒" . "は") ; 15 + ) + (("龍" . "りゅう") ; 16 + ("龜" . "かめ") + ) + (("龠" . "やく") ; 17 + ) + ]) + +(defvar busyu-kaku-alist + '(("あお" + (8 . "青") + (13 . "靖") + (14 . "静") + (16 . "靜")) + ("あか" + (7 . "赤") + (12 . "赧") + (14 . "赫") + (16 . "赭")) + ("あさ" + (11 . "麻") + (14 . "麼") + (15 . "麾") + (18 . "麿")) + ("あし" + (7 . "足") + (11 . "跂趾趺") + (12 . "跏距跚跖跌跛跋") + (13 . "跪跫跨跟跡践跣跳路") + (14 . "踈跼踊踉跿") + (15 . "踐踝踞踟踏踪") + (16 . "踴蹂踵蹄踰") + (17 . "蹊蹇蹉蹌蹐蹈") + (18 . "蹠蹟蹙蹤蹣蹕") + (19 . "蹶蹴蹲蹼") + (20 . "躁躇躄躅") + (21 . "躋躊躍") + (22 . "躓躑躔") + (23 . "躙") + (25 . "躡") + (27 . "躪")) + ("あな" + (5 . "穴") + (7 . "究") + (8 . "穹空突") + (9 . "穽窃穿") + (10 . "窈") + (11 . "窄窓窒窕") + (12 . "窗窘窖") + (13 . "窟") + (14 . "窪窩") + (15 . "窮窯窰") + (16 . "窶窺") + (17 . "窿竃") + (18 . "竅竄") + (20 . "竇") + (21 . "竈") + (22 . "竊")) + ("あまい" + (5 . "甘") + (9 . "甚") + (11 . "甜") + (13 . "甞")) + ("あみがしら" + (6 . "网") + (7 . "罕") + (8 . "罔") + (9 . "罘") + (10 . "罟罠") + (13 . "罨罫罪署置罩罧") + (14 . "罰") + (15 . "罸罵罷") + (16 . "罹") + (18 . "羂") + (19 . "羃羆羅") + (22 . "羇") + (24 . "羈")) + ("あめ" + (8 . "雨") + (11 . "雪雫") + (12 . "雲雰") + (13 . "電雹雷零") + (14 . "需") + (15 . "霄震霆霈霊") + (16 . "霍霓霎霑霏霖") + (17 . "霙霞霜") + (18 . "霤") + (19 . "霪霧") + (20 . "霰露") + (21 . "霸霹") + (22 . "霽霾") + (24 . "靈靄靆靂") + (25 . "靉")) + ("あらず" + (8 . "非") + (15 . "靠") + (19 . "靡")) + ("いし" + (5 . "石") + (8 . "矼") + (9 . "研砂砕砌砒") + (10 . "砦砥砠砧破砲砺砿") + (11 . "硅") + (12 . "硯硬硝硫硲硴") + (13 . "碚碗碎碍碕碁碓碇硼碌碆") + (14 . "碪碣磁碑碧碯碵碩") + (15 . "磆磑確磋磔碾碼磐磅磊") + (16 . "磚磬磧磨") + (17 . "磯磽礁磴") + (18 . "礒礎礑礇") + (19 . "礙") + (20 . "礬礪礫礦")) + ("いたる" + (6 . "至") + (10 . "致") + (14 . "臺") + (16 . "臻")) + ("いちた" + (4 . "歹") + (6 . "死") + (8 . "歿殀") + (9 . "殆殄殃") + (10 . "残殊殉") + (11 . "殍") + (12 . "殘殖殕") + (14 . "殞") + (15 . "殤") + (16 . "殪殫") + (18 . "殯") + (19 . "殱") + (21 . "殲")) + ("いち" + (1 . "一") + (2 . "七丁") + (3 . "下三上丈万与") + (4 . "丐丑不") + (5 . "丘且世丗丕丙") + (6 . "丞両") + (8 . "並")) + ("いとがしら" + (3 . "幺") + (4 . "幻") + (5 . "幼") + (9 . "幽") + (12 . "幾")) + ("いと" + (6 . "糸") + (7 . "系糺") + (9 . "紆紀級糾紅紂約") + (10 . "紜紘紗索紙純素紐納紕紊紛紡紋") + (11 . "経絅絃紺細紮紫終紹紳紲組紿紬紵絆累絋") + (12 . "絲絵給結絢絞絳絖絎絨絮絶統絣絡絏") + (13 . "經継絹絛綏続絽綛綉") + (14 . "維綺綮綣綱綵緇綽綬緒総綜綻綢綴綯緋綿網綾緑綸綟練綰綫緕") + (15 . "緲緜縁緩緘緊緝縄緤線緞緻締緡編緬縅") + (16 . "緯縊縣縞縡縒縦縟縉縋縢縛繁縫") + (17 . "縲總縱繆繦縮績繊縵縻縹繃縷縺") + (18 . "繪繝繞織繕繙繚繧繖繍") + (19 . "繩繭繹繋繰") + (20 . "繼纂繻繽辮纃繿") + (21 . "續纎纈纏纐纉") + (22 . "纒") + (23 . "纖纓纔") + (25 . "纛") + (27 . "纜")) + ("いぬ" + (4 . "犬") + (5 . "犯") + (6 . "犲") + (7 . "状狂狃狆狄犹") + (8 . "狐狎狗狙狛狒") + (9 . "狠狭狡狩独狢") + (10 . "狹狷狸狼狽") + (11 . "倏猗猊猜猖猝猪猛猟") + (12 . "猫猴猩猶猥猯") + (13 . "献猷猿猾獅") + (14 . "獄獏") + (15 . "獎獗") + (16 . "獣獨獪獲") + (17 . "獰") + (18 . "獵") + (19 . "獸獺") + (20 . "獻")) + ("いのこ" + (7 . "豕") + (11 . "豚") + (12 . "象") + (13 . "豢") + (14 . "豪") + (16 . "豫豬")) + ("いる" + (2 . "入") + (6 . "全") + (8 . "兩") + (9 . "兪")) + ("いろ" + (6 . "色") + (19 . "艶") + (24 . "艷")) + ("うお" + (11 . "魚") + (15 . "魯魴") + (16 . "鮓鮎鮃鮒鮑鮗鮖") + (17 . "鮟鮪鮠鮭鮫鮨鮮鮴") + (18 . "鯀鯊鮹鯉鯆鯏鯑鯒") + (19 . "鯣鯨鯢鯤鯔鯖鯛鯡鯱鯰鯲鯵") + (20 . "鰕鰉鰓鰌鰍鰆鰈鰒鰊鰔鰄鰛鰐") + (21 . "鰮鰥鰭鰤鰯鰡鰰") + (22 . "鰹鰺鰻鰾鱈鱆鱇鰲") + (23 . "鱒鱗鱚") + (24 . "鱠鱧") + (26 . "鱶") + (27 . "鱸")) + ("うかんむり" + (3 . "宀") + (5 . "它") + (6 . "安宇守宅") + (7 . "完宏宋宍") + (8 . "宛官宜実宗宙定宕宝") + (9 . "客宦室宣宥") + (10 . "宴家害宮宰宵宸容") + (11 . "寃寅寄寂宿密寇") + (12 . "寒寓寔寐富") + (13 . "寛寝") + (14 . "實寢寡寤察寧寞寥寨") + (15 . "寫審寮") + (16 . "寰") + (19 . "寳寵") + (20 . "寶")) + ("うけばこ" + (2 . "凵") + (4 . "凶") + (5 . "凹出凸") + (8 . "函") + (9 . "凾")) + ("うし" + (4 . "牛") + (6 . "牝牟") + (7 . "牡牢") + (8 . "牧物") + (9 . "牲牴") + (10 . "特") + (11 . "牾牽犁") + (12 . "犀犇犂") + (14 . "犒犖") + (17 . "犠") + (19 . "犢") + (20 . "犧")) + ("うじ" + (4 . "氏") + (5 . "民") + (8 . "氓")) + ("うす" + (6 . "臼") + (9 . "臾舁") + (11 . "舂") + (13 . "舅") + (14 . "與") + (16 . "興") + (17 . "舉") + (18 . "舊")) + ("うまれる" + (5 . "生") + (11 . "産") + (12 . "甥甦")) + ("うま" + (10 . "馬") + (12 . "馭馮") + (13 . "馴馳") + (14 . "駅駆駄駁馼") + (15 . "駈駕駒駟駛駝駘駐駑") + (16 . "駭駮駱駲") + (17 . "駻駿駸騁") + (18 . "騎騏験騅騒駢") + (19 . "騙騨") + (20 . "騷騫騰") + (21 . "驅驂驀驃騾") + (22 . "驚驕驍") + (23 . "驛驗") + (24 . "驟") + (26 . "驢") + (27 . "驥驤") + (28 . "驩") + (29 . "驪") + (30 . "驫")) + ("うり" + (6 . "瓜") + (11 . "瓠") + (16 . "瓢") + (19 . "瓣")) + ("えんがまえ" + (2 . "冂") + (4 . "内円") + (5 . "冊册冉囘") + (6 . "再") + (7 . "冏") + (9 . "冑冒") + (10 . "冓") + (11 . "冕")) + ("えんにょう" + (3 . "廴") + (7 . "廷") + (8 . "延廸") + (9 . "廻建廼")) + ("おい" + (6 . "考老") + (8 . "者") + (10 . "耆耄") + (12 . "耋")) + ("おおがい" + (9 . "頁") + (11 . "頃頂") + (12 . "項須順") + (13 . "頑頏頌頓頒預") + (14 . "頗領頚") + (15 . "頤頡") + (16 . "頼頷頬頸頽頭") + (17 . "顆頻") + (18 . "額顎顔顏顕顋題類") + (19 . "願顛") + (21 . "顧") + (22 . "顫") + (23 . "顯") + (24 . "顰") + (25 . "顱") + (27 . "顴顳")) + ("おつ" + (1 . "乙") + (2 . "九") + (3 . "乞也") + (7 . "乱") + (8 . "乳") + (11 . "乾亀") + (13 . "亂")) + ("おと" + (9 . "音") + (13 . "韵") + (14 . "韶") + (19 . "韻") + (20 . "響")) + ("おに" + (10 . "鬼") + (14 . "魁魂") + (15 . "魄魃魅") + (17 . "醜") + (18 . "魏魍魎") + (21 . "魑魔") + (24 . "魘")) + ("おのれ" + (3 . "已己巳") + (4 . "巴") + (7 . "巵") + (9 . "巻巷") + (12 . "巽")) + ("おんな" + (3 . "女") + (5 . "奴") + (6 . "如奸好妁妃妄") + (7 . "妓妝妥妊妣妨妙妖妍") + (8 . "侫委姑妻始姉妾姓姐妲妬姆妹") + (9 . "姙娃威姨姻姦姜姿姪姥姚姶") + (10 . "娚娥姫娟娯娑娘娠娜娉娩") + (11 . "婀婉婚娵娶娼婆婢婦婁婪婬") + (12 . "媛婿媒媚") + (13 . "媼嫁嫌媾嫉嫋嫂媽嫐") + (14 . "嫦嫣嫗嫡嫩嫖") + (15 . "嫺嫻嬉嬌嬋") + (16 . "嬢嬖") + (17 . "嬰嬬嬲嬪嬶") + (19 . "嬾") + (20 . "孃孅孀")) + ("かい" + (7 . "貝") + (9 . "負") + (10 . "貢財") + (11 . "貨貫責貪販貧貮貭") + (12 . "貽賀貴貲貰貸貯貼貳買費貶貿賁") + (13 . "賊賈資賃賂賄賎賍") + (14 . "賑") + (15 . "賛賜賞賤質賣賠賓賦賚") + (16 . "賢賭") + (17 . "購賽賺賻") + (18 . "贄贅贈贇") + (19 . "贊贋") + (20 . "贏贍") + (21 . "贐贓贔") + (22 . "贖")) + ("かくしがまえ" + (2 . "匸") + (4 . "区匹") + (7 . "医") + (10 . "匿") + (11 . "區")) + ("かくのかわ" + (9 . "革") + (12 . "靫靱靭") + (13 . "靴靹") + (14 . "鞅靼鞄靺鞆鞁") + (15 . "鞋鞍鞏鞐") + (16 . "鞘") + (17 . "鞠鞜") + (18 . "鞫鞦鞣鞭鞨") + (19 . "鞴鞳") + (22 . "韃") + (24 . "韈韆")) + ("かく" + (10 . "鬲") + (22 . "鬻")) + ("かける" + (4 . "欠") + (6 . "次") + (8 . "欧欣") + (11 . "欸欷欲") + (12 . "欹款欺欽") + (13 . "歇歃") + (14 . "歌歉") + (15 . "歐歓歎") + (16 . "歙歔") + (17 . "歛") + (18 . "歟") + (22 . "歡")) + ("かぜ" + (9 . "風") + (12 . "颪") + (14 . "颯颱") + (17 . "颶") + (20 . "飄飃") + (21 . "飆")) + ("かたな" + (2 . "刀") + (3 . "刃刄") + (4 . "刈切分") + (5 . "刊刋") + (6 . "刑刎列刔") + (7 . "刪初判別利刧") + (8 . "刮券刳刻刷刺制刹到") + (9 . "剏剄剋削前則剃剌") + (10 . "剞剣剛剤剔剥剖") + (11 . "剱剰剩剪副") + (12 . "剴割創剳") + (13 . "剿剽") + (14 . "劃") + (15 . "劍劇劈劉") + (16 . "劒劔劑")) + ("かた" + (4 . "片") + (8 . "版") + (12 . "牌牋") + (13 . "牒") + (17 . "牆") + (19 . "牘")) + ("かなえ" + (13 . "鼎")) + ("かね" + (8 . "金") + (10 . "釖針釘釜釡釛釟") + (11 . "釼釦釵釧釣釶") + (12 . "鈞釿鈔鈍鈑鈎鈬鈩") + (13 . "鉞鉛鉗鉅鉉鈷鉱鉤鉈鉦鉄鈿鉢鉋鈴鉐鉚") + (14 . "銕銜銀銖銃銭銑銓銛銅鉾銘銚") + (15 . "鋪鋭鋏銹鋤銷鋳鋒鋲鋩") + (16 . "錦錢錏鋺鋸錮鋼錯錙錠錐錆錫錚錘錣錬録錺錵錻鍄") + (17 . "鍋鍔鍵鍠鍬鍾鍼鍛鍮鍍錨鍖鍜") + (18 . "鎰鎧鎬鎖鎗鎮鎭鎚鎔鎌鎹") + (19 . "鏥鏖鏡鏗鏨鏘鏃鏑鏝鏐鏈鏤") + (20 . "鐡鐚鐘鐔鐓鐙鐃鐐鐇") + (21 . "鐵鐶鐫鐸鐺") + (22 . "鑄鑓鑁鑒") + (23 . "鑛鑑鑠鑢鑞鑚") + (24 . "鑪") + (25 . "鑰") + (26 . "鑵鑷") + (27 . "鑽鑼鑾鑿") + (28 . "钁")) + ("かのほこ" + (4 . "戈") + (5 . "戉戊") + (6 . "戍戎戌成") + (7 . "我戒") + (8 . "或戔") + (11 . "戛戚戝") + (12 . "戞戟") + (13 . "戡戦") + (14 . "截") + (15 . "戯戮") + (16 . "戰") + (17 . "戲") + (18 . "戴戳")) + ("かみがしら" + (10 . "髟") + (13 . "髢") + (14 . "髪髣髦") + (15 . "髴髯髮髭髫髱") + (16 . "髷髻") + (18 . "鬆") + (21 . "鬘") + (22 . "鬚") + (23 . "鬟") + (24 . "鬢") + (25 . "鬣")) + ("かめ" + (16 . "龜")) + ("からい" + (7 . "辛") + (12 . "辜") + (13 . "辟") + (14 . "辣") + (16 . "辨辧") + (19 . "辭") + (21 . "辯")) + ("かわら" + (5 . "瓦") + (7 . "瓧") + (8 . "瓩") + (9 . "瓮瓲瓱瓰") + (11 . "瓷瓶瓸") + (14 . "甄甃甅") + (16 . "甌甎甍") + (17 . "甑") + (18 . "甕甓")) + ("がんだれ" + (2 . "厂") + (4 . "厄") + (9 . "厚厖厘") + (10 . "原") + (11 . "厠") + (12 . "厥厦厩厨") + (14 . "厭厮厰") + (17 . "厳")) + ("きいろ" + (11 . "黄") + (25 . "黌")) + ("きがまえ" + (4 . "气") + (6 . "気") + (8 . "氛") + (10 . "氣氤")) + ("きば" + (4 . "牙")) + ("きび" + (12 . "黍") + (15 . "黎") + (17 . "黏") + (23 . "黐")) + ("きん" + (4 . "斤") + (5 . "斥") + (8 . "斧") + (9 . "斫") + (11 . "斬断") + (12 . "斯") + (13 . "新") + (18 . "斷")) + ("き" + (4 . "木") + (5 . "札朮本末未") + (6 . "机朽朿朱朶朴朸杁朷") + (7 . "来杆杏杞材杉条杖束村杜杓杙李杣杢杤杠") + (8 . "杲杳枉果杭枝杵松枩枢析杼枕東杯板枇杪枌枋枚林枡枠杰枅枦杷") + (9 . "柆栄架枷柯柑柬枳柩枸枯査柴柵柞柿柘柊柁柝柱柢柔某柏柎柄枹柚柳\ +栂栃柾柤柧柮枴") + (10 . "栢案桜格核桓栞桔框栩桂桀校桁栲根栽桟桎株栓栴桑桃桐梅栗栫桍桙\ +栖桧档") + (11 . "桿條桝梳械桷梟梧梗梏梱梭梓梔梢梛梯梃桶梶桴梵梨梠梁梺桾梍梼梹") + (12 . "椄棧椅椁棺棋棊棘検棍棕椒植森棲棗椎棣棟棹棠棚棒棉椋椀椚椙椛棆\ +棔棡棯椈椌椏椡椪椣椥椨椦椢") + (13 . "楳椶楹楷楽棄業極楸楫楢楯楔楚楮椿椹椽楠楓椰楡楊楝楼椴楙楜楪楴\ +楾榁楕楞") + (14 . "榮榔榎槐概構槁槓榾槎槊様榛榱槍槌槙槇榻槃榧榑模榜榕榴榊榠榲榿\ +樮槝槞") + (15 . "樞槨樂樓樣横槻樛槿権槲槧樟樅槽樗樋樊標樒樫槫槭槹樔樌樢") + (16 . "樺橄機橘橋樹樵橡橇樽橢橙橦橈樸樶橲橸") + (17 . "檢檐橿檠檄檎檣檀檗檍檪檜") + (18 . "櫁檻櫃櫂檮檸檳檬") + (19 . "櫛櫚櫟櫓櫞櫑") + (20 . "欄櫪櫨") + (21 . "櫻欅櫺") + (22 . "權") + (23 . "欒") + (25 . "欖") + (26 . "欝") + (29 . "欟")) + ("ぎふのふ" + (6 . "阡") + (7 . "阯阪阨阮防") + (8 . "阜陂阿阻陀附") + (9 . "限陌陋陏") + (10 . "院陥降除陞陣陝陟陛陜陦") + (11 . "陷陰険陲陬陳陶陪陸隆陵") + (12 . "隋随階隅隍隊陽隈") + (13 . "隘隕隗隔") + (14 . "隙隠際障") + (16 . "險隧隣") + (17 . "隱隰隲") + (19 . "隴")) + ("ぎょうにんべん" + (3 . "彳") + (7 . "役彷") + (8 . "彿往徃径征徂彼") + (9 . "後很徇待律徊") + (10 . "徑従徐徒") + (11 . "徠從徙得徘") + (12 . "御徨循復") + (13 . "微徭") + (14 . "徴徳") + (15 . "徹") + (16 . "徼") + (17 . "徽")) + ("ぎょう" + (6 . "行") + (9 . "衍") + (11 . "衒術") + (12 . "街") + (13 . "衙") + (15 . "衝") + (16 . "衛衞衡") + (24 . "衢")) + ("くさ" + (6 . "艸艾芋") + (7 . "芍芒花芸芝芙芳") + (8 . "苅芥芹芫芟芯芭芬芦若英苑芽苦茎苗茉茂") + (9 . "苛茄苣苟苫苒苴苔苧苳范苻苹苞茅茆苜苓苙苡苺荒茜草荘茶") + (10 . "芻茵茴荊茨茲茱荀茹茸荏荐荅茯茫茗茘茖荷華莉") + (11 . "莅莖莊莚莪莞莟莢莎荵荻荼莫莓莠莨莇茣莽莵荳菓菊菌菜著菩萌") + (12 . "菷菴萎菅菫菰菎菽菖萃菘萋菁萇菟菠菲萍萠莱菱菻萄萓萢萬葵萩葬葉落") + (13 . "葦葭萼葛葷萱葫葺葱董葩葡葆葯葎萪蒄萵萸葮葹葢蒂蒸蓄蓉") + (14 . "蒭蓊蓋蒹蒿蒟蓑蒜蓍蒔蒻蒐蓐蓁蓆蒼蓖蒲蒙蓙蒡蓚蔦蔵") + (15 . "蔔蔆蔭蔚蔡蓴蔗蒋蔘蔬蔟蔕蔓蔑蓬蔀蓼蓮蓿") + (16 . "蕩蕚蕎蕀蕨蕣蕉蕘蕈蕁蕊蕋蕃蕪蔽蕕蕭蕗薫薪薦薄薬") + (17 . "薗薤薈薑薊薨薔薛薙薇薜蕾蕷薐薮薀") + (18 . "藁藏薩藉薯薺薹藐藤藩藍") + (19 . "藝藥藕藪藜藻蘭") + (20 . "蘂藷藹蘊蘇蘓蘋藺蘆蘢藾") + (21 . "蘗蘖蘯蘚蘰") + (23 . "蘿")) + ("くち" + (3 . "口") + (5 . "叶叩可句古号司史只叱召台叮叨右叺叭") + (6 . "吉吃叫吁向后合吊吐吋同名吏各") + (7 . "吸吽呀含听吟君呉吾吭吼告吹吮呈吶呑吠否吻吩呆呂吝呎") + (8 . "咏呵咎呟呼呱呷咋呰呪咒周呻咀知呶咄咆味命和咐") + (9 . "哀哇咽咳咢咸咥咬哄哈哉咨咫咲哂咤品咼咾哘咯") + (10 . "唔員哥唏哽哮哭唆哨唇哲唐唄哺哩哢哦唖") + (11 . "啀啓售商唱啜唾啅啄啖啗唸問唯唳唹啌啝啣") + (12 . "喝営喙喀喚喊喜喟喫喬喧喉啻啾善喘喪喞單喋啼喃喩喇喰喨") + (13 . "嗚嗅嗟嗄嗣嗜嗤嗔嘆") + (14 . "嘔嘉嗷嘖嘗嗾嗽嗹嘛") + (15 . "噎器噐嘘嘴嘱嘶噌噂嘲嘸噴噛嘩") + (16 . "噫噤嘯噬噸噺噪") + (17 . "嚇嚆嚔嚏嚊嚀") + (18 . "嚠") + (19 . "嚥嚮") + (20 . "嚶嚴") + (21 . "囂嚼囁囃囀") + (22 . "囈嚢囎") + (24 . "囑囓")) + ("くにがまえ" + (3 . "囗") + (5 . "囚四") + (6 . "因回団") + (7 . "囲囮困図") + (8 . "固国囹") + (9 . "圀囿") + (10 . "圄圃") + (11 . "國圉圈") + (12 . "圍圏") + (13 . "圓園嗇") + (14 . "團圖") + (16 . "圜")) + ("くび" + (9 . "首") + (11 . "馗") + (17 . "馘")) + ("くらべるひ" + (4 . "比") + (9 . "毘")) + ("くるま" + (7 . "車") + (8 . "軋") + (9 . "軌軍") + (10 . "軒") + (11 . "軛転軟軣") + (12 . "軼軻軽軸軫") + (13 . "較載軾輊輅輌") + (14 . "輕輒輓輔") + (15 . "輙輝輜輟輩輛輪輦") + (16 . "輯輳輻輸輹") + (17 . "轅轄轂輾輿") + (18 . "轉轆轌") + (19 . "轎轍") + (20 . "轗") + (21 . "轟轜") + (22 . "轡轢") + (23 . "轣轤")) + ("くろ" + (11 . "黒") + (15 . "黙") + (16 . "默黔") + (17 . "黛黜點黝") + (18 . "黠") + (20 . "黨黥") + (21 . "黯") + (23 . "黴") + (26 . "黶") + (27 . "黷")) + ("ぐうのあし" + (9 . "禹禺") + (13 . "禽")) + ("けいがしら" + (3 . "彑") + (6 . "当") + (9 . "彖") + (11 . "彗") + (13 . "彙") + (16 . "彜") + (18 . "彝")) + ("け" + (4 . "毛") + (8 . "毟") + (11 . "毬毫") + (12 . "毳毯") + (17 . "氈")) + ("げん" + (5 . "玄") + (11 . "率")) + ("こころ" + (4 . "心") + (5 . "必") + (6 . "忖忙") + (7 . "応忌志忍忘快忻忤忸忱忰") + (8 . "忽忠忝念忿怐怡怪怯怙性怛怕怖怫怦怏怜怺怩") + (9 . "怨急思怎怠怒怱恊恠悔恢恪恟恒恆恰恍恨恃恤恂恬恫") + (10 . "恚恁恩恐恭恵恣恕息恥恙恋恷悧悦悁悍悟悃悚悄悛悌悩悖悒悋悗") + (11 . "悪患悉悠惟悸惓惚惨情悴悽惜惆悵悼惇惘惧") + (12 . "悳惠惣悲悶惑惱愕慌惶愀惴惺惻惰愎愉愃愡") + (13 . "惡愛意感愚愆慈惹愁惷想愍愈慍慨愧愾慊慎愼愴慄愽戀") + (14 . "慇愨愿愬態慕慂慘慣慳慷慚慴慥慟慓慢慵慯慱") + (15 . "慰慶慧慙慫慝憂慾慮憇憎憬憔憚憧憫憮憤憐") + (16 . "憙憖憩憲憊憑懌懊憶懐懈憾懆憺懍") + (17 . "應懃懇懋懦") + (18 . "懲懣懴") + (19 . "懷懶") + (20 . "懸懺") + (21 . "懽懼懾") + (22 . "懿")) + ("ことば" + (7 . "言") + (9 . "計訂訃") + (10 . "記訖訓訐訌訊託討") + (11 . "設訛訝許訣訟訥訪訳") + (12 . "詠訶詁詐詞証詔診訴詛詑詒註詆評詈") + (13 . "詼該詭詰詣誇詬詩試詢詳誠詫誅誂誉誄話詮") + (14 . "誨誡誑語誤誥誌誦誚誓説読認誣誘") + (15 . "謁課誼諏諄諸誰請諍諾誕談調諂誹諒論諚諫") + (16 . "諤諳謂諧諌諱謔諠諺諢諮諜諦諷諞謀諭諛謡諡") + (17 . "謌謠謹謙謇講謚謝謖謄謐謗謎") + (18 . "謳謦謫謾謬謨") + (19 . "譌證譁譏譎警識譖譛譚譜") + (20 . "譯議護譲譫譟譬") + (21 . "譽譴") + (22 . "讀讃") + (23 . "讌讎讐") + (24 . "讓讒讖") + (25 . "讙") + (26 . "讚")) + ("こめ" + (6 . "米") + (8 . "籵") + (9 . "粁粂籾") + (10 . "粃粋粉粍粐") + (11 . "粗粘粕粒") + (12 . "粤粢粥粧粟粡粨粭粫") + (13 . "粳粲粱粮") + (14 . "粹精糀粽") + (15 . "糊糅糎糂") + (16 . "糖糒糘") + (17 . "糢糠糟糜糞") + (18 . "糧") + (20 . "糯") + (21 . "糲") + (22 . "糴") + (25 . "糶")) + ("ころも" + (6 . "衣") + (8 . "衫表") + (9 . "衿衵衽衷衲袂") + (10 . "袁衾袞衰袖袗袒袙袢被袍") + (11 . "袈袋袤袮袰袵袿袷袱裃裄裳") + (12 . "裁装裂裙補裕裡") + (13 . "裝裔裘裏裟褂裾裼裨裸裲褄") + (14 . "裹製裴褐褌複褊褓褝") + (15 . "褒褞褥褪褫") + (16 . "褸襁褶") + (17 . "襃襄褻襌襍") + (18 . "襖襟襠") + (19 . "襞襦襤") + (20 . "襭襪") + (21 . "襯") + (22 . "襲襴襷")) + ("こん" + (6 . "艮") + (7 . "良") + (17 . "艱")) + ("こ" + (3 . "孑子") + (4 . "孔") + (5 . "孕") + (6 . "字存") + (7 . "孝孚孛") + (8 . "学孥孟孤季") + (9 . "孩") + (10 . "孫") + (11 . "孰") + (12 . "孱") + (13 . "孳") + (14 . "孵") + (16 . "學") + (17 . "孺")) + ("さけのとり" + (7 . "酉") + (9 . "酋酊") + (10 . "酌酒酎配") + (11 . "酔酖酘") + (12 . "酣酢酥鈕") + (13 . "酬酩酪") + (14 . "酳酵酷酸酲") + (15 . "醉醋醇醂") + (16 . "醒醍醐醗") + (17 . "醢") + (18 . "醫醯醤醪") + (20 . "醵醸醴") + (21 . "醺") + (24 . "釀") + (25 . "釁")) + ("さじのひ" + (2 . "匕") + (4 . "化") + (5 . "北") + (11 . "匙")) + ("さと" + (7 . "里") + (9 . "重") + (11 . "野") + (12 . "量") + (18 . "釐")) + ("さむらい" + (3 . "士") + (4 . "壬") + (6 . "壮") + (7 . "壯壱声売") + (11 . "壷") + (12 . "壹壺壻") + (13 . "壼") + (14 . "壽")) + ("さら" + (5 . "皿") + (8 . "盂") + (9 . "盃盈盆") + (10 . "益盍") + (11 . "盗盒盛盖") + (12 . "盜") + (13 . "盞盟") + (14 . "盡") + (15 . "監盤") + (16 . "盥盧") + (17 . "盪")) + ("さんづくり" + (3 . "彡") + (7 . "形") + (9 . "彦") + (11 . "彩彫彪彬") + (12 . "彭") + (14 . "彰") + (15 . "影")) + ("しかして" + (6 . "而") + (9 . "耐")) + ("しかばね" + (3 . "尸") + (4 . "尹尺") + (5 . "尻尼") + (6 . "尽") + (7 . "局尿屁尾") + (8 . "届屆居屈") + (9 . "屋屍屎屏昼") + (10 . "屐屑展屓") + (12 . "属屠屡") + (14 . "層") + (15 . "履") + (21 . "屬")) + ("しか" + (11 . "鹿") + (13 . "麁") + (16 . "麈") + (17 . "麋") + (18 . "麌") + (19 . "麓麕麒麑麗") + (21 . "麝") + (23 . "麟")) + ("しきがまえ" + (3 . "弋") + (4 . "弌") + (5 . "弍") + (6 . "式弐") + (12 . "弑")) + ("した" + (6 . "舌") + (8 . "舎舍") + (10 . "舐") + (12 . "舒") + (13 . "辞") + (15 . "舗舖") + (16 . "舘")) + ("しめす" + (5 . "示礼") + (7 . "社") + (8 . "祀祁祈祉") + (9 . "祇祝神祖祐") + (10 . "祠祗祟祚祕祓祢祥") + (11 . "祭票祷袴") + (12 . "禄") + (13 . "祺禁祿禀禍禅禎福") + (14 . "禊") + (15 . "禝") + (16 . "禦頴") + (17 . "禪禧") + (18 . "禮") + (19 . "禰") + (22 . "禳")) + ("しょうへん" + (4 . "爿") + (8 . "牀")) + ("しょく" + (9 . "食") + (10 . "飢") + (12 . "飯") + (13 . "飭飲飮飫飩飾飼飽") + (14 . "飴") + (15 . "餃餌餉養餅餓") + (16 . "餘餐餒餔館") + (17 . "餝餡餞餤餠") + (18 . "餬餮") + (19 . "餽餾饂") + (20 . "饉饅") + (21 . "饐饋饑饒饌") + (22 . "饗饕")) + ("しろ" + (5 . "白") + (6 . "百") + (7 . "皀皃") + (8 . "的") + (9 . "皈皆皇") + (10 . "皋") + (11 . "皐皎") + (12 . "皖皓") + (13 . "皙") + (15 . "皚")) + ("しんにゅう" + (5 . "辷辺込") + (6 . "辻迅") + (7 . "迂迄辿近迎返") + (8 . "迚述迭迫") + (9 . "迦迥迢迪迯迩邇逆送退追逃迷") + (10 . "迹迴迺迸逅逝造速逐通逓途透連") + (11 . "逕逑這逡逍逞逖逗逋逢逎逸週進逮") + (12 . "逶逵逹運過遇遂達遅道遍遊遥") + (13 . "遏遐遑遒遉遁逼逾遖違遠遣") + (14 . "逧遡遞遙遘遜遭適") + (15 . "遨遮遯遺遵選遷遼") + (16 . "隨遲遶還避") + (17 . "邂遽邁邀") + (18 . "邃") + (19 . "邊") + (21 . "邉") + (23 . "邏")) + ("しんのたつ" + (7 . "辰") + (10 . "辱") + (13 . "農")) + ("しん" + (7 . "臣") + (8 . "臥") + (14 . "臧") + (18 . "臨")) + ("じゅうまた" + (4 . "支")) + ("じゅう" + (2 . "十") + (3 . "千") + (4 . "午升卅卆") + (5 . "卉半") + (6 . "卍") + (8 . "協卒卓") + (9 . "南卑単") + (12 . "博")) + ("すでのつくり" + (4 . "旡无") + (10 . "既")) + ("すん" + (3 . "寸") + (6 . "寺") + (7 . "寿対") + (9 . "専封") + (10 . "尅射将") + (11 . "專將尉") + (12 . "尋尊") + (14 . "對") + (15 . "導")) + ("せい" + (14 . "齊") + (17 . "齋") + (21 . "齎") + (23 . "齏")) + ("たかい" + (10 . "高") + (23 . "髞")) + ("たくみ" + (3 . "工") + (5 . "巨巧左") + (7 . "巫") + (10 . "差")) + ("たけ" + (6 . "竹") + (8 . "竺") + (9 . "竿笂") + (10 . "笈笏笑笊笆笋") + (11 . "笳笥笘笙第笞笛符笨笠笹笶笵") + (12 . "筈筐筋笄策筍筌筅筑等答筒筏筆筝") + (13 . "筺筵筥筴筧筮節筬筰筱") + (14 . "篏箇管箝箕箘箟箍箜箚算箋箒箏箔箙箆") + (15 . "篋篁箱箴箭箸篆篇篌箪範") + (16 . "築篝篩篦篥篭簑篤") + (17 . "簒簀篠簇篳篷篶簍簓簗簔") + (18 . "簡簣簧簪簟") + (19 . "簷簫簽簸簿簾籀") + (20 . "籍籌籃籏") + (21 . "籐籖籔") + (22 . "籘籟籠") + (23 . "籤籥") + (25 . "籬")) + ("たつ" + (5 . "立") + (7 . "竍") + (8 . "竏") + (9 . "竒竓竕") + (10 . "竚站竝竜") + (11 . "章竡竟") + (12 . "竢竣竦童") + (13 . "竪") + (14 . "竭端竰") + (20 . "競") + (22 . "竸")) + ("たに" + (7 . "谷") + (11 . "谺") + (17 . "豁谿")) + ("たま" + (4 . "王") + (5 . "玉") + (7 . "玖") + (8 . "玩") + (9 . "珂珈珊珍珎玻玲珀玳") + (10 . "珪珥珠珮班琉珞珱") + (11 . "球現理琅珸") + (12 . "琢琴琥琵琺琳琲琶") + (13 . "瑛瑕瑚瑟瑞瑁瑜瑶琿瑙") + (14 . "瑯瑤瑰瑣瑳瑪瑠") + (15 . "瑩瑾璋璃") + (16 . "璢璞") + (17 . "環") + (18 . "璧") + (19 . "璽瓊") + (20 . "瓏") + (21 . "瓔")) + ("た" + (5 . "甲申田由") + (7 . "甸男町甼") + (8 . "画畄") + (9 . "畋畏界畍畑畉畆畊") + (10 . "畛畜畔畝畚留畠") + (11 . "異畦畤畢略畧畩") + (12 . "畫畳番畭畴") + (13 . "畸畷當") + (15 . "畿") + (16 . "疂") + (19 . "疆疇") + (22 . "疊疉")) + ("だい" + (3 . "大") + (4 . "夬太天夫夭") + (5 . "央失夲") + (6 . "夷夸") + (7 . "夾") + (8 . "奄奇奈奉奔") + (9 . "奕奐奎契奏") + (10 . "奚奘套") + (12 . "奥奢奠") + (13 . "奧奨") + (14 . "奩奬奪") + (16 . "奮")) + ("ちいさい" + (3 . "小") + (4 . "少") + (5 . "尓") + (6 . "尖") + (8 . "尚") + (13 . "尠")) + ("ちから" + (2 . "力") + (5 . "加功") + (6 . "劣") + (7 . "劬劫助劭努励労") + (8 . "劵劾効劼") + (9 . "勁勅勃勇") + (10 . "勍勉") + (11 . "勘動勗務勒") + (12 . "勞勤勝募") + (13 . "勧勢勦勠勣") + (15 . "勲") + (16 . "勳") + (17 . "勵") + (20 . "勸")) + ("ちち" + (4 . "父") + (13 . "爺")) + ("ちょう" + (10 . "鬯") + (29 . "鬱")) + ("ち" + (6 . "血") + (9 . "衂") + (10 . "衄") + (12 . "衆")) + ("つき" + (4 . "月") + (6 . "有") + (8 . "服朋") + (9 . "朏") + (10 . "朔朕朗") + (11 . "朖望") + (12 . "期朞朝") + (18 . "朦") + (20 . "朧")) + ("つくえ" + (2 . "几") + (3 . "凡") + (5 . "処凧") + (6 . "凩凪") + (8 . "凭") + (11 . "凰") + (12 . "凱")) + ("つち" + (3 . "土") + (5 . "圧圦") + (6 . "圭在地圷圸") + (7 . "坎圻均坑坐址坏坂坊") + (8 . "坩坤垂坦坡坿坪垉尭") + (9 . "垈垣垓垠型垢城垤垪垰垳") + (10 . "埖埀埃埋埒埓埔埆") + (11 . "堊域基埼堀執埴堆堂培埠堋埣埜") + (12 . "堙堰堝堪堅場堕塚堤堵塔報堡塁塀堽堺堯") + (13 . "塋塊塙塒塑塞填塗塘墓塰塢塩") + (14 . "塲境塹塾墅塵増墨") + (15 . "墮墟墜墳墫墹墸") + (16 . "墺壊墾壌壇壁壅") + (17 . "墻壓壑壕壗") + (18 . "壘壙") + (19 . "壞壜壟") + (20 . "壤壥")) + ("つつみがまえ" + (2 . "勹") + (3 . "勺") + (4 . "勾勿匂匁") + (5 . "匆包") + (6 . "匈") + (9 . "匍") + (11 . "匏匐")) + ("つづみ" + (13 . "鼓") + (14 . "皷") + (18 . "鼕")) + ("つの" + (7 . "角") + (12 . "觚觜觝") + (13 . "解触") + (15 . "觧") + (18 . "觴") + (20 . "觸")) + ("つめ" + (4 . "爪") + (8 . "爭爬") + (9 . "爰") + (12 . "爲") + (17 . "爵")) + ("てつ" + (3 . "屮") + (4 . "屯")) + ("てん" + (1 . "丶") + (3 . "丸") + (4 . "丹") + (5 . "主丼")) + ("て" + (3 . "才") + (4 . "手扎") + (5 . "打払") + (6 . "扞扣扛扠扱托扨") + (7 . "扼技抉抗抒抄抓択投抖把抜批扶扮抃抔抑找折抂") + (8 . "承抻拂拔押拗拐拡拑拒拠拘招拙拓拆担抽抵拈拝拍拌披拊拇抱抛抹拉抬") + (9 . "拏拜按挌括拮挟拱挂拷拶指持拾拯拭拵挑挧") + (10 . "拿挙挈拳捍挾挨捐挫振挺捜挿捉捏捌挽捕捗") + (11 . "掖掩掛掎掬据掀掘掲捲控採捨授捷推捶接措掃探掏掉掟捺捻排捧捫掠\ +捩掫掵掴") + (12 . "掌掣插描握援掾揩換揮揆揣揉揃提揶揄揖揚揺揀") + (13 . "搜搭搖携搆搓搦搶摂掻損搗搨搏搬搾") + (14 . "搴摧摺摶摘摸摎") + (15 . "撃摯摩撮撰撒撞撤撓撚播撥撫撲撩撈撕撹") + (16 . "擇據擔撼擒擅操撻擁擂") + (17 . "擘擱擬擦擠擡擢擣擯") + (18 . "擧擴擾擲擺擽擶攅") + (19 . "攀") + (20 . "攘") + (21 . "攜攝") + (22 . "攤") + (23 . "攣攪攫") + (24 . "攬")) + ("とうがまえ" + (10 . "鬥") + (15 . "鬧") + (16 . "鬨") + (18 . "鬩") + (20 . "鬪") + (26 . "鬮")) + ("とびらのと" + (4 . "戸") + (7 . "戻") + (8 . "房所") + (9 . "扁") + (10 . "扇") + (11 . "扈") + (12 . "扉")) + ("とぶ" + (9 . "飛") + (21 . "飜")) + ("とます" + (4 . "斗") + (10 . "料") + (11 . "斛斜") + (13 . "斟") + (14 . "斡")) + ("とまた" + (4 . "攴攵") + (6 . "收攷") + (7 . "改攻孜攸") + (8 . "放") + (9 . "故政") + (10 . "效敏") + (11 . "赦敕敍敘救教敖敗") + (12 . "敢敬散敞敦敝") + (13 . "数") + (14 . "敲") + (15 . "數敵敷") + (16 . "整") + (17 . "斂") + (18 . "斃") + (22 . "變")) + ("とめる" + (4 . "止") + (5 . "正此") + (8 . "武歩") + (9 . "歪") + (12 . "歯") + (13 . "歳") + (14 . "歴") + (18 . "歸")) + ("とらがしら" + (6 . "虍") + (8 . "虎") + (9 . "虐") + (10 . "虔") + (11 . "處虚") + (13 . "號虞虜") + (17 . "虧")) + ("とり" + (9 . "鳬") + (11 . "鳥") + (13 . "鳫鳩鳧鳰") + (14 . "鳶鳳鳴") + (15 . "鴈鴉鴃鴆鴇") + (16 . "鴛鴨鴟鴕鴫鴒鴣鴪鴦鴬鴎鶯") + (17 . "鵄鴻鵁鴿鴾鵆鵈") + (18 . "鵝鵞鵑鵠鵜鵐鵡鵤鵙") + (19 . "鶏鵲鶉鶇鵯鵬鵺") + (20 . "鶚鶤鶩鶫") + (21 . "鷄鶴鷁鶻鶸鶺鶲鷂鷆鷏") + (22 . "鷙鷓") + (23 . "鷸鷲鷦鷭鷯鷺") + (24 . "鷽鷹") + (28 . "鸚") + (29 . "鸛") + (30 . "鸞")) + ("なかれ" + (4 . "毋") + (5 . "母") + (6 . "毎") + (8 . "毒") + (14 . "毓")) + ("ながい" + (8 . "長")) + ("なべふた" + (2 . "亠") + (3 . "亡") + (4 . "亢") + (6 . "亦亥交") + (7 . "亨") + (8 . "享京") + (9 . "亰亭亮") + (10 . "亳") + (13 . "亶")) + ("なめしがわ" + (9 . "韋") + (17 . "韓") + (19 . "韜")) + ("においこう" + (9 . "香") + (18 . "馥") + (20 . "馨")) + ("にく" + (6 . "肉肌肋") + (7 . "肝肛肓肖肘肚") + (8 . "冐育肯肩股肴肱肢肥肪肬肭") + (9 . "胃胤胡胛胥胙胎胆胝胄背肺胚胖胞脉") + (10 . "胸脅脇胯脂脆脊胴能脈胱") + (11 . "脣脚脛脩脱脳脯") + (12 . "腋腔腎脹腆脾腓腑胼腕") + (13 . "腦腱腫腥腸腹腴腰腺腟腮") + (14 . "腐膃膈膏腿膊膀膜膂") + (15 . "膓膠膝膣膚膕膤") + (16 . "膩膳膰膨膵") + (17 . "膽臆膾臀膿臂膺臉膸臈") + (18 . "臍臑") + (19 . "臓臘") + (20 . "臙臚") + (22 . "臟") + (25 . "臠")) + ("にし" + (6 . "襾西") + (9 . "要") + (12 . "覃") + (18 . "覆") + (19 . "覈覇") + (25 . "覊")) + ("にじゅうあし" + (3 . "廾") + (4 . "廿") + (5 . "弁") + (7 . "弄弃") + (10 . "弉") + (15 . "弊")) + ("にすい" + (2 . "冫") + (5 . "冬") + (6 . "冱冰决冲") + (7 . "冴冶冷况") + (8 . "冽") + (10 . "凅准凄凋凍凉") + (11 . "凌") + (12 . "凖") + (15 . "凛") + (16 . "凝")) + ("にち" + (4 . "日") + (5 . "旦旧") + (6 . "旭旨旬早") + (7 . "旱") + (8 . "易旺昊昆昏昇昌昔昃明旻") + (9 . "昂映昨昵春昭是星昶昧昴昜昿") + (10 . "晏晃晄時晋晉晁晒") + (11 . "晝晦晞晤晧晨晟晢") + (12 . "暁景暑晶晴晰智晩普暃") + (13 . "暎暘暗暈暇暉暄暖") + (14 . "暢暮暝暦") + (15 . "暫暴") + (16 . "曉曁暹暾曇曄暼暸") + (17 . "曖") + (18 . "曙曚曜") + (19 . "曠曝") + (20 . "曦") + (21 . "曩")) + ("にら" + (9 . "韭") + (13 . "韮") + (19 . "韲")) + ("に" + (2 . "二") + (3 . "于") + (4 . "云五互井") + (6 . "亙亘") + (7 . "亜些") + (8 . "亞") + (9 . "亟")) + ("ねずみ" + (8 . "鼡") + (13 . "鼠") + (18 . "鼬")) + ("のぎ" + (5 . "禾") + (7 . "私秀禿") + (8 . "秉") + (9 . "科秋秕秒") + (10 . "秘秧秬称秤秦租秩秣秡") + (11 . "移") + (12 . "稈稀税稍程") + (13 . "稔稚稠稗稜稟稘稙") + (14 . "稱穀種稲") + (15 . "稻稼稽稿稾稷穂穃") + (16 . "穐穎穏積穆") + (17 . "穉穗") + (18 . "穢穫穣穡") + (19 . "穩") + (21 . "龝") + (22 . "穰")) + ("のごめ" + (7 . "釆") + (8 . "采") + (11 . "釈") + (12 . "釉") + (20 . "釋")) + ("の" + (1 . "丿") + (2 . "乂乃") + (3 . "久") + (4 . "之") + (5 . "乎乍乏") + (7 . "乕") + (8 . "乖") + (9 . "乗") + (10 . "乘")) + ("はこがまえ" + (2 . "匚") + (6 . "匡匠") + (7 . "匣") + (10 . "匪") + (13 . "匯") + (14 . "匱") + (15 . "匳")) + ("はしる" + (5 . "赱") + (7 . "走") + (9 . "赴") + (10 . "起赳") + (12 . "越超趁") + (14 . "趙") + (15 . "趣") + (17 . "趨")) + ("はち" + (2 . "八") + (4 . "兮公六") + (6 . "共") + (7 . "兵") + (8 . "其具典") + (10 . "兼") + (16 . "冀")) + ("はつがしら" + (5 . "癶") + (9 . "癸発") + (12 . "發登")) + ("はな" + (14 . "鼻") + (17 . "鼾")) + ("はねぼう" + (1 . "亅") + (2 . "了") + (4 . "予") + (6 . "争") + (7 . "亊") + (8 . "事")) + ("はね" + (6 . "羽") + (10 . "翁翅翆") + (11 . "習翌翊") + (12 . "翕翔") + (14 . "翠翡") + (15 . "翫翦翩") + (16 . "翰") + (17 . "翳翼") + (18 . "翹翻") + (20 . "耀")) + ("はば" + (3 . "巾") + (5 . "匝市布") + (6 . "帆") + (7 . "希帋") + (8 . "帖帚帙帑帛") + (9 . "帥帝") + (10 . "師席帯帰") + (11 . "帶帷常帳") + (12 . "幄幃幀幅帽幇") + (13 . "幌幕幎") + (14 . "幗幔") + (15 . "幟幢幡幣幤")) + ("は" + (15 . "齒") + (17 . "齔齢") + (20 . "齣齟齠齡") + (21 . "齦齧") + (22 . "齪齬") + (24 . "齷齲齶")) + ("ひき" + (5 . "疋") + (11 . "疏") + (12 . "疎") + (14 . "疑")) + ("ひつじ" + (6 . "羊") + (8 . "羌") + (9 . "美") + (10 . "羔") + (11 . "羞羝羚") + (13 . "義群羣羨") + (15 . "羯羮") + (16 . "羲") + (19 . "羹羶羸") + (20 . "譱")) + ("ひとあし" + (2 . "儿") + (3 . "兀") + (4 . "允元") + (5 . "兄") + (6 . "兇光充先兆") + (7 . "克児兌兎") + (8 . "兒兔免") + (10 . "党") + (11 . "兜") + (14 . "兢")) + ("ひと" + (2 . "人") + (4 . "介仇今什仍仁仄仆仏仂从") + (5 . "以仕仔仗仞仭仙仟他代付令") + (6 . "伊仮会价企伎休仰件伍伉仲伝任伐伏伜") + (7 . "佛位佚何伽估佝佐作伺似住伸佗但佇体低佃伯伴佑余伶佞") + (8 . "依価佳侃佶供佼使侈侍侏侘佻佩佰侮併侑佯來例侖侠儘侭") + (9 . "俄係俔侯俟俊俎信侵促俗俘便俛保俑俚俐侶俤俥俣") + (10 . "倚倭俺倨倶倔倪倹倦個候倖倥倅借俶倡倩倬値倒俳倍俾俵俯倣俸們倆\ +倫倉修") + (11 . "假做偃偕偐偽偶偈健偲偖偬側偸停偵偏偉") + (12 . "傀傚傘備傅傍傑償") + (13 . "傳傴僅傾傲債催傷僉僊僧傭僂働") + (14 . "僞僖僑僥僭僣像僮僕僚") + (15 . "價儉億儀僵儁儂僻") + (16 . "儒儕儔儚儖") + (17 . "優儡") + (18 . "儲") + (21 . "儺儷") + (22 . "儼儻")) + ("ひのかわら" + (5 . "皮") + (10 . "皰") + (12 . "皴") + (14 . "皸皹") + (15 . "皺")) + ("ひらび" + (4 . "曰") + (6 . "曳曲") + (7 . "曵更") + (9 . "曷") + (10 . "書") + (11 . "曼曹曽") + (12 . "最曾替") + (13 . "會")) + ("ひ" + (4 . "火") + (6 . "灰灯") + (7 . "灸災灼") + (8 . "炎炙炊炒炉") + (9 . "炯炬炸炭炳炮為点熨") + (10 . "烏烝烈烙烋烟") + (11 . "烱焉烹烽") + (12 . "焔焜煮焼焦然無焚焙") + (13 . "煙煥煕煦煢煌照煎煖煤煬煉煩") + (14 . "熈熏煽熄熊熕熔") + (15 . "熬熟熱") + (16 . "燈燒燕熹熾燉燃燔燎燐燗") + (17 . "燮營燠燬燦燭燧燥燵") + (18 . "燻燼燹燿") + (19 . "爆爍") + (20 . "爐") + (21 . "爛") + (29 . "爨")) + ("ふいにょう" + (3 . "夊") + (10 . "夏") + (14 . "夐")) + ("ふしづくり" + (2 . "卩") + (5 . "卮卯夘") + (6 . "印危") + (7 . "却即卵") + (8 . "卷") + (9 . "卻卸") + (10 . "卿")) + ("ふつ" + (12 . "黹") + (17 . "黻") + (19 . "黼")) + ("ふでづくり" + (6 . "聿") + (11 . "粛") + (13 . "肅肄肆") + (14 . "肇")) + ("ふね" + (6 . "舟") + (10 . "航般舫舩舮") + (11 . "舵舸舷船舳舶") + (13 . "艇艀") + (16 . "艙艘") + (17 . "艚艝") + (18 . "艟") + (19 . "艢艤") + (20 . "艨") + (21 . "艦艪") + (22 . "艫")) + ("ふゆがしら" + (3 . "夂") + (9 . "変")) + ("ふるとり" + (8 . "隹") + (10 . "隻隼") + (11 . "雀寉") + (12 . "雁雇集雄") + (13 . "雅雌雎雋雉雍") + (14 . "雑") + (16 . "雕") + (17 . "雖") + (18 . "雙雜雛難") + (19 . "離")) + ("ぶん" + (4 . "文") + (7 . "斈") + (8 . "斉") + (11 . "斎") + (12 . "斑斐斌")) + ("べん" + (13 . "黽") + (24 . "鼇") + (25 . "鼈")) + ("ほう" + (4 . "方") + (8 . "於") + (9 . "施") + (10 . "旃旆旁旄旅") + (11 . "旌族旋") + (12 . "旒") + (14 . "旗") + (16 . "旙") + (18 . "旛")) + ("ほす" + (3 . "干") + (5 . "平") + (6 . "幵年并") + (8 . "幸") + (13 . "幹")) + ("ほとぎ" + (6 . "缶") + (9 . "缸") + (10 . "缺") + (17 . "罅") + (20 . "罌") + (21 . "罍") + (22 . "罎") + (24 . "罐")) + ("ほね" + (10 . "骨") + (13 . "骭") + (14 . "骰") + (16 . "骸骼") + (18 . "髀") + (19 . "髄") + (21 . "髏") + (23 . "體髓髑")) + ("ぼう" + (3 . "个") + (4 . "中") + (5 . "丱") + (7 . "串")) + ("ぼくのと" + (2 . "卜") + (4 . "卞") + (5 . "占") + (8 . "卦") + (9 . "貞")) + ("まがりがわ" + (3 . "巛川") + (6 . "州巡") + (11 . "巣")) + ("まげあし" + (3 . "尢") + (4 . "尤") + (7 . "尨") + (12 . "就")) + ("ます" + (6 . "舛") + (12 . "舜") + (15 . "舞")) + ("また" + (2 . "又") + (3 . "叉") + (4 . "及双反友") + (5 . "収") + (8 . "取受叔") + (9 . "叙叛") + (10 . "叟") + (16 . "叡") + (18 . "叢")) + ("まだれ" + (3 . "广") + (5 . "広庁庄") + (7 . "序床庇") + (8 . "庚底店府庖") + (9 . "度庠") + (10 . "庫座庭") + (11 . "庵康庸庶") + (12 . "廁廂廃廊") + (13 . "廈廉") + (14 . "廓廏廐廖") + (15 . "廣廢廝廠廚廛廟廡") + (16 . "廨廩") + (19 . "廬") + (20 . "廰") + (21 . "廱") + (25 . "廳")) + ("まめ" + (7 . "豆") + (10 . "豈") + (13 . "豊") + (15 . "豌豎") + (18 . "豐")) + ("みずから" + (6 . "自") + (9 . "臭")) + ("みず" + (4 . "水") + (5 . "永氷汁汀氾") + (6 . "汚汗江汕汝汐池汎汢") + (7 . "求汞汪汽沂汲決沍沙沚沁汰沢沖沈沌沛汾汨汳沐没沒沃") + (8 . "沓泳泄沿泱泓河泣況沽泗泅沮沼沱治注泥沾波泊泛泌泯沸法泡泙沫油沺泪泝") + (9 . "泉洟洩海活洶洫洪洽洸洙洲洵洋浄津洒浅洗染洞派洛洌洳") + (10 . "泰浤浣涓浩浚消浹浸浙涎涕涅浜浮浦浴浬流涙浪涌涛涜") + (11 . "淨淺淫液淵渕渊淹涯渇涵淇渓涸淆混淬渋淑淳渉淞深清済淒淅淙淡添\ +淀淘淤涼淪淋淮淌淕淦") + (12 . "湶渚渥渭湮温渦渙渠減湖港渾渣滋湿湘湫渫湊測湛湍渟渡湯渺湎渤満\ +渝游湧湾渮湃湟湲溂溌") + (13 . "溪溢滑漢源溝溘滉溷滓準溽溯滄溲滞溺滔漠溥滂溟滅溶溜滝溏") + (14 . "滿滯演漑滬滸滾漬漆滲漸漕漱漲滴滌漂漫漾漣漁漏漉滷潅漓") + (15 . "滕潁漿澁澀澑潰澗澆潔潺潸潤潯潟潜潛潭澄澂潮潼潘澎潦潴") + (16 . "澤澣濂澳激澡濁澹澱濃濆澪") + (17 . "濱濟濕濠濡濬濯濤濘濮濛濔濶") + (18 . "瀁瀉瀋濺瀑濫瀏濾") + (19 . "瀞瀧濳瀛瀚瀦瀕瀬瀝瀘") + (20 . "瀟瀰瀾瀲") + (21 . "灌") + (22 . "灑灘") + (25 . "灣")) + ("みみ" + (6 . "耳") + (9 . "耶耻") + (10 . "耿耽") + (11 . "聊聆") + (12 . "聒") + (13 . "聖聘") + (14 . "聟聚聡聞聢") + (15 . "聨") + (17 . "聰聳聲聴聯") + (18 . "聶職") + (20 . "聹") + (22 . "聽聾")) + ("みる" + (7 . "見") + (11 . "規視覓") + (12 . "覚覗覘") + (14 . "覡") + (16 . "覩親覦") + (17 . "覬覯覧") + (18 . "観覲") + (20 . "覺") + (21 . "覽") + (22 . "覿") + (25 . "觀")) + ("み" + (7 . "身") + (10 . "躬") + (11 . "躯") + (12 . "躰") + (13 . "躱") + (16 . "躾") + (19 . "軅") + (20 . "軆") + (24 . "軈")) + ("むぎ" + (7 . "麦") + (11 . "麥麸") + (15 . "麩麪") + (16 . "麭") + (19 . "麹") + (20 . "麺")) + ("むし" + (6 . "虫") + (8 . "虱") + (9 . "虹虻") + (10 . "蚓蚩蚤蚕蚊蚌蚣蚪蚋") + (11 . "蚶蛍蛆蛇蛋蚰蚫蚯蛄蛉蛎") + (12 . "蛙蛔蛞蛩蛬蛟蛤蛭蛛蛮蛯") + (13 . "蜒蛾蜆蜈蛸蜀蜃蛻蜑蜉蜂蛹蜊蜍") + (14 . "蜿蜷蜻蜥蜘蜩蜚蜜蜴蝋") + (15 . "蝟蝦蝸蝌蝎蝴蝗蝨蝕蝶蝮蝙蝓蝠蝣蝪蝉蝿") + (16 . "螢螟螂融") + (17 . "螯蟋螽螫蟄螳螺螻蟀蟆蟇蟐") + (18 . "蟲蟯蟠蟒") + (19 . "蟷蠎蟹蠏蠍蟻蟾蟶蠅") + (20 . "蠑蠖蠕") + (21 . "蠢蠣蠡") + (23 . "蠱蠧") + (24 . "蠶蠹") + (25 . "蠻")) + ("むじな" + (7 . "豸") + (10 . "豺豹") + (11 . "豼") + (12 . "貂") + (13 . "貉貅貊") + (14 . "貍貌") + (15 . "貎") + (17 . "貔") + (18 . "貘")) + ("むのほこ" + (5 . "矛") + (9 . "矜")) + ("むら" + (7 . "邑邨那邦") + (8 . "邯邱邵邸邪") + (9 . "郁郊郎") + (10 . "郢郡郤郛") + (11 . "郭郷都部郵") + (12 . "鄂") + (13 . "鄒") + (14 . "鄙") + (15 . "鄭鄲鄰")) + ("む" + (2 . "厶") + (5 . "去") + (8 . "参") + (11 . "參")) + ("めめ" + (4 . "爻") + (9 . "爼") + (11 . "爽") + (14 . "爾")) + ("めん" + (9 . "面") + (14 . "靤") + (16 . "靦") + (23 . "靨")) + ("め" + (5 . "目") + (8 . "直盲") + (9 . "看盻盾相省眈眉眇眄県") + (10 . "眩真眞眥眦眛眠眤") + (11 . "眼眷眺眸") + (12 . "着睇") + (13 . "睚睨睫睡睛督睥睦") + (14 . "睿睾睹") + (15 . "瞎瞋瞑") + (16 . "瞠瞞") + (17 . "瞰瞳瞥瞭瞶瞹") + (18 . "瞿瞼瞽瞬瞻") + (19 . "矇") + (20 . "矍") + (24 . "矗") + (26 . "矚")) + ("もちいる" + (5 . "用") + (7 . "甫甬")) + ("もん" + (8 . "門") + (9 . "閂") + (10 . "閃") + (11 . "閉閇閊") + (12 . "開間閑閏閔閖") + (13 . "閘閠閙") + (14 . "閣関閨閤閧閥") + (15 . "閲閭") + (16 . "閼閻閹閾") + (17 . "闇闊闃闍闌") + (18 . "闕闔闖闘") + (19 . "關") + (20 . "闡") + (21 . "闥闢")) + ("やく" + (17 . "龠")) + ("やまいだれ" + (7 . "疔") + (8 . "疚疝") + (9 . "疫疥疣") + (10 . "痂疳痃疵疾疽症疹疸疼疲病疱") + (11 . "痍痕痔痊痒") + (12 . "痙痣痛痘痞痢") + (13 . "痾痿痼瘁痰痴痲痳痺") + (14 . "瘋瘍瘉") + (15 . "瘟瘧瘠瘡痩瘢瘤") + (16 . "瘴瘰瘻") + (17 . "癇癌癈療癆") + (18 . "癜癖癒癘") + (19 . "癡") + (20 . "癢") + (21 . "癨癩癪癧") + (22 . "癬") + (23 . "癰") + (24 . "癲")) + ("やま" + (3 . "山") + (4 . "乢") + (5 . "屶") + (6 . "屹") + (7 . "岐岌岑妛岔") + (8 . "岳岸岡岬岫岨岱岷岻岾峅岼岶岩") + (9 . "峡峙峠峇") + (10 . "峽峨峩峻峭島峰峯峪峺") + (11 . "崗崋崖崕崎崟崛崑崔崇崢崩崘崙崚") + (12 . "嵋嵜嵌嵎嵐嵒嵩") + (13 . "嵬嵯嵳嵶") + (14 . "嶌嶋嶇嶄嶂") + (15 . "嶐嶢嶝") + (16 . "嶮嶬") + (17 . "嶽嶷嶼嶺") + (20 . "巌巉") + (21 . "巍") + (22 . "巓巒") + (23 . "巖")) + ("や" + (5 . "矢") + (7 . "矣") + (9 . "矧") + (10 . "矩") + (12 . "短") + (13 . "矮") + (17 . "矯")) + ("ゆうべ" + (3 . "夕") + (5 . "外") + (6 . "夙多夛") + (8 . "夜") + (11 . "梦") + (13 . "夢") + (14 . "夥")) + ("ゆみ" + (3 . "弓") + (4 . "引弔弖") + (5 . "弘弗") + (6 . "弛") + (7 . "弟") + (8 . "弦弩弥") + (9 . "弧弭弯") + (10 . "弱") + (11 . "強張弸") + (12 . "弾弼") + (13 . "彁") + (15 . "彈") + (16 . "彊") + (17 . "彌") + (22 . "彎")) + ("らいすき" + (6 . "耒") + (10 . "耘耕耙耗") + (11 . "耜") + (13 . "耡") + (16 . "耨")) + ("りゅう" + (16 . "龍") + (22 . "龕")) + ("るまた" + (4 . "殳") + (8 . "殴") + (9 . "段") + (10 . "殷殺") + (11 . "殻") + (12 . "殼") + (13 . "毀殿") + (15 . "毆毅")) + ("れいづくり" + (8 . "隶") + (16 . "隷") + (17 . "隸")) + ("ろ" + (11 . "鹵") + (20 . "鹹") + (24 . "鹽鹸")) + ("わかんむり" + (2 . "冖") + (4 . "冗") + (5 . "写") + (9 . "冠") + (10 . "冤冢冥冦") + (11 . "冨") + (14 . "冩") + (16 . "冪")) + )) + +(defvar kakusuu-table + '[0 ; ignore + "一丶丿乙亅" ; 1 + "七丁乂乃九了二亠人儿入八冂冖冫几凵刀力勹匕匚匸十卜卩厂厶又" ; 2 + "下三上丈万与个丸久乞也于亡兀凡刃刄勺千叉口囗土士夂夊夕大女孑\ +子宀寸小尢尸屮山巛川工已己巳巾干幺广廴廾弋弓彑彡彳才" ; 3 + "丐丑不中丹之予云五互井亢介仇今什仍仁仄仆仏仂从允元兮公六内円\ +冗凶刈切分勾勿匂匁化区匹午升卅卆卞厄及双反友壬夬太天夫夭孔少\ +尤尹尺屯乢巴幻廿弌引弔弖心戈戸手扎支攴攵文斗斤方旡无日曰月木\ +欠止歹殳毋比毛氏气水火爪父爻爿片牙牛犬王" ; 4 + "丘且世丗丕丙丱主丼乎乍乏以仕仔仗仞仭仙仟他代付令兄冊册冉囘写\ +冬処凧凹出凸刊刋加功匆包北卉半占卮卯夘去収叶叩可句古号司史只\ +叱召台叮叨右叺叭囚四圧圦外央失夲奴孕它尓尻尼屶巨巧左匝市布平\ +幼広庁庄弁弍弘弗必戉戊打払斥旦旧札朮本末未正此母民永氷汁汀氾\ +犯玄玉瓦甘生用甲申田由疋癶白皮皿目矛矢石示礼禾穴立赱辷辺込" ; 5 + "丞両争亙亘亦亥交伊仮会价企伎休仰件伍伉仲伝任伐伏伜兇光充先兆\ +全共再冱冰决冲凩凪刑刎列刔劣匈匡匠卍印危吉吃叫吁向后合吊吐吋\ +同名吏各因回団圭在地圷圸壮夙多夛夷夸如奸好妁妃妄字存安宇守宅\ +寺尖尽屹州巡帆幵年并式弐弛当忖忙戍戎戌成扞扣扛扠扱托扨收攷旭\ +旨旬早曳曲有机朽朿朱朶朴朸杁朷次死毎気汚汗江汕汝汐池汎汢灰灯\ +牝牟犲瓜百竹米糸缶网羊羽考老而耒耳聿肉肌肋自至臼舌舛舟艮色艸\ +艾芋虍虫血行衣襾西辻迅阡" ; 6 + "串乕乱亊亜些亨佛位佚何伽估佝佐作伺似住伸佗但佇体低佃伯伴佑余\ +伶佞克児兌兎兵冏冴冶冷况刪初判別利刧劬劫助劭努励労匣医却即卵\ +吸吽呀含听吟君呉吾吭吼告吹吮呈吶呑吠否吻吩呆呂吝呎囲囮困図坎\ +圻均坑坐址坏坂坊壯壱声売夾妓妝妥妊妣妨妙妖妍孝孚孛完宏宋宍寿\ +対尨局尿屁尾岐岌岑妛岔巫巵希帋序床庇廷弄弃弟形役彷応忌志忍忘\ +快忻忤忸忱忰我戒戻扼技抉抗抒抄抓択投抖把抜批扶扮抃抔抑找折抂\ +改攻孜攸斈旱曵更来杆杏杞材杉条杖束村杜杓杙李杣杢杤杠求汞汪汽\ +沂汲決沍沙沚沁汰沢沖沈沌沛汾汨汳沐没沒沃灸災灼牡牢状狂狃狆狄\ +犹玖瓧甫甬甸男町甼疔皀皃矣社私秀禿究竍系糺罕肝肛肓肖肘肚臣良\ +芍芒花芸芝芙芳見角言谷豆豕豸貝赤走足身車辛辰迂迄辿近迎返邑邨\ +那邦酉釆里阯阪阨阮防麦" ; 7 + "並乖乳事亞享京依価佳侃佶供佼使侈侍侏侘佻佩佰侮併侑佯來例侖侠\ +儘侭兒兔免兩其具典冽凭函刮券刳刻刷刺制刹到劵劾効劼協卒卓卦卷\ +参取受叔咏呵咎呟呼呱呷咋呰呪咒周呻咀知呶咄咆味命和咐固国囹坩\ +坤垂坦坡坿坪垉尭夜奄奇奈奉奔侫委姑妻始姉妾姓姐妲妬姆妹学孥孟\ +孤季宛官宜実宗宙定宕宝尚届屆居屈岳岸岡岬岫岨岱岷岻岾峅岼岶岩\ +帖帚帙帑帛幸庚底店府庖延廸弦弩弥彿往徃径征徂彼忽忠忝念忿怐怡\ +怪怯怙性怛怕怖怫怦怏怜怺怩或戔房所承抻拂拔押拗拐拡拑拒拠拘招\ +拙拓拆担抽抵拈拝拍拌披拊拇抱抛抹拉抬放斉斧於易旺昊昆昏昇昌昔\ +昃明旻服朋杲杳枉果杭枝杵松枩枢析杼枕東杯板枇杪枌枋枚林枡枠杰枅\ +枦杷欧欣武歩歿殀殴毒毟氓氛沓泳泄沿泱泓河泣況沽泗泅沮沼沱治注\ +泥沾波泊泛泌泯沸法泡泙沫油沺泪泝炎炙炊炒炉爭爬牀版牧物狐狎狗\ +狙狛狒玩瓩画畄疚疝的盂直盲矼祀祁祈祉秉穹空突竏竺籵罔羌者冐\ +育肯肩股肴肱肢肥肪肬肭臥舎舍苅芥芹芫芟芯芭芬芦若英苑芽苦茎苗\ +茉茂虎虱衫表軋迚述迭迫邯邱邵邸邪采金長門阜陂阿阻陀附隶隹雨青\ +非鼡" ; 8 + "乗亟亰亭亮俄係俔侯俟俊俎信侵促俗俘便俛保俑俚俐侶俤俥俣兪冑冒\ +冠凾剏剄剋削前則剃剌勁勅勃勇匍南卑単貞卻卸厚厖厘叙叛哀哇咽咳\ +咢咸咥咬哄哈哉咨咫咲哂咤品咼咾哘咯圀囿垈垣垓垠型垢城垤垪垰垳\ +変奕奐奎契奏姙娃威姨姻姦姜姿姪姥姚姶孩客宦室宣宥専封屋屍屎屏\ +昼峡峙峠峇巻巷帥帝幽度庠廻建廼弧弭弯彖彦後很徇待律徊怨急思怎\ +怠怒怱恊恠悔恢恪恟恒恆恰恍恨恃恤恂恬恫扁拏拜按挌括拮挟拱挂拷\ +拶指持拾拯拭拵挑挧故政斫施昂映昨昵春昭是星昶昧昴昜昿曷朏柆栄\ +架枷柯柑柬枳柩枸枯査柴柵柞柿柘柊柁柝柱柢柔某柏柎柄枹柚柳栂栃\ +柾柤柧柮枴歪殆殄殃段毘泉洟洩海活洶洫洪洽洸洙洲洵洋浄津洒浅洗\ +染洞派洛洌洳炯炬炸炭炳炮為点熨爰爼牲牴狠狭狡狩独狢珂珈珊珍珎\ +玻玲珀玳瓮瓲瓱瓰甚畋畏界畍畑畉畆畊疫疥疣癸発皈皆皇盃盈盆看盻\ +盾相省眈眉眇眄県矜矧研砂砕砌砒祇祝神祖祐禹禺科秋秕秒穽窃穿竒\ +竓竕竿笂粁粂籾紆紀級糾紅紂約缸罘美耐耶耻胃胤胡胛胥胙胎胆胝胄\ +背肺胚胖胞脉臭臾舁苛茄苣苟苫苒苴苔苧苳范苻苹苞茅茆苜苓苙苡苺\ +荒茜草荘茶虐虹虻衂衍衿衵衽衷衲袂要計訂訃負赴軌軍迦迥迢迪迯迩\ +邇逆送退追逃迷郁郊郎酋酊重閂限陌陋陏面革韋韭音頁風飛食首香鳬" ; 9 + "乘亳倚倭俺倨倶倔倪倹倦個候倖倥倅借俶倡倩倬値倒俳倍俾俵俯倣俸\ +們倆倫倉修党兼冓冤冢冥冦凅准凄凋凍凉剞剣剛剤剔剥剖勍勉匪匿卿\ +原叟唔員哥唏哽哮哭唆哨唇哲唐唄哺哩哢哦唖圄圃埖埀埃埋埒埓埔埆\ +夏奚奘套娚娥姫娟娯娑娘娠娜娉娩孫宴家害宮宰宵宸容尅射将屐屑展\ +屓峽峨峩峻峭島峰峯峪峺差師席帯帰庫座庭弉弱徑従徐徒恚恁恩恐恭\ +恵恣恕息恥恙恋恷悧悦悁悍悟悃悚悄悛悌悩悖悒悋悗扇拿挙挈拳捍挾\ +挨捐挫振挺捜挿捉捏捌挽捕捗效敏料旃旆旁旄旅既晏晃晄時晋晉晁晒\ +書朔朕朗栢案桜格核桓栞桔框栩桂桀校桁栲根栽桟桎株栓栴桑桃桐梅\ +栗栫桍桙栖桧档残殊殉殷殺氣氤泰浤浣涓浩浚消浹浸浙涎涕涅浜浮浦\ +浴浬流涙浪涌涛涜烏烝烈烙烋烟特狹狷狸狼狽珪珥珠珮班琉珞珱畛畜\ +畔畝畚留畠痂疳痃疵疾疽症疹疸疼疲病疱皋皰益盍眩真眞眥眦眛眠眤\ +矩砦砥砠砧破砲砺砿祠祗祟祚祕祓祢祥秘秧秬称秤秦租秩秣秡窈竚站\ +竝竜笈笏笑笊笆笋粃粋粉粍粐紜紘紗索紙純素紐納紕紊紛紡紋缺罟罠\ +羔翁翅翆耆耄耘耕耙耗耿耽胸脅脇胯脂脆脊胴能脈胱致舐航般舫舩舮\ +芻茵茴荊茨茲茱荀茹茸荏荐荅茯茫茗茘茖荷華莉虔蚓蚩蚤蚕蚊蚌蚣蚪\ +蚋衄袁衾袞衰袖袗袒袙袢被袍記訖訓訐訌訊託討豈豺豹貢財起赳躬軒\ +辱迹迴迺迸逅逝造速逐通逓途透連郢郡郤郛酌酒酎配釖針釘釜釡釛釟\ +閃院陥降除陞陣陝陟陛陜陦隻隼飢馬骨高髟鬥鬯鬲鬼" ; 10 + "乾亀假做偃偕偐偽偶偈健偲偖偬側偸停偵偏偉兜冕冨凌凰剱剰剩剪副\ +勘動勗務勒匏匐匙區厠參啀啓售商唱啜唾啅啄啖啗唸問唯唳唹啌啝啣\ +國圉圈堊域基埼堀執埴堆堂培埠堋埣埜壷梦婀婉婚娵娶娼婆婢婦婁婪\ +婬孰寃寅寄寂宿密寇專將尉崗崋崖崕崎崟崛崑崔崇崢崩崘崙崚巣帶帷\ +常帳庵康庸庶強張弸彗彩彫彪彬徠從徙得徘悪患悉悠惟悸惓惚惨情悴\ +悽惜惆悵悼惇惘惧戛戚戝扈掖掩掛掎掬据掀掘掲捲控採捨授捷推捶接\ +措掃探掏掉掟捺捻排捧捫掠捩掫掵掴赦敕敍敘救教敖敗斎斛斜斬断旌\ +族旋晝晦晞晤晧晨晟晢曼曹曽朖望桿條桝梳械桷梟梧梗梏梱梭梓梔梢\ +梛梯梃桶梶桴梵梨梠梁梺桾梍梼梹欸欷欲殍殻毬毫淨淺淫液淵渕渊淹\ +涯渇涵淇渓涸淆混淬渋淑淳渉淞深清済淒淅淙淡添淀淘淤涼淪淋淮淌\ +淕淦烱焉烹烽爽牾牽犁倏猗猊猜猖猝猪猛猟率球現理琅珸瓠瓷瓶瓸甜\ +産異畦畤畢略畧畩疏痍痕痔痊痒皐皎盗盒盛盖眼眷眺眸硅祭票祷移窄\ +窓窒窕章竡竟笳笥笘笙第笞笛符笨笠笹笶笵粗粘粕粒経絅絃紺細紮紫\ +終紹紳紲組紿紬紵絆累絋袴羞羝羚習翌翊耜聊聆粛脣脚脛脩脱脳脯舂\ +舵舸舷船舳舶莅莖莊莚莪莞莟莢莎荵荻荼莫莓莠莨莇茣莽莵荳菓菊菌\ +菜著菩萌處虚蚶蛍蛆蛇蛋蚰蚫蚯蛄蛉蛎衒術袈袋袤袮袰袵袿袷袱裃裄\ +裳規視覓設訛訝許訣訟訥訪訳谺豚豼貨貫責貪販貧貮貭跂趾趺躯軛転\ +軟軣逕逑這逡逍逞逖逗逋逢逎逸週進逮郭郷都部郵酔酖酘釈野釼釦釵\ +釧釣釶閉閇閊陷陰険陲陬陳陶陪陸隆陵雀寉雪雫頃頂馗魚鳥鹵鹿麥麸\ +麻黄黒" ; 11 + "傀傚傘備傅傍傑償凖凱剴割創剳勞勤勝募博厥厦厩厨喝営喙喀喚喊喜\ +喟喫喬喧喉啻啾善喘喪喞單喋啼喃喩喇喰喨圍圏堙堰堝堪堅場堕塚堤\ +堵塔報堡塁塀堽堺堯壹壺壻奥奢奠媛婿媒媚孱寒寓寔寐富尋尊就属屠\ +屡嵋嵜嵌嵎嵐嵒嵩巽幄幃幀幅帽幇幾廁廂廃廊弑弾弼彭御徨循復悳惠\ +惣悲悶惑惱愕慌惶愀惴惺惻惰愎愉愃愡戞戟扉掌掣插描握援掾揩換揮\ +揆揣揉揃提揶揄揖揚揺揀敢敬散敞敦敝斑斐斌斯旒暁景暑晶晴晰智晩\ +普暃最曾替期朞朝椄棧椅椁棺棋棊棘検棍棕椒植森棲棗椎棣棟棹棠棚\ +棒棉椋椀椚椙椛棆棔棡棯椈椌椏椡椪椣椥椨椦椢欹款欺欽歯殘殖殕殼\ +毳毯湶渚渥渭湮温渦渙渠減湖港渾渣滋湿湘湫渫湊測湛湍渟渡湯渺湎\ +渤満渝游湧湾渮湃湟湲溂溌焔焜煮焼焦然無焚焙爲牌牋犀犇犂猫猴猩\ +猶猥猯琢琴琥琵琺琳琲琶甥甦畫畳番畭畴疎痙痣痛痘痞痢發登皖皓皴\ +盜着睇短硯硬硝硫硲硴禄稈稀税稍程窗窘窖竢竣竦童筈筐筋笄策筍筌\ +筅筑等答筒筏筆筝粤粢粥粧粟粡粨粭粫絲絵給結絢絞絳絖絎絨絮絶統\ +絣絡絏翕翔耋聒腋腔腎脹腆脾腓腑胼腕舒舜菷菴萎菅菫菰菎菽菖萃菘\ +萋菁萇菟菠菲萍萠莱菱菻萄萓萢萬葵萩葬葉落蛙蛔蛞蛩蛬蛟蛤蛭蛛蛮\ +蛯衆街裁装裂裙補裕裡覃覚覗覘觚觜觝詠訶詁詐詞証詔診訴詛詑詒註\ +詆評詈象貂貽賀貴貲貰貸貯貼貳買費貶貿賁赧越超趁跏距跚跖跌跛跋\ +躰軼軻軽軸軫辜逶逵逹運過遇遂達遅道遍遊遥鄂酣酢酥鈕釉量鈞釿鈔\ +鈍鈑鈎鈬鈩開間閑閏閔閖隋随階隅隍隊陽隈雁雇集雄雲雰靫靱靭項須\ +順颪飯馭馮黍黹" ; 12 + "亂亶傳傴僅傾傲債催傷僉僊僧傭僂働剿剽勧勢勦勠勣匯嗚嗅嗟嗄嗣嗜\ +嗤嗔嘆圓園嗇塋塊塙塒塑塞填塗塘墓塰塢塩壼夢奧奨媼嫁嫌媾嫉嫋嫂\ +媽嫐孳寛寝尠嵬嵯嵳嵶幌幕幎幹廈廉彁彙微徭惡愛意感愚愆慈惹愁惷\ +想愍愈慍慨愧愾慊慎愼愴慄愽戀戡戦搜搭搖携搆搓搦搶摂掻損搗搨搏\ +搬搾数斟新暎暘暗暈暇暉暄暖會楳椶楹楷楽棄業極楸楫楢楯楔楚楮椿\ +椹椽楠楓椰楡楊楝楼椴楙楜楪楴楾榁楕楞歇歃歳毀殿溪溢滑漢源溝溘\ +滉溷滓準溽溯滄溲滞溺滔漠溥滂溟滅溶溜滝溏煙煥煕煦煢煌照煎煖煤\ +煬煉煩爺牒献猷猿猾獅瑛瑕瑚瑟瑞瑁瑜瑶琿瑙甞畸畷當痾痿痼瘁痰痴\ +痲痳痺皙盞盟睚睨睫睡睛督睥睦矮碚碗碎碍碕碁碓碇硼碌碆祺禁祿禀\ +禍禅禎福禽稔稚稠稗稜稟稘稙窟竪筺筵筥筴筧筮節筬筰筱粳粲粱粮經\ +継絹絛綏続絽綛綉罨罫罪署置罩罧義群羣羨耡聖聘肅肄肆腦腱腫腥腸\ +腹腴腰腺腟腮舅辞艇艀葦葭萼葛葷萱葫葺葱董葩葡葆葯葎萪蒄萵萸葮\ +葹葢蒂蒸蓄蓉號虞虜蜒蛾蜆蜈蛸蜀蜃蛻蜑蜉蜂蛹蜊蜍衙裝裔裘裏裟褂\ +裾裼裨裸裲褄解触詼該詭詰詣誇詬詩試詢詳誠詫誅誂誉誄話詮豊豢貉\ +貅貊賊賈資賃賂賄賎賍跪跫跨跟跡践跣跳路躱較載軾輊輅輌辟農遏遐\ +遑遒遉遁逼逾遖違遠遣鄒酬酩酪鉞鉛鉗鉅鉉鈷鉱鉤鉈鉦鉄鈿鉢鉋鈴鉐\ +鉚閘閠閙隘隕隗隔雅雌雎雋雉雍電雹雷零靖靴靹韮韵頑頏頌頓頒預飭\ +飲飮飫飩飾飼飽馴馳骭髢鳫鳩鳧鳰麁黽鼎鼓鼠" ; 13 + "僞僖僑僥僭僣像僮僕僚兢冩劃匱厭厮厰嘔嘉嗷嘖嘗嗾嗽嗹嘛團圖塲境\ +塹塾墅塵増墨壽夐夥奩奬奪嫦嫣嫗嫡嫩嫖孵實寢寡寤察寧寞寥寨對層\ +嶌嶋嶇嶄嶂幗幔廓廏廐廖彰徴徳慇愨愿愬態慕慂慘慣慳慷慚慴慥慟慓\ +慢慵慯慱截搴摧摺摶摘摸摎敲斡旗暢暮暝暦榮榔榎槐概構槁槓榾槎槊\ +様榛榱槍槌槙槇榻槃榧榑模榜榕榴榊榠榲榿樮槝槞歌歉歴殞毓滿滯演\ +漑滬滸滾漬漆滲漸漕漱漲滴滌漂漫漾漣漁漏漉滷潅漓熈熏煽熄熊熕熔\ +爾犒犖獄獏瑯瑤瑰瑣瑳瑪瑠甄甃甅疑瘋瘍瘉皸皹盡睿睾睹碪碣磁碑碧\ +碯碵碩禊稱穀種稲窪窩竭端竰篏箇管箝箕箘箟箍箜箚算箋箒箏箔箙箆\ +粹精糀粽維綺綮綣綱綵緇綽綬緒総綜綻綢綴綯緋綿網綾緑綸綟練綰綫\ +緕罰翠翡聟聚聡聞聢肇腐膃膈膏腿膊膀膜膂臧臺與蒭蓊蓋蒹蒿蒟蓑蒜\ +蓍蒔蒻蒐蓐蓁蓆蒼蓖蒲蒙蓙蒡蓚蔦蔵蜿蜷蜻蜥蜘蜩蜚蜜蜴蝋裹製裴褐\ +褌複褊褓褝覡誨誡誑語誤誥誌誦誚誓説読認誣誘豪貍貌賑赫趙踈跼踊\ +踉跿輕輒輓輔辣逧遡遞遙遘遜遭適鄙酳酵酷酸酲銕銜銀銖銃銭銑銓銛\ +銅鉾銘銚閣関閨閤閧閥隙隠際障雑需静靤鞅靼鞄靺鞆鞁韶頗領頚颯颱\ +飴駅駆駄駁馼骰髪髣髦魁魂鳶鳳鳴麼皷鼻齊" ; 14 + "價儉億儀僵儁儂僻凛劍劇劈劉勲匳噎器噐嘘嘴嘱嘶噌噂嘲嘸噴噛嘩墮\ +墟墜墳墫墹墸嫺嫻嬉嬌嬋寫審寮導履嶐嶢嶝幟幢幡幣幤廣廢廝廠廚廛\ +廟廡弊彈影徹慰慶慧慙慫慝憂慾慮憇憎憬憔憚憧憫憮憤憐戯戮撃摯摩\ +撮撰撒撞撤撓撚播撥撫撲撩撈撕撹數敵敷暫暴樞槨樂樓樣横槻樛槿権\ +槲槧樟樅槽樗樋樊標樒樫槫槭槹樔樌樢歐歓歎殤毆毅滕潁漿澁澀澑潰\ +澗澆潔潺潸潤潯潟潜潛潭澄澂潮潼潘澎潦潴熬熟熱獎獗瑩瑾璋璃畿瘟\ +瘧瘠瘡痩瘢瘤皚皺監盤瞎瞋瞑磆磑確磋磔碾碼磐磅磊禝稻稼稽稿稾稷\ +穂穃窮窯窰篋篁箱箴箭箸篆篇篌箪範糊糅糎糂緲緜縁緩緘緊緝縄緤線\ +緞緻締緡編緬縅罸罵罷羯羮翫翦翩聨膓膠膝膣膚膕膤舗舖舞蔔蔆蔭蔚\ +蔡蓴蔗蒋蔘蔬蔟蔕蔓蔑蓬蔀蓼蓮蓿蝟蝦蝸蝌蝎蝴蝗蝨蝕蝶蝮蝙蝓蝠蝣\ +蝪蝉蝿衝褒褞褥褪褫觧謁課誼諏諄諸誰請諍諾誕談調諂誹諒論諚諫豌\ +豎貎賛賜賞賤質賣賠賓賦賚趣踐踝踞踟踏踪輙輝輜輟輩輛輪輦遨遮遯\ +遺遵選遷遼鄭鄲鄰醉醋醇醂鋪鋭鋏銹鋤銷鋳鋒鋲鋩閲閭霄震霆霈霊靠\ +鞋鞍鞏鞐頤頡餃餌餉養餅餓駈駕駒駟駛駝駘駐駑髴髯髮髭髫髱鬧魄魃\ +魅魯魴鴈鴉鴃鴆鴇麩麪麾黎黙齒" ; 15 + "儒儕儔儚儖冀冪凝劒劔劑勳叡噫噤嘯噬噸噺噪圜墺壊墾壌壇壁壅奮嬢\ +嬖學寰嶮嶬廨廩彊彜徼憙憖憩憲憊憑懌懊憶懐懈憾懆憺懍戰擇據擔撼\ +擒擅操撻擁擂整旙曉曁暹暾曇曄暼暸樺橄機橘橋樹樵橡橇樽橢橙橦橈\ +樸樶橲橸歙歔殪殫澤澣濂澳激澡濁澹澱濃濆澪燈燒燕熹熾燉燃燔燎燐\ +燗獣獨獪獲璢璞瓢甌甎甍疂瘴瘰瘻盥盧瞠瞞磚磬磧磨禦頴穐穎穏積穆\ +窶窺築篝篩篦篥篭簑篤糖糒糘緯縊縣縞縡縒縦縟縉縋縢縛繁縫罹羲翰\ +耨膩膳膰膨膵臻興舘艙艘蕩蕚蕎蕀蕨蕣蕉蕘蕈蕁蕊蕋蕃蕪蔽蕕蕭蕗薫\ +薪薦薄薬螢螟螂融衛衞衡褸襁褶覩親覦諤諳謂諧諌諱謔諠諺諢諮諜諦\ +諷諞謀諭諛謡諡豫豬賢賭赭踴蹂踵蹄踰躾輯輳輻輸輹辨辧隨遲遶還避\ +醒醍醐醗錦錢錏鋺鋸錮鋼錯錙錠錐錆錫錚錘錣錬録錺錵錻鍄閼閻閹閾\ +險隧隣隷雕霍霓霎霑霏霖靜靦鞘頼頷頬頸頽頭餘餐餒餔館駭駮駱駲骸\ +骼髷髻鬨鮓鮎鮃鮒鮑鮗鮖鴛鴨鴟鴕鴫鴒鴣鴪鴦鴬鴎鶯麈麭默黔龍龜" ; 16 + "優儡勵厳嚇嚆嚔嚏嚊嚀墻壓壑壕壗嬰嬬嬲嬪嬶孺嶽嶷嶼嶺彌徽應懃懇\ +懋懦戲擘擱擬擦擠擡擢擣擯斂曖檢檐橿檠檄檎檣檀檗檍檪檜歛氈濱濟\ +濕濠濡濬濯濤濘濮濛濔濶燮營燠燬燦燭燧燥燵爵牆犠獰環甑癇癌癈療\ +癆盪瞰瞳瞥瞭瞶瞹矯磯磽礁磴禪禧穉穗窿竃簒簀篠簇篳篷篶簍簓簗簔\ +糢糠糟糜糞縲總縱繆繦縮績繊縵縻縹繃縷縺罅翳翼聰聳聲聴聯膽臆膾\ +臀膿臂膺臉膸臈舉艚艝艱薗薤薈薑薊薨薔薛薙薇薜蕾蕷薐薮薀虧螯蟋\ +螽螫蟄螳螺螻蟀蟆蟇蟐襃襄褻襌襍覬覯覧謌謠謹謙謇講謚謝謖謄謐謗\ +謎豁谿貔購賽賺賻趨蹊蹇蹉蹌蹐蹈轅轄轂輾輿邂遽邁邀醢鍋鍔鍵鍠鍬\ +鍾鍼鍛鍮鍍錨鍖鍜闇闊闃闍闌隱隰隲隸雖霙霞霜鞠鞜韓顆頻颶餝餡餞\ +餤餠馘駻駿駸騁醜鮟鮪鮠鮭鮫鮨鮮鮴鵄鴻鵁鴿鴾鵆鵈麋黏黛黜點黝黻\ +鼾齋齔齢龠" ; 17 + "儲叢嚠壘壙彝懲懣懴戴戳擧擴擾擲擺擽擶攅斃斷旛曙曚曜朦櫁檻櫃櫂\ +檮檸檳檬歟歸殯瀁瀉瀋濺瀑濫瀏濾燻燼燹燿獵璧甕甓癜癖癒癘瞿瞼瞽\ +瞬瞻礒礎礑礇禮穢穫穣穡竅竄簡簣簧簪簟糧繪繝繞織繕繙繚繧繖繍羂\ +翹翻聶職臍臑臨舊艟藁藏薩藉薯薺薹藐藤藩藍蟲蟯蟠蟒襖襟襠覆観覲\ +觴謳謦謫謾謬謨豐貘贄贅贈贇蹠蹟蹙蹤蹣蹕轉轆轌邃醫醯醤醪釐鎰鎧\ +鎬鎖鎗鎮鎭鎚鎔鎌鎹闕闔闖闘雙雜雛難霤鞫鞦鞣鞭鞨額顎顔顏顕顋題\ +類餬餮馥騎騏験騅騒駢髀鬆鬩魏魍魎鯀鯊鮹鯉鯆鯏鯑鯒鵝鵞鵑鵠鵜鵐\ +鵡鵤鵙麌麿黠鼕鼬" ; 18 + "嚥嚮壞壜壟嬾寳寵廬懷懶攀曠曝櫛櫚櫟櫓櫞櫑殱瀞瀧濳瀛瀚瀦瀕瀬瀝\ +瀘爆爍牘犢獸獺璽瓊瓣疆疇癡矇礙禰穩簷簫簽簸簿簾籀繩繭繹繋繰羃\ +羆羅羹羶羸臓臘艢艤艶藝藥藕藪藜藻蘭蟷蠎蟹蠏蠍蟻蟾蟶蠅襞襦襤覈\ +覇譌證譁譏譎警識譖譛譚譜贊贋蹶蹴蹲蹼軅轎轍辭邊鏥鏖鏡鏗鏨鏘鏃\ +鏑鏝鏐鏈鏤關隴離霪霧靡鞴鞳韜韲韻願顛餽餾饂騙騨髄鯣鯨鯢鯤鯔鯖\ +鯛鯡鯱鯰鯲鯵鶏鵲鶉鶇鵯鵬鵺麓麕麒麑麗麹黼" ; 19 + "勸嚶嚴壤壥孃孅孀寶巌巉廰懸懺攘曦朧欄櫪櫨瀟瀰瀾瀲爐犧獻瓏癢矍\ +礬礪礫礦竇競籍籌籃籏糯繼纂繻繽辮纃繿罌譱耀聹臙臚艨蘂藷藹蘊蘇\ +蘓蘋藺蘆蘢藾蠑蠖蠕襭襪覺觸譯議護譲譫譟譬贏贍躁躇躄躅軆轗醵醸\ +醴釋鐡鐚鐘鐔鐓鐙鐃鐐鐇闡霰露響飄飃饉饅馨騷騫騰鬪鰕鰉鰓鰌鰍鰆\ +鰈鰒鰊鰔鰄鰛鰐鶚鶤鶩鶫鹹麺黨黥齣齟齠齡" ; 20 + "儺儷囂嚼囁囃囀屬巍廱懽懼懾攜攝曩櫻欅櫺殲灌爛瓔癨癩癪癧龝竈籐\ +籖籔糲續纎纈纏纐纉罍艦艪蘗蘖蘯蘚蘰蠢蠣蠡襯覽譽譴贐贓贔躋躊躍\ +轟轜辯邉醺鐵鐶鐫鐸鐺闥闢霸霹顧飆飜饐饋饑饒饌驅驂驀驃騾髏鬘魑\ +魔鰮鰥鰭鰤鰯鰡鰰鷄鶴鷁鶻鶸鶺鶲鷂鷆鷏麝黯齎齦齧" ; 21 + "儼儻囈嚢囎巓巒彎懿攤變權歡灑灘疊疉癬禳穰竊竸籘籟籠糴纒罎羇聽\ +聾臟艫襲襴襷覿讀讃贖躓躑躔轡轢鑄鑓鑁鑒霽霾韃顫饗饕驚驕驍鬚鬻\ +鰹鰺鰻鰾鱈鱆鱇鰲鷙鷓齪齬龕" ; 22 + "巖攣攪攫欒癰籤籥纖纓纔蘿蠱蠧讌讎讐躙轣轤邏鑛鑑鑠鑢鑞鑚靨顯驛\ +驗體髓髑髞鬟鱒鱗鱚鷸鷲鷦鷭鷯鷺麟黐黴齏" ; 23 + "囑囓攬癲矗罐羈艷蠶蠹衢讓讒讖軈釀鑪靈靄靆靂韈韆顰驟鬢魘鱠鱧鷽鷹\ +鹽鹸鼇齷齲齶" ; 24 + "廳欖灣籬糶纛臠蠻覊觀讙躡釁鑰靉顱鬣黌鼈" ; 25 + "欝矚讚鑵鑷驢鬮鱶黶" ; 26 + "纜躪鑽鑼鑾鑿顴顳驥驤鱸黷" ; 27 + "钁驩鸚" ; 28 + "欟爨驪鬱鸛" ; 29 + "驫鸞" ; 30 + ]) + +;; 92.7.24 by T.Shingu -- Completely modified. +;; 92.8.24 by T.Shingu -- Bug fixed. +;; 92.9.17 by K.Handa -- Now table contents are strings (not lists of strings) +(defun busyu-input () + (interactive) + (let ((loop1 t) + (loop2) + (loop3) + (val1) + (val2) + (busyuname) + (nbusyu (1- (length busyu-table))) + (kaku1) + (kaku2)) + (while (or loop1 loop2 loop3) + (if loop1 + (progn + (setq loop1 nil) + (setq kaku1 (string-to-number (read-from-minibuffer + (format "部首画数(1-%d): " nbusyu) + (if kaku1 (int-to-string kaku1))))) + (and (< 0 kaku1) (<= kaku1 nbusyu) ; 92.9.30 by K.Mitani + (setq loop2 t)))) + (let ((inhibit-quit t)) + (if loop2 + (progn + (setq loop2 nil) + (setq busyuname + (menu:select-from-menu + (list 'menu "部首:" (aref busyu-table kaku1)))) + (if quit-flag + (progn + (setq quit-flag nil) + (setq loop1 t)) + (setq loop3 t) + (setq val1 (cdr (assoc busyuname busyu-kaku-alist)))))) + (if loop3 + (progn + (setq loop3 nil) + (setq kaku2 + (menu:select-from-menu + (list 'menu "総画数:" + (cons (cons "*" val1) + (mapcar (function + (lambda (x) + (cons (format " %s画" (car x)) + (cdr x)))) + val1))))) + (if quit-flag + (progn + (setq quit-flag nil) + (setq loop2 t)) + (setq val2 + (menu:select-from-menu + (list 'menu "漢字:" + (if (stringp kaku2) + (busyu-break-string kaku2) + (apply (function nconc) + (mapcar (function + (lambda (x) + (busyu-break-string (cdr x)))) + kaku2)))))) + (if quit-flag + (progn + (setq quit-flag nil) + (setq loop3 t)) + (insert val2))))))))) + +(defun kakusuu-input () + (interactive) + (let ((loop t) + (kaku nil) + (nkakusuu (1- (length kakusuu-table))) + (val)) + (while loop + (setq kaku (string-to-number + (read-from-minibuffer (format "画数(1-%d): " nkakusuu) + (if kaku (int-to-string kaku))))) + (if (not (and (< 0 kaku) (<= kaku nkakusuu))) ; 92.9.30 by K.Mitani + (setq loop nil) + (let ((inhibit-quit t)) + (setq val + (menu:select-from-menu + (list 'menu "漢字:" + (busyu-break-string (aref kakusuu-table kaku))))) + (if quit-flag + (setq quit-flag nil) + (insert val) + (setq loop nil))))))) + +(defun busyu-break-string (str) + (mapcar 'char-to-string str)) --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/can-n-egg.el 2007-06-03 23:21:07 +0000 @@ -0,0 +1,83 @@ +;; This file is a part of Canna and Egg on Nemacs/Mule. + +;; Canna and Egg on Nemacs/Mule is distributed in the forms of +;; patches to Nemacs under the terms of the GNU EMACS GENERAL +;; PUBLIC LICENSE which is distributed along with GNU Emacs by +;; the Free Software Foundation. + +;; Canna and Egg on Nemacs/Mule 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 EMACS GENERAL PUBLIC +;; LICENSE for more details. + +;; You should have received a copy of the GNU EMACS GENERAL +;; PUBLIC LICENSE along with Nemacs/Mule; see the file +;; COPYING. If not, write to the Free Software Foundation, +;; 675 Mass Ave, Cambridge, MA 02139, USA. + +;; Written by Akira Kon, NEC Corporation. +;; E-Mail: kon@d1.bs2.mt.nec.co.jp. + +;; -*-mode: emacs-lisp-*- + +;; $Id: can-n-egg.el,v 1.7 1994/03/16 07:24:15 kon Exp $ + +;; この機能を使うには、 +;; M-x load このファイル +;; M-x can-n-egg +;; を実行します。 + +(require 'canna) + +(if (boundp 'MULE) + (require 'egg) + (require 'wnn-egg)) + +(provide 'can-n-egg) + +;;; この関数では、現在のモードが『かんな』の日本語入力モードか +;;; どうかをチェックして、『かんな』の日本語入力モードでないの +;;; であれば、『たまご』の egg-self-insert-command を呼ぶ。『か +;;; んな』の日本語入力モードであれば、『かんな』の +;;; canna-self-insert-command を呼ぶ。 + +(defvar canna-exec-hook nil) +(defvar canna-toggle-key nil) +(defvar egg-toggle-key nil) + +(defun can-n-egg-self-insert-command (arg) + "Self insert pressed key and use it to assemble Romaji character." + (interactive "p") + (if canna:*japanese-mode* + (canna-self-insert-command arg) + (egg-self-insert-command arg))) + +;; かんなだったら再変換、たまごだったら普通のキー入力。 +;; by rtakigaw@jp.oracle.com, 1994.3.16 +(defun can-n-egg-henkan-region-or-self-insert (arg) + "Do Canna Kana-to-Kanji re-conversion in region or Egg self insert." + (interactive "p") + (if canna:*japanese-mode* + (canna-henkan-region-or-self-insert arg) + (egg-self-insert-command arg))) + +(defun can-n-egg () + "Start to use both Canna and Egg." + (interactive) + (if canna-exec-hook + (run-hooks canna-exec-hook) + (canna)) + (let ((ch 32)) + (while (< ch 127) + (define-key global-map (make-string 1 ch) 'can-n-egg-self-insert-command) + (setq ch (1+ ch)) )) + (if canna-use-space-key-as-henkan-region + (progn + (global-set-key "\C-@" 'canna-set-mark-command) + (global-set-key " " 'can-n-egg-henkan-region-or-self-insert))) + (global-set-key + (if canna-toggle-key canna-toggle-key "\C-o") 'canna-toggle-japanese-mode) + (global-set-key + (if egg-toggle-key egg-toggle-key "\C-\\") 'toggle-egg-mode) ) + --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/canna.el 2007-06-03 23:21:07 +0000 @@ -0,0 +1,1545 @@ +;; This file is a part of Canna on Nemacs/Mule. + +;; Canna on Nemacs/Mule is distributed in the forms of +;; patches to Nemacs under the terms of the GNU EMACS +;; GENERAL PUBLIC LICENSE which is distributed along with +;; GNU Emacs by the Free Software Foundation. + +;; Canna on Nemacs/Mule 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 EMACS GENERAL PUBLIC +;; LICENSE for more details. + +;; You should have received a copy of the GNU EMACS GENERAL +;; PUBLIC LICENSE along with Nemacs/Mule; see the file +;; COPYING. If not, write to the Free Software Foundation, +;; 675 Mass Ave, Cambridge, MA 02139, USA. + +;; Egg offered some influences to the implementation of +;; Canna on Nemacs/Mule, and this file contains a few part +;; of Egg which is written by S.Tomura, Electrotechnical +;; Lab. (tomura@etl.go.jp) + +;; Written by Akira Kon, NEC Corporation. +;; E-Mail: kon@d1.bs2.mt.nec.co.jp. + +;; -*-mode: emacs-lisp-*- + +(defconst canna-rcs-version "Canna/mule 2.x-5.x, based on Canna 2.2/3.2/3.5. : canna.el,v x.xx 1998/9/28 00:00:00") + +(if (featurep 'xemacs) (require 'poem)) + +(eval-when-compile + (if (featurep 'xemacs) + nil + (defalias 'event-key 'ignore) + (defalias 'get-frame-background-mode 'ignore) + (defalias 'self-insert-internal 'ignore))) + +(cond + ((fboundp 'dynamic-link) + (defvar canna-dl-module + (expand-file-name "canna.so" exec-directory)) + + (defvar canna-dl-handle + (or (boundp 'CANNA) + (eval '(dynamic-link canna-dl-module)))) + + (and canna-dl-handle + (eval '(dynamic-call "emacs_canna_init" canna-dl-handle))))) + +(defvar self-insert-after-hook nil) + +(defun canna-version () + (interactive) + (message (concat (substring canna-rcs-version 0 72) " ..."))) + +;;; かんなの変数 + +(defvar canna-save-undo-text-predicate nil) +(defvar canna-undo-hook nil) + +(defvar canna-do-keybind-for-functionkeys t) +(defvar canna-use-functional-numbers nil) +(defvar canna-use-space-key-as-henkan-region t) + +(defvar canna-server nil) +(defvar canna-file nil) + +(defvar canna-underline nil) +(defvar canna-with-fences (not canna-underline)) + +(defvar canna-initialize-minibuffer-state-when-exit nil + "*Non-nil のときは, ミニバッファを抜ける時日本語状態を初期化する.") + +(defvar canna-inhibit-hankakukana nil + "*Non-nil の時、字種変換で半角かなに変換しない") + +;;; +;;; モードラインの修整 +;;; + +(defvar canna:*kanji-mode-string* "[ あ ]") +(defvar canna:*alpha-mode-string* "かんな") +(defvar canna:*saved-mode-string* "[ あ ]") + +(defvar mode-line-canna-mode canna:*alpha-mode-string*) +(defvar mode-line-canna-mode-in-minibuffer canna:*alpha-mode-string*) + +(defvar display-minibuffer-mode-in-minibuffer t) + +(make-variable-buffer-local 'mode-line-canna-mode) + +(defvar canna:minibuffer-preprompt-overlay nil + "Internal variable used to keep an overlay to show a preprompt string +in the minibuffer.") + +(eval-when-compile + (defvar canna:*japanese-mode-in-minibuffer*)) + +(defun canna:select-window-hook (old new) + (if (and (eq old (minibuffer-window)) + (not (eq new (minibuffer-window)))) + (save-excursion + (set-buffer (window-buffer (minibuffer-window))) + (if canna:minibuffer-preprompt-overlay + (delete-overlay canna:minibuffer-preprompt-overlay)) + (setq canna:minibuffer-preprompt-overlay nil + ;; minibufferのデフォルトはアルファベットモード + mode-line-canna-mode-in-minibuffer canna:*alpha-mode-string* + canna:*japanese-mode-in-minibuffer* nil))) + (if (eq new (minibuffer-window)) + (setq minibuffer-window-selected t) + (setq minibuffer-window-selected nil))) + +(defun canna:minibuffer-setup-hook () + (canna:select-window-hook nil (minibuffer-window))) + +(add-hook 'minibuffer-setup-hook 'canna:minibuffer-setup-hook) + +(defun canna:minibuffer-exit-hook () + (canna:select-window-hook (minibuffer-window) nil)) + +(add-hook 'minibuffer-exit-hook 'canna:minibuffer-exit-hook) + +(defun mode-line-canna-mode-update (str) + (if (eq (current-buffer) (window-buffer (minibuffer-window))) + (if display-minibuffer-mode-in-minibuffer + (progn + (or canna:minibuffer-preprompt-overlay + (setq canna:minibuffer-preprompt-overlay + (make-overlay (point-min) (point-min)))) + (overlay-put canna:minibuffer-preprompt-overlay + 'before-string str)) + ;else + (setq mode-line-canna-mode-in-minibuffer str)) + (setq mode-line-canna-mode str) ) + (set-buffer-modified-p (buffer-modified-p)) ) + +;; memq を強調するなら、以下だが、 +;(defun canna:memq-recursive (a l) +; (or (eq a l) +; (and (consp l) +; (or (canna:memq-recursive a (car l)) +; (canna:memq-recursive a (cdr l)) )))) +;; 次の定義を使おう... +(defun canna:memq-recursive (a l) + (if (atom l) (eq a l) + (or (canna:memq-recursive a (car l)) + (canna:memq-recursive a (cdr l)) ))) + +(defun canna:create-mode-line () + "Add Canna status string into mode-line." + (cond ((featurep 'xemacs) + (or (canna:memq-recursive 'mode-line-canna-mode + (default-value 'default-modeline-format)) + (set-default 'default-modeline-format + (append '("" mode-line-canna-mode) + (symbol-value 'default-modeline-format)))) + (mapcar (function + (lambda (buffer) + (save-excursion + (set-buffer buffer) + (or (canna:memq-recursive 'mode-line-canna-mode + (symbol-value + 'modeline-format)) + (set 'modeline-format + (append '("" mode-line-canna-mode) + (symbol-value 'modeline-format))))))) + (buffer-list))) + (t + (or (canna:memq-recursive 'mode-line-canna-mode mode-line-format) + (setq-default + mode-line-format + (append (list (list 'minibuffer-window-selected + (list 'display-minibuffer-mode-in-minibuffer + "-" "m") "-") + (list 'minibuffer-window-selected + (list 'display-minibuffer-mode-in-minibuffer + 'mode-line-canna-mode + 'mode-line-canna-mode-in-minibuffer) + 'mode-line-canna-mode)) + mode-line-format)) + ))) + (mode-line-canna-mode-update mode-line-canna-mode)) + +(defun canna:mode-line-display () + (mode-line-canna-mode-update mode-line-canna-mode)) + +;;; +;;; Canna local variables +;;; + +(defvar canna:*japanese-mode* nil "T if canna mode is ``japanese''.") +(make-variable-buffer-local 'canna:*japanese-mode*) +(set-default 'canna:*japanese-mode* nil) + +(defvar canna:*japanese-mode-in-minibuffer* nil + "T if canna mode is ``japanese'' in minibuffer.") + +(defvar canna:*exit-japanese-mode* nil) +(defvar canna:*fence-mode* nil) +(make-variable-buffer-local 'canna:*fence-mode*) +(setq-default canna:*fence-mode* nil) +(defvar canna:*select-mode* nil) + +;;; +;;; global variables +;;; + +(defvar canna-sys:*global-map* (copy-keymap global-map)) +(defvar canna:*region-start* (make-marker)) +(defvar canna:*region-end* (make-marker)) +(defvar canna:*spos-undo-text* (make-marker)) +(defvar canna:*epos-undo-text* (make-marker)) +(defvar canna:*undo-text-yomi* nil) +(defvar canna:*last-kouho* 0) +(defvar canna:*initialized* nil) +(defvar canna:*previous-window* nil) +(defvar canna:*cursor-was-in-minibuffer* nil) +(defvar canna:*menu-buffer* " *menu*") +(defvar canna:*saved-minibuffer*) +(defvar canna:*saved-redirection* nil) +(defvar canna:*use-region-as-henkan-region* nil) +(make-variable-buffer-local 'canna:*use-region-as-henkan-region*) +(setq-default canna:*use-region-as-henkan-region* nil) + +;;; +;;; 色の設定 +;;; +(defvar canna-use-color nil + "*Non-nil でカラーディスプレイで色を付ける. +t の時はデフォルトの色を使用する。 +色を指定したい時は, \"読みの色\", \"変換対象の色\", \"選択対象の色\" の +リストを設定する") +(defvar canna:color-p nil "色が使えるか") +(defvar canna:attr-mode nil "現在のディスプレイモード") +(defvar canna:attr-yomi nil "読みの色属性") +(defvar canna:attr-taishou nil "変換対象部分の色属性") +(defvar canna:attr-select nil + "ミニバッファ分離時のメニューの選択対象番号の色属性") +(defvar canna-background-mode nil + "かんな変換時の配色セットを黒地背景用にする場合は 'dark にする") +(defvar canna:attribute-alist ;colored by tagu@ae.keio.ac.jp + '((yomi (normal . "red") + (reverse . "moccasin") + (nw . "blue/white") + (nw-rv . "yellow/black")) + (taishou (normal . "blue/lavender") + (reverse . "yellow/cadet blue") + (nw . "black/yellow") + (nw-rv . "yellow/blue")) + (select (normal . "DarkOliveGreen1/cadet blue") + (reverse . "light sea green/burlywood1") + (nw . "black/cyan") + (nw-rv . "black/cyan"))) + "かんな変換時の配色のalist +強制的に暗い背景の配色を選びたい場合は変数 canna-background-mode に +シンボル 'dark をセットしておく。") + +(make-variable-buffer-local (defvar canna:*yomi-overlay* nil)) +(make-variable-buffer-local (defvar canna:*henkan-overlay* nil)) +(make-variable-buffer-local (defvar canna:*select-overlay* nil)) + +;;; +;;; キーマップテーブル +;;; + +;; フェンスモードでのローカルマップ +(defvar canna-mode-map (make-sparse-keymap)) + +(let ((ch 0)) + (while (<= ch 127) + (define-key canna-mode-map (make-string 1 ch) 'canna-functional-insert-command) + (setq ch (1+ ch)))) + +(cond ((featurep 'xemacs) + (define-key canna-mode-map [up] "\C-p") + (define-key canna-mode-map [(shift up)] "\C-p") + (define-key canna-mode-map [(control up)] "\C-p") + (define-key canna-mode-map [down] "\C-n") + (define-key canna-mode-map [(shift down)] "\C-n") + (define-key canna-mode-map [(control down)] "\C-n") + (define-key canna-mode-map [right] "\C-f") + (define-key canna-mode-map [(shift right)] "\C-f") + (define-key canna-mode-map [(control right)] "\C-f") + (define-key canna-mode-map [left] "\C-b") + (define-key canna-mode-map [(shift left)] "\C-b") + (define-key canna-mode-map [(control left)] "\C-b") + (define-key canna-mode-map [kanji] " ") + (define-key canna-mode-map [(control space)] [(control @)]) + (define-key canna-mode-map [backspace] "\C-h") + (define-key canna-mode-map [delete] "\C-h") + ) + (t + (define-key canna-mode-map [up] [?\C-p]) + (define-key canna-mode-map [S-up] [?\C-p]) + (define-key canna-mode-map [C-up] [?\C-p]) + (define-key canna-mode-map [down] [?\C-n]) + (define-key canna-mode-map [S-down] [?\C-n]) + (define-key canna-mode-map [C-down] [?\C-n]) + (define-key canna-mode-map [right] [?\C-f]) + (define-key canna-mode-map [S-right] [?\C-f]) + (define-key canna-mode-map [C-right] [?\C-f]) + (define-key canna-mode-map [left] [?\C-b]) + (define-key canna-mode-map [S-left] [?\C-b]) + (define-key canna-mode-map [C-left] [?\C-b]) + (define-key canna-mode-map [kanji] [? ]) + (define-key canna-mode-map [?\C- ] [?\C-@]) + (define-key canna-mode-map [backspace] [?\C-h]) + (define-key canna-mode-map [delete] [?\C-h]) + )) + +(or (assq 'canna:*fence-mode* minor-mode-map-alist) + (setq minor-mode-map-alist + (cons (cons 'canna:*fence-mode* canna-mode-map) + minor-mode-map-alist))) + +;; ミニバッファに何かを表示している時のローカルマップ +(defvar canna-minibuffer-mode-map (make-sparse-keymap)) + +(let ((ch 0)) + (while (<= ch 127) + (define-key canna-minibuffer-mode-map (make-string 1 ch) 'canna-minibuffer-insert-command) + (setq ch (1+ ch)))) + +(cond ((featurep 'xemacs) + (define-key canna-minibuffer-mode-map [up] "\C-p") + (define-key canna-minibuffer-mode-map [(shift up)] "\C-p") + (define-key canna-minibuffer-mode-map [(control up)] "\C-p") + (define-key canna-minibuffer-mode-map [down] "\C-n") + (define-key canna-minibuffer-mode-map [(shift down)] "\C-n") + (define-key canna-minibuffer-mode-map [(control down)] "\C-n") + (define-key canna-minibuffer-mode-map [right] "\C-f") + (define-key canna-minibuffer-mode-map [(shift right)] "\C-f") + (define-key canna-minibuffer-mode-map [(control right)] "\C-f") + (define-key canna-minibuffer-mode-map [left] "\C-b") + (define-key canna-minibuffer-mode-map [(shift left)] "\C-b") + (define-key canna-minibuffer-mode-map [(control left)] "\C-b") + (define-key canna-minibuffer-mode-map [kanji] " ") + (define-key canna-minibuffer-mode-map [(control space)] [(control @)]) + (define-key canna-minibuffer-mode-map [backspace] "\C-h") + (define-key canna-minibuffer-mode-map [delete] "\C-h") + ) + (t + (define-key canna-minibuffer-mode-map [up] [?\C-p]) + (define-key canna-minibuffer-mode-map [S-up] [?\C-p]) + (define-key canna-minibuffer-mode-map [C-up] [?\C-p]) + (define-key canna-minibuffer-mode-map [down] [?\C-n]) + (define-key canna-minibuffer-mode-map [S-down] [?\C-n]) + (define-key canna-minibuffer-mode-map [C-down] [?\C-n]) + (define-key canna-minibuffer-mode-map [right] [?\C-f]) + (define-key canna-minibuffer-mode-map [S-right] [?\C-f]) + (define-key canna-minibuffer-mode-map [C-right] [?\C-f]) + (define-key canna-minibuffer-mode-map [left] [?\C-b]) + (define-key canna-minibuffer-mode-map [S-left] [?\C-b]) + (define-key canna-minibuffer-mode-map [C-left] [?\C-b]) + (define-key canna-minibuffer-mode-map [kanji] [? ]) + (define-key canna-minibuffer-mode-map [?\C- ] [?\C-@]) + (define-key canna-minibuffer-mode-map [backspace] [?\C-h]) + (define-key canna-minibuffer-mode-map [delete] [?\C-h]) + )) + +(or (assq 'canna:*select-mode* minor-mode-map-alist) + (setq minor-mode-map-alist + (cons (cons 'canna:*select-mode* canna-minibuffer-mode-map) + minor-mode-map-alist))) + +;;; +;;; グローバル関数の書き替え +;;; + + +;; Keyboard quit + +;(if (not (fboundp 'canna-sys:keyboard-quit)) +; (fset 'canna-sys:keyboard-quit (symbol-function 'keyboard-quit)) ) + +;(defun canna:keyboard-quit () +; "See documents for canna-sys:keyboard-quit" +; (interactive) +; (if canna:*japanese-mode* +; (progn +;; (setq canna:*japanese-mode* nil) +; (setq canna:*fence-mode* nil) +; (if (boundp 'disable-undo) +; (setq disable-undo canna:*fence-mode*)) +; (canna:mode-line-display) )) +; (canna-sys:keyboard-quit) ) + +;; Abort recursive edit + +;(if (not (fboundp 'canna-sys:abort-recursive-edit)) +; (fset 'canna-sys:abort-recursive-edit +; (symbol-function 'abort-recursive-edit)) ) + +;(defun canna:abort-recursive-edit () +; "see documents for canna-sys:abort-recursive-edit" +; (interactive) +; (if canna:*japanese-mode* +; (progn +; (setq canna:*japanese-mode* nil) +; (setq canna:*fence-mode* nil) +; (if (boundp 'disable-undo) +; (setq disable-undo canna:*fence-mode*)) +; (canna:mode-line-display) )) +; (canna-sys:abort-recursive-edit) ) + +;; Exit-minibuffer + +(defun canna:exit-minibuffer () + "Exit minibuffer turning off canna Japanese mode. +See also document for canna:saved-exit-minibuffer." + (interactive) + (if canna-initialize-minibuffer-state-when-exit + (setq canna:*japanese-mode-in-minibuffer* nil + mode-line-canna-mode-in-minibuffer canna:*alpha-mode-string*)) + ) + +(add-hook 'minibuffer-exit-hook 'canna:exit-minibuffer) + +;; kill-emacs + +(add-hook 'kill-emacs-hook 'canna:finalize) + +;;; +;; for Emacs 20.3 or later +;;; +(defun canna-buffer-substring (start end) + (cond + ((and (fboundp 'encode-coding-string) (not (featurep 'xemacs))) + (encode-coding-string (buffer-substring start end) 'japanese-iso-8bit)) + (t (buffer-substring start end)))) +(defun canna-string-to-list (str) + (cond + ((fboundp 'string-to-list) (string-to-list str)) + ((fboundp 'string-to-char-list) (string-to-char-list str)))) + +;;; +;;; function for mini-buffer +;;; + +(defun adjust-minibuffer-mode () + (if (eq (current-buffer) (window-buffer (minibuffer-window))) + (progn + (setq canna:*japanese-mode* canna:*japanese-mode-in-minibuffer*) + t) + nil)) + +;;; +;;; keyboard input for japanese language +;;; + +(defun canna-functional-insert-command (arg) + "Use input character as a key of complex translation input such as +kana-to-kanji translation." + (interactive "*p") + (let ((ch)) + (cond ((integerp last-command-char) + (setq ch last-command-char)) + ((and (fboundp 'char-or-char-int-p) + (char-or-char-int-p arg) + (not (null last-command-char))) + (setq ch last-command-char)) + ((eq (event-key last-command-event) 'backspace) + (setq ch ?\010)) + ((eq (event-key last-command-event) 'delete) + (setq ch ?\177)) + ;; XEmacs: + ;;(t + ;; (setq ch (event-to-character last-command-event))) + ) + (canna:functional-insert-command2 ch arg))) + +(defun canna:functional-insert-command2 (ch arg) + "This function actually inserts a converted Japanese string." + ;; この関数は与えられた文字を日本語入力のためのキー入力として取り扱 + ;; い、日本語入力の中間結果を含めた処理をEmacsのバッファに反映させる + ;; 関数である。 + (canna:display-candidates (canna-key-proc ch)) ) + +(defun canna:delete-last-preedit () + (let ((buffer-undo-list t)) + (if (and (not (zerop canna:*last-kouho*)) + (if (fboundp 'buffer-live-p) + (buffer-live-p (marker-buffer canna:*region-start*)) + t)) + (progn + (if canna-underline + ; まず、属性を消す。 + (progn + (canna:henkan-attr-off canna:*region-start* canna:*region-end*) + (canna:yomi-attr-off canna:*region-start* canna:*region-end*))) + (delete-region canna:*region-start* canna:*region-end*) + (setq canna:*last-kouho* 0) )))) + +(defun canna:insert-fixed (strs) + (if (and (fboundp 'encode-coding-string) (not (featurep 'xemacs)) + canna-kakutei-yomi) + (setq canna-kakutei-yomi + (encode-coding-string canna-kakutei-yomi 'japanese-iso-8bit))) + (cond ((> strs 0) + (cond ((and canna-kakutei-yomi + (or (null canna-save-undo-text-predicate) + (funcall canna-save-undo-text-predicate + (cons canna-kakutei-yomi + canna-kakutei-romaji) ))) + (setq canna:*undo-text-yomi* + + (cons canna-kakutei-yomi canna-kakutei-romaji)) + (set-marker canna:*spos-undo-text* (point)) +;; +;; update kbnes + (set-marker canna:*region-start* (point)) + (let ((list (canna-string-to-list canna-kakutei-string)) + ;; 挿入の途中で blink が起きるとうっとおしいので、 + ;; 一時的に blink を抑止する。 + (blink-matching-paren nil)) + (while list + ;(self-insert-internal (car list)) ;is obsoleted(yuuji) + (insert-char (car list) 1) + (setq list (cdr list)))) + (set-marker canna:*region-end* (point)) + ;; 未確定の文字がなく、確定文字列の最後が閉じ括弧の + ;; 類だったときは blink させる。 + (if (and canna-empty-info + (eq (char-syntax (char-before (point))) ?\)) ) + (blink-matching-open)) + +; (if overwrite-mode +; (let ((num strs) +; (kanji-compare 128)) +; (catch 'delete-loop +; (while (> num 0) +; (if (eolp) +; (throw 'delete-loop nil)) +; (if (>= (following-char) kanji-compare) +; (setq num (1- num))) +; (delete-char 1) +; (setq num (1- num)))))) +;; end kbnes +; (insert canna-kakutei-string) + (if (and (boundp 'self-insert-after-hook) + self-insert-after-hook) + (funcall self-insert-after-hook + canna:*region-start* canna:*region-end*)) + (canna:do-auto-fill) + (set-marker canna:*epos-undo-text* (point)) ) + (t +;; +;; update kbnes + (let ((list (canna-string-to-list canna-kakutei-string)) + ;; 挿入の途中で blink が起きるとうっとおしいので、 + ;; 一時的に blink を抑止する。 + (blink-matching-paren nil)) + (while list + ;(self-insert-internal (car list)) ;is obsoleted(yuuji) + (insert-char (car list) 1) + (setq list (cdr list)))) + ;; 未確定の文字がなく、確定文字列の最後が閉じ括弧の + ;; 類だったときは blink させる。 + (if (and canna-empty-info + (eq (char-syntax (char-before (point))) ?\)) ) + (blink-matching-open)) + +; (if overwrite-mode +; (let ((num strs) +; (kanji-compare 128)) +; (catch 'delete-loop +; (while (> num 0) +; (if (eolp) +; (throw 'delete-loop nil)) +; (if (>= (following-char) kanji-compare) +; (setq num (1- num))) +; (delete-char 1) +; (setq num (1- num)))))) +;; end kbnes +; (insert canna-kakutei-string) + (if (and (boundp 'self-insert-after-hook) + self-insert-after-hook) + (funcall self-insert-after-hook + canna:*region-start* canna:*region-end*)) + (canna:do-auto-fill) )) + ) )) + +(defun canna:insert-preedit () + (let ((buffer-undo-list t)) + (cond ((> canna-henkan-length 0) + (set-marker canna:*region-start* (point)) + (if canna-with-fences + (progn + (insert "||") + (set-marker canna:*region-end* (point)) + (backward-char 1) + )) + (insert canna-henkan-string) + (if (not canna-with-fences) + (set-marker canna:*region-end* (point)) ) + (if canna-underline + (canna:yomi-attr-on canna:*region-start* canna:*region-end*)) + (setq canna:*last-kouho* canna-henkan-length) + )) + + ;; 候補領域では強調したい文字列が存在するものと考えら + ;; れる。強調したい文字はEmacsではカーソルポジションにて表示 + ;; することとする。強調したい文字がないのであれば、カーソル + ;; は一番後の部分(入力が行われるポイント)に置いておく。 + + ;; カーソルを移動する。 + (if (not canna-underline) + (backward-char + (- canna:*last-kouho* + ;; カーソル位置は、反転表示部分が存在しないのであれば、 + ;; 候補文字列の最後の部分とし、反転表示部分が存在するの + ;; であれば、その部分の始めとする。 + (cond ((zerop canna-henkan-revlen) + canna:*last-kouho*) + (t canna-henkan-revpos) )) ) + (if (and (> canna-henkan-revlen 0) + (> canna-henkan-length 0)) + ; 候補の長さが0でなく、 + ; 反転表示の長さが0でなければ、 + ; その部分を変転表示する。 + (let ((start (+ canna:*region-start* + (if canna-with-fences 1 0) + canna-henkan-revpos))) + (canna:henkan-attr-on start + (+ start canna-henkan-revlen))))))) + +(defun canna:display-candidates (strs) + (cond ((stringp strs) ; エラーが起こった場合 + (beep) + (message strs) ) + (canna-henkan-string + ;; もし候補表示が前の結果から変わっていなくないときは...... + + ;; 取り合えず最初は前に書いておいた中間結果を消す。 + (canna:delete-last-preedit) + + ;; 確定した文字列があればそれを挿入する。 + (canna:insert-fixed strs) + ;; 次は候補についての作業である。 + + ;; 候補を挿入する。候補は縦棒二本にて挟まれる。 + (canna:insert-preedit) + )) + + ;; モードを表す文字列が存在すればそれをモードとして取り扱う。 + (if (stringp canna-mode-string) + (mode-line-canna-mode-update canna-mode-string)) + + ;; 候補表示がなければフェンスモードから抜ける。 + (cond (canna-empty-info (canna:quit-canna-mode) +;; (if (member last-command +;; '(canna-henkan-region-or-self-insert +;; canna-self-insert-command)) +;; nil +;; ;(skip-undo-boundary) ; append by knak 97.10.23 +;; ) + )) + ;; ミニバッファに書くことが存在するのであれば、それをミニバッファ + ;; に表示する。 + (cond (canna-ichiran-string + (canna:minibuffer-input canna-ichiran-string + canna-ichiran-length + canna-ichiran-revpos + canna-ichiran-revlen + strs) ) + (canna:*cursor-was-in-minibuffer* +; (select-frame (window-frame (minibuffer-window))) + (select-window (minibuffer-window)) + (set-window-buffer (minibuffer-window) + (get-buffer-create canna:*menu-buffer*)) + (setq canna:*select-mode* t))) + ) + +(defun canna:minibuffer-input (str len revpos revlen nfixed) + "Displaying misc informations for kana-to-kanji input." + + ;; 作業をミニバッファに移すのに際して、現在のウィンドウの情報を保存 + ;; しておく。 + (setq canna:*previous-window* (selected-window)) +; (select-frame (window-frame (minibuffer-window))) + +;; 自分に来る前がミニバッファかどうかを変数にでもいれておいた方がいいなあ。 + + (if (not canna:*cursor-was-in-minibuffer*) + (progn + ;; ミニバッファをクリアする。 +; (if (eq canna:*previous-window* (selected-window)) +; (progn +; (canna:henkan-attr-off (point-min) (point-max)) +; (canna:delete-last-preedit) )) + + ;; ミニバッファウィンドウに候補一覧用のバッファを割り当てる。 + (setq canna:*saved-minibuffer* (window-buffer (minibuffer-window))) +; (set-window-buffer (minibuffer-window) +; (get-buffer-create canna:*menu-buffer*)) + (or (featurep 'xemacs) + (progn + (setq canna:*saved-redirection* (frame-focus (selected-frame))) + (redirect-frame-focus (selected-frame) + (window-frame (minibuffer-window))))) + )) + (select-window (minibuffer-window)) + (set-window-buffer (minibuffer-window) + (get-buffer-create canna:*menu-buffer*)) + + (setq canna:*select-mode* t) + +; (canna:yomi-attr-off (point-min) (point-max) ) +; (canna:henkan-attr-off (point-min) (point-max) ) + (canna:select-attr-off (point-min) (point-max) ) + (setq canna:*cursor-was-in-minibuffer* t) + (delete-region (point-min) (point-max)) + (if (not (eq canna:*previous-window* (selected-window))) + (setq minibuffer-window-selected nil)) + + (insert str) + + ;; ミニバッファで反転表示するべき文字のところにカーソルを移動する。 + (cond ((> revlen 0) + (backward-char (- len revpos)) )) + ;;(message "%s" (selected-frame)) (sit-for 3) + (raise-frame (window-frame (minibuffer-window))) +; (select-frame (window-frame (minibuffer-window))) + (and canna:color-p (not (eobp)) + (canna:select-attr-on (point) + (save-excursion (forward-char 1) (point)))) + + ;; ミニバッファに表示するべき文字列がヌル文字列なのであれば、前のウィ + ;; ンドウに戻る。 + (if (or (zerop len) canna-empty-info) + (progn + (setq canna:*cursor-was-in-minibuffer* nil) + (setq canna:*select-mode* nil) + + ;; ミニバッファウィンドウのバッファを元に戻す。 + (set-window-buffer (minibuffer-window) canna:*saved-minibuffer*) +; (setq canna:*saved-minibuffer* nil) + (or (featurep 'xemacs) + (redirect-frame-focus (window-frame canna:*previous-window*) + canna:*saved-redirection*)) + ; ミニバッファで入力していたのなら以下もする。 +; (if (eq canna:*previous-window* (selected-window)) +; (progn +; (canna:insert-fixed nfixed) +; (canna:insert-preedit) )) + + (if (and canna-empty-info (> len 0)) + (progn +; (delete-region (point-min) (point-max)) + (message str) )) + (select-window canna:*previous-window*) )) + ) + +(defun canna-minibuffer-insert-command (arg) + "Use input character as a key of complex translation input such as\n\ +kana-to-kanji translation, even if you are in the minibuffer." + (interactive "p") + (setq canna:*select-mode* nil) + (set-window-buffer (minibuffer-window) canna:*saved-minibuffer*) + (select-window canna:*previous-window*) + ;-;(canna:functional-insert-command2 last-command-char arg) + (canna-functional-insert-command arg)) + +;;; +;;; かんなモードの主役は、次の canna-self-insert-command である。この +;;; コマンドは全てのグラフィックキーにバインドされる。 +;;; +;;; この関数では、現在のモードが日本語入力モードかどうかをチェックして、 +;;; 日本語入力モードでないのであれば、システムの self-insert-command +;;; を呼ぶ。日本語入力モードであれば、フェンスモードに入り、 +;;; canna-functional-insert-command を呼ぶ。 +;;; + +(eval-and-compile + (and (not (fboundp 'cancel-undo-boundary)) + (boundp 'buffer-undo-list) + ;; cancel-undo-boundary from mule2/mule-util.el + (fset 'cancel-undo-boundary + (function + (lambda () + "Cancel undo boundary." + (if (and (consp buffer-undo-list) + ;; if car is nil. + (null (car buffer-undo-list)) ) + (setq buffer-undo-list (cdr buffer-undo-list)))))))) + +(defun canna-self-insert-command (arg) + "Self insert pressed key and use it to assemble Romaji character." + (interactive "*p") + (adjust-minibuffer-mode) + (if (and canna:*japanese-mode* + ;; フェンスモードだったらもう一度フェンスモードに入ったりし + ;; ない。 + (not canna:*fence-mode*) ) + (canna:enter-canna-mode-and-functional-insert) + (progn + ;; 以下の部分は egg.el の 3.09 の egg-self-insert-command の部分から + ;; コピーし、手を入れています。93.11.5 kon + ;; treat continuous 20 self insert as a single undo chunk. + ;; `20' is a magic number copied from keyboard.c +; (if (or ;92.12.20 by T.Enami +; (not (eq last-command 'canna-self-insert-command)) +; (>= canna:*self-insert-non-undo-count* 20)) +; (setq canna:*self-insert-non-undo-count* 1) +; (cancel-undo-boundary) +; (setq canna:*self-insert-non-undo-count* +; (1+ canna:*self-insert-non-undo-count*))) + (if (and (eq last-command 'canna-self-insert-command) + (> last-command-char ? )) + (cancel-undo-boundary)) + (self-insert-command arg) +; (if canna-insert-after-hook +; (run-hooks 'canna-insert-after-hook)) + (if (and (boundp 'self-insert-after-hook) ; append by knak 97.10.21 + self-insert-after-hook) + (if (<= 1 arg) + (funcall self-insert-after-hook + (- (point) arg) (point))) + (if (= last-command-char ? ) (canna:do-auto-fill)))))) + +(defun canna-self-insert-string-2 (string) + (let ((len (length string)) + (i 0) + ;; 挿入の途中で blink が起きるとうっとおしいので、 + ;; 一時的に blink を抑止する。 + (blink-matching-paren nil)) + (while (< i len) + (self-insert-internal (aref canna-kakutei-string i)) + (setq i (1+ i)) + ))) + +;; (cond +;; ((featurep 'xemacs) +;; (fset 'canna-self-insert-command 'canna-self-insert-string-2)) +;; ((string< "19" emacs-version) +;; (fset 'canna-self-insert-command 'canna-self-insert-string-1)) +;; (t +;; (fset 'canna-self-insert-command 'insert))) + +;; wire us into pending-delete +(put 'canna-self-insert-command 'pending-delete t) + +(defun canna-toggle-japanese-mode () + "Toggle canna japanese mode." + (interactive) + (let ((in-minibuffer (adjust-minibuffer-mode))) + (cond (canna:*japanese-mode* + (setq canna:*japanese-mode* nil) + (canna-abandon-undo-info) + (setq canna:*use-region-as-henkan-region* nil) + (setq canna:*saved-mode-string* mode-line-canna-mode) + (mode-line-canna-mode-update canna:*alpha-mode-string*) ) + (t + (setq canna:*japanese-mode* t) + (if (fboundp 'canna-query-mode) + (let ((new-mode (canna-query-mode))) + (if (string-equal new-mode "") + (setq canna:*kanji-mode-string* canna:*saved-mode-string*) + (setq canna:*kanji-mode-string* new-mode) + )) ) + (mode-line-canna-mode-update canna:*kanji-mode-string*) ) ) + (if in-minibuffer + (setq canna:*japanese-mode-in-minibuffer* canna:*japanese-mode*)) )) + +(defun canna:initialize () + (let ((init-val nil)) + (cond (canna:*initialized*) ; initialize されていたら何もしない + (t + (setq canna:*initialized* t) + (setq init-val (canna-initialize + (if canna-underline 0 1) + canna-server canna-file)) + (cond ((car (cdr (cdr init-val))) + (canna:output-warnings (car (cdr (cdr init-val)))) )) + (cond ((car (cdr init-val)) + (error (car (cdr init-val))) )) + ) ) + + (if (fboundp 'canna-query-mode) + (progn + (canna-change-mode canna-mode-alpha-mode) + (setq canna:*alpha-mode-string* (canna-query-mode)) )) + + (canna-do-function canna-func-japanese-mode) + + (if (fboundp 'canna-query-mode) + (setq canna:*kanji-mode-string* (canna-query-mode))) + + init-val)) + +(defun canna:finalize () + (cond ((null canna:*initialized*)) ; initialize されていなかったら何もしない + (t + (setq canna:*initialized* nil) + (let ((init-val (canna-finalize))) + (cond ((car (cdr (cdr init-val))) + (canna:output-warnings (car (cdr (cdr init-val)))) )) + (cond ((car (cdr init-val)) + (error (car (cdr init-val))) )) + ) + (message "『かんな』の辞書をセーブします。") + ))) + +(defun canna:enter-canna-mode () + (if (not canna:*initialized*) + (progn + (message "『かんな』の初期化を行っています....") + (canna:initialize) + (message "『かんな』の初期化を行っています....done") + )) + (canna-set-width (- (window-width (minibuffer-window)) + (minibuffer-prompt-width) + (if (and display-minibuffer-mode-in-minibuffer + (eq (selected-window) (minibuffer-window))) + (string-width + (let ((new-mode (canna-query-mode))) + (if (string-equal new-mode "") + canna:*saved-mode-string* + new-mode))) + 0))) + (setq canna:*fence-mode* t) + (if (not (featurep 'xemacs)) + (progn + (if (boundp 'buffer-disable-undo) ; append by knak 97.10.21 + (buffer-disable-undo (current-buffer))) ; append by knak 97.10.21 + (if (boundp 'disable-undo) + (set 'disable-undo canna:*fence-mode*))))) ; mew-1.93/patches/canna.el-19.34.patch + +(defun canna:enter-canna-mode-and-functional-insert () + (canna:enter-canna-mode) + (setq canna:*use-region-as-henkan-region* nil) + (setq unread-command-events (list last-command-event))) + +(defun canna:quit-canna-mode () + (cond (canna:*fence-mode* + (setq canna:*fence-mode* nil) + (if canna:*exit-japanese-mode* + (progn + (setq canna:*exit-japanese-mode* nil) + (setq canna-mode-string canna:*alpha-mode-string*) + (if canna:*japanese-mode* + (canna-toggle-japanese-mode) + (mode-line-canna-mode-update canna:*alpha-mode-string*) ))) + (if (not (featurep 'xemacs)) + (progn + (if (boundp 'buffer-disable-undo) ; append by knak 97.10.21 + (buffer-disable-undo (current-buffer))) ; append by knak 97.10.21 + (if (boundp 'disable-undo) + (set 'disable-undo canna:*fence-mode*)))))) + (set-marker canna:*region-start* nil) + (set-marker canna:*region-end* nil) + ) + +(defun canna-touroku () + "Register a word into a kana-to-kanji dictionary." + (interactive) + (if (not canna:*fence-mode*) + (progn + (setq canna:*exit-japanese-mode* (not canna:*japanese-mode*)) + (canna:enter-canna-mode) + (canna:display-candidates (canna-touroku-string "")) ) + (beep) + )) + +(defun canna-without-newline (start end) + (and (not (eq start end)) + (or + (and (<= end (point)) + (save-excursion + (beginning-of-line) + (<= (point) start) )) + (and (<= (point) start) + (save-excursion + (end-of-line) + (<= end (point)) )) + ))) + +(defun canna-touroku-region (start end) + "Register a word which is indicated by region into a kana-to-kanji\n\ +dictionary." + (interactive "r") + (if (canna-without-newline start end) + (if (not canna:*fence-mode*) + (progn + (setq canna:*use-region-as-henkan-region* nil) + (setq canna:*exit-japanese-mode* (not canna:*japanese-mode*)) + (canna:enter-canna-mode) + (canna:display-candidates + (canna-touroku-string (canna-buffer-substring start end))) )) + (message "リージョンが不正です。ヌルリージョンか、改行が含まれています。") + )) + +(defun canna-extend-mode () + "To enter an extend-mode of Canna." + (interactive "*") +; (if (and (not (eq (window-frame (minibuffer-window)) (selected-frame))) +; (not canna:*fence-mode*)) + ;; ミニバッファを分離している時は一時的にフェンスモードに入る + ;; そうしないとメニューを選べない + ;; (focusがミニバッファに行かないから) + (if (not canna:*fence-mode*) + (progn + (setq canna:*exit-japanese-mode* (not canna:*japanese-mode*)) + (canna:enter-canna-mode) + (canna:display-candidates + (canna-do-function canna-func-extend-mode) )) + (beep))) + +(defun canna-kigou-mode () + "Enter symbol choosing mode." + (interactive "*") + (if (not canna:*fence-mode*) + (progn + (setq canna:*exit-japanese-mode* (not canna:*japanese-mode*)) + (canna:enter-canna-mode) + (canna:display-candidates (canna-change-mode canna-mode-kigo-mode)) ) + (beep) + )) + +(defun canna-hex-mode () + "Enter hex code entering mode." + (interactive "*") + (if (not canna:*fence-mode*) + (progn + (setq canna:*exit-japanese-mode* (not canna:*japanese-mode*)) + (canna:enter-canna-mode) + (canna:display-candidates (canna-change-mode canna-mode-hex-mode)) ) + (beep) + )) + +(defun canna-bushu-mode () + "Enter special mode to convert by BUSHU name." + (interactive "*") + (if (not canna:*fence-mode*) + (progn + (setq canna:*exit-japanese-mode* (not canna:*japanese-mode*)) + (canna:enter-canna-mode) + (canna:display-candidates (canna-change-mode canna-mode-bushu-mode)) ) + (beep) + )) + +(defun canna-reset () + (interactive) + (message "『かんな』の辞書をセーブします。"); + (canna:finalize) + (message "『かんな』の再初期化を行っています....") + (canna:initialize) + (message "『かんな』の再初期化を行っています....done") + ) + + +(defun canna () + (interactive) + (message "『かんな』を初期化しています....") + (let (init-val) + (cond ((and (fboundp 'canna-initialize) (fboundp 'canna-change-mode) ) + + ;; canna が使える時は次の処理をする。 + + ;; 配色設定 (by yuuji@ae.keio.ac.jp) + (setq canna:color-p (and canna-use-color + (if window-system + (x-display-color-p) + (or (featurep 'xemacs) + (and (string< "21" emacs-version) + (tty-display-color-p)))))) + ;;カラーの時underlineモードと同じ状態で初期化する必要がある + (setq canna-underline (or canna:color-p canna-underline)) + (cond + (canna:color-p + (setq canna:attr-mode + (cond + (canna-background-mode + (if window-system + (if (eq canna-background-mode 'dark) + 'reverse 'normal) + (if (eq canna-background-mode 'dark) + 'nw-rv 'nw))) + ((eq 'dark + (cond + ((boundp 'hilit-background-mode) + (symbol-value 'hilit-background-mode)) + ((boundp 'frame-background-mode) + frame-background-mode) + ((fboundp 'get-frame-background-mode) + (get-frame-background-mode nil)))) + (if window-system 'reverse 'nw-rv)) + (window-system + (if (string-match + "on\\|t\\|yes" + (or (if (featurep 'xemacs) + (x-get-resource "ReverseVideo" + "reverseVideo" 'string) + (x-get-resource "ReverseVideo" "reverseVideo")) + "")) + 'reverse + 'normal)) + (t 'nw))) + (setq canna:attr-yomi + (if (listp canna-use-color) + (car canna-use-color) + (cdr (assq canna:attr-mode + (assq 'yomi canna:attribute-alist))))) + (setq canna:attr-taishou + (if (listp canna-use-color) + (car (cdr canna-use-color)) + (setq canna:attr-taishou + (cdr (assq + canna:attr-mode + (assq 'taishou canna:attribute-alist)))))) + (setq canna:attr-select + (if (listp canna-use-color) + (car (cdr (cdr canna-use-color))) + (setq canna:attr-select + (cdr (assq canna:attr-mode + (assq 'select canna:attribute-alist)))))) + ;;色づけ用faceの作成 + (condition-case err + (mapcar + (function + (lambda (face) + (let* ((color (symbol-value + (intern (concat "canna:" (symbol-name face))))) + backp) + (make-face face) + (if (stringp color) + (progn + (setq backp (string-match "/" color)) + (set-face-foreground + face (substring color 0 backp)) + (if backp + (set-face-background + face (substring color (1+ backp))))) + (copy-face color face))))) + '(attr-yomi attr-taishou attr-select)) + (error + (message "必要な色数が確保できませんでした") + (sit-for 1) + (setq canna-use-color nil canna-underline nil))) + )) + ;;配色設定終了 + + ;; 『かんな』システムの初期化 + + (setq init-val (canna:initialize)) + + ;; キーのバインディング + + (let ((ch 32)) + (while (< ch 127) + (define-key global-map (make-string 1 ch) 'canna-self-insert-command) + (setq ch (1+ ch)) )) + + (cond ((let ((keys (car init-val)) (ok nil)) + (while keys + (cond ((< (car keys) 128) + (global-set-key + (make-string 1 (car keys)) + 'canna-toggle-japanese-mode) + (setq ok t) )) + (setq keys (cdr keys)) + ) ok)) + (t ; デフォルトの設定 + (global-set-key "\C-o" 'canna-toggle-japanese-mode) )) + + (if (not (keymapp (global-key-binding "\e["))) + (global-unset-key "\e[") ) + (global-set-key "\e[210z" 'canna-toggle-japanese-mode) ; XFER + (define-key global-map [kanji] 'canna-toggle-japanese-mode) + (if canna-do-keybind-for-functionkeys + (progn + (global-set-key "\e[28~" 'canna-extend-mode) ; HELP on EWS4800 + (global-set-key "\e[2~" 'canna-kigou-mode) ; INS on EWS4800 + (global-set-key "\e[11~" 'canna-kigou-mode) + (global-set-key "\e[12~" 'canna-hex-mode) + (global-set-key "\e[13~" 'canna-bushu-mode) + (define-key global-map [help] 'canna-extend-mode) + (define-key global-map [insert] 'canna-kigou-mode) + (define-key global-map [f1] 'canna-kigou-mode) + (define-key global-map [f2] 'canna-hex-mode) + (define-key global-map [f3] 'canna-bushu-mode) + )) + + (if canna-use-space-key-as-henkan-region + (progn + (global-set-key "\C-@" 'canna-set-mark-command) + ;; X Window は C-@ と C-SPC を区別するので、これが必要。 + (global-set-key [?\C-\ ] 'canna-set-mark-command) + (global-set-key " " 'canna-henkan-region-or-self-insert) )) + + ;; モード行の作成 + + (canna:create-mode-line) + (mode-line-canna-mode-update canna:*alpha-mode-string*) + + ;; システム関数の書き替え + +; (fset 'abort-recursive-edit +; (symbol-function 'canna:abort-recursive-edit)) +; (fset 'keyboard-quit +; (symbol-function 'canna:keyboard-quit)) + + ) + + ((fboundp 'canna-initialize) + (beep) + (with-output-to-temp-buffer "*canna-warning*" + (princ "この Mule では new-canna が使えません") + (terpri) + (print-help-return-message)) ) + + (t ; 『かんな』システムが使えなかった時の処理 + (beep) + (with-output-to-temp-buffer "*canna-warning*" + (princ "この Mule では canna が使えません") + (terpri) + (print-help-return-message)) + )) + (message "『かんな』を初期化しています....done") + ) ) + +;;; +;;; auto fill control (from egg) +;;; + +(defun canna:do-auto-fill () + (if (and auto-fill-function (not buffer-read-only) + (> (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))))) + +(defun canna:output-warnings (mesg) + (with-output-to-temp-buffer "*canna-warning*" + (while mesg + (princ (car mesg)) + (terpri) + (setq mesg (cdr mesg)) ) + (print-help-return-message))) + +(defun canna-undo (&optional arg) + (interactive "*P") + (if (and canna:*undo-text-yomi* + (eq (current-buffer) (marker-buffer canna:*spos-undo-text*)) +; (canna-without-newline canna:*spos-undo-text* +; canna:*epos-undo-text*) + ) + (progn + (message "読みに戻します!") +; (switch-to-buffer (marker-buffer canna:*spos-undo-text*)) + (goto-char canna:*spos-undo-text*) + (delete-region canna:*spos-undo-text* + canna:*epos-undo-text*) + + (if (null canna:*japanese-mode*) + (progn + (setq canna:*exit-japanese-mode* t) )) +; (canna-toggle-japanese-mode) )) + (if (not canna:*fence-mode*) + ;; フェンスモードだったらもう一度フェンスモードに入ったりし + ;; ない。 + (canna:enter-canna-mode) ) + (canna:display-candidates + (let ((texts (canna-store-yomi + (if (and (not (featurep 'xemacs)) + (string< "20.2" emacs-version)) + (encode-coding-string (car canna:*undo-text-yomi*) + 'japanese-iso-8bit) + (car canna:*undo-text-yomi*)) + (cdr canna:*undo-text-yomi*) )) ) + (cond (canna-undo-hook + (funcall canna-undo-hook)) + (t texts) ))) + (canna-abandon-undo-info)) + (undo arg))) + +(defun canna-abandon-undo-info () + (interactive) + (setq canna:*undo-text-yomi* nil) + (set-marker canna:*spos-undo-text* nil) + (set-marker canna:*epos-undo-text* nil) ) + +(defun canna-henkan-region (start end) + "Convert a text which is indicated by region into a kanji text." + (interactive "*r") + (if (null canna:*japanese-mode*) + (progn + (setq canna:*exit-japanese-mode* t) )) + (let ((res nil)) + (setq res (canna-store-yomi (canna-buffer-substring start end))) + (delete-region start end) + (canna:enter-canna-mode) + (if (fboundp 'canna-do-function) + (setq res (canna-do-function canna-func-henkan))) + (canna:display-candidates res) )) + +;;; +;;; マークコマンド,canna-henkan-region-or-self-insert で使うかも +;;; + +(defun canna-set-mark-command (arg) + "Besides setting mark, set mark as a HENKAN region if it is in\n\ +the japanese mode." + (interactive "P") + (set-mark-command arg) + (if canna:*japanese-mode* + (progn + (setq canna:*use-region-as-henkan-region* t) + (message "Mark set(変換領域開始)") ))) + +(defun canna-henkan-region-or-self-insert (arg) + "Do kana-to-kanji convert region if HENKAN region is defined,\n\ +self insert otherwise." + (interactive "*p") + (if (and canna:*use-region-as-henkan-region* +; (< (mark) (point)) +; (not (save-excursion (beginning-of-line) (< (mark) (point)))) ) + (canna-without-newline (region-beginning) (region-end))) + (progn + (setq canna:*use-region-as-henkan-region* nil) + (canna-henkan-region (region-beginning) (region-end))) + (canna-self-insert-command arg) )) + +;; +;; for C-mode +;; + +(eval-when-compile + (autoload 'electric-c-terminator "c-mode" nil t) + (autoload 'electric-c-semi "c-mode" nil t) + (autoload 'electric-c-brace "c-mode" nil t)) + +(defun canna-electric-c-terminator (arg) + (interactive "P") + (if canna:*japanese-mode* + (canna-self-insert-command arg) + (electric-c-terminator arg) )) + +(defun canna-electric-c-semi (arg) + (interactive "P") + (if canna:*japanese-mode* + (canna-self-insert-command arg) + (electric-c-semi arg) )) + +(defun canna-electric-c-brace (arg) + (interactive "P") + (if canna:*japanese-mode* + (canna-self-insert-command arg) + (electric-c-brace arg) )) + +(defun canna-c-mode-hook () + (let ((map (symbol-value 'c-mode-map))) + (define-key map "{" 'canna-electric-c-brace) + (define-key map "}" 'canna-electric-c-brace) + (define-key map ";" 'canna-electric-c-semi) + (define-key map ":" 'canna-electric-c-terminator))) + +;; +;; for CC-mode +;; + +(eval-when-compile + (autoload 'c-electric-colon "cc-cmds" nil t) + (autoload 'c-electric-semi&comma "cc-cmds" nil t) + (autoload 'c-electric-brace "cc-cmds" nil t)) + +(defun canna-c-electric-colon (arg) + (interactive "P") + (if canna:*japanese-mode* + (canna-self-insert-command arg) + (c-electric-colon arg))) + +(defun canna-c-electric-semi&comma (arg) + (interactive "P") + (if canna:*japanese-mode* + (canna-self-insert-command arg) + (c-electric-semi&comma arg))) + +(defun canna-c-electric-brace (arg) + (interactive "P") + (if canna:*japanese-mode* + (canna-self-insert-command arg) + (c-electric-brace arg))) + +(defun canna-cc-mode-hook () + (let ((map (symbol-value 'c-mode-base-map))) + (define-key map "{" 'canna-c-electric-brace) + (define-key map "}" 'canna-c-electric-brace) + (define-key map ";" 'canna-c-electric-semi&comma) + (define-key map ":" 'canna-c-electric-colon))) + +(defun canna-set-fence-mode-format (fence sep underline) + (setq canna-with-fences fence) + (canna-set-bunsetsu-kugiri sep) + (setq canna-underline underline) +) + +;; リージョンにあるローマ字を『かんな』に食わす。 +;; 結果として、『かんな』の読みモードになる。 +;; リージョンに存在している空白文字と制御文字は捨てられる。 + +(defun canna-rk-region (start end) + "Convert region into kana." + (interactive "*r") + (let ((str nil) (len 0) (i 0) (res 0)) + (setq str (buffer-substring start end)) + (setq len (length str)) + (while (< i len) + (let ((ch (elt str i))) + (if (> ch ? ) + (setq res (canna-do-function canna-func-functional-insert ch)) )) + (setq i (1+ i)) ) + res)) + +(defun canna-rk-trans-region (start end) + "Insert alpha-numeric string as it is sent from keyboard." + (interactive "*r") + (let ((res)) + (setq res (canna-rk-region start end)) + (delete-region start end) + (if (null canna:*japanese-mode*) + (progn + (setq canna:*exit-japanese-mode* t) )) + (setq res (canna-do-function canna-func-henkan)) + (canna:enter-canna-mode) + (canna:display-candidates res) )) + +;; カーソルの左にある arg ワードのローマ字を『かんな』に食わす。 + +(defun canna-rk-trans (arg) + (interactive "*p") + (let ((po (point))) + (skip-chars-backward "-a-zA-Z.,?!~") + (if (not (eq (point) po)) + (canna-rk-trans-region (point) po) ))) + +(defun canna-henkan-kakutei-and-self-insert (arg) + (interactive "*p") + (if canna:*japanese-mode* + (canna-functional-insert-command arg) + (progn + (setq unread-command-events (list last-command-event)) + (canna-kakutei-to-basic-stat)) )) + +(defun canna-kakutei-to-basic-stat () + (let ((res 0) + (kakutei canna-henkan-string)) + (while (not canna-empty-info) +; (setq res (canna-key-proc ?\C-m))) + (setq res (canna-do-function canna-func-kakutei))) + (setq canna-kakutei-string kakutei) + (canna:display-candidates (length canna-kakutei-string)) + (if (not canna:*japanese-mode*) + (mode-line-canna-mode-update canna:*alpha-mode-string*)) + )) + +(defun canna-minibuffer-henkan-kakutei-and-self-insert (arg) + (interactive "p") + (set-window-buffer (minibuffer-window) canna:*saved-minibuffer*) + (select-window canna:*previous-window*) + (if canna:*japanese-mode* + (canna:functional-insert-command2 last-command-event arg) + (progn + (setq unread-command-events (list last-command-event)) + (canna-kakutei-to-basic-stat)) )) + +(defun canna-setup-for-being-boiled () + (let ((ch (1+ ? ))) + (while (< ch 127) + (define-key canna-mode-map (make-string 1 ch) 'canna-henkan-kakutei-and-self-insert) + (define-key canna-minibuffer-mode-map (make-string 1 ch) 'canna-minibuffer-henkan-kakutei-and-self-insert) + (setq ch (1+ ch))))) + +(defvar rK-trans-key "\C-j" "for `boil' only") +(make-variable-buffer-local 'rK-trans-key) + +(defun canna-boil () + "`canna-boil' cooks `canna' as if `boil' does for `egg'." + (interactive) + (canna-setup-for-being-boiled) + (local-set-key rK-trans-key 'canna-rk-trans) + (message "boiled")) + +;; +;; 色づけのための関数 +;; +(defun canna:yomi-attr-on (start end) + (if (overlayp canna:*yomi-overlay*) + (move-overlay canna:*yomi-overlay* start end) + (overlay-put (setq canna:*yomi-overlay* + (apply + 'make-overlay start end nil nil + (if (string< "20.2" emacs-version) (list t)))) + 'face + (if canna:color-p 'attr-yomi 'underline)))) + +(defun canna:yomi-attr-off (start end); + (and (overlayp canna:*yomi-overlay*) + (delete-overlay canna:*yomi-overlay*))) + +(defun canna:henkan-attr-on (start end) + (if (overlayp canna:*henkan-overlay*) + (move-overlay canna:*henkan-overlay* start end) + (overlay-put (setq canna:*henkan-overlay* + (apply + 'make-overlay start end nil nil + (if (string< "20.2" emacs-version) (list t)))) + 'face + (if canna:color-p 'attr-taishou 'region)))) + +(defun canna:henkan-attr-off (start end) + (and (overlayp canna:*henkan-overlay*) + (delete-overlay canna:*henkan-overlay*))) + +(defun canna:select-attr-on (start end) + (if (overlayp canna:*select-overlay*) + (move-overlay canna:*select-overlay* start end) + (overlay-put (setq canna:*select-overlay* + (apply + 'make-overlay start end nil nil + (if (string< "20.2" emacs-version) (list t)))) + 'face + 'attr-select))) + +(defun canna:select-attr-off (start end) + (and (overlayp canna:*select-overlay*) + (delete-overlay canna:*select-overlay*))) + +(eval-when-compile + (autoload 'picture-substitute "picture")) +(if (featurep 'picture) + (progn + (picture-substitute 'self-insert-command 'canna-self-insert-command) + (picture-substitute 'completion-separator-self-insert-command + 'canna-self-insert-command) + (picture-substitute 'completion-separator-self-insert-autofilling + 'canna-self-insert-command))) + +(provide 'canna) --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/egg-jsymbol.el 2007-06-03 23:21:07 +0000 @@ -0,0 +1,914 @@ +;; Japanese Character Input Package for Egg +;; Coded by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp) + +;; This file is part of Egg on Mule (Multilingal Environment) + +;; Egg is distributed in the forms of patches to GNU +;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC +;; LICENSE which is distributed along with GNU Emacs by the +;; Free Software Foundation. + +;; 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 EMACS GENERAL PUBLIC LICENSE for +;; more details. + +;; You should have received a copy of the GNU EMACS GENERAL +;; PUBLIC LICENSE along with Nemacs; see the file COPYING. +;; If not, write to the Free Software Foundation, 675 Mass +;; Ave, Cambridge, MA 02139, USA. + +;;; 92.10.18 modified for Mule Ver.0.9.6 by K.Handa <handa@etl.go.jp> +;;; Moved from egg.el +;;; 92.12.26 modified for Mule Ver.0.9.7 by T.Shingu <shingu@cpr.canon.co.jp> +;;; JIS Hojo Kanji support. + +(provide 'egg-jsymbol) + +(defvar *ku1-alist* '( + ( " " . " ") + ( "、" . "、") + ( "。" . "。") + ( "," . ",") + ( "." . ".") + ( "・" . "・") + ( ":" . ":") + ( ";" . ";") + ( "?" . "?") + ( "!" . "!") + ( "゛" . "゛") + ( "゜" . "゜") + ( "´" . "´") + ( "`" . "`") + ( "¨" . "¨") + ( "^" . "^") + ( " ̄" . " ̄") + ( "_" . "_") + ( "ヽ" . "ヽ") + ( "ヾ" . "ヾ") + ( "ゝ" . "ゝ") + ( "ゞ" . "ゞ") + ( "〃" . "〃") + ( "仝" . "仝") + ( "々" . "々") + ( "〆" . "〆") + ( "〇" . "〇") + ( "ー" . "ー") + ( "―" . "―") + ( "‐" . "‐") + ( "/" . "/") + ( "\" . "\") + ( "~" . "~") + ( "∥" . "∥") + ( "|" . "|") + ( "…" . "…") + ( "‥" . "‥") + ( "‘" . "‘") + ( "’" . "’") + ( "“" . "“") + ( "”" . "”") + ( "(" . "(") + ( ")" . ")") + ( "〔" . "〔") + ( "〕" . "〕") + ( "[" . "[") + ( "]" . "]") + ( "{" . "{") + ( "}" . "}") + ( "〈" . "〈") + ( "〉" . "〉") + ( "《" . "《") + ( "》" . "》") + ( "「" . "「") + ( "」" . "」") + ( "『" . "『") + ( "』" . "』") + ( "【" . "【") + ( "】" . "】") + ( "+" . "+") + ( "-" . "-") + ( "±" . "±") + ( "×" . "×") + ( "÷" . "÷") + ( "=" . "=") + ( "≠" . "≠") + ( "<" . "<") + ( ">" . ">") + ( "≦" . "≦") + ( "≧" . "≧") + ( "∞" . "∞") + ( "∴" . "∴") + ( "♂" . "♂") + ( "♀" . "♀") + ( "°" . "°") + ( "′" . "′") + ( "″" . "″") + ( "℃" . "℃") + ( "¥" . "¥") + ( "$" . "$") + ( "¢" . "¢") + ( "£" . "£") + ( "%" . "%") + ( "#" . "#") + ( "&" . "&") + ( "*" . "*") + ( "@" . "@") + ( "§" . "§") + ( "☆" . "☆") + ( "★" . "★") + ( "○" . "○") + ( "●" . "●") + ( "◎" . "◎") + ( "◇" . "◇") +)) +(defvar *ku2-alist* '( + ( "◆" . "◆") + ( "□" . "□") + ( "■" . "■") + ( "△" . "△") + ( "▲" . "▲") + ( "▽" . "▽") + ( "▼" . "▼") + ( "※" . "※") + ( "〒" . "〒") + ( "→" . "→") + ( "←" . "←") + ( "↑" . "↑") + ( "↓" . "↓") + ( "〓" . "〓") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") + ( "∈" . "∈") + ( "∋" . "∋") + ( "⊆" . "⊆") + ( "⊇" . "⊇") + ( "⊂" . "⊂") + ( "⊃" . "⊃") + ( "∪" . "∪") + ( "∩" . "∩") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") + ( "∧" . "∧") + ( "∨" . "∨") + ( "¬" . "¬") + ( "⇒" . "⇒") + ( "⇔" . "⇔") + ( "∀" . "∀") + ( "∃" . "∃") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") + ( "∠" . "∠") + ( "⊥" . "⊥") + ( "⌒" . "⌒") + ( "∂" . "∂") + ( "∇" . "∇") + ( "≡" . "≡") + ( "≒" . "≒") + ( "≪" . "≪") + ( "≫" . "≫") + ( "√" . "√") + ( "∽" . "∽") + ( "∝" . "∝") + ( "∵" . "∵") + ( "∫" . "∫") + ( "∬" . "∬") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") + ( "Å" . "Å") + ( "‰" . "‰") + ( "♯" . "♯") + ( "♭" . "♭") + ( "♪" . "♪") + ( "†" . "†") + ( "‡" . "‡") + ( "¶" . "¶") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") + ( "◯" . "◯") +)) + +(defvar egg:*symbol-alist* (append *ku1-alist* *ku2-alist*)) + +(defvar *ku3-alist* '( +;I ( "�" . "�") +;II ( "�" . "�") +;III ( "�" . "�") +;IV ( "�" . "�") +;V ( "�" . "�") +;VI ( "�" . "�") +;VII ( "�" . "�") +;VIII ( "�" . "�") +;IX ( "�" . "�") +;X ( "�" . "�") +;XI ( "�" . "�") +;XII ( "�" . "�") +;XIII ( "�" . "�") +;XIV ( "�" . "�") +;XV ( "�" . "�") + ( "0" . "0") + ( "1" . "1") + ( "2" . "2") + ( "3" . "3") + ( "4" . "4") + ( "5" . "5") + ( "6" . "6") + ( "7" . "7") + ( "8" . "8") + ( "9" . "9") +;1/2 ( "�" . "�") +;1/3 ( "�" . "�") +;1/4 ( "�" . "�") +;2/3 ( "�" . "�") +;3/4 ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") + ( "A" . "A") + ( "B" . "B") + ( "C" . "C") + ( "D" . "D") + ( "E" . "E") + ( "F" . "F") + ( "G" . "G") + ( "H" . "H") + ( "I" . "I") + ( "J" . "J") + ( "K" . "K") + ( "L" . "L") + ( "M" . "M") + ( "N" . "N") + ( "O" . "O") + ( "P" . "P") + ( "Q" . "Q") + ( "R" . "R") + ( "S" . "S") + ( "T" . "T") + ( "U" . "U") + ( "V" . "V") + ( "W" . "W") + ( "X" . "X") + ( "Y" . "Y") + ( "Z" . "Z") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") + ( "a" . "a") + ( "b" . "b") + ( "c" . "c") + ( "d" . "d") + ( "e" . "e") + ( "f" . "f") + ( "g" . "g") + ( "h" . "h") + ( "i" . "i") + ( "j" . "j") + ( "k" . "k") + ( "l" . "l") + ( "m" . "m") + ( "n" . "n") + ( "o" . "o") + ( "p" . "p") + ( "q" . "q") + ( "r" . "r") + ( "s" . "s") + ( "t" . "t") + ( "u" . "u") + ( "v" . "v") + ( "w" . "w") + ( "x" . "x") + ( "y" . "y") + ( "z" . "z") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +)) + +(defvar egg:*alphanumeric-alist* *ku3-alist*) + +(defvar *ku4-alist* '( + + ( "ぁ" . "ぁ") + ( "あ" . "あ") + ( "ぃ" . "ぃ") + ( "い" . "い") + ( "ぅ" . "ぅ") + ( "う" . "う") + ( "ぇ" . "ぇ") + ( "え" . "え") + ( "ぉ" . "ぉ") + ( "お" . "お") + ( "か" . "か") + ( "が" . "が") + ( "き" . "き") + ( "ぎ" . "ぎ") + ( "く" . "く") + ( "ぐ" . "ぐ") + ( "け" . "け") + ( "げ" . "げ") + ( "こ" . "こ") + ( "ご" . "ご") + ( "さ" . "さ") + ( "ざ" . "ざ") + ( "し" . "し") + ( "じ" . "じ") + ( "す" . "す") + ( "ず" . "ず") + ( "せ" . "せ") + ( "ぜ" . "ぜ") + ( "そ" . "そ") + ( "ぞ" . "ぞ") + ( "た" . "た") + ( "だ" . "だ") + ( "ち" . "ち") + ( "ぢ" . "ぢ") + ( "っ" . "っ") + ( "つ" . "つ") + ( "づ" . "づ") + ( "て" . "て") + ( "で" . "で") + ( "と" . "と") + ( "ど" . "ど") + ( "な" . "な") + ( "に" . "に") + ( "ぬ" . "ぬ") + ( "ね" . "ね") + ( "の" . "の") + ( "は" . "は") + ( "ば" . "ば") + ( "ぱ" . "ぱ") + ( "ひ" . "ひ") + ( "び" . "び") + ( "ぴ" . "ぴ") + ( "ふ" . "ふ") + ( "ぶ" . "ぶ") + ( "ぷ" . "ぷ") + ( "へ" . "へ") + ( "べ" . "べ") + ( "ぺ" . "ぺ") + ( "ほ" . "ほ") + ( "ぼ" . "ぼ") + ( "ぽ" . "ぽ") + ( "ま" . "ま") + ( "み" . "み") + ( "む" . "む") + ( "め" . "め") + ( "も" . "も") + ( "ゃ" . "ゃ") + ( "や" . "や") + ( "ゅ" . "ゅ") + ( "ゆ" . "ゆ") + ( "ょ" . "ょ") + ( "よ" . "よ") + ( "ら" . "ら") + ( "り" . "り") + ( "る" . "る") + ( "れ" . "れ") + ( "ろ" . "ろ") + ( "ゎ" . "ゎ") + ( "わ" . "わ") + ( "ゐ" . "ゐ") + ( "ゑ" . "ゑ") + ( "を" . "を") + ( "ん" . "ん") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +)) + +(defvar egg:*hiragana-alist* *ku4-alist*) + +(defvar *ku5-alist* '( + ( "ァ" . "ァ") + ( "ア" . "ア") + ( "ィ" . "ィ") + ( "イ" . "イ") + ( "ゥ" . "ゥ") + ( "ウ" . "ウ") + ( "ェ" . "ェ") + ( "エ" . "エ") + ( "ォ" . "ォ") + ( "オ" . "オ") + ( "カ" . "カ") + ( "ガ" . "ガ") + ( "キ" . "キ") + ( "ギ" . "ギ") + ( "ク" . "ク") + ( "グ" . "グ") + ( "ケ" . "ケ") + ( "ゲ" . "ゲ") + ( "コ" . "コ") + ( "ゴ" . "ゴ") + ( "サ" . "サ") + ( "ザ" . "ザ") + ( "シ" . "シ") + ( "ジ" . "ジ") + ( "ス" . "ス") + ( "ズ" . "ズ") + ( "セ" . "セ") + ( "ゼ" . "ゼ") + ( "ソ" . "ソ") + ( "ゾ" . "ゾ") + ( "タ" . "タ") + ( "ダ" . "ダ") + ( "チ" . "チ") + ( "ヂ" . "ヂ") + ( "ッ" . "ッ") + ( "ツ" . "ツ") + ( "ヅ" . "ヅ") + ( "テ" . "テ") + ( "デ" . "デ") + ( "ト" . "ト") + ( "ド" . "ド") + ( "ナ" . "ナ") + ( "ニ" . "ニ") + ( "ヌ" . "ヌ") + ( "ネ" . "ネ") + ( "ノ" . "ノ") + ( "ハ" . "ハ") + ( "バ" . "バ") + ( "パ" . "パ") + ( "ヒ" . "ヒ") + ( "ビ" . "ビ") + ( "ピ" . "ピ") + ( "フ" . "フ") + ( "ブ" . "ブ") + ( "プ" . "プ") + ( "ヘ" . "ヘ") + ( "ベ" . "ベ") + ( "ペ" . "ペ") + ( "ホ" . "ホ") + ( "ボ" . "ボ") + ( "ポ" . "ポ") + ( "マ" . "マ") + ( "ミ" . "ミ") + ( "ム" . "ム") + ( "メ" . "メ") + ( "モ" . "モ") + ( "ャ" . "ャ") + ( "ヤ" . "ヤ") + ( "ュ" . "ュ") + ( "ユ" . "ユ") + ( "ョ" . "ョ") + ( "ヨ" . "ヨ") + ( "ラ" . "ラ") + ( "リ" . "リ") + ( "ル" . "ル") + ( "レ" . "レ") + ( "ロ" . "ロ") + ( "ヮ" . "ヮ") + ( "ワ" . "ワ") + ( "ヰ" . "ヰ") + ( "ヱ" . "ヱ") + ( "ヲ" . "ヲ") + ( "ン" . "ン") + ( "ヴ" . "ヴ") + ( "ヵ" . "ヵ") + ( "ヶ" . "ヶ") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +)) + +(defvar egg:*katakana-alist* *ku5-alist*) + +(defvar *ku6-alist* '( + ( "Α" . "Α") + ( "Β" . "Β") + ( "Γ" . "Γ") + ( "Δ" . "Δ") + ( "Ε" . "Ε") + ( "Ζ" . "Ζ") + ( "Η" . "Η") + ( "Θ" . "Θ") + ( "Ι" . "Ι") + ( "Κ" . "Κ") + ( "Λ" . "Λ") + ( "Μ" . "Μ") + ( "Ν" . "Ν") + ( "Ξ" . "Ξ") + ( "Ο" . "Ο") + ( "Π" . "Π") + ( "Ρ" . "Ρ") + ( "Σ" . "Σ") + ( "Τ" . "Τ") + ( "Υ" . "Υ") + ( "Φ" . "Φ") + ( "Χ" . "Χ") + ( "Ψ" . "Ψ") + ( "Ω" . "Ω") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") + ( "α" . "α") + ( "β" . "β") + ( "γ" . "γ") + ( "δ" . "δ") + ( "ε" . "ε") + ( "ζ" . "ζ") + ( "η" . "η") + ( "θ" . "θ") + ( "ι" . "ι") + ( "κ" . "κ") + ( "λ" . "λ") + ( "μ" . "μ") + ( "ν" . "ν") + ( "ξ" . "ξ") + ( "ο" . "ο") + ( "π" . "π") + ( "ρ" . "ρ") + ( "σ" . "σ") + ( "τ" . "τ") + ( "υ" . "υ") + ( "φ" . "φ") + ( "χ" . "χ") + ( "ψ" . "ψ") + ( "ω" . "ω") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +;(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) ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +)) + +(defvar egg:*greek-alist* *ku6-alist*) + +(defvar *ku7-alist* '( + ( "А" . "А") + ( "Б" . "Б") + ( "В" . "В") + ( "Г" . "Г") + ( "Д" . "Д") + ( "Е" . "Е") + ( "Ё" . "Ё") + ( "Ж" . "Ж") + ( "З" . "З") + ( "И" . "И") + ( "Й" . "Й") + ( "К" . "К") + ( "Л" . "Л") + ( "М" . "М") + ( "Н" . "Н") + ( "О" . "О") + ( "П" . "П") + ( "Р" . "Р") + ( "С" . "С") + ( "Т" . "Т") + ( "У" . "У") + ( "Ф" . "Ф") + ( "Х" . "Х") + ( "Ц" . "Ц") + ( "Ч" . "Ч") + ( "Ш" . "Ш") + ( "Щ" . "Щ") + ( "Ъ" . "Ъ") + ( "Ы" . "Ы") + ( "Ь" . "Ь") + ( "Э" . "Э") + ( "Ю" . "Ю") + ( "Я" . "Я") +;(1) ( "�" . "�") +;(2) ( "�" . "�") +;(3) ( "�" . "�") +;(4) ( "�" . "�") +;(5) ( "�" . "�") +;(6) ( "�" . "�") +;(7) ( "�" . "�") +;(8) ( "�" . "�") +;(9) ( "�" . "�") +;(10) ( "�" . "�") +;(11) ( "�" . "�") +;(12) ( "�" . "�") +;(13) ( "�" . "�") +;(14) ( "�" . "�") +;(15) ( "�" . "�") + ( "а" . "а") + ( "б" . "б") + ( "в" . "в") + ( "г" . "г") + ( "д" . "д") + ( "е" . "е") + ( "ё" . "ё") + ( "ж" . "ж") + ( "з" . "з") + ( "и" . "и") + ( "й" . "й") + ( "к" . "к") + ( "л" . "л") + ( "м" . "м") + ( "н" . "н") + ( "о" . "о") + ( "п" . "п") + ( "р" . "р") + ( "с" . "с") + ( "т" . "т") + ( "у" . "у") + ( "ф" . "ф") + ( "х" . "х") + ( "ц" . "ц") + ( "ч" . "ч") + ( "ш" . "ш") + ( "щ" . "щ") + ( "ъ" . "ъ") + ( "ы" . "ы") + ( "ь" . "ь") + ( "э" . "э") + ( "ю" . "ю") + ( "я" . "я") +;i ( "�" . "�") +;ii ( "�" . "�") +;iii ( "�" . "�") +;iv ( "�" . "�") +;v ( "�" . "�") +;vi ( "�" . "�") +;vii ( "�" . "�") +;viii ( "�" . "�") +;ix ( "�" . "�") +;x ( "�" . "�") +;| ( "�" . "�") +;' ( "�" . "�") +;'' ( "�" . "�") +)) + +(defvar egg:*russian-alist* *ku7-alist*) + +(defvar *ku8-alist* '( + ( "─" . "─") + ( "│" . "│") + ( "┌" . "┌") + ( "┐" . "┐") + ( "┘" . "┘") + ( "└" . "└") + ( "├" . "├") + ( "┬" . "┬") + ( "┤" . "┤") + ( "┴" . "┴") + ( "┼" . "┼") + ( "━" . "━") + ( "┃" . "┃") + ( "┏" . "┏") + ( "┓" . "┓") + ( "┛" . "┛") + ( "┗" . "┗") + ( "┣" . "┣") + ( "┳" . "┳") + ( "┫" . "┫") + ( "┻" . "┻") + ( "╋" . "╋") + ( "┠" . "┠") + ( "┯" . "┯") + ( "┨" . "┨") + ( "┷" . "┷") + ( "┿" . "┿") + ( "┝" . "┝") + ( "┰" . "┰") + ( "┥" . "┥") + ( "┸" . "┸") + ( "╂" . "╂") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +;* ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +; ( "�" . "�") +)) + +(defvar egg:*keisen-alist* *ku8-alist*) + +(defun make-all-jis-code-alist () + (let ((result nil) (ku 116)) + (while (< 32 ku) + (let ((ten 126)) + (while (< 32 ten) + (setq result (cons + (let ((str (make-string 1 0))) + (aset str 0 (make-char 'japanese-jisx0208 ku ten)) + (cons str str)) + result)) + (setq ten (1- ten)))) + (setq ku (1- ku))) + result)) + +(defun make-jis-first-level-code-alist () + (let ((result nil) (ku 79)) + (while (<= 48 ku) + (let ((ten 126)) + (while (<= 33 ten) + (setq result (cons + (let ((str (make-string 1 0))) + (aset str 0 (make-char 'japanese-jisx0208 ku ten)) + (cons str str)) + result)) + (setq ten (1- ten)))) + (setq ku (1- ku))) + result)) + +(defun make-jis-second-level-code-alist () + (let ((result nil) (ku 116)) + (while (<= 80 ku) + (let ((ten 126)) + (while (<= 33 ten) + (setq result (cons + (let ((str (make-string 1 0))) + (aset str 0 (make-char 'japanese-jisx0208 ku ten)) + (cons str str)) + result)) + (setq ten (1- ten)))) + (setq ku (1- ku))) + result)) + +(defun make-jis-hojo-kanji-code-alist () + (let ((result nil) (ku 109)) + (while (<= 34 ku) + (let ((ten 126)) + (while (<= 33 ten) + (setq result (cons + (let ((str (make-string 1 0))) ; by T.Shingu + (aset str 0 (make-char 'japanese-jisx0212 ku ten)) + (cons str str)) + result)) + (setq ten (1- ten)))) + (setq ku (1- ku))) + result)) + +;;;(defvar egg:*all-jis-code-alist* (make-all-jis-code-alist)) + +(defvar egg:*first-level-alist* (make-jis-first-level-code-alist)) +(defvar egg:*second-level-alist* (make-jis-second-level-code-alist)) +(defvar egg:*hojo-kanji-alist* (make-jis-hojo-kanji-code-alist)) + +(defvar *symbol-input-menu* + (list 'menu "記号入力:" + (list + (cons "JIS入力" + '(jis-code-input)) + (cons "記号" + (list 'menu "記号:" egg:*symbol-alist*)) + (cons "英数字" + (list 'menu "英数字:" egg:*alphanumeric-alist*)) + (cons "ひらがな" + (list 'menu "ひらがな:" egg:*hiragana-alist*)) + (cons "カタカナ" + (list 'menu "カタカナ:" egg:*katakana-alist*)) + (cons "ギリシャ文字" + (list 'menu "ギリシャ文字:" egg:*greek-alist*)) + (cons "ロシア文字" + (list 'menu "ロシア文字:" egg:*russian-alist*)) + (cons "罫線" + (list 'menu "罫線:" egg:*keisen-alist*)) + ;; 92.7.8 by T.Shingu + (cons "部首入力" + '(busyu-input)) + (cons "画数入力" + '(kakusuu-input)) + ;; end of patch + (cons "第一水準" + (list 'menu "第一水準:" egg:*first-level-alist*)) + (cons "第二水準" + (list 'menu "第二水準:" egg:*second-level-alist*)) + (cons "補助漢字" + (list 'menu "補助漢字:" egg:*hojo-kanji-alist*)) + ;; (cons "全コード(少し時間が掛かります。)" + ;; (list 'menu "全コード:" egg:*all-jis-code-alist*)) + ))) --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/egg-keymap.el 2007-06-03 23:21:07 +0000 @@ -0,0 +1,118 @@ +;; Usefull key binding for Sun Function keys +;; Coded by Yutaka Ishikawa at ETL (yisikawa@etl.junet) + +;; This file is part of Egg on Mule (Multilingual Environment) + +;; 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 Mule; see the file COPYING. If not, write to +;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + +;;; 92.4.16 modified for Mule Ver.0.9.3 by K.Handa <handa@etl.go.jp> + +;; +;; Table of Function key codes: +;; +;;; x11term xterm +;;; +;;; XK_F1: [f1] "\e[11~" +;;; XK_F2: [f2] "\e[12~" +;;; XK_F3: [f3] "\e[13~" +;;; XK_F4: [f4] "\e[14~" +;;; XK_F5: [f5] "\e[15~" +;;; XK_F6: [f5] "\e[17~" +;;; XK_F7: [f7] "\e[18~" +;;; XK_F8: [f8] "\e[19~" +;;; XK_F9: [f9] "\e[20~" +;;; +;;; XK_F10: [f10] "\e[21~" +;;; XK_F11: [f11] "\e[23~" +;;; XK_F12: [f12] "\e[24~" +;;; XK_F13: [f13] "\e[25~" +;;; XK_F14: [f14] "\e[26~" +;;; XK_F15: [f15] "\e[28~" +;;; XK_Help: [help] "\e[28~" +;;; XK_F16: [f16] "\e[29~" +;;; XK_Menu: ??? "\e[29~" +;;; XK_F17: [f17] "\e[31~" +;;; XK_F18: [f18] "\e[32~" +;;; XK_F19: [f19] "\e[33~" +;;; XK_F20: [f20] "\e[34~" +;;; +;;; XK_Find : [find] "\e[1~" +;;; XK_Insert: [insert] "\e[2~" +;;; XK_Delete: [delete] "\e[3~" +;;; XK_Select: ??? "\e[4~" +;;; XK_Prior: [prior] "\e[5~" +;;; XK_Next: [next] "\e[6~" +;;; +;;; XK_Left: [left] "\eOC"(XK_R12) +;;; XK_Right: [right] "\eOD"(XK_R10) +;;; XK_Up: [up] "\eOA"(XK_R8) +;;; XK_Down: [down] "\eOB"(XK_R10) +;;; + +;;; +;;; Key bindings for X11 terminals(x11term) +;;; + +(define-key global-map [f1] 'set-buffer-file-coding-system) +(define-key global-map [f2] 'edit-dict-item) +(define-key global-map [f3] 'jis-code-input) +(define-key global-map [f4] 'toroku-region) +(define-key global-map [f5] 'japanese-zenkaku-region) +(define-key global-map [f6] 'japanese-hankaku-region) +(define-key global-map [f7] 'japanese-katakana-region) +(define-key global-map [f8] 'japanese-hiragana-region) +(define-key global-map [f9] 'henkan-region) + +(define-key global-map [f11] 'insert-buffer) +(define-key global-map [f12] 'insert-file) +(define-key global-map [f13] 'eval-region) +(define-key global-map [f14] 'eval-current-buffer) +(define-key global-map [f15] 'enlarge-window) +(define-key global-map [f16] 'shrink-window) +(define-key global-map [f17] 'revert-buffer) +(define-key global-map [f18] 'revert-buffer) +(define-key global-map [f19] 'beginning-of-buffer) +(define-key global-map [f20] 'end-of-buffer) + +;;; +;;; Key bindings for non X11 terminal([kx]term) +;;; + +(defvar sun-fkeymap (make-keymap)) +(fset 'sun-fprefix sun-fkeymap) + +(define-key global-map "\e[" 'sun-fprefix) +(define-key sun-fkeymap "[" 'backward-paragraph) ; old "\e[" assignment +(define-key sun-fkeymap "11~" + 'set-buffer-file-coding-system) ; F1 92.4.16 by K.Handa +(define-key sun-fkeymap "12~" 'edit-dict-item) ; F2 +(define-key sun-fkeymap "13~" 'jis-code-input) ; F3 +(define-key sun-fkeymap "14~" 'toroku-region) ; F4 +(define-key sun-fkeymap "15~" 'japanese-zenkaku-region) ; F5 +(define-key sun-fkeymap "17~" 'japanese-hankaku-region) ; F6 +(define-key sun-fkeymap "18~" 'japanese-katakana-region); F7 +(define-key sun-fkeymap "19~" 'japanese-hiragana-region); F8 +(define-key sun-fkeymap "20~" 'henkan-region) ; F9 + +(define-key sun-fkeymap "23~" 'insert-buffer) ; F11 or L1 +(define-key sun-fkeymap "24~" 'insert-file) ; F12 or L2 +(define-key sun-fkeymap "25~" 'eval-region) ; F13 or L3 +(define-key sun-fkeymap "26~" 'eval-current-buffer) ; F14 or L4 +(define-key sun-fkeymap "28~" 'enlarge-window) ; F15 or Help or L5 +(define-key sun-fkeymap "29~" 'shrink-window) ; F16 or Menu or L6 +(define-key sun-fkeymap "31~" 'revert-buffer) ; F17 or L7 +(define-key sun-fkeymap "32~" 'revert-buffer) ; F18 or L8 +(define-key sun-fkeymap "33~" 'beginning-of-buffer) ; F19 or L9 +(define-key sun-fkeymap "34~" 'end-of-buffer) ; F20 or L10 --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/egg.el 2007-06-03 23:21:07 +0000 @@ -0,0 +1,2847 @@ +;; Japanese Character Input Package for Egg +;; Coded by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp) + +;; This file is part of Egg on Mule (Multilingal Environment) + +;; 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, 675 Mass Ave, Cambridge, MA 02139, USA. + +;;;================================================================== +;;; +;;; 日本語環境 「たまご」 第3版 +;;; +;;;=================================================================== + +;;; +;;;「たまご」はネットワークかな漢字変換サーバを利用し、Mule での日本 +;;; 語環境を提供するシステムです。「たまご」第2版では Wnn V3 および +;;; Wnn V4 のかな漢字変換サーバを使用しています。 +;;; + +;;; 名前は 「沢山/待たせて/ごめんなさい」の各文節の先頭1音である「た」 +;;; と「ま」と「ご」を取って、「たまご」と言います。電子技術総合研究所 +;;; の錦見 美貴子氏の命名に依るものです。egg は「たまご」の英訳です。 + +;;; +;;; 使用法は info/egg-jp を見て下さい。 +;;; + +;;; +;;; 「たまご」に関する提案、虫情報は tomura@etl.go.jp にお送り下さい。 +;;; + +;;; +;;; 〒 305 茨城県つくば市梅園1-1-4 +;;; 通産省工業技術院電子技術総合研究所 +;;; 情報アーキテクチャ部言語システム研究室 +;;; +;;; 戸村 哲 + +;;; +;;; (注意)このファイルは漢字コードを含んでいます。 +;;; +;;; 第3版 1991年2月 4日 +;;; 第2版 1989年6月 1日 +;;; 第1版 1988年7月14日 +;;; 暫定版 1988年6月24日 + +;;;=================================================================== +;;; +;;; (eval-when (load) (require 'wnn-client)) +;;; + +(defvar egg-version "3.09" "Version number of this version of Egg. ") +;;; Last modified date: Fri Sep 25 12:59:00 1992 + +;;;; 修正要求リスト + +;;;; read-hiragana-string, read-kanji-string で使用する平仮名入力マップを roma-kana に固定しないで欲しい. + +;;;; 修正メモ + +;;; 95.6.5 modified by S.Tomura <tomura@etl.go.jp> +;;; 変換直後に連続して変換する場合を認識するために、"-in-cont" に関連した +;;; 部分を追加した。(この部分は将来再修正する予定。) + +;;; 93.6.19 modified by T.Shingu <shingu@cpr.canon.co.jp> +;;; egg:*in-fence-mode* should be buffer local. + +;;; 93.6.4 modified by T.Shingu <shingu@cpr.canon.co.jp> +;;; In its-defrule**, length is called instead of chars-in-string. + +;;; 93.3.15 modified by T.Enami <enami@sys.ptg.sony.co.jp> +;;; egg-self-insert-command simulates the original more perfectly. + +;;; 92.12.20 modified by S.Tomura <tomura@etl.go.jp> +;;; In its:simulate-input, sref is called instead of aref. + +;;; 92.12.20 modified by T.Enami <enami@sys.ptg.sony.co.jp> +;;; egg-self-insert-command calls cancel-undo-boundary to simulate original. + +;;; 92.11.4 modified by M.Higashida <manabu@sigmath.osaka-u.ac.jp> +;;; read-hiragana-string sets minibuffer-preprompt correctly. + +;;; 92.10.26, 92.10.30 modified by T.Saneto sanewo@pdp.crl.sony.co.jp +;;; typo fixed. + +;;; 92.10.18 modified by K. Handa <handa@etl.go.jp> +;;; special-symbol-input 用のテーブルを autoload に。 +;;; busyu.el の autoload の指定を mule-init.el から egg.el に移す。 + +;;; 92.9.20 modified by S. Tomura +;;;; hiragana-region の虫の修正 + +;;;; 92.9.19 modified by Y. Kawabe +;;;; some typos + +;;;; 92.9.19 modified by Y. Kawabe<kawabe@sramhc.sra.co.jp> +;;;; menu の表示関係の lenght を string-width に置き換える. + +;;; 92.8.19 modified for Mule Ver.0.9.6 by K.Handa <handa@etl.go.jp> +;;;; menu:select-from-menu calls string-width instead of length. + +;;;; 92.8.1 modified by S. Tomura +;;;; internal mode を追加.its:*internal-mode-alist* 追加. + +;;;; 92.7.31 modified by S. Tomura +;;;; its-mode-map が super mode map を持つように変更した.これにより +;;;; mode map が共有できる. its-define-mode, get-next-map などを変更. +;;;; get-next-map-locally を追加.its-defrule** を変更. + +;;;; 92.7.31 modified by S. Tomura +;;;; its:make-kanji-buffer , its:*kanji* 関連コードを削除した. + +;;;; 92.7.31 modified by S. Tomura +;;;; egg:select-window-hook を修正し,minibuffer から exit するときに, +;;;; 各種変数を default-value に戻すようにした.これによって +;;;; minibufffer に入る前に各種設定が可能となる. + +;;; 92.7.14 modified for Mule Ver.0.9.5 by T.Ito <toshi@his.cpl.melco.co.jp> +;;; Attribute bold can be used. +;;; Unnecessary '*' in comments of variables deleted. +;;; 92.7.8 modified for Mule Ver.0.9.5 by Y.Kawabe <kawabe@sra.co.jp> +;;; special-symbol-input keeps the position selected last. +;;; 92.7.8 modified for Mule Ver.0.9.5 by T.Shingu <shingu@cpr.canon.co.jp> +;;; busyu-input and kakusuu-input are added in *symbol-input-menu*. +;;; 92.7.7 modified for Mule Ver.0.9.5 by K.Handa <handa@etl.go.jp> +;;; In egg:quit-mode, overwrite-mode is supported correctly. +;;; egg:*overwrite-mode-deleted-chars* is not used now. +;;; 92.6.26 modified for Mule Ver.0.9.5 by K.Handa <handa@etl.go.jp> +;;; Funtion dump-its-mode-map gets obsolete. +;;; 92.6.26 modified for Mule Ver.0.9.5 by M.Shikida <shikida@cs.titech.ac.jp> +;;; Backquote ` is registered in *hankaku-alist* and *zenkaku-alist*. +;;; 92.6.17 modified for Mule Ver.0.9.5 by T.Shingu <shingu@cpr.canon.co.jp> +;;; Bug in make-jis-second-level-code-alist fixed. +;;; 92.6.14 modified for Mule Ver.0.9.5 by T.Enami <enami@sys.ptg.sony.co.jp> +;;; menu:select-from-menu is replaced with new version. +;;; 92.5.18 modified for Mule Ver.0.9.4 by T.Shingu <shingu@cpr.canon.co.jp> +;;; lisp/wnn-egg.el is devided into two parts: this file and wnn*-egg.el. + +;;;; +;;;; Mule Ver.0.9.3 以前 +;;;; + +;;;; April-15-92 for Mule Ver.0.9.3 +;;;; by T.Enami <enami@sys.ptg.sony.co.jp> and K.Handa <handa@etl.go.jp> +;;;; notify-internal calls 'message' with correct argument. + +;;;; April-11-92 for Mule Ver.0.9.3 +;;;; by T.Enami <enami@sys.ptg.sony.co.jp> and K.Handa <handa@etl.go.jp> +;;;; minibuffer から抜ける時 egg:select-window-hook で egg:*input-mode* を +;;;; t にする。hook の形を大幅修正。 + +;;;; April-3-92 for Mule Ver.0.9.2 by T.Enami <enami@sys.ptg.sony.co.jp> +;;;; minibuffer から抜ける時 egg:select-window-hook が new-buffer の +;;;; egg:*mode-on* などを nil にしているのを修正。 + +;;;; Mar-22-92 by K.Handa +;;;; etags が作る TAGS に不必要なものを入れないようにするため関数名変更 +;;;; define-its-mode -> its-define-mode, defrule -> its-defrule + +;;;; Mar-16-92 by K.Handa +;;;; global-map への define-key を mule-keymap に変更。 + +;;;; Mar-13-92 by K.Handa +;;;; Language specific part を japanese.el,... に移した。 + +;;;; Feb-*-92 by K. Handa +;;;; nemacs 4 では minibuffer-window-selected が廃止になり,関連するコードを削除した. + +;;;; Jan-13-92 by S. Tomura +;;;; mc-emacs or nemacs 4 対応作業開始. + +;;;; Aug-9-91 by S. Tomura +;;;; ?\^ を ?^ に修正. + +;;;; menu を key map を見るようにする. + +;;;; Jul-6-91 by S. Tomura +;;;; setsysdict の error メッセージを変更. + +;;;; Jun-11-91 by S. Tomura +;;;; its:*defrule-verbose* を追加. +;;;; + +;;;; Mar-25-91 by S. Tomura +;;;; reset-its-mode を廃止 + +;;;; Mar-23-91 by S. Tomura +;;;; read-hiragana-string を修正, read-kanji-string を追加, +;;;; isearch:read-kanji-string を設定. + +;;;; Mar-22-91 by S. Tomura +;;;; defrule-conditional, defrule-select-mode-temporally を追加。 +;;;; for-each の簡易版として dolist を追加。 +;;;; enable-double-n-syntax を活用.ほかに use-kuten-for-comma, use-touten-for-period を追加 + +;;;; Mar-5-91 by S. Tomura +;;;; roma-kana-word, henkan-word, roma-kanji-word を追加した. + +;;;; Jan-14-91 by S. Tomura +;;;; 入力文字変換系 ITS(Input character Translation System) を改造する. +;;;; 変換は最左最長変換を行ない,変換のないものはもとのままとなる. +;;;; 改造の動機は立木@慶応さんのハングル文字の入力要求である. +;;;; its:* を追加した.また従来 fence-self-insert-command と roma-kana-region +;;;; 二箇所にわかれていたコードを its:translate-region によって一本化した. + +;;;; July-30-90 by S. Tomura +;;;; henkan-region をoverwrite-mode に対応させる.変数 +;;;; egg:*henkan-fence-mode*, egg:*overwrite-mode-deleted-chars* +;;;; を追加し,henkan-fence-region, henkan-region-internal, +;;;; quit-egg-mode を変更する. + +;;;; Mar-4-90 by K.Handa +;;;; New variable alphabet-mode-indicator, transparent-mode-indicator, +;;;; and henkan-mode-indicator. + +;;;; Feb-27-90 by enami@ptgd.sony.co.jp +;;;; menu:select-from-menu で2箇所ある ((and (<= ?0 ch) (<= ch ?9)... +;;;; の一方を ((and (<= ?0 ch) (<= ch ?9)... に修正 + +;;;; Feb-07-89 +;;;; bunsetu-length-henko の中の egg:*attribute-off の位置を KKCP を呼ぶ前に +;;;; 変更する。 wnn-client では KKCP を呼ぶと文節情報が変化する。 + +;;;; Feb-01-89 +;;;; henkan-goto-kouho の egg:set-bunsetu-attribute の引数 +;;;; の順番が間違っていたのを修正した。(toshi@isvax.isl.melco.co.jp +;;;; (Toshiyuki Ito)の指摘による。) + +;;;; Dec-25-89 +;;;; meta-flag t の場合の対応を再修正する。 +;;;; overwrite-mode での undo を改善する。 + +;;;; Dec-21-89 +;;;; bug fixed by enami@ptdg.sony.co.jp +;;;; (fboundp 'minibuffer-window-selected ) +;;;; -->(boundp 'minibuffer-window-selected ) +;;;; self-insert-after-hook を buffer local にして定義を kanji.el へ移動。 + +;;;; Dec-15-89 +;;;; kill-all-local-variables の定義を kanji.el へ移動する。 + +;;;; Dec-14-89 +;;;; meta-flag t の場合の処理を修正する +;;;; overwrite-mode に対応する。 + +;;;; Dec-12-89 +;;;; egg:*henkan-open*, egg:*henkan-close* を追加。 +;;;; egg:*henkan-attribute* を追加 +;;;; set-egg-fence-mode-format, set-egg-henkan-mode-format を追加 + +;;;; Dec-12-89 +;;;; *bunpo-code* に 1000: "その他" を追加 + +;;;; Dec-11-89 +;;;; egg:*fence-attribute* を新設 +;;;; egg:*bunsetu-attribute* を新設 + +;;;; Dec-11-89 +;;;; attribute-*-region を利用するように変更する。 +;;;; menu:make-selection-list は width が小さい時にloop する。これを修正した。 + +;;;; Dec-10-89 +;;;; set-marker-type を利用する方式に変更。 + +;;;; Dec-07-89 +;;;; egg:search-path を追加。 +;;;; egg-default-startup-file を追加する。 + +;;;; Nov-22-89 +;;;; egg-startup-file を追加する。 +;;;; eggrc-search-path を egg-startup-file-search-path に名前変更。 + +;;;; Nov-21-89 +;;;; Nemacs 3.2 に対応する。kanji-load* を廃止する。 +;;;; wnnfns.c に対応した修正を加える。 +;;;; *Notification* buffer を見えなくする。 + +;;;; Oct-2-89 +;;;; *zenkaku-alist* の 文字定数の書き方が間違っていた。 + +;;;; Sep-19-89 +;;;; toggle-egg-mode の修正(kanji-flag) +;;;; egg-self-insert-command の修正 (kanji-flag) + +;;;; Sep-18-89 +;;;; self-insert-after-hook の追加 + +;;;; Sep-15-89 +;;;; EGG:open-wnn bug fix +;;;; provide wnn-egg feature + +;;;; Sep-13-89 +;;;; henkan-kakutei-before-point を修正した。 +;;;; enter-fence-mode の追加。 +;;;; egg-exit-hook の追加。 +;;;; henkan-region-internal の追加。henkan-regionは point をmark する。 +;;;; eggrc-search-path の追加。 + +;;;; Aug-30-89 +;;;; kanji-kanji-1st を訂正した。 + +;;;; May-30-89 +;;;; EGG:open-wnn は get-wnn-host-name が nil の場合、(system-name) を使用する。 + +;;;; May-9-89 +;;;; KKCP:make-directory added. +;;;; KKCP:file-access bug fixed. +;;;; set-default-usr-dic-directory modified. + +;;;; Mar-16-89 +;;;; minibuffer-window-selected を使って minibuffer の egg-mode表示機能追加 + +;;;; Mar-13-89 +;;;; mode-line-format changed. + +;;;; Feb-27-89 +;;;; henkan-saishou-bunsetu added +;;;; henkan-saichou-bunsetu added +;;;; M-< henkan-saishou-bunsetu +;;;; M-> henkan-saichou-bunsetu + +;;;; Feb-14-89 +;;;; C-h in henkan mode: help-command added + +;;;; Feb-7-89 +;;;; egg-insert-after-hook is added. + +;;;; M-h fence-hiragana +;;;; M-k fence-katakana +;;;; M-> fence-zenkaku +;;;; M-< fence-hankaku + +;;;; Dec-19-88 henkan-hiragana, henkan-katakaraを追加: +;;;; M-h henkan-hiragana +;;;; M-k henkan-katakana + +;;;; Ver. 2.00 kana2kanji.c を使わず wnn-client.el を使用するように変更。 +;;;; 関連して一部関数を変更 + +;;;; Dec-2-88 special-symbol-input を追加; +;;;; C-^ special-symbol-input + +;;;; Nov-18-88 henkan-mode-map 一部変更; +;;;; M-i henkan-inspect-bunsetu +;;;; M-s henkan-select-kouho +;;;; C-g henkan-quit + +;;;; Nov-18-88 jserver-henkan-kakutei の仕様変更に伴い、kakutei のコー +;;;; ドを変更した。 + +;;;; Nov-17-88 kakutei-before-point で point 以降の間違った部分の変換 +;;;; が頻度情報に登録されないように修正した。これにはKKCC:henkan-end +;;;; の一部仕様と対応するkana2kanji.cも変更した。 + +;;;; Nov-17-88 henkan-inspect-bunsetu を追加した。 + +;;;; Nov-17-88 新しい kana2kanji.c に変更する。 + +;;;; Sep-28-88 defruleが値としてnilを返すように変更した。 + +;;;; Aug-25-88 変換学習を正しく行なうように変更した。 +;;;; KKCP:henkan-kakuteiはKKCP:jikouho-listを呼んだ文節に対してのみ適 +;;;; 用でき、それ以外の場合の結果は保証されない。この条件を満たすよう +;;;; にKKCP:jikouho-listを呼んでいない文節に対しては +;;;; KKCP:henkan-kakuteiを呼ばないようにした。 + +;;;; Aug-25-88 egg:do-auto-fill を修正し、複数行にわたるauto-fillを正 +;;;; しく行なうように修正した。 + +;;;; Aug-25-88 menu commandに\C-l: redraw を追加した。 + +;;;; Aug-25-88 toroku-regionで登録する文字列からno graphic characterを +;;;; 自動的に除くことにした。 + +(eval-when-compile (require 'egg-jsymbol)) + +;;;---------------------------------------------------------------------- +;;; +;;; Version control routine +;;; +;;;---------------------------------------------------------------------- + +(and (equal (user-full-name) "Satoru Tomura") + (defun egg-version-update (arg) + (interactive "P") + (if (equal (buffer-name (current-buffer)) "wnn-egg.el") + (save-excursion + (goto-char (point-min)) + (re-search-forward "(defvar egg-version \"[0-9]+\\.") + (let ((point (point)) + (minor)) + (search-forward "\"") + (backward-char 1) + (setq minor (string-to-number (buffer-substring point (point)))) + (delete-region point (point)) + (if (<= minor 8) (insert "0")) + (insert (int-to-string (1+ minor))) + (search-forward "Egg last modified date: ") + (kill-line) + (insert (current-time-string))) + (save-buffer) + (if arg (byte-compile-file (buffer-file-name))) + ))) + ) +;;; +;;;---------------------------------------------------------------------- +;;; +;;; Utilities +;;; +;;;---------------------------------------------------------------------- + +;;; +;;;; + +(defun characterp (form) + (numberp form)) + +(defun coerce-string (form) + (cond((stringp form) form) + ((characterp form) (char-to-string form)))) + +(defun coerce-internal-string (form) + (cond((stringp form) + (if (= (length form) 1) + (string-to-char form) + form)) + ((characterp form) form))) + +;;; kill-all-local-variables から保護する local variables。 +(put 'egg:*input-mode* 'permanent-local t) +(put 'egg:*mode-on* 'permanent-local t) +(put 'its:*current-map* 'permanent-local t) +(put 'mode-line-egg-mode 'permanent-local t) + +;; undo functions for Emacs-20 +(make-variable-buffer-local + (defvar egg-buffer-undo-list nil)) +(make-variable-buffer-local + (defvar egg-buffer-modified-flag nil)) + +(defun suspend-undo () + (setq egg-buffer-undo-list buffer-undo-list) + (setq egg-buffer-modified-flag (buffer-modified-p)) + ;;(setq buffer-undo-list t) + ) + +(defun resume-undo-list () + (setq buffer-undo-list egg-buffer-undo-list) + (if (not egg-buffer-modified-flag) + (let ((time (visited-file-modtime))) + (if (eq time 0) (setq time '(0 . 0))) + (set 'buffer-undo-list + (cons (cons t time) + buffer-undo-list))))) + +;;;---------------------------------------------------------------------- +;;; +;;; 16進表現のJIS 漢字コードを minibuffer から読み込む +;;; +;;;---------------------------------------------------------------------- + +;;; +;;; User entry: jis-code-input +;;; + +(defun jis-code-input () + (interactive) + (insert-jis-code-from-minibuffer "JIS 漢字コード(16進数表現): ")) + +(defun insert-jis-code-from-minibuffer (prompt) + (let ((str (read-from-minibuffer prompt)) val) + (while (null (setq val (read-jis-code-from-string str))) + (beep) + (setq str (read-from-minibuffer prompt str))) + (insert (make-char 'japanese-jisx0208 (car val) (cdr val))))) + +(defun hexadigit-value (ch) + (cond((and (<= ?0 ch) (<= ch ?9)) + (- ch ?0)) + ((and (<= ?a ch) (<= ch ?f)) + (+ (- ch ?a) 10)) + ((and (<= ?A ch) (<= ch ?F)) + (+ (- ch ?A) 10)))) + +(defun read-jis-code-from-string (str) + (if (and (= (length str) 4) + (<= 2 (hexadigit-value (aref str 0))) + (hexadigit-value (aref str 1)) + (<= 2 (hexadigit-value (aref str 2))) + (hexadigit-value (aref str 3))) + (cons (+ (* 16 (hexadigit-value (aref str 0))) + (hexadigit-value (aref str 1))) + (+ (* 16 (hexadigit-value (aref str 2))) + (hexadigit-value (aref str 3)))))) + +;;;---------------------------------------------------------------------- +;;; +;;; 「たまご」 Notification System +;;; +;;;---------------------------------------------------------------------- + +(defconst *notification-window* " *Notification* ") + +;;;(defmacro notify (str &rest args) +;;; (list 'notify-internal +;;; (cons 'format (cons str args)))) + +(defun notify (str &rest args) + (notify-internal (apply 'format (cons str args)))) + +(defun notify-internal (message &optional noerase) + (save-excursion + (let ((notify-buff (get-buffer-create *notification-window*))) + (set-buffer notify-buff) + (goto-char (point-max)) + (setq buffer-read-only nil) + (insert (substring (current-time-string) 4 19) ":: " message ?\n ) + (setq buffer-read-only t) + (bury-buffer notify-buff) + (message "%s" message) ; 92.4.15 by T.Enami + (if noerase nil + (sleep-for 1) (message ""))))) + +;;;(defmacro notify-yes-or-no-p (str &rest args) +;;; (list 'notify-yes-or-no-p-internal +;;; (cons 'format (cons str args)))) + +(defun notify-yes-or-no-p (str &rest args) + (notify-yes-or-no-p-internal (apply 'format (cons str args)))) + +(defun notify-yes-or-no-p-internal (message) + (save-window-excursion + (pop-to-buffer *notification-window*) + (goto-char (point-max)) + (setq buffer-read-only nil) + (insert (substring (current-time-string) 4 19) ":: " message ?\n ) + (setq buffer-read-only t) + (yes-or-no-p "いいですか?"))) + +(defun notify-y-or-n-p (str &rest args) + (notify-y-or-n-p-internal (apply 'format (cons str args)))) + +(defun notify-y-or-n-p-internal (message) + (save-window-excursion + (pop-to-buffer *notification-window*) + (goto-char (point-max)) + (setq buffer-read-only nil) + (insert (substring (current-time-string) 4 19) ":: " message ?\n ) + (setq buffer-read-only t) + (y-or-n-p "いいですか?"))) + +(defun select-notification () + (interactive) + (pop-to-buffer *notification-window*) + (setq buffer-read-only t)) + +;;;---------------------------------------------------------------------- +;;; +;;; Minibuffer Menu System +;;; +;;;---------------------------------------------------------------------- + +;;; user-customizable variables +(defvar menu:*display-item-value* nil + "*Non-nil means values of items are displayed in minibuffer menu") + +;;; The following will be localized, added only to pacify the compiler. +(defvar menu:*cur-menu*) +(defvar menu:*cur-selection*) +(defvar menu:*cur-selections*) +(defvar menu:*cur-element-no*) +(defvar menu:*cur-selection-no*) +(defvar menu:*cur-element-points*) +(defvar menu:*menu-stack*) + +(defvar minibuffer-local-menu-map + (append '(keymap (t . undefined) + (?\C-x keymap (t . undefined)) + (?\e keymap (t . undefined))) + function-key-map)) + +(dolist (elem '((" " next-element) + ("\C-a" beginning-of-selection) + ("\C-b" previous-element) + ("\C-d" previous-element) + ("\C-e" end-of-selection) + ("\C-f" next-element) + ("\C-g" quit) + ("\C-h" previous-element) + ("\C-i" next-element) + ("\C-j" select) + ("\C-l" refresh) + ("\C-m" select) + ("\C-n" next-selection) + ("\C-p" previous-selection) + ([backspace] previous-element) + ([clear] quit) + ([delete] previous-element) + ([down] next-selection) + ([left] previous-element) + ([next] next-selection) + ([prior] previous-selection) + ([return] select) + ([right] next-element) + ([tab] next-element) + ([up] previous-selection))) + (define-key minibuffer-local-menu-map + (car elem) (intern (format "menu:%s" (car (cdr elem)))))) +;;; 0 .. 9 A .. Z a .. z +(dolist (char + (append + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + nil)) + (define-key minibuffer-local-menu-map (vector char) 'menu:goto-nth-element)) + +;;; +;;; predicates and selectors for menu +;;; +;; <menu> ::= ( menu <prompt string> <items> ) +;; <items> ::= ( <item> ... ) +;; <item> ::= ( <string> . <value> ) | <string> +;; | ( <char> . <value> ) | <char> +;; <value> :: = <menu> | <other object> +;; +(defun menu:menup (value) + (and (listp value) + (eq (car value) 'menu))) + +(defun menu:menu-prompt (&optional menu) + (car (cdr (or menu menu:*cur-menu*)))) + +(defun menu:menu-items (&optional menu) + (car (cdr (cdr (or menu menu:*cur-menu*))))) + +(defun menu:menu-nth-item (n &optional menu) + (nth n (menu:menu-items menu))) + +(defun menu:item-string (item) + (cond ((stringp item) item) + ((numberp item) (char-to-string item)) + ((consp item) + (let ((str (cond ((stringp (car item)) (car item)) + ((numberp (car item)) (char-to-string (car item))) + (t "")))) + (if menu:*display-item-value* + (format "%s [%s]" str (cdr item)) + str))) + (t ""))) + +(defun menu:item-value (item) + (cond ((stringp item) item) + ((numberp item) (char-to-string item)) + ((consp item) (cdr item)) + (t ""))) + +(defun menu:select-submenu (submenu) + "Save the current selection state, and select a new menu." + (setq menu:*menu-stack* + (cons (list menu:*cur-selection* menu:*cur-selections* + menu:*cur-element-no* menu:*cur-selection-no* + menu:*cur-menu* menu:*cur-element-points*) + menu:*menu-stack*)) + (setq menu:*cur-menu* submenu)) + +(defun menu:select-saved-menu () + "Restore the most recently stored selection state." + (let ((save (car menu:*menu-stack*))) + (setq menu:*menu-stack* + (cdr menu:*menu-stack*)) + (setq menu:*cur-selection* (nth 0 save);92.10.26 by T.Saneto + menu:*cur-selections* (nth 1 save) + menu:*cur-element-no* (nth 2 save) + menu:*cur-selection-no* (nth 3 save) + menu:*cur-menu* (nth 4 save) + menu:*cur-element-points* (nth 5 save)))) + +;;; +;;; constructors and selector for selection +;;; +;; <selection> ::= ( <pos> . <elements> ) +;; <pos> ... integer that means the absolute position in menu items +;; <elements> ::= ( <element string> ... ) +;; +(defsubst menu:make-selection (pos elements) + (cons pos elements)) + +(defsubst menu:selection-pos (&optional selection) + (car (or selection menu:*cur-selection*))) + +(defsubst menu:selection-elements (&optional selection) + (cdr (or selection menu:*cur-selection*))) + +(defsubst menu:selection-nth-element (&optional n selection) + (nth (or n menu:*cur-element-no*) + (menu:selection-elements selection))) + +(defsubst menu:selection-element-length (&optional selection) + (length (menu:selection-elements selection))) + +(defun menu:make-selections (items width) + "Make selection list from ITEMS so that each selection can fit with WIDTH." + (let ((headpos 0) (pos 0) (size 0) + revselections revelems + item-string item-width) + (while items + (setq item-string (menu:item-string (car items))) + (setq item-width (string-width item-string)) + ;;; 92.9.19 by Y. Kawabe + (cond ((and revelems (<= width (+ size 4 item-width))) + (setq revselections + (cons (menu:make-selection headpos (nreverse revelems)) + revselections)) + (setq revelems nil) + (setq size 0) + (setq headpos pos)) + ((or (null (cdr items)) (<= width (+ size 4 item-width))) + (setq revselections + (cons + (menu:make-selection + headpos (nreverse (cons item-string revelems))) + revselections)) + (setq size 0) + (setq headpos pos) + (setq items (cdr items)) + (setq pos (1+ pos))) + (t + ;;; 92.9.19 by Y. Kawabe + (setq revelems (cons item-string revelems)) + (setq size (+ size 4 item-width)) + (setq items (cdr items)) + (setq pos (1+ pos))))) + (nreverse revselections))) + +(defun menu:setup-selections (window-width initpos) + (setq menu:*cur-selections* + (menu:make-selections (menu:menu-items) + (- window-width + ;;; 92.8.19 by K.Handa + (string-width + (menu:menu-prompt))))) + (if initpos + (let ((selections menu:*cur-selections*) + finished) + (setq menu:*cur-selection-no* 0) + (while (and (cdr selections) + (< (menu:selection-pos (car (cdr selections))) + initpos)) + (setq menu:*cur-selection-no* (1+ menu:*cur-selection-no*)) + (setq selections (cdr selections))) + (setq menu:*cur-element-no* + (- initpos (menu:selection-pos (car selections))))))) + +;;; utility +(defun menu:check-number-range (i min max) + (cond ((eq i 'max) max) + ((eq i 'min) min) + ((< i min) max) + ((< max i) min) + (t i))) + +;;; +;;; main part of menu +;;; +(defun menu:select-from-menu (menu &optional initial position) + "Display menu in minibuffer and return the selected value. +If INITIAL is non-nil integer list, it behaves as menu is selected +using the path specified by INITIAL in advance. +If POSITION is non-nil value, return value is a pair of the selected +value and the chosen path (represented by an integer list)." + (let ((menu:*cur-menu* menu) + (menu:*window-width* (window-width (minibuffer-window))) + menu:*cur-selection* menu:*cur-selections* + menu:*cur-element-no* + menu:*cur-selection-no* + menu:*cur-element-points* + menu:*menu-stack* menu:*select-positions* + (menu:*window-width* (window-width (minibuffer-window))) + (pos 0) value finished) + (if initial + (progn + (if (numberp initial) + (setq initial (list initial))) + (while (cdr initial) + (setq value (menu:item-value (menu:menu-nth-item (car initial)))) + (if (menu:menup value) + (progn + (menu:setup-selections menu:*window-width* (car initial)) + (menu:select-submenu value))) + (setq menu:*select-positions* + (cons (car initial) menu:*select-positions*)) + (setq initial (cdr initial))) + (setq pos (car initial)))) + (while (not finished) + (menu:setup-selections menu:*window-width* pos) + (add-hook 'minibuffer-setup-hook 'menu:minibuffer-setup) + (unwind-protect + (setq pos (read-from-minibuffer "" nil minibuffer-local-menu-map + t 'menu:*select-positions*)) + (remove-hook 'minibuffer-setup-hook 'menu:minibuffer-setup) + (if quit-flag + (setq pos nil + quit-flag nil))) + (cond (pos ; element selected + (setcar menu:*select-positions* pos) + (setq value (menu:item-value (menu:menu-nth-item pos))) + (if (menu:menup value) + (progn (menu:select-submenu value) + (setq pos 0)) + (setq finished t))) + (menu:*menu-stack* ; quit (restore menu) + (if (string= (car menu:*select-positions*) "nil") + (setq menu:*select-positions* (cdr menu:*select-positions*))) + (setq menu:*select-positions* (cdr menu:*select-positions*)) + (menu:select-saved-menu)) + (t ; really quit + (setq quit-flag t) + (setq menu:*select-positions* nil) + (setq finished t)))) + (if position + (cons value (nreverse menu:*select-positions*)) + value))) + +(defun menu:minibuffer-setup () + (if (eq (current-local-map) minibuffer-local-menu-map) + (menu:goto-selection))) + +(defun menu:goto-selection (&optional sel-no elem-no) + (setq menu:*cur-selection-no* + (menu:check-number-range (or sel-no menu:*cur-selection-no*) + 0 (1- (length menu:*cur-selections*)))) + (setq menu:*cur-selection* + (nth menu:*cur-selection-no* menu:*cur-selections*)) + (erase-buffer) + (insert (menu:menu-prompt)) + (let ((elements (menu:selection-elements)) + (i 0) + revpoints) + (while elements + (setq revpoints (cons (+ (point) 2) revpoints)) + (insert (if (<= i 9) (format " %d." i) + (format " %c." (+ (- i 10) ?a))) + (car elements)) + (setq elements (cdr elements) + i (1+ i))) + (setq menu:*cur-element-points* (nreverse revpoints))) + (menu:goto-element elem-no)) + +(defun menu:goto-element (&optional elem-no) + (setq menu:*cur-element-no* + (menu:check-number-range (or elem-no menu:*cur-element-no*) + 0 (1- (menu:selection-element-length)))) + (goto-char (nth menu:*cur-element-no* menu:*cur-element-points*))) + +(defun menu:beginning-of-selection () + (interactive) + (menu:goto-element 0)) + +(defun menu:end-of-selection () + (interactive) + (menu:goto-element (1- (menu:selection-element-length)))) + +(defun menu:next-selection () + (interactive) + (menu:goto-selection (1+ menu:*cur-selection-no*))) + +(defun menu:previous-selection () + (interactive) + (menu:goto-selection (1- menu:*cur-selection-no*))) + +(defun menu:next-element () + (interactive) + (if (< menu:*cur-element-no* (1- (menu:selection-element-length))) + (menu:goto-element (1+ menu:*cur-element-no*)) + (menu:goto-selection (1+ menu:*cur-selection-no*) 0))) + +(defun menu:previous-element () + (interactive) + (if (< 0 menu:*cur-element-no*) + (menu:goto-element (1- menu:*cur-element-no*)) + (menu:goto-selection (1- menu:*cur-selection-no*) 'max))) + +(defun menu:goto-nth-element () + (interactive) + (let ((ch (if (integerp last-command-event) + last-command-event + ;; Convert kp-0 .. kp-9 to chars. + (get last-command-event 'ascii-character))) + (elem-no-max (1- (menu:selection-element-length)))) + (if ch + (cond + ((and (<= ?0 ch) (<= ch ?9) + (<= ch (+ ?0 elem-no-max))) + (menu:goto-element (- ch ?0))) + ((and (<= ?a ch) (<= ch ?z) + (<= (+ 10 ch) (+ ?a elem-no-max))) + (menu:goto-element (+ 10 (- ch ?a)))) + ((and (<= ?A ch) (<= ch ?Z) + (<= (+ 10 ch) (+ ?A elem-no-max))) + (menu:goto-element (+ 10 (- ch ?A)))))))) + +(defun menu:refresh () + (interactive) + (menu:goto-selection)) + +(defun menu:select () + (interactive) + (erase-buffer) + (prin1 (+ (menu:selection-pos) menu:*cur-element-no*) (current-buffer)) + (exit-minibuffer)) + +(defun menu:quit () + (interactive) + (erase-buffer) + (prin1 nil (current-buffer)) + (exit-minibuffer)) + +;;;---------------------------------------------------------------------- +;;; +;;; 一括型変換機能 +;;; +;;;---------------------------------------------------------------------- + +;;; +;;; ひらがな変換 +;;; + +(defun hiragana-paragraph () + "hiragana paragraph at or after point." + (interactive ) + (save-excursion + (forward-paragraph) + (let ((end (point))) + (backward-paragraph) + (japanese-hiragana-region (point) end )))) + +(defun hiragana-sentence () + "hiragana sentence at or after point." + (interactive ) + (save-excursion + (forward-sentence) + (let ((end (point))) + (backward-sentence) + (japanese-hiragana-region (point) end )))) + +;;; +;;; カタカナ変換 +;;; + +(defun katakana-paragraph () + "katakana paragraph at or after point." + (interactive ) + (save-excursion + (forward-paragraph) + (let ((end (point))) + (backward-paragraph) + (japanese-katakana-region (point) end )))) + +(defun katakana-sentence () + "katakana sentence at or after point." + (interactive ) + (save-excursion + (forward-sentence) + (let ((end (point))) + (backward-sentence) + (japanese-katakana-region (point) end )))) + +;;; +;;; 半角変換 +;;; + +(defun hankaku-paragraph () + "hankaku paragraph at or after point." + (interactive ) + (save-excursion + (forward-paragraph) + (let ((end (point))) + (backward-paragraph) + (japanese-hankaku-region (point) end )))) + +(defun hankaku-sentence () + "hankaku sentence at or after point." + (interactive ) + (save-excursion + (forward-sentence) + (let ((end (point))) + (backward-sentence) + (japanese-hankaku-region (point) end )))) + +(defun hankaku-word (arg) + (interactive "p") + (let ((start (point))) + (forward-word arg) + (japanese-hankaku-region start (point)))) + +;;; +;;; 全角変換 +;;; + +(defun zenkaku-paragraph () + "zenkaku paragraph at or after point." + (interactive ) + (save-excursion + (forward-paragraph) + (let ((end (point))) + (backward-paragraph) + (japanese-zenkaku-region (point) end )))) + +(defun zenkaku-sentence () + "zenkaku sentence at or after point." + (interactive ) + (save-excursion + (forward-sentence) + (let ((end (point))) + (backward-sentence) + (japanese-zenkaku-region (point) end )))) + +(defun zenkaku-word (arg) + (interactive "p") + (let ((start (point))) + (forward-word arg) + (japanese-zenkaku-region start (point)))) + +;;; +;;; ローマ字かな変換 +;;; + +(defun roma-kana-region (start end ) + (interactive "r") + (its:translate-region start end nil (its:get-mode-map "roma-kana"))) + +(defun roma-kana-paragraph () + "roma-kana paragraph at or after point." + (interactive ) + (save-excursion + (forward-paragraph) + (let ((end (point))) + (backward-paragraph) + (roma-kana-region (point) end )))) + +(defun roma-kana-sentence () + "roma-kana sentence at or after point." + (interactive ) + (save-excursion + (forward-sentence) + (let ((end (point))) + (backward-sentence) + (roma-kana-region (point) end )))) + +(defun roma-kana-word () + "roma-kana word at or after point." + (interactive) + (save-excursion + (re-search-backward "\\b\\w" nil t) + (let ((start (point))) + (re-search-forward "\\w\\b" nil t) + (roma-kana-region start (point))))) + +;;; +;;; ローマ字漢字変換 +;;; + +(defun roma-kanji-region (start end) + (interactive "r") + (roma-kana-region start end) + (save-restriction + (narrow-to-region start (point)) + (goto-char (point-min)) + (while (re-search-forward "[ ]+" nil 'move) + (delete-region (match-beginning 0) (match-end 0)))) + (henkan-region-internal start (point))) + +(defun roma-kanji-paragraph () + "roma-kanji paragraph at or after point." + (interactive ) + (save-excursion + (forward-paragraph) + (let ((end (point))) + (backward-paragraph) + (roma-kanji-region (point) end )))) + +(defun roma-kanji-sentence () + "roma-kanji sentence at or after point." + (interactive ) + (save-excursion + (forward-sentence) + (let ((end (point))) + (backward-sentence) + (roma-kanji-region (point) end )))) + +(defun roma-kanji-word () + "roma-kanji word at or after point." + (interactive) + (save-excursion + (re-search-backward "\\b\\w" nil t) + (let ((start (point))) + (re-search-forward "\\w\\b" nil t) + (roma-kanji-region start (point))))) + + +;;;---------------------------------------------------------------------- +;;; +;;; 「たまご」入力文字変換系 ITS +;;; +;;;---------------------------------------------------------------------- + +(defun egg:member (elt list) + (while (not (or (null list) (equal elt (car list)))) + (setq list (cdr list))) + list) + +;;; +;;; Mode name --> map +;;; +;;; ITS mode name: string + +(defvar its:*mode-alist* nil) +(defvar its:*internal-mode-alist* nil) + +(defun its:get-mode-map (name) + (or (cdr (assoc name its:*mode-alist*)) + (cdr (assoc name its:*internal-mode-alist*)))) + +(defun its:set-mode-map (name map &optional internalp) + (let ((place (assoc name + (if internalp its:*internal-mode-alist* + its:*mode-alist*)))) + (if place (let ((mapplace (cdr place))) + (setcar mapplace (car map)) + (setcdr mapplace (cdr map))) + (progn (setq place (cons name map)) + (if internalp + (setq its:*internal-mode-alist* + (append its:*internal-mode-alist* (list place))) + (setq its:*mode-alist* + (append its:*mode-alist* (list place)))))))) + +;;; +;;; ITS mode indicators +;;; Mode name --> indicator +;;; + +(defun its:get-mode-indicator (name) + (let ((map (its:get-mode-map name))) + (if map (map-indicator map) + name))) + +(defun its:set-mode-indicator (name indicator) + (let ((map (its:get-mode-map name))) + (if map + (map-set-indicator map indicator) + (its-define-mode name indicator)))) + +;;; +;;; ITS mode declaration +;;; + +(defvar its:*processing-map* nil) + +(defun its-define-mode (name &optional indicator reset supers internalp) + "its-mode NAME を定義選択する.他の its-mode が選択されるまでは +its-defrule などは NAME に対して規則を追加する.INDICATOR が non-nil +の時には its-mode NAME を選択すると mode-line に表示される.RESET が +non-nil の時には its-mode の定義が空になる.SUPERS は上位の its-mode +名をリストで指定する.INTERNALP は mode name を内部名とする. +its-defrule, its-defrule-conditional, defule-select-mode-temporally を +参照" + + (if (null(its:get-mode-map name)) + (progn + (setq its:*processing-map* + (make-map nil (or indicator name) nil (mapcar 'its:get-mode-map supers))) + (its:set-mode-map name its:*processing-map* internalp) + ) + (progn (setq its:*processing-map* (its:get-mode-map name)) + (if indicator + (map-set-indicator its:*processing-map* indicator)) + (if reset + (progn + (map-set-state its:*processing-map* nil) + (map-set-alist its:*processing-map* nil) + )) + (if supers + (progn + (map-set-supers its:*processing-map* (mapcar 'its:get-mode-map supers)))))) + nil) + +;;; +;;; defrule +;;; + +(defun its:make-standard-action (output next) + "OUTPUT と NEXT からなる standard-action を作る." + + (if (and (stringp output) (string-equal output "")) + (setq output nil)) + (if (and (stringp next) (string-equal next "")) + (setq next nil)) + (cond((null output) + (cond ((null next) nil) + (t (list nil next)))) + ((consp output) + ;;; alternative output + (list (cons 0 output) next)) + ((null next) output) + (t + (list output next)))) + +(defun its:standard-actionp (action) + "ACITION が standard-action であるかどうかを判定する." + (or (stringp action) + (and (consp action) + (or (stringp (car action)) + (and (consp (car action)) + (numberp (car (car action)))) + (null (car action))) + (or (null (car (cdr action))) + (stringp (car (cdr action))))))) + +(defvar its:make-terminal-state 'its:default-make-terminal-state + "終端の状態での表示を作成する関数を指定する. 関数は map input +action state を引数として呼ばれ,状態表示の文字列を返す.") + +(defun its:default-make-terminal-state (map input action state) + (cond(state state) + (t input))) + +(defun its:make-terminal-state-hangul (map input action state) + (cond((its:standard-actionp action) (action-output action)) + (t nil))) + +(defvar its:make-non-terminal-state 'its:default-make-standard-non-terminal-state + "非終端の状態での表示を作成する関数を指定する.関数は map input を +引数として呼ばれ,状態表示の文字列を返す" ) + +(defun its:default-make-standard-non-terminal-state (map input) + " ****" + (concat + (map-state-string map) + (char-to-string (aref input (1- (length input)))))) + +(defun its-defrule (input output &optional next state map) + + "INPUT が入力されると OUTPUT に変換する.NEXT が nil でないときは変 +換した後に NEXT が入力されたように変換を続ける.INPUTが入力された時点 +で変換が確定していない時は STATE をフェンス上に表示する.変換が確定し +ていない時に表示する文字列は変数 its:make-terminal-state および 変数 +its:make-non-terminal-state に指示された関数によって生成される.変換規 +則は MAP で指定された変換表に登録される.MAP が nil の場合はもっとも最 +近に its-define-mode された変換表に登録される.なお OUTPUT が nil の場 +合は INPUT に対する変換規則が削除される." + + (its-defrule* input + (its:make-standard-action output next) state + (if (stringp map) map + its:*processing-map*))) + +(defmacro its-defrule-conditional (input &rest conds) + "(its-defrule-conditional INPUT ((COND1 OUTPUT1) ... (CONDn OUTPUTn)))は +INPUT が入力された時に条件 CONDi を順次調べ,成立した時には OUTPUTi を +出力する." + (list 'its-defrule* input (list 'quote (cons 'cond conds)))) + +(defmacro its-defrule-conditional* (input state map &rest conds) + "(its-defrule-conditional INPUT STATE MAP ((COND1 OUTPUT1) ... (CONDn +OUTPUTn)))は INPUT が入力された時に状態 STATE を表示し,条件 CONDi を +順次調べ,成立した時には OUTPUTi を出力する." + (list 'its-defrule* input (list 'quote (cons 'cond conds)) state map)) + +(defun its-defrule-select-mode-temporally (input name) + "INPUT が入力されると temporally-mode として NAME が選択される." + + (its-defrule* input (list 'quote (list 'its:select-mode-temporally name)))) + +(defun its-defrule* (input action &optional state map) + (its:resize (length input)) + (setq map (cond((stringp map) (its:get-mode-map map)) + ((null map) its:*processing-map*) + (t map))) + (its-defrule** 0 input action state map) + map) + +(defvar its:*defrule-verbose* t "nilの場合, its-defrule の警告を抑制する") + +(defun its-defrule** (i input action state map) + (cond((= (length input) i) ;93.6.4 by T.Shingu + (map-set-state + map + (coerce-internal-string + (funcall its:make-terminal-state map input action state))) + (if (and its:*defrule-verbose* (map-action map)) + (if action + (notify "(its-defrule \"%s\" \"%s\" ) を再定義しました." + input action) + (notify "(its-defrule \"%s\" \"%s\" )を削除しました." + input (map-action map)))) + (if (and (null action) (map-terminalp map)) nil + (progn (map-set-action map action) + map))) + (t + (let((newmap + (or (get-next-map-locally map (aref input i)) + (make-map (funcall its:make-non-terminal-state + map + (substring input 0 (1+ i))))))) + (set-next-map map (aref input i) + (its-defrule** (1+ i) input action state newmap))) + (if (and (null (map-action map)) + (map-terminalp map)) + nil + map)))) + +;;; +;;; map: +;;; +;;; <map-alist> ::= ( ( <char> . <map> ) ... ) +;;; <topmap> ::= ( nil <indicator> <map-alist> <supers> ) +;;; <supers> ::= ( <topmap> .... ) +;;; <map> ::= ( <state> <action> <map-alist> ) +;;; <action> ::= <output> | ( <output> <next> ) .... + +(defun make-map (&optional state action alist supers) + (list state action alist supers)) + +(defun map-topmap-p (map) + (null (map-state map))) + +(defun map-supers (map) + (nth 3 map)) + +(defun map-set-supers (map val) + (setcar (nthcdr 3 map) val)) + +(defun map-terminalp (map) + (null (map-alist map))) + +(defun map-state (map) + (nth 0 map)) + +(defun map-state-string (map) + (coerce-string (map-state map))) + +(defun map-set-state (map val) + (setcar (nthcdr 0 map) val)) + +(defun map-indicator (map) + (map-action map)) +(defun map-set-indicator (map indicator) + (map-set-action map indicator)) + +(defun map-action (map) + (nth 1 map)) +(defun map-set-action (map val) + (setcar (nthcdr 1 map) val)) + +(defun map-alist (map) + (nth 2 map)) + +(defun map-set-alist (map alist) + (setcar (nthcdr 2 map) alist)) + +(defun get-action (map) + (if (null map) nil + (let ((action (map-action map))) + (cond((its:standard-actionp action) + action) + ((symbolp action) (condition-case nil + (funcall action) + (error nil))) + (t (condition-case nil + (eval action) + (error nil))))))) + +(defun action-output (action) + (cond((stringp action) action) + (t (car action)))) + +(defun action-next (action) + (cond((stringp action) nil) + (t (car (cdr action))))) + +(defun get-next-map (map ch) + (or (cdr (assq ch (map-alist map))) + (if (map-topmap-p map) + (let ((supers (map-supers map)) + (result nil)) + (while supers + (setq result (get-next-map (car supers) ch)) + (if result + (setq supers nil) + (setq supers (cdr supers)))) + result)))) + +(defun get-next-map-locally (map ch) + (cdr (assq ch (map-alist map)))) + +(defun set-next-map (map ch val) + (let ((place (assq ch (map-alist map)))) + (if place + (if val + (setcdr place val) + (map-set-alist map (delq place (map-alist map)))) + (if val + (map-set-alist map (cons (cons ch val) + (map-alist map))) + val)))) + +(defun its:simple-actionp (action) + (stringp action)) + +(defun collect-simple-action (map) + (if (map-terminalp map) + (if (its:simple-actionp (map-action map)) + (list (map-action map)) + nil) + (let ((alist (map-alist map)) + (result nil)) + (while alist + (setq result + ;;; 92.9.19 by Y. Kawabe + (append (collect-simple-action (cdr (car alist))) + result)) + (setq alist (cdr alist))) + result))) + +;;;---------------------------------------------------------------------- +;;; +;;; Runtime translators +;;; +;;;---------------------------------------------------------------------- + +(defun its:simulate-input (i j input map) + (while (<= i j) + (setq map (get-next-map map (aref input i))) ;92.12.26 by S.Tomura + (setq i (1+ i))) ;92.12.26 by S.Tomura + map) + +;;; meta-flag が on の時には、入力コードに \200 を or したものが入力さ +;;; れる。この部分の指摘は東工大の中川 貴之さんによる。 +;;; pointted by nakagawa@titisa.is.titech.ac.jp Dec-11-89 +;;; +;;; emacs では 文字コードは 0-127 で扱う。 +;;; + +(defvar its:*buff-s* (make-marker)) +(defvar its:*buff-e* (make-marker)) +(set-marker-insertion-type its:*buff-e* t) + +;;; STATE unread +;;; |<-s p->|<- e ->| +;;; s : ch0 state0 map0 +;;; +1: ch1 state1 map1 +;;; .... +;;; (point): + +;;; longest matching region : [s m] +;;; suspending region: [m point] +;;; unread region : [point e] + + +(defvar its:*maxlevel* 10) +(defvar its:*maps* (make-vector its:*maxlevel* nil)) +(defvar its:*actions* (make-vector its:*maxlevel* nil)) +(defvar its:*inputs* (make-vector its:*maxlevel* 0)) +(defvar its:*level* 0) + +(defun its:resize (size) + (if (<= its:*maxlevel* size) + (setq its:*maxlevel* size + its:*maps* (make-vector size nil) + its:*actions* (make-vector size nil) + its:*inputs* (make-vector size 0)))) + +(defun its:reset-maps (&optional init) + (setq its:*level* 0) + (if init + (aset its:*maps* its:*level* init))) + +(defun its:current-map () (aref its:*maps* its:*level*)) +(defun its:previous-map () (aref its:*maps* (max 0 (1- its:*level*)))) + +(defun its:level () its:*level*) + +(defun its:enter-newlevel (map ch output) + (setq its:*level* (1+ its:*level*)) + (aset its:*maps* its:*level* map) + (aset its:*inputs* its:*level* ch) + (aset its:*actions* its:*level* output)) + +(defvar its:*char-from-buff* nil) +(defvar its:*interactive* t) + +(defun its:reset-input () + (setq its:*char-from-buff* nil)) + +(defun its:flush-input-before-point (from) + (save-excursion + (while (<= from its:*level*) + (its:insert-char (aref its:*inputs* from)) + (setq from (1+ from))))) + +(defun its:peek-char () + (if (= (point) its:*buff-e*) + (if its:*interactive* + (setq unread-command-events (list (read-event))) + nil) + (following-char))) + +(defun its:read-char () + (if (= (point) its:*buff-e*) + (progn + (setq its:*char-from-buff* nil) + (if its:*interactive* + (read-char-exclusive) + nil)) + (let ((ch (following-char))) + (setq its:*char-from-buff* t) + (delete-char 1) + ch))) + +(defun its:push-char (ch) + (if its:*char-from-buff* + (save-excursion + (its:insert-char ch)) + (if ch (setq unread-command-events (list ch))))) + +(defun its:insert-char (ch) + (insert ch)) + +(defun its:ordinal-charp (ch) + (and (numberp ch) (<= 0 ch) (<= ch 127) + (eq (lookup-key fence-mode-map (char-to-string ch)) 'fence-self-insert-command))) + +(defun its:delete-charp (ch) + (and (numberp ch) (<= 0 ch) (<= ch 127) + (eq (lookup-key fence-mode-map (char-to-string ch)) 'fence-backward-delete-char))) + +(defun fence-self-insert-command () + (interactive) + (cond((or (not egg:*input-mode*) + (null (get-next-map its:*current-map* last-command-event))) + (insert last-command-event)) + (t + (insert last-command-event) + (its:translate-region (1- (point)) (point) t)))) + +;;; +;;; its: completing-read system +;;; + +(defun its:all-completions (string alist &optional pred) + "A variation of all-completions.\n\ +Arguments are STRING, ALIST and optional PRED. ALIST must be no obarray." + (let ((tail alist) (allmatches nil)) + (while tail + (let* ((elt (car tail)) + (eltstring (car elt))) + (setq tail (cdr tail)) + (if (and (stringp eltstring) + (<= (length string) (length eltstring)) + ;;;(not (= (aref eltstring 0) ? )) + (string-equal string (substring eltstring 0 (length string)))) + (if (or (and pred + (if (eq pred 'commandp) + (commandp elt) + (funcall pred elt))) + (null pred)) + (setq allmatches (cons elt allmatches)))))) + (nreverse allmatches))) + +(defun its:temp-echo-area-contents (message) + (let ((inhibit-quit inhibit-quit) + (point-max (point-max))) + (goto-char point-max) + (insert message) + (goto-char point-max) + (setq inhibit-quit t) + (sit-for 2 nil) + ;;; 92.9.19 by Y. Kawabe, 92.10.30 by T.Saneto + (delete-region (point) (point-max)) + (if quit-flag + (progn + (setq quit-flag nil) + (setq unread-command-events (list ?\^G)))))) + +(defun car-string-lessp (item1 item2) + (string-lessp (car item1) (car item2))) + +(defun its:minibuffer-completion-help () + "Display a list of possible completions of the current minibuffer contents." + (interactive) + (let ((completions)) + (message "Making completion list...") + (setq completions (its:all-completions (buffer-string) + minibuffer-completion-table + minibuffer-completion-predicate)) + (if (null completions) + (progn + ;;; 92.9.19 by Y. Kawabe + (beep) + (its:temp-echo-area-contents " [No completions]")) + (with-output-to-temp-buffer " *Completions*" + (display-completion-list + (sort completions 'car-string-lessp)))) + nil)) + +(defvar its:minibuffer-local-completion-map + (copy-keymap minibuffer-local-completion-map)) +(define-key its:minibuffer-local-completion-map "?" 'its:minibuffer-completion-help) +(define-key its:minibuffer-local-completion-map " " 'its:minibuffer-completion-help) + +(defvar its:minibuffer-local-must-match-map + (copy-keymap minibuffer-local-must-match-map)) +(define-key its:minibuffer-local-must-match-map "?" 'its:minibuffer-completion-help) +(define-key its:minibuffer-local-must-match-map " " 'its:minibuffer-completion-help) + +;;(fset 'si:all-completions (symbol-function 'all-completions)) +;;(fset 'si:minibuffer-completion-help (symbol-function 'minibuffer-completion-help)) + +(defun its:completing-read (prompt table &optional predicate require-match initial-input) + "See completing-read" + (let ((minibuffer-local-completion-map its:minibuffer-local-completion-map) + (minibuffer-local-must-match-map its:minibuffer-local-must-match-map) + (completion-auto-help nil)) + (completing-read prompt table predicate t initial-input))) + +(defvar its:*completing-input-menu* '(menu "Which?" nil)) ;92.10.26 by T.Saneto + +(defun its:completing-input (map) + ;;; + (let ((action (get-action map))) + (cond((and (null action) + (= (length (map-alist map)) 1)) + (its:completing-input (cdr (nth 0 (map-alist map))))) + (t + (setcar (nthcdr 2 its:*completing-input-menu*) + (map-alist map)) + (let ((values + (menu:select-from-menu its:*completing-input-menu* + 0 t))) + (cond((consp values) + ;;; get input char from menu + ) + (t + (its:completing-input map)))))))) + +(defvar its:*make-menu-from-map-result* nil) + +(defun its:make-menu-from-map (map) + (let ((its:*make-menu-from-map-result* nil)) + (its:make-menu-from-map* map "") + (list 'menu "Which?" (reverse its:*make-menu-from-map-result*) ))) + +(defun its:make-menu-from-map* (map string) + (let ((action (get-action map))) + (if action + (setq its:*make-menu-from-map-result* + (cons (format "%s[%s]" string (action-output action)) + its:*make-menu-from-map-result*))) + (let ((alist (map-alist map))) + (while alist + (its:make-menu-from-map* + (cdr (car alist)) + (concat string (char-to-string (car (car alist))))) + (setq alist (cdr alist)))))) + +(defvar its:*make-alist-from-map-result* nil) + +(defun its:make-alist-from-map (map &optional string) + (let ((its:*make-alist-from-map-result* nil)) + (its:make-alist-from-map* map (or string "")) + (reverse its:*make-alist-from-map-result*))) + +(defun its:make-alist-from-map* (map string) + (let ((action (get-action map))) + (if action + (setq its:*make-alist-from-map-result* + (cons (list string + (let ((action-output (action-output action))) + (cond((and (consp action-output) + (numberp (car action-output))) + (format "%s..." + (nth (car action-output) (cdr action-output)))) + ((stringp action-output) + action-output) + (t + (format "%s" action-output))))) + its:*make-alist-from-map-result*))) + (let ((alist (map-alist map))) + (while alist + (its:make-alist-from-map* + (cdr (car alist)) + (concat string (char-to-string (car (car alist))))) + (setq alist (cdr alist)))))) + +(defvar its:*select-alternative-output-menu* '(menu "Which?" nil)) + +(defun its:select-alternative-output (action-output) + ;;;; action-output : (pos item1 item2 item3 ....) + (let ((point (point)) + (output (cdr action-output)) + (ch 0)) + (while (not (eq ch ?\^L)) + (insert "<" (nth (car action-output)output) ">") + (setq ch (read-event)) + (cond ((eq ch ?\^N) + (setcar action-output + (mod (1+ (car action-output)) (length output)))) + ((eq ch ?\^P) + (setcar action-output + (if (= 0 (car action-output)) + (1- (length output)) + (1- (car action-output))))) + ((eq ch ?\^M) + (setcar (nthcdr 2 its:*select-alternative-output-menu* ) + output) + (let ((values + (menu:select-from-menu its:*select-alternative-output-menu* + (car action-output) + t))) + (cond((consp values) + (setcar action-output (nth 1 values)) + (setq ch ?\^L))))) + ((eq ch ?\^L) + ) + (t + (beep) + )) + (delete-region point (point))) + (if its:*insert-output-string* + (funcall its:*insert-output-string* (nth (car action-output) output)) + (insert (nth (car action-output) output))))) + + + +;;; translate until +;;; interactive --> not ordinal-charp +;;; or +;;; not interactive --> end of input + +(defvar its:*insert-output-string* nil) +(defvar its:*display-status-string* nil) + +(defun its:translate-region (start end its:*interactive* &optional topmap) + (set-marker its:*buff-s* start) + (set-marker its:*buff-e* end) + (its:reset-input) + (goto-char its:*buff-s*) + (let ((topmap (or topmap its:*current-map*)) + (map nil) + (ch nil) + (action nil) + (newmap nil) + (inhibit-quit t) + (its-quit-flag nil) + (echo-keystrokes 0)) + (setq map topmap) + (its:reset-maps topmap) + (while (not its-quit-flag) + (setq ch (its:read-char)) + (setq newmap (get-next-map map ch)) + (setq action (get-action newmap)) + + (cond + ((and its:*interactive* (not its:*char-from-buff*) (numberp ch) (= ch ?\^@)) + (delete-region its:*buff-s* (point)) + (let ((i 1)) + (while (<= i its:*level*) + (insert (aref its:*inputs* i)) + (setq i (1+ i)))) + (let ((inputs (its:completing-read "ITS:>" + (its:make-alist-from-map topmap) + nil + t + (buffer-substring its:*buff-s* (point))))) + (delete-region its:*buff-s* (point)) + (save-excursion (insert inputs)) + (its:reset-maps) + (setq map topmap) + )) + ((or (null newmap) + (and (map-terminalp newmap) + (null action))) + + (cond((and its:*interactive* (its:delete-charp ch)) + (delete-region its:*buff-s* (point)) + (cond((= its:*level* 0) + (setq its-quit-flag t)) + ((= its:*level* 1) + (its:insert-char (aref its:*inputs* 1)) + (setq its-quit-flag t)) + (t + (its:flush-input-before-point (1+ its:*level*)) + (setq its:*level* (1- its:*level*)) + (setq map (its:current-map)) + (if (and its:*interactive* + its:*display-status-string*) + (funcall its:*display-status-string* (map-state map)) + (insert (map-state map))) + ))) + + (t + (let ((output nil)) + (let ((i its:*level*) (newlevel (1+ its:*level*))) + (aset its:*inputs* newlevel ch) + (while (and (< 0 i) (null output)) + (if (and (aref its:*actions* i) + (its:simulate-input (1+ i) newlevel its:*inputs* topmap)) + (setq output i)) + (setq i (1- i))) + (if (null output) + (let ((i its:*level*)) + (while (and (< 0 i) (null output)) + (if (aref its:*actions* i) + (setq output i)) + (setq i (1- i))))) + + (cond(output + (delete-region its:*buff-s* (point)) + (cond((its:standard-actionp (aref its:*actions* output)) + (let ((action-output (action-output (aref its:*actions* output)))) + (if (and (not its:*interactive*) + (consp action-output)) + (setq action-output (nth (car action-output) (cdr action-output)))) + (cond((stringp action-output) + (if (and its:*interactive* + its:*insert-output-string*) + (funcall its:*insert-output-string* action-output) + (insert action-output))) + ((consp action-output) + (its:select-alternative-output action-output) + ) + (t + (beep) (beep) + ))) + (set-marker its:*buff-s* (point)) + (its:push-char ch) + (its:flush-input-before-point (1+ output)) + (if (action-next (aref its:*actions* output)) + (save-excursion + (insert (action-next (aref its:*actions* output))))) + ) + ((symbolp (aref its:*actions* output)) + (its:push-char ch) + (funcall (aref its:*actions* output)) + (its:reset-maps its:*current-map*) + (setq topmap its:*current-map*) + (set-marker its:*buff-s* (point))) + (t + (its:push-char ch) + ;92.10.26 by T.Saneto + (eval (aref its:*actions* output)) + (its:reset-maps its:*current-map*) + (setq topmap its:*current-map*) + (set-marker its:*buff-s* (point)) + )) + ) + ((= 0 its:*level*) + (cond ((or (its:ordinal-charp ch) + its:*char-from-buff*) + (its:insert-char ch)) + (t (setq its-quit-flag t)))) + + ((< 0 its:*level*) + (delete-region its:*buff-s* (point)) + (its:insert-char (aref its:*inputs* 1)) + (set-marker its:*buff-s* (point)) + (its:push-char ch) + (its:flush-input-before-point 2))))) + + (cond((null ch) + (setq its-quit-flag t)) + ((not its-quit-flag) + (its:reset-maps) + (set-marker its:*buff-s* (point)) + (setq map topmap)))))) + + ((map-terminalp newmap) + (its:enter-newlevel (setq map newmap) ch action) + (delete-region its:*buff-s* (point)) + (let ((output nil) (m nil) (i (1- its:*level*))) + (while (and (< 0 i) (null output)) + (if (and (aref its:*actions* i) + (setq m (its:simulate-input (1+ i) its:*level* its:*inputs* topmap)) + (not (map-terminalp m))) + (setq output i)) + (setq i (1- i))) + + (cond((null output) + (cond ((its:standard-actionp action) + (let ((action-output (action-output action))) + (if (and (not its:*interactive*) + (consp action-output)) + (setq action-output (nth (car action-output) (cdr action-output)))) + (cond((stringp action-output) + (if (and its:*interactive* + its:*insert-output-string*) + (funcall its:*insert-output-string* action-output) + (insert action-output))) + ((consp action-output) + (its:select-alternative-output action-output) + ) + (t + (beep) (beep) + ))) + (cond((null (action-next action)) + (cond ((and (= (point) its:*buff-e*) + its:*interactive* + (its:delete-charp (its:peek-char))) + nil) + (t + (set-marker its:*buff-s* (point)) + (its:reset-maps) + (setq map topmap) + ))) + (t + (save-excursion (insert (action-next action))) + (set-marker its:*buff-s* (point)) + (its:reset-maps) + (setq map topmap)))) + ((symbolp action) + (funcall action) + (its:reset-maps its:*current-map*) + (setq topmap its:*current-map*) + (setq map topmap) + (set-marker its:*buff-s* (point))) + (t + (eval action) + (its:reset-maps its:*current-map*) + (setq topmap its:*current-map*) + (setq map topmap) + (set-marker its:*buff-s* (point))))) + (t + (if (and its:*interactive* + its:*display-status-string*) + (funcall its:*display-status-string* (map-state map)) + (insert (map-state map))))))) + + ((null action) + (delete-region its:*buff-s* (point)) + (if (and its:*interactive* + its:*display-status-string*) + (funcall its:*display-status-string* (map-state newmap)) + (insert (map-state newmap))) + (its:enter-newlevel (setq map newmap) + ch action)) + + (t + (its:enter-newlevel (setq map newmap) ch action) + (delete-region its:*buff-s* (point)) + (if (and its:*interactive* + its:*display-status-string*) + (funcall its:*display-status-string* (map-state map)) + (insert (map-state map)))))) + + (set-marker its:*buff-s* nil) + (set-marker its:*buff-e* nil) + (if (and its:*interactive* ch) (setq unread-command-events (list ch))) + )) + +;;;---------------------------------------------------------------------- +;;; +;;; ITS-map dump routine: +;;; +;;;---------------------------------------------------------------------- + +;;;;; +;;;;; User entry: dump-its-mode-map +;;;;; + +;; 92.6.26 by K.Handa +(defun dump-its-mode-map (name filename) + "Obsolete." + (interactive) + (message "This function is obsolete in the current version of Mule.")) +;;; +;;; EGG mode variables +;;; + +(defvar egg:*mode-on* nil "T if egg mode is on.") +(make-variable-buffer-local 'egg:*mode-on*) +(set-default 'egg:*mode-on* nil) + +(defvar egg:*input-mode* t "T if egg map is active.") +(make-variable-buffer-local 'egg:*input-mode*) +(set-default 'egg:*input-mode* t) + +(defvar egg:*in-fence-mode* nil "T if in fence mode.") +(make-variable-buffer-local 'egg:*in-fence-mode*) +(set-default 'egg:*in-fence-mode* nil) + +;;(load-library "its-dump/roma-kana") ;;;(define-its-mode "roma-kana" " aあ") +;;(load-library "its-dump/roma-kata") ;;;(define-its-mode "roma-kata" " aア") +;;(load-library "its-dump/downcase") ;;;(define-its-mode "downcase" " a a") +;;(load-library "its-dump/upcase") ;;;(define-its-mode "upcase" " a A") +;;(load-library "its-dump/zenkaku-downcase") ;;;(define-its-mode "zenkaku-downcase" " aa") +;;(load-library "its-dump/zenkaku-upcase") ;;;(define-its-mode "zenkaku-upcase" " aA") +;; 92.3.13 by K.Handa +;; (load "its-hira") +;; (load-library "its-kata") +;; (load-library "its-hankaku") +;; (load-library "its-zenkaku") + + +(defvar its:*current-map* nil) +(make-variable-buffer-local 'its:*current-map*) +;; 92.3.13 by K.Handa +;; moved to each language specific setup files (japanese.el, ...) +;; (setq-default its:*current-map* (its:get-mode-map "roma-kana")) + +(defvar its:*previous-map* nil) +(make-variable-buffer-local 'its:*previous-map*) +(setq-default its:*previous-map* nil) + +;;;---------------------------------------------------------------------- +;;; +;;; Mode line control functions; +;;; +;;;---------------------------------------------------------------------- + +(defvar mode-line-egg-mode "--") +(make-variable-buffer-local 'mode-line-egg-mode) + +(defvar mode-line-egg-mode-in-minibuffer "--" "global variable") + +(defun egg:find-symbol-in-tree (item tree) + (if (consp tree) + (or (egg:find-symbol-in-tree item (car tree)) + (egg:find-symbol-in-tree item (cdr tree))) + (equal item tree))) + +;;; +;;; nemacs Ver. 3.0 では Fselect_window が変更になり、minibuffer-window +;;; 他の window との間で出入りがあると、mode-line の更新を行ない、変数 +;;; minibuffer-window-selected の値が更新される +;;; + +;;; nemacs Ver. 4 では Fselect_window が変更になり,select-window-hook +;;; が定義された.これにともない従来,再定義していた select-window, +;;; other-window, keyborad-quit, abort-recursive-edit, exit-minibuffer +;;; を削除した. + +(defvar display-minibuffer-mode-in-minibuffer t) + +(defvar minibuffer-window-selected nil) + +(defun egg:select-window-hook (old new) + (if (and (eq old (minibuffer-window)) + (not (eq new (minibuffer-window)))) + (save-excursion + (set-buffer (window-buffer (minibuffer-window))) + (setq ;;minibuffer-preprompt nil + egg:*mode-on* (default-value 'egg:*mode-on*) + egg:*input-mode* (default-value 'egg:*input-mode*) + egg:*in-fence-mode* (default-value 'egg:*in-fence-mode*)))) + (if (eq new (minibuffer-window)) + (setq minibuffer-window-selected t) + (setq minibuffer-window-selected nil))) + +(defvar mode-line-egg-mode-in-minibuffer-as-before "--" + "Internal variable used to keep the value of +`mode-line-egg-mode-in-minibuffer' as it was before entering the +minibuffer.") + +(defvar egg:minibuffer-preprompt-overlay nil + "Internal variable used to keep an overlay to show a preprompt string +in the minibuffer.") + +(defun egg:minibuffer-setup-function () + (setq minibuffer-window-selected t + mode-line-egg-mode-in-minibuffer-as-before + mode-line-egg-mode-in-minibuffer)) +(add-hook 'minibuffer-setup-hook 'egg:minibuffer-setup-function) + +(defun egg:minibuffer-exit-function () + (if egg:minibuffer-preprompt-overlay + (delete-overlay egg:minibuffer-preprompt-overlay)) + (setq egg:minibuffer-preprompt-overlay nil + ;;minibuffer-preprompt nil + minibuffer-window-selected nil + ;; reset the value of each variables in minibuffer + egg:*mode-on* (default-value 'egg:*mode-on*) + egg:*input-mode* (default-value 'egg:*input-mode*) + egg:*in-fence-mode* (default-value 'egg:*in-fence-mode*) + display-minibuffer-mode nil + mode-line-egg-mode-in-minibuffer + mode-line-egg-mode-in-minibuffer-as-before)) +(add-hook 'minibuffer-exit-hook 'egg:minibuffer-exit-function) + +;(setq select-window-hook 'egg:select-window-hook) + +;;; +;;; +;;; + +(defvar its:*reset-mode-line-format* nil) + +(if its:*reset-mode-line-format* + (setq-default mode-line-format + (cdr mode-line-format))) + +(if (not (egg:find-symbol-in-tree 'mode-line-egg-mode mode-line-format)) + (setq-default + mode-line-format + (cons (list ;'mc-flag + (list 'display-minibuffer-mode-in-minibuffer + ;;; minibuffer mode in minibuffer + (list + (list 'its:*previous-map* "<" "[") + 'mode-line-egg-mode + (list 'its:*previous-map* ">" "]") + ) + ;;;; minibuffer mode in mode line + (list + (list 'minibuffer-window-selected + (list 'display-minibuffer-mode + "m" + " ") + " ") + (list 'its:*previous-map* "<" "[") + (list 'minibuffer-window-selected + (list 'display-minibuffer-mode + 'mode-line-egg-mode-in-minibuffer + 'mode-line-egg-mode) + 'mode-line-egg-mode) + (list 'its:*previous-map* ">" "]") + ))) + mode-line-format))) + +;;; +;;; minibuffer でのモード表示をするために nemacs 4 で定義された +;;; minibuffer-preprompt を利用する. +;;; + +;; Emcws chage: Since Emacs 20+ does not supprt `minibuffer-preprompt', +;; we will use overlays in the minibuffer. + +(defvar egg:minibuffer-preprompt '("[" nil "]")) + +(defun mode-line-egg-mode-update (str) + (if (eq (current-buffer) (window-buffer (minibuffer-window))) + (if display-minibuffer-mode-in-minibuffer + (progn + (aset (nth 0 egg:minibuffer-preprompt) 0 + (if its:*previous-map* ?\< ?\[)) + (setcar (nthcdr 1 egg:minibuffer-preprompt) + str) + (aset (nth 2 egg:minibuffer-preprompt) 0 + (if its:*previous-map* ?\> ?\])) + ;;(setq minibuffer-preprompt egg:minibuffer-preprompt) + (or egg:minibuffer-preprompt-overlay + (setq egg:minibuffer-preprompt-overlay + (make-overlay (point-min) (point-min)))) + (overlay-put egg:minibuffer-preprompt-overlay 'before-string + (apply 'concat egg:minibuffer-preprompt))) + (setq display-minibuffer-mode t + mode-line-egg-mode-in-minibuffer str)) + (setq display-minibuffer-mode nil + mode-line-egg-mode str)) + ;;; nemacs 4 only(update-mode-lines) + (set-buffer-modified-p (buffer-modified-p))) + +(mode-line-egg-mode-update mode-line-egg-mode) + +;;; +;;; egg mode line display +;;; + +(defvar alphabet-mode-indicator "aA") +(defvar transparent-mode-indicator "--") + +(defun egg:mode-line-display () + (mode-line-egg-mode-update + (cond((and egg:*in-fence-mode* (not egg:*input-mode*)) + alphabet-mode-indicator) + ((and egg:*mode-on* egg:*input-mode*) + (map-indicator its:*current-map*)) + (t transparent-mode-indicator)))) + +(defun egg:toggle-egg-mode-on-off () + (interactive) + (setq egg:*mode-on* (not egg:*mode-on*)) + (egg:mode-line-display)) + +(defun its:select-mode (name) + (interactive (list (completing-read "ITS mode: " its:*mode-alist*))) + (if (its:get-mode-map name) + (progn + (setq its:*current-map* (its:get-mode-map name)) + (egg:mode-line-display)) + (beep)) + ) + +(defvar its:*select-mode-menu* '(menu "Mode:" nil)) + +(defun its:select-mode-from-menu () + (interactive) + (setcar (nthcdr 2 its:*select-mode-menu*) its:*mode-alist*) + (setq its:*current-map* (menu:select-from-menu its:*select-mode-menu*)) + (egg:mode-line-display)) + +(defvar its:*standard-modes* nil + "List of standard mode-map of EGG." + ;; 92.3.13 by K.Handa + ;; moved to each language specific setup files (japanese.el, ...) + ;; (list (its:get-mode-map "roma-kana") + ;; (its:get-mode-map "roma-kata") + ;; (its:get-mode-map "downcase") + ;; (its:get-mode-map "upcase") + ;; (its:get-mode-map "zenkaku-downcase") + ;; (its:get-mode-map "zenkaku-upcase")) + ) + +(defun its:find (map list) + (let ((n 0)) + (while (and list (not (eq map (car list)))) + (setq list (cdr list) + n (1+ n))) + (if list n nil))) + +(defun its:next-mode () + (interactive) + (let ((pos (its:find its:*current-map* its:*standard-modes*))) + (setq its:*current-map* + (nth (% (1+ pos) (length its:*standard-modes*)) + its:*standard-modes*)) + (egg:mode-line-display))) + +(defun its:previous-mode () + (interactive) + (let ((pos (its:find its:*current-map* its:*standard-modes*))) + (setq its:*current-map* + (nth (1- (if (= pos 0) (length its:*standard-modes*) pos)) + its:*standard-modes*)) + (egg:mode-line-display))) + +(defun its:select-hiragana () (interactive) (its:select-mode "roma-kana")) +(defun its:select-katakana () (interactive) (its:select-mode "roma-kata")) +(defun its:select-downcase () (interactive) (its:select-mode "downcase")) +(defun its:select-upcase () (interactive) (its:select-mode "upcase")) +(defun its:select-zenkaku-downcase () (interactive) (its:select-mode "zenkaku-downcase")) +(defun its:select-zenkaku-upcase () (interactive) (its:select-mode "zenkaku-upcase")) + +(defun its:select-mode-temporally (name) + (interactive (list (completing-read "ITS mode: " its:*mode-alist*))) + (let ((map (its:get-mode-map name))) + (if map + (progn + (if (null its:*previous-map*) + (setq its:*previous-map* its:*current-map*)) + (setq its:*current-map* map) + (egg:mode-line-display)) + (beep)))) + +(defun its:select-previous-mode () + (interactive) + (if (null its:*previous-map*) + (beep) + (setq its:*current-map* its:*previous-map* + its:*previous-map* nil) + (egg:mode-line-display))) + + +(defun toggle-egg-mode () + (interactive) + (if t ;mc-flag + (if egg:*mode-on* (fence-toggle-egg-mode) + (progn + (setq egg:*mode-on* t) + (egg:mode-line-display))))) + +(defun fence-toggle-egg-mode () + (interactive) + (if its:*current-map* + (progn + (setq egg:*input-mode* (not egg:*input-mode*)) + (egg:mode-line-display)) + (beep))) + +;;; +;;; Changes on Global map +;;; + +(defvar si:*global-map* (copy-keymap global-map)) + +(substitute-key-definition 'self-insert-command + 'egg-self-insert-command + global-map) + +;;; +;;; Currently entries C-\ and C-^ at global-map are undefined. +;;; + +(define-key global-map "\C-\\" 'toggle-egg-mode) +(define-key global-map "\C-x " 'henkan-region) + +;; 92.3.16 by K.Handa +;; global-map => mule-keymap +(define-key mule-keymap "m" 'its:select-mode-from-menu) +(define-key mule-keymap ">" 'its:next-mode) +(define-key mule-keymap "<" 'its:previous-mode) +(define-key mule-keymap "h" 'its:select-hiragana) +(define-key mule-keymap "k" 'its:select-katakana) +(define-key mule-keymap "q" 'its:select-downcase) +(define-key mule-keymap "Q" 'its:select-upcase) +(define-key mule-keymap "z" 'its:select-zenkaku-downcase) +(define-key mule-keymap "Z" 'its:select-zenkaku-upcase) + +;;; +;;; auto fill controll +;;; + +(defun egg:do-auto-fill () + (if (and auto-fill-function (not buffer-read-only) + (> (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))))) + +;;;---------------------------------------------------------------------- +;;; +;;; Egg fence mode +;;; +;;;---------------------------------------------------------------------- + +(defvar egg:*fence-open* "|" "*フェンスの始点を示す文字列") +(defvar egg:*fence-close* "|" "*フェンスの終点を示す文字列") +(defvar egg:*fence-face* nil "*フェンス表示に用いる face または nil") +(make-variable-buffer-local + (defvar egg:*fence-overlay* nil "フェンス表示用 overlay")) + +(defvar egg:*face-alist* + '(("nil" . nil) + ("highlight" . highlight) ("modeline" . modeline) + ("inverse" . modeline) ("underline" . underline) ("bold" . bold) + ("region" . region))) + +(defun set-egg-fence-mode-format (open close &optional face) + "fence mode の表示方法を設定する。OPEN はフェンスの始点を示す文字列または nil。\n\ +CLOSEはフェンスの終点を示す文字列または nil。\n\ +第3引数 FACE が指定されて nil でなければ、フェンス区間の表示にそれを使う。" + (interactive (list (read-string "フェンス開始文字列: ") + (read-string "フェンス終了文字列: ") + (cdr (assoc (completing-read "フェンス表示属性: " egg:*face-alist*) + egg:*face-alist*)))) + + (if (and (or (stringp open) (null open)) + (or (stringp close) (null close)) + (or (null face) (memq face (face-list)))) + (progn + (setq egg:*fence-open* (or open "") + egg:*fence-close* (or close "") + egg:*fence-face* face) + (if (overlayp egg:*fence-overlay*) + (overlay-put egg:*fence-overlay* 'face egg:*fence-face*)) + t) + (error "Wrong type of argument: %s %s %s" open close face))) + +;(defconst egg:*region-start* (make-marker)) +;(defconst egg:*region-end* (make-marker)) +;(set-marker-insertion-type egg:*region-end* t) +(defvar egg:*region-start* nil) +(defvar egg:*region-end* nil) +(make-variable-buffer-local 'egg:*region-start*) +(make-variable-buffer-local 'egg:*region-end*) +(set-default 'egg:*region-start* nil) +(set-default 'egg:*region-end* nil) + +;;; +;;; (defvar disable-undo nil "*Compatibility for Nemacs") +;;; +;;; Moved to kanji.el +;;; (defvar self-insert-after-hook nil +;;; "Hook to run when extended self insertion command exits. Should take +;;; two arguments START and END correspoding to character position.") +(defvar self-insert-after-hook nil + "Hook to run when extended self insertion command exits. Should take +two arguments START and END correspoding to character position.") + +(defvar egg:*self-insert-non-undo-count* 0 + "counter to hold repetition of egg-self-insert-command.") + +(defun egg:cancel-undo-boundary () + "Cancel undo boundary for egg-self-insert-command" + (if (eq last-command 'egg-self-insert-command) + (if (and (consp buffer-undo-list) + ;; if car is nil. + (null (car buffer-undo-list)) + (< egg:*self-insert-non-undo-count* 20)) + ;; treat consecutive 20 self-insert commands as a single undo chunk. + ;; `20' is a magic number copied from keyboard.c + (setq buffer-undo-list (cdr buffer-undo-list) + egg:*self-insert-non-undo-count* + (1+ egg:*self-insert-non-undo-count*)) + (setq egg:*self-insert-non-undo-count* 1)))) + +(defun egg-self-insert-command (arg) + (interactive "p") + (if (and (not buffer-read-only) +; mc-flag + egg:*mode-on* egg:*input-mode* + (not egg:*in-fence-mode*) ;;; inhibit recursive fence mode + (not (= last-command-event ? ))) + (egg:enter-fence-mode-and-self-insert) + (progn + (if (and (eq last-command 'egg-self-insert-command) + (> last-command-char ? )) + (egg:cancel-undo-boundary)) + (self-insert-command arg) + (if egg-insert-after-hook + (run-hooks 'egg-insert-after-hook)) + (if self-insert-after-hook + (if (<= 1 arg) + (funcall self-insert-after-hook + (- (point) arg) (point))) + (if (= last-command-event ? ) (egg:do-auto-fill)))))) + +;; +;; 前確定変換処理関数 +;; +(defvar egg:*fence-open-backup* nil) +(defvar egg:*fence-close-backup* nil) +(defvar egg:*fence-face-backup* nil) + +(defvar egg:*fence-open-in-cont* "+" "*前確定状態での *fence-open*") +(defvar egg:*fence-close-in-cont* t "*前確定状態での *fence-close*") +(defvar egg:*fence-face-in-cont* t + "*前確定状態での *fence-face*") + +(defun set-egg-fence-mode-format-in-cont (open close face) + "前確定状態での fence mode の表示方法を設定する。OPEN はフェンスの始点を示す文 +字列、t または nil。\n\ +CLOSEはフェンスの終点を示す文字列、t または nil。\n\ +FACE は nil でなければ、フェンス区間の表示にそれを使う。\n\ +それぞれの値が t の場合、通常の egg:*fence-open* 等の値を引き継ぐ。" + (interactive (list (read-string "フェンス開始文字列: ") + (read-string "フェンス終了文字列: ") + (cdr (assoc (completing-read "フェンス表示属性: " egg:*face-alist*) + egg:*face-alist*)))) + + (if (and (or (stringp open) (eq open t) (null open)) + (or (stringp close) (eq close t) (null close)) + (or (null face) (eq face t) (memq face (face-list)))) + (progn + (setq egg:*fence-open-in-cont* (or open "") + egg:*fence-close-in-cont* (or close "") + egg:*fence-face-in-cont* face) + (if (overlayp egg:*fence-overlay*) + (overlay-put egg:*fence-overlay* 'face egg:*fence-face*)) + t) + (error "Wrong type of argument: %s %s %s" open close face))) + +(defvar *in-cont-flag* nil + "直前に変換した直後の入力かどうかを示す。") + +(defvar *in-cont-backup-flag* nil) + +(defun egg:check-fence-in-cont () + (if *in-cont-flag* + (progn + (setq *in-cont-backup-flag* t) + (setq egg:*fence-open-backup* egg:*fence-open*) + (setq egg:*fence-close-backup* egg:*fence-close*) + (setq egg:*fence-face-backup* egg:*fence-face*) + (or (eq egg:*fence-open-in-cont* t) + (setq egg:*fence-open* egg:*fence-open-in-cont*)) + (or (eq egg:*fence-close-in-cont* t) + (setq egg:*fence-close* egg:*fence-close-in-cont*)) + (or (eq egg:*fence-face-in-cont* t) + (setq egg:*fence-face* egg:*fence-face-in-cont*))))) + +(defun egg:restore-fence-in-cont () + "Restore egg:*fence-open* and egg:*fence-close*" + (if *in-cont-backup-flag* + (progn + (setq egg:*fence-open* egg:*fence-open-backup*) + (setq egg:*fence-close* egg:*fence-close-backup*) + (setq egg:*fence-face* egg:*fence-face-backup*))) + (setq *in-cont-backup-flag* nil) + ) + +(defun egg:enter-fence-mode-and-self-insert () + (setq *in-cont-flag* + (memq last-command '(henkan-kakutei henkan-kakutei-and-self-insert))) + (enter-fence-mode) + (setq unread-command-events (list last-command-event))) + +(defun egg:fence-face-on () + (if egg:*fence-face* + (progn + (or (overlayp egg:*fence-overlay*) + (setq egg:*fence-overlay* (make-overlay 1 1 nil nil t))) + (if egg:*fence-face* + (or (eq egg:*fence-face* + (overlay-get egg:*fence-overlay* 'face)) + (overlay-put egg:*fence-overlay* 'face egg:*fence-face*))) + (move-overlay egg:*fence-overlay* egg:*region-start* egg:*region-end*)))) + +(defun egg:fence-face-off () + (and egg:*fence-face* + (overlayp egg:*fence-overlay*) + (delete-overlay egg:*fence-overlay*) )) + +(defun enter-fence-mode () + ;;;(buffer-flush-undo (current-buffer)) + (suspend-undo) + ;;;(and (boundp 'disable-undo) (setq disable-undo t)) + (setq egg:*in-fence-mode* t) + (egg:mode-line-display) + (egg:check-fence-in-cont) ; for Wnn6 + (insert egg:*fence-open*) + (or (markerp egg:*region-start*) (setq egg:*region-start* (make-marker))) + (set-marker egg:*region-start* (point)) + (insert egg:*fence-close*) + (or (markerp egg:*region-end*) + (progn + (setq egg:*region-end* (make-marker)) + (set-marker-insertion-type egg:*region-end* t))) + (set-marker egg:*region-end* egg:*region-start*) + (egg:fence-face-on) + (goto-char egg:*region-start*) + ) + +(defun henkan-fence-region-or-single-space () + (interactive) + (if egg:*input-mode* + (henkan-fence-region) + (insert ? ))) + +(defvar egg:*henkan-fence-mode* nil) + +(defun henkan-fence-region () + (interactive) + (setq egg:*henkan-fence-mode* t) + (egg:fence-face-off) + (henkan-region-internal egg:*region-start* egg:*region-end* )) + +(defun fence-katakana () + (interactive) + (japanese-katakana-region egg:*region-start* egg:*region-end* )) + +(defun fence-hiragana () + (interactive) + (japanese-hiragana-region egg:*region-start* egg:*region-end*)) + +(defun fence-hankaku () + (interactive) + (japanese-hankaku-region egg:*region-start* egg:*region-end*)) + +(defun fence-zenkaku () + (interactive) + (japanese-zenkaku-region egg:*region-start* egg:*region-end*)) + +(defun fence-backward-char () + (interactive) + (if (< egg:*region-start* (point)) + (backward-char) + (beep))) + +(defun fence-forward-char () + (interactive) + (if (< (point) egg:*region-end*) + (forward-char) + (beep))) + +(defun fence-beginning-of-line () + (interactive) + (goto-char egg:*region-start*)) + +(defun fence-end-of-line () + (interactive) + (goto-char egg:*region-end*)) + +(defun fence-transpose-chars (arg) + (interactive "P") + (if (and (< egg:*region-start* (point)) + (< (point) egg:*region-end*)) + (transpose-chars arg) + (beep))) + +(defun egg:exit-if-empty-region () + (if (= egg:*region-start* egg:*region-end*) + (fence-exit-mode))) + +(defun fence-delete-char () + (interactive) + (if (< (point) egg:*region-end*) + (progn + (delete-char 1) + (egg:exit-if-empty-region)) + (beep))) + +(defun fence-backward-delete-char () + (interactive) + (if (< egg:*region-start* (point)) + (progn + (delete-char -1) + (egg:exit-if-empty-region)) + (beep))) + +(defun fence-kill-line () + (interactive) + (delete-region (point) egg:*region-end*) + (egg:exit-if-empty-region)) + +(defun fence-exit-mode () + (interactive) + (egg:fence-face-off) + (setq egg:*in-fence-mode* nil) + (let ((kakutei-string (buffer-substring egg:*region-start* egg:*region-end*))) + (delete-region (- egg:*region-start* (length egg:*fence-open*)) egg:*region-start*) + (delete-region egg:*region-start* egg:*region-end*) + (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*fence-close*))) + (goto-char egg:*region-start*) + (resume-undo-list) + (insert kakutei-string)) + (if its:*previous-map* + (setq its:*current-map* its:*previous-map* + its:*previous-map* nil)) + (egg:quit-egg-mode)) + +(defun delete-text-in-column (from to) + "Delete the text between column FROM and TO (exclusive) of the current line. +Nil of FORM or TO means the current column. +If there's a charcter across the borders, the character is replaced with +the same width of spaces before deleting." + (save-excursion + (let (p1 p2) + (if from + (progn + (setq p1 (move-to-column from)) + (if (> p1 from) + (progn + (delete-char -1) + (insert-char ? (- p1 (current-column))) + (forward-char (- from p1)))))) + (setq p1 (point)) + (if to + (progn + (setq p2 (move-to-column to)) + (if (> p2 to) + (progn + (delete-char -1) + (insert-char ? (- p2 (current-column))) + (forward-char (- to p2)))))) + (setq p2 (point)) + (delete-region p1 p2)))) + +(defvar egg-insert-after-hook nil) +(make-variable-buffer-local 'egg-insert-after-hook) + +(defvar egg-exit-hook nil + "Hook to run when egg exits. Should take two arguments START and END +correspoding to character position.") + +(defun egg:quit-egg-mode () + (egg:mode-line-display) + (if overwrite-mode + (let ((str (buffer-substring egg:*region-end* egg:*region-start*))) + (delete-text-in-column nil (+ (current-column) (string-width str))))) + (egg:restore-fence-in-cont) ; for Wnn6 + (setq egg:*henkan-fence-mode* nil) + (if self-insert-after-hook + (funcall self-insert-after-hook egg:*region-start* egg:*region-end*) + (if egg-exit-hook + (funcall egg-exit-hook egg:*region-start* egg:*region-end*) + (if (not (= egg:*region-start* egg:*region-end*)) + (egg:do-auto-fill)))) + (set-marker egg:*region-start* nil) + (set-marker egg:*region-end* nil) + ;;;(buffer-enable-undo) + ;;;(undo-boundary) + ;;;(and (boundp 'disable-undo) (setq disable-undo nil)) + (if egg-insert-after-hook + (run-hooks 'egg-insert-after-hook)) + ) + +(defun fence-cancel-input () + (interactive) + (delete-region egg:*region-start* egg:*region-end*) + (fence-exit-mode)) + +(defun fence-mode-help-command () + "Display documentation for fence-mode." + (interactive) + (let ((buf "*Help*")) + (if (eq (get-buffer buf) (current-buffer)) + (henkan-quit) + (with-output-to-temp-buffer buf + (princ (substitute-command-keys "The keys that are defined for the fence mode here are:\\{fence-mode-map}")) + (print-help-return-message))))) + +(defvar fence-mode-map (append '(keymap (t . undefined) + (?\C-x keymap (t . undefined))) + function-key-map)) + +(defvar fence-mode-esc-map + (let (map) + (cond ((keymapp (setq map (lookup-key fence-mode-map + (vector meta-prefix-char)))) + map) + ((keymapp (setq map (lookup-key fence-mode-map [escape]))) + map) + (t + (make-sparse-keymap))))) + +(or (keymapp (lookup-key fence-mode-map (vector meta-prefix-char))) + (define-key fence-mode-map (vector meta-prefix-char) fence-mode-esc-map)) +(or (keymapp (lookup-key fence-mode-map [escape])) + (define-key fence-mode-map [escape] fence-mode-esc-map)) + +(substitute-key-definition 'egg-self-insert-command + 'fence-self-insert-command + fence-mode-map global-map) + +(dolist (elem '((" " henkan-fence-region-or-single-space) + ("\177" fence-backward-delete-char) + ("\C-@" henkan-fence-region) + ("\C-\ " henkan-fence-region) + ("\C-\\" fence-toggle-egg-mode) + ("\C-_" jis-code-input) + ("\C-a" fence-beginning-of-line) + ("\C-b" fence-backward-char) + ("\C-c" fence-cancel-input) + ("\C-d" fence-delete-char) + ("\C-e" fence-end-of-line) + ("\C-f" fence-forward-char) + ("\C-g" fence-cancel-input) + ("\C-h" fence-mode-help-command) + ("\C-k" fence-kill-line) + ("\C-l" fence-exit-mode) + ("\C-m" fence-exit-mode) + ("\C-q" its:select-previous-mode) + ("\C-t" fence-transpose-chars) + ("\C-w" henkan-fence-region) + ("\C-z" eval-expression) + + ([backspace] fence-backward-delete-char) + ([clear] fence-cancel-input) + ([delete] fence-backward-delete-char) + ([help] fence-mode-help-command) + ([left] fence-backward-char) + ([return] fence-exit-mode) + ([right] fence-forward-char))) + (apply 'define-key fence-mode-map elem)) + +(dolist (elem '(([t] undefined);; default binding + ("<" fence-hankaku) + (">" fence-zenkaku) + ("Q" its:select-upcase) + ("Z" its:select-zenkaku-upcase) + ("\C-h" its:select-hiragana) + ("\C-k" its:select-katakana) + ("h" fence-hiragana) + ("k" fence-katakana) + ("q" its:select-downcase) + ("z" its:select-zenkaku-downcase))) + (apply 'define-key fence-mode-esc-map elem)) + + +(or (assq 'egg:*in-fence-mode* minor-mode-map-alist) + (setq minor-mode-map-alist + (cons (cons 'egg:*in-fence-mode* fence-mode-map) + minor-mode-map-alist))) + +;;;---------------------------------------------------------------------- +;;; +;;; Read hiragana from minibuffer +;;; +;;;---------------------------------------------------------------------- + +(defvar egg:*minibuffer-local-hiragana-map* + (append '(keymap (?\C-x keymap (t . undefined)) + (?\e keymap (t . undefined))) + minibuffer-local-map)) + +(substitute-key-definition 'egg-self-insert-command + 'fence-self-insert-command + egg:*minibuffer-local-hiragana-map* + global-map) + +(substitute-key-definition 'toggle-egg-mode 'ignore + egg:*minibuffer-local-hiragana-map* + global-map) + +(defun egg:read-hiragana-string (prompt &optional initial-input) + (let (minibuffer-setup-hook minibuffer-setup-hook) + (add-hook 'minibuffer-setup-hook + `(lambda nil + (mode-line-egg-mode-update + ,(nth 1 (its:get-mode-indicator its:*current-map*))))) + (read-from-minibuffer prompt initial-input + egg:*minibuffer-local-hiragana-map*))) + +(defun egg:read-kanji-string (prompt &optional initial-input) + (let ((its:*current-map* (its:get-mode-map "roma-kana")) + (minibuffer-setup-hook minibuffer-setup-hook)) + (add-hook 'minibuffer-setup-hook + (lambda nil + (setq egg:*input-mode* t + egg:*mode-on* t) + (mode-line-egg-mode-update + (its:get-mode-indicator "roma-kana")))) + (read-from-minibuffer prompt initial-input))) + +(defconst isearch:read-kanji-string 'read-kanji-string) + +;;; 記号入力 + +(defvar special-symbol-input-point nil) + +(defun special-symbol-input () + (interactive) + (require 'egg-jsymbol) + ;; 92.7.8 by Y.Kawabe + (let ((item (menu:select-from-menu + *symbol-input-menu* special-symbol-input-point t)) + (code t)) + (and (listp item) + (setq code (car item) special-symbol-input-point (cdr item))) + ;; end of patch + (cond((stringp code) (insert code)) + ((consp code) (eval code)) + ))) + +(define-key global-map "\C-^" 'special-symbol-input) + +(autoload 'busyu-input "busyu" nil t) ;92.10.18 by K.Handa +(autoload 'kakusuu-input "busyu" nil t) ;92.10.18 by K.Handa + +(provide 'egg) + +;;; egg.el ends here --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/eggrc-sj3 2007-06-03 23:21:07 +0000 @@ -0,0 +1,23 @@ +;;; +;;; Standard Start Up File for EGG +;;; Version 1.0 +;;; Copyright 1990 Kiyoji Ishii +;;; + +(set-default-sys-dic-directory "/usr/sony/dict/sj3") +(set-default-usr-dic-directory "/usr/sony/dict/sj3/user/$USER") + +;;; +;;; System Dictionary +;;; + +(setsysdic "sj3main.dic") + +;;; +;;; Private Dictionary +;;; + +(setusrdic "private.dic") +(setusrstdy "study.dat") + + --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/eggrc-v41 2007-06-03 23:21:07 +0000 @@ -0,0 +1,127 @@ +;; -*-Emacs-Lisp-*- +;; Standard Start Up File for EGG +;; Copyright (C) 1992 Free Software Foundation, Inc. +;; This file is part of Mule (MULtilingual Enhancement of GNU Emacs). + +;; Mule is free software distributed in the form of patches to GNU Emacs. +;; 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 1, or (at your option) +;; any later version. + +;; Mule 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, 675 Mass Ave, Cambridge, MA 02139, USA. + +;;; Version 1.0 +;;; Written by Satoru.Tomura@etl.jp 1988 +;;; modified for LUNA'default ryuji@nfa.ncl.omron.junet +;;; +;;; modified for Wnn V4 - Use compatible library of Wnn v3 +;;; Copyright 1989 OMRON Tateisi Electronics, Co. +;;; 1989 7/12 by H.Kuribayashi kuri@frf.oron.junet + +;;; 92.5.19 modified for Wnn V4 by T.Shingu <shingu@cpr.canon.co.jp> +;;; Use non compatible library. +;;; 93.1.8 file names of frequency and private dictionary ware adjusted +;;; to Wnn version 4.1. +;;; 93.4.2 dictianary, frequency files are set up on normal/reverse +;;; environment individually. +;;; 93.6.30 specifying default user directory to make customize easily +;;; suggested by K.Sakai <ksakai@mtl.t.u-tokyo.ac.jp> + +;(defvar wnn-usr-dic-dir "usr/$USER") +(defvar wnn-usr-dic-dir (concat "usr/" (user-login-name))) + +(cond ((eq wnn-server-type 'jserver) + (set-wnn-reverse nil) + (set-wnn-fuzokugo "pubdic/full.fzk") + (add-wnn-dict "pubdic/kihon.dic" (concat wnn-usr-dic-dir "/kihon.h") 5 nil t) + (add-wnn-dict "pubdic/setsuji.dic" (concat wnn-usr-dic-dir "/setsuji.h") 5 nil t) + (add-wnn-dict "pubdic/koyuu.dic" (concat wnn-usr-dic-dir "/koyuu.h") 1 nil t) + (add-wnn-dict "pubdic/chimei.dic" (concat wnn-usr-dic-dir "/chimei.h") 1 nil t) + (add-wnn-dict "pubdic/jinmei.dic" (concat wnn-usr-dic-dir "/jinmei.h") 1 nil t) + (add-wnn-dict "pubdic/special.dic" (concat wnn-usr-dic-dir "/special.h") 5 nil t) + (add-wnn-dict "pubdic/computer.dic" (concat wnn-usr-dic-dir "/computer.h") 5 nil t) + (add-wnn-dict "pubdic/symbol.dic" (concat wnn-usr-dic-dir "/symbol.h") 1 nil t) + (add-wnn-dict "pubdic/tankan.dic" "" 1 nil nil) + (add-wnn-dict "pubdic/bio.dic" (concat wnn-usr-dic-dir "/bio.h") 1 nil t) + (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t) +; (add-wnn-dict "wnncons/tankan2.dic" "" 1 nil nil) +; (add-wnn-dict "wnncons/tankan3.dic" "" 1 nil nil) + (set-wnn-param 2 10 2 45 5 80 5 1 40 0 400 -100 400 80 200 2 200) + (set-wnn-reverse t) + (set-wnn-fuzokugo "pubdic/full.fzk") + (add-wnn-dict "pubdic/kihon.dic" (concat wnn-usr-dic-dir "/kihon.h") 5 nil t) + (add-wnn-dict "pubdic/setsuji.dic" (concat wnn-usr-dic-dir "/setsuji.h") 5 nil t) + (add-wnn-dict "pubdic/koyuu.dic" (concat wnn-usr-dic-dir "/koyuu.h") 1 nil t) + (add-wnn-dict "pubdic/chimei.dic" (concat wnn-usr-dic-dir "/chimei.h") 1 nil t) + (add-wnn-dict "pubdic/jinmei.dic" (concat wnn-usr-dic-dir "/jinmei.h") 1 nil t) + (add-wnn-dict "pubdic/special.dic" (concat wnn-usr-dic-dir "/special.h") 5 nil t) + (add-wnn-dict "pubdic/computer.dic" (concat wnn-usr-dic-dir "/computer.h") 5 nil t) +; (add-wnn-dict "pubdic/symbol.dic" (concat wnn-usr-dic-dir "/symbol.h") 1 nil t) + (add-wnn-dict "pubdic/tankan.dic" "" 1 nil nil) + (add-wnn-dict "pubdic/bio.dic" (concat wnn-usr-dic-dir "/bio.h") 1 nil t) + (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t) +; (add-wnn-dict "wnncons/tankan2.dic" "" 1 nil nil) +; (add-wnn-dict "wnncons/tankan3.dic" "" 1 nil nil) + (set-wnn-param 2 10 2 45 1 80 5 1 50 -20 400 -10 100 -100 200 0 200) + + ) + ((eq wnn-server-type 'cserver) + (set-wnn-reverse nil) + (set-wnn-fuzokugo "sys/full.con") + (add-wnn-dict "sys/level_1.dic" (concat wnn-usr-dic-dir "/level_1.h") 4 nil t) + (add-wnn-dict "sys/level_2.dic" (concat wnn-usr-dic-dir "/level_2.h") 1 nil t) + (add-wnn-dict "sys/basic.dic" (concat wnn-usr-dic-dir "/basic.h") 7 nil t) + (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t) + (set-wnn-param 1 5 2 750 10 80 10 5 1000 50 0 -200 0 0 0 16 0) + (set-wnn-reverse t) + (set-wnn-fuzokugo "sys/full.con") + (add-wnn-dict "sys/level_1.dic" (concat wnn-usr-dic-dir "/level_1.h") 4 nil t) + (add-wnn-dict "sys/level_2.dic" (concat wnn-usr-dic-dir "/level_2.h") 1 nil t) + (add-wnn-dict "sys/basic.dic" (concat wnn-usr-dic-dir "/basic.h") 7 nil t) + (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t) + (set-wnn-param 1 5 2 750 10 80 10 5 1000 50 0 -200 0 0 0 16 0) + ) + ((eq wnn-server-type 'tserver) + (set-wnn-reverse nil) + (set-wnn-fuzokugo "sys/full.con") + (add-wnn-dict "sys/cns_ch.dic" (concat wnn-usr-dic-dir "/cns_ch.h") 4 nil t) + (add-wnn-dict "sys/cns_wd.dic" (concat wnn-usr-dic-dir "/cns_wd.h") 1 nil t) + (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t) + (set-wnn-param 1 5 2 750 10 80 10 5 1000 50 0 -200 0 0 0 16 0) + (set-wnn-reverse t) + (set-wnn-fuzokugo "sys/full.con") + (add-wnn-dict "sys/cns_ch.dic" (concat wnn-usr-dic-dir "/cns_ch.h") 4 nil t) + (add-wnn-dict "sys/cns_wd.dic" (concat wnn-usr-dic-dir "/cns_wd.h") 1 nil t) + (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t) + (set-wnn-param 1 5 2 750 10 80 10 5 1000 50 0 -200 0 0 0 16 0) + ) + ((eq wnn-server-type 'kserver) + (set-wnn-reverse nil) + (set-wnn-fuzokugo "sys/full.fzk") +; (add-wnn-dict "sys/hword.dic" (concat wnn-usr-dic-dir "/hword.h") 4 nil t) + (add-wnn-dict "sys/single.dic" (concat wnn-usr-dic-dir "/single.h") 1 nil t) + (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t) +; (add-wnn-dict (concat wnn-usr-dic-dir "/hangul") "" 5 t t) +; (add-wnn-dict (concat wnn-usr-dic-dir "/fuzokugo") "" 5 t t) + (set-wnn-param 1 5 2 750 10 80 10 5 1000 50 0 -200 0 0 0 16 0) + (set-wnn-reverse t) + (set-wnn-fuzokugo "sys/full.fzk") +; (add-wnn-dict "sys/hword.dic" (concat wnn-usr-dic-dir "/hword.h") 4 nil t) + (add-wnn-dict "sys/single.dic" (concat wnn-usr-dic-dir "/single.h") 1 nil t) + (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t) +; (add-wnn-dict (concat wnn-usr-dic-dir "/hangul") "" 5 t t) +; (add-wnn-dict (concat wnn-usr-dic-dir "/fuzokugo") "" 5 t t) + (set-wnn-param 1 5 2 750 10 80 10 5 1000 50 0 -200 0 0 0 16 0) + ) +) + +;; N nsho hindo len jiri flag jisho sbn dbn_len sbn_cnt suuji kana eisuu kigou toji_kakko fuzokogo kaikakko + --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/eggrc-wnn 2007-06-03 23:21:07 +0000 @@ -0,0 +1,286 @@ +;; -*-Emacs-Lisp-*- +;; Standard Start Up File for EGG +;; Copyright (C) 1992 Free Software Foundation, Inc. +;; This file is part of Mule (MULtilingual Enhancement of GNU Emacs). + +;; Mule is free software distributed in the form of patches to GNU Emacs. +;; 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 1, or (at your option) +;; any later version. + +;; Mule 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, 675 Mass Ave, Cambridge, MA 02139, USA. + +;;; Version 1.0 +;;; Written by Satoru.Tomura@etl.jp 1988 +;;; modified for LUNA'default ryuji@nfa.ncl.omron.junet +;;; +;;; modified for Wnn V4 - Use compatible library of Wnn v3 +;;; Copyright 1989 OMRON Tateisi Electronics, Co. +;;; 1989 7/12 by H.Kuribayashi kuri@frf.oron.junet + +;;; 92.5.19 modified for Wnn V4 by T.Shingu <shingu@cpr.canon.co.jp> +;;; Use non compatible library. +;;; 93.1.8 file names of frequency and private dictionary ware adjusted +;;; to Wnn version 4.1. +;;; 93.4.2 dictianary, frequency files are set up on normal/reverse +;;; environment individually. +;;; 93.6.30 specifying default user directory to make customize easily +;;; suggested by K.Sakai <ksakai@mtl.t.u-tokyo.ac.jp> + +;(defvar wnn-usr-dic-dir "usr/$USER") +(defvar wnn-usr-dic-dir (concat "usr/" (user-login-name))) + +(defun wnn7-jserver-setup () + (set-wnn-reverse nil) + ;; maindic + (set-wnn-fuzokugo "system/kougo.fzk") + (add-wnn-fisys-dict "system/fisd" + (concat wnn-usr-dic-dir "/fisd.h") t) + (add-wnn-fiusr-dict (concat wnn-usr-dic-dir "/fiud") "" t nil) + (add-wnn-dict "system/kihon.dic" + (concat wnn-usr-dic-dir "/kihon.h") 6 nil t) + (add-wnn-dict "system/symbol.dic" + (concat wnn-usr-dic-dir "/symbol.h") 1 nil t) +; (add-wnn-dict "system/symbol_noat.dic" +; (concat wnn-usr-dic-dir "/symbol_noat.h") 1 nil t) + (add-wnn-dict "system/tel.dic" + (concat wnn-usr-dic-dir "/tel.h") 1 nil t) + (add-wnn-dict "system/zip.dic" + (concat wnn-usr-dic-dir "/zip.h") 1 nil t) + (add-wnn-dict "system/tankan.dic" "" 1 nil nil) + (add-wnn-dict "system/tankan2.dic" "" 1 nil nil) + (add-wnn-dict "system/ikeiji.dic" "" 1 nil nil) + (add-wnn-dict "system/rensou.dic" "" 1 nil nil) + (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 15 t t) + + ;; optiondic + (add-wnn-dict "option/jinmei.dic" + (concat wnn-usr-dic-dir "/jinmei.h") 1 nil t) + (add-wnn-dict "option/chimei.dic" + (concat wnn-usr-dic-dir "/chimei.h") 1 nil t) + (add-wnn-dict "option/address.dic" + (concat wnn-usr-dic-dir "/address.h") 1 nil t) + (add-wnn-dict "option/station.dic" + (concat wnn-usr-dic-dir "/station.h") 1 nil t) + (add-wnn-dict "option/kana_english.dic" + (concat wnn-usr-dic-dir "/kana_english.h") 1 nil t) + (add-wnn-dict "option/enterprise.dic" + (concat wnn-usr-dic-dir "/enterprise.h") 1 nil t) + (add-wnn-dict "option/airport.dic" + (concat wnn-usr-dic-dir "/airport.h") 1 nil t) + (add-wnn-dict "option/university.dic" + (concat wnn-usr-dic-dir "/university.h") 1 nil t) + (add-wnn-dict "option/zoo.dic" + (concat wnn-usr-dic-dir "/zoo.h") 1 nil t) + (add-wnn-dict "option/botanical_garden.dic" + (concat wnn-usr-dic-dir "/botanical_garden.h") 1 nil t) + (add-wnn-dict "option/aquarium.dic" + (concat wnn-usr-dic-dir "/aquarium.h") 1 nil t) + (add-wnn-dict "option/conveni.dic" + (concat wnn-usr-dic-dir "/conveni.h") 1 nil t) + (add-wnn-dict "option/amusement.dic" + (concat wnn-usr-dic-dir "/amusement.h") 1 nil t) + + ;; computerdic 2001/12/07 + (add-wnn-dict "option/computer.dic" + (concat wnn-usr-dic-dir "/computer.h") 1 nil t) + + (set-wnn-param 5 10 2 45 0 80 5 1 20 0 400 -100 400 80 200 2 200) + + (add-wnn-notrans-dict (concat wnn-usr-dic-dir "/muhenkan") 15 t) + (add-wnn-bmodify-dict (concat wnn-usr-dic-dir "/bunsetsu") 15 t) + + (set-last-is-first-mode t) + (set-okuri-learn-mode t) + (set-complex-conv-mode nil) + (set-okuri-flag -1) + (set-prefix-flag 0) + (set-prefix-learn-mode t) + (set-suffix-learn-mode t) + (set-common-learn-mode t) + (set-freq-func-mode 4) + (set-numeric-mode -12) + (set-alphabet-mode -30) + (set-symbol-mode -40) + (set-yuragi-mode nil) + (wnn7-set-boin-kabusoku t) + (wnn7-set-n-choka t) + (wnn7-set-shiin-choka t) + (wnn7-set-nihongo-kosei t) + + (set-wnn-reverse t) + (set-wnn-fuzokugo "system/kougo.fzk") + (add-wnn-dict "system/kihonR.dic" "" 1 nil nil) + (add-wnn-dict "system/telR.dic" "" 1 nil nil) + (add-wnn-dict "system/zipR.dic" "" 1 nil nil) + (add-wnn-dict "system/tankanR.dic" "" 1 nil nil) + (add-wnn-dict "system/tankan2R.dic" "" 1 nil nil) + (add-wnn-dict "option/jinmeiR.dic" "" 1 nil nil) + (add-wnn-dict "option/chimeiR.dic" "" 1 nil nil) + (add-wnn-dict "option/addressR.dic" "" 1 nil nil) +; (add-wnn-dict "option/stationR.dic" "" 1 nil nil) +; (add-wnn-dict "option/enterpriseR.dic" "" 1 nil nil) +; (add-wnn-dict "option/airportR.dic" "" 1 nil nil) +; (add-wnn-dict "option/universityR.dic" "" 1 nil nil) +; (add-wnn-dict "option/zooR.dic" "" 1 nil nil) +; (add-wnn-dict "option/botanical_gardenR.dic" "" 1 nil nil) +; (add-wnn-dict "option/aquariumR.dic" "" 1 nil nil) +; (add-wnn-dict "option/conveniR.dic" "" 1 nil nil) +; (add-wnn-dict "option/amusementR.dic" "" 1 nil nil) +; (add-wnn-dict "option/computerR.dic" "" 1 nil nil) + (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 15 t t) + (set-wnn-param 2 10 2 45 1 80 5 1 50 -20 400 -10 100 -100 200 0 200) + ) + +(defun wnn6-jserver-setup () + (set-wnn-reverse nil) + (set-wnn-fuzokugo "iwanami/kougo.fzk") + (add-wnn-fisys-dict "iwanami/fisd" + (concat wnn-usr-dic-dir "/fisd.h") t) + (add-wnn-fiusr-dict (concat wnn-usr-dic-dir "/fiud") "" t nil) + (add-wnn-dict "iwanami/kihon.dic" + (concat wnn-usr-dic-dir "/kihon.h") 6 nil t) + (add-wnn-dict "iwanami/symbol.dic" + (concat wnn-usr-dic-dir "/symbol.h") 1 nil t) + (add-wnn-dict "iwanami/tankan.dic" "" 1 nil nil) + (add-wnn-dict "iwanami/tankan2.dic" "" 1 nil nil) + (add-wnn-dict "iwanami/tel.dic" "" 1 nil nil) + (add-wnn-dict "iwanami/zip.dic" "" 1 nil nil) + (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 15 t t) +; (add-wnn-dict "wnncons/tankan2.dic" "" 1 nil nil) +; (add-wnn-dict "wnncons/tankan3.dic" "" 1 nil nil) + (set-wnn-param 5 10 2 45 0 80 5 1 20 0 400 -100 400 80 200 2 200) + + (add-wnn-notrans-dict (concat wnn-usr-dic-dir "/katakana") 15 t) + (add-wnn-bmodify-dict (concat wnn-usr-dic-dir "/bunsetsu") 15 t) + + (set-last-is-first-mode t) + (set-complex-conv-mode nil) +; (set-okuri-flag -1) + (set-prefix-flag 0) + + (set-okuri-learn-mode t) + (set-prefix-learn-mode t) + (set-suffix-learn-mode t) + (set-common-learn-mode t) + (set-yuragi-mode nil) + + (set-freq-func-mode 4) + +; (set-numeric-mode -12) +; (set-alphabet-mode -30) +; (set-symbol-mode -40) + + (set-wnn-reverse t) + (set-wnn-fuzokugo "iwanami/kougo.fzk") + (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 15 t t) + (set-wnn-param 2 10 2 45 1 80 5 1 50 -20 400 -10 100 -100 200 0 200) + + ) + + +(defun wnn4-jserver-setup () + (set-wnn-reverse nil) + (set-wnn-fuzokugo "pubdic/full.fzk") + (add-wnn-dict "pubdic/kihon.dic" (concat wnn-usr-dic-dir "/kihon.h") 5 nil t) + (add-wnn-dict "pubdic/setsuji.dic" (concat wnn-usr-dic-dir "/setsuji.h") 5 nil t) + (add-wnn-dict "pubdic/koyuu.dic" (concat wnn-usr-dic-dir "/koyuu.h") 1 nil t) + (add-wnn-dict "pubdic/chimei.dic" (concat wnn-usr-dic-dir "/chimei.h") 1 nil t) + (add-wnn-dict "pubdic/jinmei.dic" (concat wnn-usr-dic-dir "/jinmei.h") 1 nil t) + (add-wnn-dict "pubdic/special.dic" (concat wnn-usr-dic-dir "/special.h") 5 nil t) + (add-wnn-dict "pubdic/computer.dic" (concat wnn-usr-dic-dir "/computer.h") 5 nil t) + (add-wnn-dict "pubdic/symbol.dic" (concat wnn-usr-dic-dir "/symbol.h") 1 nil t) + (add-wnn-dict "pubdic/tankan.dic" "" 1 nil nil) + (add-wnn-dict "pubdic/bio.dic" (concat wnn-usr-dic-dir "/bio.h") 1 nil t) + (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t) +; (add-wnn-dict "wnncons/tankan2.dic" "" 1 nil nil) +; (add-wnn-dict "wnncons/tankan3.dic" "" 1 nil nil) + (set-wnn-param 2 10 2 45 5 80 5 1 40 0 400 -100 400 80 200 2 200) + (set-wnn-reverse t) + (set-wnn-fuzokugo "pubdic/full.fzk") + (add-wnn-dict "pubdic/kihon.dic" (concat wnn-usr-dic-dir "/kihon.h") 5 nil t) + (add-wnn-dict "pubdic/setsuji.dic" (concat wnn-usr-dic-dir "/setsuji.h") 5 nil t) + (add-wnn-dict "pubdic/koyuu.dic" (concat wnn-usr-dic-dir "/koyuu.h") 1 nil t) + (add-wnn-dict "pubdic/chimei.dic" (concat wnn-usr-dic-dir "/chimei.h") 1 nil t) + (add-wnn-dict "pubdic/jinmei.dic" (concat wnn-usr-dic-dir "/jinmei.h") 1 nil t) + (add-wnn-dict "pubdic/special.dic" (concat wnn-usr-dic-dir "/special.h") 5 nil t) + (add-wnn-dict "pubdic/computer.dic" (concat wnn-usr-dic-dir "/computer.h") 5 nil t) +; (add-wnn-dict "pubdic/symbol.dic" (concat wnn-usr-dic-dir "/symbol.h") 1 nil t) + (add-wnn-dict "pubdic/tankan.dic" "" 1 nil nil) + (add-wnn-dict "pubdic/bio.dic" (concat wnn-usr-dic-dir "/bio.h") 1 nil t) + (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t) +; (add-wnn-dict "wnncons/tankan2.dic" "" 1 nil nil) +; (add-wnn-dict "wnncons/tankan3.dic" "" 1 nil nil) + (set-wnn-param 2 10 2 45 1 80 5 1 50 -20 400 -10 100 -100 200 0 200) + +) + +(cond ((eq wnn-server-type 'jserver) + (cond ((and (fboundp 'is-wnn7-server) + (is-wnn7-server)) + (wnn7-jserver-setup)) + ((and (fboundp 'is-wnn6-server) + (is-wnn6-server)) + (wnn6-jserver-setup)) + (t + (wnn4-jserver-setup)))) + ((eq wnn-server-type 'cserver) + (set-wnn-reverse nil) + (set-wnn-fuzokugo "sys/full.con") + (add-wnn-dict "sys/level_1.dic" (concat wnn-usr-dic-dir "/level_1.h") 4 nil t) + (add-wnn-dict "sys/level_2.dic" (concat wnn-usr-dic-dir "/level_2.h") 1 nil t) + (add-wnn-dict "sys/basic.dic" (concat wnn-usr-dic-dir "/basic.h") 7 nil t) + (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t) + (set-wnn-param 1 5 2 750 10 80 10 5 1000 50 0 -200 0 0 0 16 0) + (set-wnn-reverse t) + (set-wnn-fuzokugo "sys/full.con") + (add-wnn-dict "sys/level_1.dic" (concat wnn-usr-dic-dir "/level_1.h") 4 nil t) + (add-wnn-dict "sys/level_2.dic" (concat wnn-usr-dic-dir "/level_2.h") 1 nil t) + (add-wnn-dict "sys/basic.dic" (concat wnn-usr-dic-dir "/basic.h") 7 nil t) + (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t) + (set-wnn-param 1 5 2 750 10 80 10 5 1000 50 0 -200 0 0 0 16 0) + ) + ((eq wnn-server-type 'tserver) + (set-wnn-reverse nil) + (set-wnn-fuzokugo "sys/full.con") + (add-wnn-dict "sys/cns_ch.dic" (concat wnn-usr-dic-dir "/cns_ch.h") 4 nil t) + (add-wnn-dict "sys/cns_wd.dic" (concat wnn-usr-dic-dir "/cns_wd.h") 1 nil t) + (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t) + (set-wnn-param 1 5 2 750 10 80 10 5 1000 50 0 -200 0 0 0 16 0) + (set-wnn-reverse t) + (set-wnn-fuzokugo "sys/full.con") + (add-wnn-dict "sys/cns_ch.dic" (concat wnn-usr-dic-dir "/cns_ch.h") 4 nil t) + (add-wnn-dict "sys/cns_wd.dic" (concat wnn-usr-dic-dir "/cns_wd.h") 1 nil t) + (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t) + (set-wnn-param 1 5 2 750 10 80 10 5 1000 50 0 -200 0 0 0 16 0) + ) + ((eq wnn-server-type 'kserver) + (set-wnn-reverse nil) + (set-wnn-fuzokugo "sys/full.fzk") + ; (add-wnn-dict "sys/hword.dic" (concat wnn-usr-dic-dir "/hword.h") 4 nil t) + (add-wnn-dict "sys/single.dic" (concat wnn-usr-dic-dir "/single.h") 1 nil t) + (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t) + ; (add-wnn-dict (concat wnn-usr-dic-dir "/hangul") "" 5 t t) + ; (add-wnn-dict (concat wnn-usr-dic-dir "/fuzokugo") "" 5 t t) + (set-wnn-param 1 5 2 750 10 80 10 5 1000 50 0 -200 0 0 0 16 0) + (set-wnn-reverse t) + (set-wnn-fuzokugo "sys/full.fzk") + ; (add-wnn-dict "sys/hword.dic" (concat wnn-usr-dic-dir "/hword.h") 4 nil t) + (add-wnn-dict "sys/single.dic" (concat wnn-usr-dic-dir "/single.h") 1 nil t) + (add-wnn-dict (concat wnn-usr-dic-dir "/ud") "" 5 t t) + ; (add-wnn-dict (concat wnn-usr-dic-dir "/hangul") "" 5 t t) + ; (add-wnn-dict (concat wnn-usr-dic-dir "/fuzokugo") "" 5 t t) + (set-wnn-param 1 5 2 750 10 80 10 5 1000 50 0 -200 0 0 0 16 0) + ) + ) + +;; N nsho hindo len jiri flag jisho sbn dbn_len sbn_cnt suuji kana eisuu kigou toji_kakko fuzokogo kaikakko + --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/isearch-ext.el 2007-06-03 23:21:07 +0000 @@ -0,0 +1,305 @@ +;;; isearch-ext.el --- incremental search with front-end inputting method + +;; Author: SAKAI Kiyotaka <ksakai@mtl.t.u-tokyo.ac.jp> +;; Keywords: search + +;; $Id: isearch-ext.el,v 1.41 1994/12/16 15:33:34 ksakai Exp $ + +;; This file is part of Mule. + +;; Mule 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. + +;; Mule 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, 675 Mass Ave, Cambridge, MA 02139, USA. + +;;; Commentary: + +;; This program is extension of isearch.el to support multi-lingal +;; incremental search with front-end input method. +;; +;; If you want to use this program, simply put C-\ or C-o or C-[ when +;; doing incremental search, and you can input search words with +;; inputting method. +;; +;; For backward compatibility with mule-1.x, you can also use C-k, but +;; isearch-edit-string may be more suitable for this use. If you +;; think so, put the following code in your .emacs. +;; +;; (define-key isearch-mode-map "\C-k" 'isearch-edit-string) +;; + +;; Following people contributed modifications to isearch-ext.el: +;; Kenichi Handa <handa@etlken.etl.go.jp> +;; YAMAMOTO Mitsuharu <mituharu@is.s.u-tokyo.ac.jp> +;; A. Sasaki <beckun@cis.canon.co.jp> +;; Atsuo Ohki <ohki@gssm.otsuka.tsukuba.ac.jp> + +;;; Code: + +;;(eval-when-compile (require 'quail)) + + +;;;###autoload +(defvar search-string-char-prompt "*Enter string... ") + +(defvar isearch-fep-prompt "" "Prompt for isearch-fep mode.") +(defvar isearch-fep-mode nil "If t, isearch-fep-mode is invoked.") + +(defconst isearch-fep-table + '((isearch-fep-string isearch-fep-prompt-string isearch-fep-read-string) + (isearch-fep-egg isearch-fep-prompt-egg isearch-fep-read-egg) + (isearch-fep-canna isearch-fep-prompt-canna isearch-fep-read-canna) + (isearch-fep-quail isearch-fep-prompt-quail isearch-fep-read-quail))) + +(define-key isearch-mode-map "\C-k" 'isearch-fep-string) +(define-key isearch-mode-map "\C-\\" 'isearch-fep-egg) +(define-key isearch-mode-map "\M-k" 'isearch-fep-egg) +(define-key isearch-mode-map "\C-o" 'isearch-fep-canna) +(define-key isearch-mode-map "\C-\]" 'isearch-fep-quail) + +(defun isearch-fep-mode () + (let ((command this-command) + (isearch-fep-mode t) + table str) + (while isearch-fep-mode + (setq table (assq command isearch-fep-table)) + (setq isearch-fep-prompt (funcall (car (cdr table)))) + (message "%s%s" isearch-fep-prompt (isearch-message)) + (if (eq command 'isearch-fep-string) ;; \C-k + (progn + (setq str (funcall (nth 2 table))) + (setq isearch-fep-mode nil) + (isearch-process-search-string str str)) + (let* ((keys (read-key-sequence nil)) + (current-command (key-binding keys t))) + (setq isearch-fep-mode (not (eq command current-command))) + (if isearch-fep-mode + (if (assq current-command isearch-fep-table) + (setq command current-command) + (cond ((eq current-command 'isearch-printing-char) + (setq str (funcall (nth 2 table) keys)) + (isearch-process-search-string str str)) + ((or (eq current-command 'isearch-other-control-char) + (eq current-command 'isearch-other-meta-char)) + (call-interactively current-command) + (setq isearch-fep-mode nil)) + ((eq current-command 'isearch-exit) + (setq isearch-fep-mode nil) + (message "%s%s" + (isearch-message-prefix) isearch-message)) + (t + (call-interactively current-command)))) + (setq isearch-fep-prompt nil) + (message "%s%s" (isearch-message-prefix) isearch-message))))))) + +;; +;; Read string from minibuffer for incremental search. +;; + +;;;###autoload +(defun isearch-fep-string () + "Read string from minibuffer for incremental search." + (interactive) + (isearch-fep-mode)) + +(defun isearch-fep-prompt-string () + search-string-char-prompt) + +(defun exit-minibuffer-and-isearch-backward () + (interactive) + (setq unread-command-events '(?\C-r ?\C-r)) + (exit-minibuffer)) + +(defun isearch-fep-read-string () + (let ((minibuffer-local-map (cons 'keymap minibuffer-local-map))) + ;; Some program overwrites "\C-m"'s default binding. + (define-key minibuffer-local-map "\C-m" 'exit-minibuffer) + (define-key minibuffer-local-map "\C-s" 'exit-minibuffer) + (define-key minibuffer-local-map "\C-r" + 'exit-minibuffer-and-isearch-backward) + (condition-case condition + ;; isearch.el of GNU Emacs 19.28 used overriding-local-map. + ;; isearch.el of GNU Emacs 19.29, 19.30 (which is latest at + ;; this point) uses overriding-terminal-local-map. Disable + ;; isearch keymap with binding it to nil. We bind the map + ;; here so that isearch-abort (actually, by isearch-done) + ;; can set it to nil. + (let ((overriding-terminal-local-map nil)) + (read-from-minibuffer (concat isearch-fep-prompt (isearch-message)))) + (quit + ;; Also, this isearch-abort should be called in original + ;; buffer, because the variable which always has buffer-local + ;; binding (at least isearch-mode is such variable) should be + ;; bound in right environment. + (isearch-abort))))) + + +;; +;; For EGG +;; + +;;;###autoload +(defun isearch-fep-egg () + "Read string for incremental search by using egg." + (interactive) + (isearch-fep-mode)) + +(defun isearch-fep-prompt-egg () + (if (featurep 'egg) + (format "[%s]" (map-indicator its:*current-map*)) + (setq isearch-fep-mode nil) + (message "No EGG!! ") + (sit-for 1) + "")) + +(defun isearch-exit-minibuffer-egg (from to) + (exit-minibuffer)) + +;; these variables are used to pass current-buffer's value of some +;; buffer-local variable to minibuffer +(defvar isearch-fep-egg-its-map nil) +(defvar isearch-fep-egg-server-type nil) + +(defun isearch-minibuffer-setup-egg () + ;; setup buffer-local variables for minibuffer + (setq its:*current-map* isearch-fep-egg-its-map) + (setq wnn-server-type isearch-fep-egg-server-type) + (setq egg:*input-mode* t) + (setq egg:*mode-on* t)) + +(defun isearch-minibuffer-exit-egg () + (setq egg:henkan-mode-in-use nil) + ;; Mule: + ;;(set 'disable-undo nil) + ) + +(defun isearch-fep-read-egg (first-str) + (if (and (featurep 'egg) (= (minibuffer-depth) 0)) + (let ((display-minibuffer-mode-in-minibuffer t) + (isearch-fep-egg-its-map its:*current-map*) + (isearch-fep-egg-server-type wnn-server-type) + ;; In GNU Emacs 19.29 or later, isearch.el doesn't + ;; make overriding-terminal-local-map buffer local. + ;; So we must bind explicitly it to nil to disable it + ;; while reading from minibuffer. + (overriding-terminal-local-map nil) + (self-insert-after-hook 'isearch-exit-minibuffer-egg)) + (setq unread-command-events (listify-key-sequence first-str)) + (unwind-protect + (progn + (add-hook 'minibuffer-setup-hook 'isearch-minibuffer-setup-egg) + (add-hook 'minibuffer-exit-hook 'isearch-minibuffer-exit-egg) + (read-from-minibuffer (isearch-message))) + (remove-hook 'minibuffer-setup-hook 'isearch-minibuffer-setup-egg) + (remove-hook 'minibuffer-exit-hook 'isearch-minibuffer-exit-egg))) + "")) + + +;; +;; For Canna +;; + +(eval-when-compile + (autoload 'canna:quit-canna-mode "canna")) + +;;;###autoload +(defun isearch-fep-canna () + "Read string for incremental search by using canna." + (interactive) + (unwind-protect + (isearch-fep-mode) + (canna:quit-canna-mode))) + +(eval-when-compile + (defvar canna:*initialized*) + (defvar canna:*kanji-mode-string*)) + +(defun isearch-fep-prompt-canna () + (if (and (featurep 'canna) canna:*initialized*) + (format "%s" canna:*kanji-mode-string*) + (setq isearch-fep-mode nil) + (message "No Canna!! ") + (sit-for 1) + "")) + +(defun isearch-exit-minibuffer-canna (from to) + (exit-minibuffer)) + +(eval-when-compile + (defvar canna:*japanese-mode*) + (defvar canna:*japanese-mode-in-minibuffer*) + (defvar canna:*fence-mode*)) + +(defun isearch-minibuffer-setup-canna () + ;; setup buffer-local variables for minibuffer. + (setq canna:*japanese-mode* t + canna:*japanese-mode-in-minibuffer* t + canna:*fence-mode* nil)) + +(defun isearch-minibuffer-exit-canna () + ;; Mule: + ;;(set 'disable-undo nil) + ) + +(defun isearch-fep-read-canna (first-str) + (if (and (featurep 'canna) (= (minibuffer-depth) 0)) + (let ((display-minibuffer-mode-in-minibuffer t) + ;; See comment in isearch-fep-read-egg. + (overriding-terminal-local-map nil) + (self-insert-after-hook 'isearch-exit-minibuffer-canna)) + (setq unread-command-events (listify-key-sequence first-str)) + (unwind-protect + (progn + (add-hook 'minibuffer-setup-hook 'isearch-minibuffer-setup-canna) + (add-hook 'minibuffer-exit-hook 'isearch-minibuffer-exit-canna) + (read-from-minibuffer (isearch-message))) + (remove-hook 'minibuffer-setup-hook 'isearch-minibuffer-setup-canna) + (remove-hook 'minibuffer-exit-hook 'isearch-minibuffer-exit-canna))) + "")) + + +;; +;; For QUAIL +;; + +;;;###autoload +(defun isearch-fep-quail () + "Read string for incremental search by using quail." + (interactive) + (require 'quail) + (isearch-fep-mode)) + +(defun isearch-fep-prompt-quail () + "[QUAIL]") + +(defun isearch-exit-minibuffer-quail () + (if (or (symbol-value 'quail-current-key) + (symbol-value 'quail-current-str)) + nil + (exit-minibuffer))) + +(defun isearch-fep-read-quail (first-str) + (let ((quail-self-insert-after-hook 'isearch-exit-minibuffer-quail) + ;; See comment in isearch-fep-read-egg. + (overriding-terminal-local-map nil)) + (setq unread-command-events (cons ?\C-\] (listify-key-sequence first-str))) + (unwind-protect + (read-from-minibuffer + (concat isearch-fep-prompt (isearch-message))) + ;; Mule: + ;;(set 'disable-undo nil) + ))) + + +(provide 'isearch-ext) +;;; isearch-ext.el ends here + --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/its/han-kata.el 2007-06-03 23:21:07 +0000 @@ -0,0 +1,291 @@ +;; Basic Roma-to-HankakuKana (jisx0201) Translation Table for Egg + +;; This file is part of Egg on Mule (Japanese Environment) + +;; Egg is distributed in the forms of patches to GNU +;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC +;; LICENSE which is distributed along with GNU Emacs by the +;; Free Software Foundation. + +;; 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 EMACS GENERAL PUBLIC LICENSE for +;; more details. + +;; You should have received a copy of the GNU EMACS GENERAL +;; PUBLIC LICENSE along with Nemacs; see the file COPYING. +;; If not, write to the Free Software Foundation, 675 Mass +;; Ave, Cambridge, MA 02139, USA. + +;;; 92.9.24 created for Mule Ver.0.9.6 by K.Shibata <shibata@sgi.co.jp> + +(its-define-mode "roma-han-kata" "アァ" t) + +(dolist (aa '("k" "s" "t" "h" "y" "r" "w" "g" "z" "d" "b" + "p" "c" "f" "j" "v")) + (its-defrule (concat aa aa) "ッ" aa)) + +(its-defrule "tch" "ッ" "ch") + +(dolist (q1 '("b" "m" "p")) + (its-defrule (concat "m" q1) "ン" q1)) + +(its-defrule "N" "ン") + +(defvar enable-double-n-syntax nil "*Enable \"nn\" input for \"ン\" ") + +(its-defrule-conditional "n" + ((not enable-double-n-syntax) "ン") + (t nil)) +(its-defrule-conditional "nn" + ( enable-double-n-syntax "ン") + (t nil)) + +(its-defrule "n'" "ン") + +(let ((small '"x" )) + (its-defrule (concat small "a") "ァ") + (its-defrule (concat small "i") "ィ") + (its-defrule (concat small "u") "ゥ") + (its-defrule (concat small "e") "ェ") + (its-defrule (concat small "o") "ォ") + (its-defrule (concat small "ya") "ャ") + (its-defrule (concat small "yu") "ュ") + (its-defrule (concat small "yo") "ョ") + (its-defrule (concat small "tu") "ッ") + (its-defrule (concat small "tsu") "ッ") + ) + + +(its-defrule "a" "ア") +(its-defrule "i" "イ") +(its-defrule "u" "ウ") +(its-defrule "e" "エ") +(its-defrule "o" "オ") +(its-defrule "ka" "カ") +(its-defrule "ki" "キ") +(its-defrule "ku" "ク") +(its-defrule "ke" "ケ") +(its-defrule "ko" "コ") +(its-defrule "kya" "キャ") +(its-defrule "kyu" "キュ") +(its-defrule "kye" "キェ") +(its-defrule "kyo" "キョ") +(its-defrule "sa" "サ") +(its-defrule "si" "シ") +(its-defrule "su" "ス") +(its-defrule "se" "セ") +(its-defrule "so" "ソ") +(its-defrule "sya" "シャ") +(its-defrule "syu" "シュ") +(its-defrule "sye" "シェ") +(its-defrule "syo" "ショ") +(its-defrule "sha" "シャ") +(its-defrule "shi" "シ") +(its-defrule "shu" "シュ") +(its-defrule "she" "シェ") +(its-defrule "sho" "ショ") +(its-defrule "ta" "タ") +(its-defrule "ti" "チ") +(its-defrule "tu" "ツ") +(its-defrule "te" "テ") +(its-defrule "to" "ト") +(its-defrule "tya" "チャ") +(its-defrule "tyi" "ティ") +(its-defrule "tyu" "チュ") +(its-defrule "tye" "チェ") +(its-defrule "tyo" "チョ") +(its-defrule "tsu" "ツ") +(its-defrule "cha" "チャ") +(its-defrule "chi" "チ") +(its-defrule "chu" "チュ") +(its-defrule "che" "チェ") +(its-defrule "cho" "チョ") +(its-defrule "na" "ナ") +(its-defrule "ni" "ニ") +(its-defrule "nu" "ヌ") +(its-defrule "ne" "ネ") +(its-defrule "no" "ノ") +(its-defrule "nya" "ニャ") +(its-defrule "nyu" "ニュ") +(its-defrule "nye" "ニェ") +(its-defrule "nyo" "ニョ") +(its-defrule "ha" "ハ") +(its-defrule "hi" "ヒ") +(its-defrule "hu" "フ") +(its-defrule "he" "ヘ") +(its-defrule "ho" "ホ") +(its-defrule "hya" "ヒャ") +(its-defrule "hyu" "ヒュ") +(its-defrule "hye" "ヒェ") +(its-defrule "hyo" "ヒョ") +(its-defrule "fa" "ファ") +(its-defrule "fi" "フィ") +(its-defrule "fu" "フ") +(its-defrule "fe" "フェ") +(its-defrule "fo" "フォ") +(its-defrule "ma" "マ") +(its-defrule "mi" "ミ") +(its-defrule "mu" "ム") +(its-defrule "me" "メ") +(its-defrule "mo" "モ") +(its-defrule "mya" "ミャ") +(its-defrule "myu" "ミュ") +(its-defrule "mye" "ミェ") +(its-defrule "myo" "ミョ") +(its-defrule "ya" "ヤ") +(its-defrule "yi" "イ") +(its-defrule "yu" "ユ") +(its-defrule "ye" "イェ") +(its-defrule "yo" "ヨ") +(its-defrule "ra" "ラ") +(its-defrule "ri" "リ") +(its-defrule "ru" "ル") +(its-defrule "re" "レ") +(its-defrule "ro" "ロ") +(its-defrule "la" "ラ") +(its-defrule "li" "リ") +(its-defrule "lu" "ル") +(its-defrule "le" "レ") +(its-defrule "lo" "ロ") +(its-defrule "rya" "リャ") +(its-defrule "ryu" "リュ") +(its-defrule "rye" "リェ") +(its-defrule "ryo" "リョ") +(its-defrule "lya" "リャ") +(its-defrule "lyu" "リュ") +(its-defrule "lye" "リェ") +(its-defrule "lyo" "リョ") +(its-defrule "wa" "ワ") +(its-defrule "wu" "ウ") +(its-defrule "wo" "ヲ") +(its-defrule "ga" "ガ") +(its-defrule "gi" "ギ") +(its-defrule "gu" "グ") +(its-defrule "ge" "ゲ") +(its-defrule "go" "ゴ") +(its-defrule "gya" "ギャ") +(its-defrule "gyu" "ギュ") +(its-defrule "gye" "ギェ") +(its-defrule "gyo" "ギョ") +(its-defrule "za" "ザ") +(its-defrule "zi" "ジ") +(its-defrule "zu" "ズ") +(its-defrule "ze" "ゼ") +(its-defrule "zo" "ゾ") +(its-defrule "zya" "ジャ") +(its-defrule "zyu" "ジュ") +(its-defrule "zye" "ジェ") +(its-defrule "zyo" "ジョ") +(its-defrule "ja" "ジャ") +(its-defrule "ji" "ジ") +(its-defrule "ju" "ジュ") +(its-defrule "je" "ジェ") +(its-defrule "jo" "ジョ") +(its-defrule "da" "ダ") +(its-defrule "di" "ヂ") +(its-defrule "du" "ヅ") +(its-defrule "de" "デ") +(its-defrule "do" "ド") +(its-defrule "dya" "ヂャ") +(its-defrule "dyi" "ヂィ") +(its-defrule "dyu" "ヂュ") +(its-defrule "dye" "ヂェ") +(its-defrule "dyo" "ヂョ") +(its-defrule "ba" "バ") +(its-defrule "bi" "ビ") +(its-defrule "bu" "ブ") +(its-defrule "be" "ベ") +(its-defrule "bo" "ボ") +(its-defrule "va" "ヴァ") +(its-defrule "vi" "ヴィ") +(its-defrule "vu" "ヴ") +(its-defrule "ve" "ヴェ") +(its-defrule "vo" "ヴォ") +(its-defrule "bya" "ビャ") +(its-defrule "byu" "ビュ") +(its-defrule "bye" "ビェ") +(its-defrule "byo" "ビョ") +(its-defrule "pa" "パ") +(its-defrule "pi" "ピ") +(its-defrule "pu" "プ") +(its-defrule "pe" "ペ") +(its-defrule "po" "ポ") +(its-defrule "pya" "ピャ") +(its-defrule "pyu" "ピュ") +(its-defrule "pye" "ピェ") +(its-defrule "pyo" "ピョ") +(its-defrule "kwi" "クィ") +(its-defrule "kwu" "ク") +(its-defrule "kwe" "クェ") +(its-defrule "kwo" "クォ") +(its-defrule "gwi" "グィ") +(its-defrule "gwu" "グ") +(its-defrule "gwe" "グェ") +(its-defrule "gwo" "グォ") +(its-defrule "tsa" "ツァ") +(its-defrule "tsi" "ツィ") +(its-defrule "tse" "ツェ") +(its-defrule "tso" "ツォ") +(its-defrule "xka" "カ") +(its-defrule "xke" "ケ") +(its-defrule "xti" "ティ") +(its-defrule "xdi" "ヂィ") +(its-defrule "xdu" "ドゥ") +(its-defrule "xde" "ヂェ") +(its-defrule "xdo" "ドォ") +(its-defrule "xwi" "ウィ") +(its-defrule "xwe" "ウェ") +(its-defrule "xwo" "ウォ") + +(its-defrule "-" "ー") +(its-defrule "[" "「") +(its-defrule "]" "」") +(its-defrule "z/" "・") + +(defvar use-kuten-for-period t "*ピリオドを句点に変換する") +(defvar use-touten-for-comma t "*コンマを読点に変換する") + +(its-defrule-conditional "." + (use-kuten-for-period "。") + (t ".")) + +(its-defrule-conditional "," + (use-touten-for-comma "、") + (t ",")) + +(defvar zenkaku-escape "Z") + +(its-defrule (concat zenkaku-escape ",") ",") +(its-defrule (concat zenkaku-escape ".") ".") + +(defun its:select-hankaku-katakana () + (interactive) + (its:select-mode "roma-han-kata")) + +(define-key mule-keymap "x" 'its:select-hankaku-katakana) +(define-key fence-mode-map "\e\C-x" 'its:select-hankaku-katakana) + +;;; +;;; JISX 0201 fence mode +;;; + +(eval-and-compile + (autoload 'japanese-hiragana-region "japan-util") + (autoload 'japanese-katakana-region "japan-util")) + +(defun fence-hankaku-katakana () + (interactive) + (japanese-katakana-region egg:*region-start* egg:*region-end* t)) + +(defun fence-katakana () + (interactive) + (japanese-katakana-region egg:*region-start* egg:*region-end*)) + +(defun fence-hiragana () + (interactive) + (japanese-katakana-region egg:*region-start* egg:*region-end*) + (japanese-hiragana-region egg:*region-start* egg:*region-end*)) + +(define-key fence-mode-map "\ex" 'fence-hankaku-katakana) --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/its/hankaku.el 2007-06-03 23:21:07 +0000 @@ -0,0 +1,86 @@ +;; Basic Roma-to-Kana Translation Table for Egg +;; Coded by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp) + +;; This file is part of Egg on Nemacs (Japanese Environment) + +;; Egg is distributed in the forms of patches to GNU +;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC +;; LICENSE which is distributed along with GNU Emacs by the +;; Free Software Foundation. + +;; 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 EMACS GENERAL PUBLIC LICENSE for +;; more details. + +;; You should have received a copy of the GNU EMACS GENERAL +;; PUBLIC LICENSE along with Nemacs; see the file COPYING. +;; If not, write to the Free Software Foundation, 675 Mass +;; Ave, Cambridge, MA 02139, USA. + +;; 92.3.16 modified for Mule Ver.0.9.1 by K.Handa <handa@etl.go.jp> +;; 92.3.23 modified for Mule Ver.0.9.1 by K.Handa <handa@etl.go.jp> +;; defrule -> its-defrule, define-its-mode -> its-define-mode + +(defvar digit-characters + '( "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" )) + +(defvar symbol-characters + '( " " "!" "@" "#" "$" "%" "^" "&" "*" "(" ")" + "-" "=" "`" "\\" "|" "_" "+" "~" "[" "]" "{" "}" + ":" ";" "\"" "'" "<" ">" "?" "/" "," "." )) + +(defvar downcase-alphabets + '("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")) + +(defvar upcase-alphabets + '("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")) + +;;;; +;;;; +;;;; + +;; 92.3.16 by K.Handa +;;(define-its-mode "downcase" " a a" t) +(its-define-mode "downcase" "aa" t) + +(dolist (digit digit-characters) + (its-defrule digit digit)) + +(dolist (symbol symbol-characters) + (its-defrule symbol symbol)) + +(dolist (downcase downcase-alphabets) + (its-defrule downcase downcase)) + +(dolist (upcase upcase-alphabets) + (its-defrule upcase upcase)) + +;;;; +;;;; +;;;; + +(defun upcase-character (ch) + (if (and (<= ?a ch) (<= ch ?z)) + (+ ?A (- ch ?a)) + ch)) + +;; 92.3.16 by K.Handa +;;(define-its-mode "upcase" " a A" t) +(its-define-mode "upcase" "aA" t);;; 93.7.21 by S.Tomura + +(dolist (digit digit-characters) + (its-defrule digit digit)) + +(dolist (symbol symbol-characters) + (its-defrule symbol symbol)) + +(dolist (downcase downcase-alphabets) + (its-defrule downcase (char-to-string (upcase-character (string-to-char downcase))))) + +(dolist (upcase upcase-alphabets) + (its-defrule upcase upcase)) + --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/its/hira.el 2007-06-03 23:21:07 +0000 @@ -0,0 +1,528 @@ +;; Basic Roma-to-Kana Translation Table for Egg +;; Coded by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp) + +;; This file is part of Egg on Nemacs (Japanese Environment) + +;; Egg is distributed in the forms of patches to GNU +;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC +;; LICENSE which is distributed along with GNU Emacs by the +;; Free Software Foundation. + +;; 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 EMACS GENERAL PUBLIC LICENSE for +;; more details. + +;; You should have received a copy of the GNU EMACS GENERAL +;; PUBLIC LICENSE along with Nemacs; see the file COPYING. +;; If not, write to the Free Software Foundation, 675 Mass +;; Ave, Cambridge, MA 02139, USA. + +;; 90.3.2 modified for Nemacs Ver.3.3.1 +;; by jiro@math.keio.ac.jp (TANAKA Jiro) +;; proposal of keybinding for JIS symbols +;; 92.3.23 modified for Mule Ver.0.9.1 by K.Handa <handa@etl.go.jp> +;; defrule -> its-defrule, define-its-mode -> its-define-mode +;; 92.7.6 modified for Mule Ver.0.9.5 by K.Handa <handa@etl.go.jp> +;; New rules added. + +(its-define-mode "roma-kana" "あ" t) + +(its-defrule-select-mode-temporally "q" "downcase") +(its-defrule-select-mode-temporally "Q" "zenkaku-downcase") + +;;; 「っ」の入力 + +(dolist (aa '("k" "s" "t" "h" "y" "r" "w" "g" "z" "d" "b" + "p" "c" "f" "j" "v")) + (its-defrule (concat aa aa) "っ" aa)) + +(its-defrule "tch" "っ" "ch") + +;;; 「ん」の入力 + +(dolist (q1 '("b" "m" "p")) + (its-defrule (concat "m" q1) "ん" q1)) + +(its-defrule "N" "ん") + +(its-defrule "n'" "ん") + +(defvar enable-double-n-syntax nil "*\"nn\"を\"ん\"に変換する") + +(its-defrule "n" "ん") +(its-defrule-conditional* "nn" "ん" nil + (enable-double-n-syntax "ん") + (t nil)) + +;; 92.7.6 by Y.Kawabe +;;(dolist (aa '("k" "s" "t" "c" "h" "f" "m" "y" "r" "l" +;; "w" "g" "z" "j" "d" "b" "v" "p" "x")) +;; (its-defrule (concat "n" aa) "ん" aa)) +;; end of patch + +(let ((small '"x" )) + (its-defrule (concat small "a") "ぁ") + (its-defrule (concat small "i") "ぃ") + (its-defrule (concat small "u") "ぅ") + (its-defrule (concat small "e") "ぇ") + (its-defrule (concat small "o") "ぉ") + (its-defrule (concat small "ya") "ゃ") + (its-defrule (concat small "yu") "ゅ") + (its-defrule (concat small "yo") "ょ") + (its-defrule (concat small "tu") "っ") + (its-defrule (concat small "tsu") "っ") + (its-defrule (concat small "wa") "ゎ") + ) + +(its-defrule "a" "あ") +(its-defrule "i" "い") +(its-defrule "u" "う") +(its-defrule "e" "え") +(its-defrule "o" "お") +(its-defrule "ka" "か") +(its-defrule "ki" "き") +(its-defrule "ku" "く") +(its-defrule "ke" "け") +(its-defrule "ko" "こ") +(its-defrule "kya" "きゃ") +(its-defrule "kyu" "きゅ") +(its-defrule "kye" "きぇ") +(its-defrule "kyo" "きょ") +(its-defrule "sa" "さ") +(its-defrule "si" "し") +(its-defrule "su" "す") +(its-defrule "se" "せ") +(its-defrule "so" "そ") +(its-defrule "sya" "しゃ") +(its-defrule "syu" "しゅ") +(its-defrule "sye" "しぇ") +(its-defrule "syo" "しょ") +(its-defrule "sha" "しゃ") +(its-defrule "shi" "し") +(its-defrule "shu" "しゅ") +(its-defrule "she" "しぇ") +(its-defrule "sho" "しょ") +(its-defrule "ta" "た") +(its-defrule "ti" "ち") +(its-defrule "tu" "つ") +(its-defrule "te" "て") +(its-defrule "to" "と") +(its-defrule "tya" "ちゃ") +(its-defrule "tyi" "てぃ") +(its-defrule "tyu" "ちゅ") +(its-defrule "tye" "ちぇ") +(its-defrule "tyo" "ちょ") +(its-defrule "tsu" "つ") +(its-defrule "cha" "ちゃ") +(its-defrule "chi" "ち") +(its-defrule "chu" "ちゅ") +(its-defrule "che" "ちぇ") +(its-defrule "cho" "ちょ") +(its-defrule "na" "な") +(its-defrule "ni" "に") +(its-defrule "nu" "ぬ") +(its-defrule "ne" "ね") +(its-defrule "no" "の") +(its-defrule "nya" "にゃ") +(its-defrule "nyu" "にゅ") +(its-defrule "nye" "にぇ") +(its-defrule "nyo" "にょ") +(its-defrule "ha" "は") +(its-defrule "hi" "ひ") +(its-defrule "hu" "ふ") +(its-defrule "he" "へ") +(its-defrule "ho" "ほ") +(its-defrule "hya" "ひゃ") +(its-defrule "hyu" "ひゅ") +(its-defrule "hye" "ひぇ") +(its-defrule "hyo" "ひょ") +(its-defrule "fa" "ふぁ") +(its-defrule "fi" "ふぃ") +(its-defrule "fu" "ふ") +(its-defrule "fe" "ふぇ") +(its-defrule "fo" "ふぉ") +(its-defrule "ma" "ま") +(its-defrule "mi" "み") +(its-defrule "mu" "む") +(its-defrule "me" "め") +(its-defrule "mo" "も") +(its-defrule "mya" "みゃ") +(its-defrule "myu" "みゅ") +(its-defrule "mye" "みぇ") +(its-defrule "myo" "みょ") +(its-defrule "ya" "や") +(its-defrule "yi" "い") +(its-defrule "yu" "ゆ") +(its-defrule "ye" "いぇ") +(its-defrule "yo" "よ") +(its-defrule "ra" "ら") +(its-defrule "ri" "り") +(its-defrule "ru" "る") +(its-defrule "re" "れ") +(its-defrule "ro" "ろ") +(its-defrule "la" "ら") +(its-defrule "li" "り") +(its-defrule "lu" "る") +(its-defrule "le" "れ") +(its-defrule "lo" "ろ") +(its-defrule "rya" "りゃ") +(its-defrule "ryu" "りゅ") +(its-defrule "rye" "りぇ") +(its-defrule "ryo" "りょ") +(its-defrule "lya" "りゃ") +(its-defrule "lyu" "りゅ") +(its-defrule "lye" "りぇ") +(its-defrule "lyo" "りょ") +(its-defrule "wa" "わ") +(its-defrule "wi" "ゐ") +(its-defrule "wu" "う") +(its-defrule "we" "ゑ") +(its-defrule "wo" "を") +(its-defrule "ga" "が") +(its-defrule "gi" "ぎ") +(its-defrule "gu" "ぐ") +(its-defrule "ge" "げ") +(its-defrule "go" "ご") +(its-defrule "gya" "ぎゃ") +(its-defrule "gyu" "ぎゅ") +(its-defrule "gye" "ぎぇ") +(its-defrule "gyo" "ぎょ") +(its-defrule "za" "ざ") +(its-defrule "zi" "じ") +(its-defrule "zu" "ず") +(its-defrule "ze" "ぜ") +(its-defrule "zo" "ぞ") +(its-defrule "zya" "じゃ") +(its-defrule "zyu" "じゅ") +(its-defrule "zye" "じぇ") +(its-defrule "zyo" "じょ") +(its-defrule "ja" "じゃ") +(its-defrule "ji" "じ") +(its-defrule "ju" "じゅ") +(its-defrule "je" "じぇ") +(its-defrule "jo" "じょ") +;; 92.7.6 by Y.Kawabe +(its-defrule "jya" "じゃ") +(its-defrule "jyu" "じゅ") +(its-defrule "jye" "じぇ") +(its-defrule "jyo" "じょ") +;; end of patch +(its-defrule "da" "だ") +(its-defrule "di" "ぢ") +(its-defrule "du" "づ") +(its-defrule "de" "で") +(its-defrule "do" "ど") +(its-defrule "dya" "ぢゃ") +(its-defrule "dyi" "でぃ") +(its-defrule "dyu" "ぢゅ") +(its-defrule "dye" "ぢぇ") +(its-defrule "dyo" "ぢょ") +(its-defrule "ba" "ば") +(its-defrule "bi" "び") +(its-defrule "bu" "ぶ") +(its-defrule "be" "べ") +(its-defrule "bo" "ぼ") +(its-defrule "va" "ヴぁ") +(its-defrule "vi" "ヴぃ") +(its-defrule "vu" "ヴ") +(its-defrule "ve" "ヴぇ") +(its-defrule "vo" "ヴぉ") +(its-defrule "bya" "びゃ") +(its-defrule "byu" "びゅ") +(its-defrule "bye" "びぇ") +(its-defrule "byo" "びょ") +(its-defrule "pa" "ぱ") +(its-defrule "pi" "ぴ") +(its-defrule "pu" "ぷ") +(its-defrule "pe" "ぺ") +(its-defrule "po" "ぽ") +(its-defrule "pya" "ぴゃ") +(its-defrule "pyu" "ぴゅ") +(its-defrule "pye" "ぴぇ") +(its-defrule "pyo" "ぴょ") +(its-defrule "kwa" "くゎ") +(its-defrule "kwi" "くぃ") +(its-defrule "kwu" "く") +(its-defrule "kwe" "くぇ") +(its-defrule "kwo" "くぉ") +(its-defrule "gwa" "ぐゎ") +(its-defrule "gwi" "ぐぃ") +(its-defrule "gwu" "ぐ") +(its-defrule "gwe" "ぐぇ") +(its-defrule "gwo" "ぐぉ") +(its-defrule "tsa" "つぁ") +(its-defrule "tsi" "つぃ") +(its-defrule "tse" "つぇ") +(its-defrule "tso" "つぉ") +(its-defrule "xka" "ヵ") +(its-defrule "xke" "ヶ") +(its-defrule "xti" "てぃ") +(its-defrule "xdi" "でぃ") +(its-defrule "xdu" "どぅ") +(its-defrule "xde" "でぇ") +(its-defrule "xdo" "どぉ") +(its-defrule "xwi" "うぃ") +(its-defrule "xwe" "うぇ") +(its-defrule "xwo" "うぉ") + +;;; Zenkaku Symbols + +(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 "-" "ー") ;;; JIS 213c ;;;(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 "/" "/") + +(defvar use-kuten-for-period t "*ピリオドを句点に変換する") +(defvar use-touten-for-comma t "*コンマを読点に変換する") + +(its-defrule-conditional "." + (use-kuten-for-period "。") + (t ".")) + +(its-defrule-conditional "," + (use-touten-for-comma "、") + (t ",")) + +;;; Escape character to Zenkaku inputs + +(defvar zenkaku-escape "Z") + +;;; Escape character to Hankaku inputs + +(defvar hankaku-escape "~") +;;; +;;; Zenkaku inputs +;;; + +(its-defrule (concat zenkaku-escape "0") "0") +(its-defrule (concat zenkaku-escape "1") "1") +(its-defrule (concat zenkaku-escape "2") "2") +(its-defrule (concat zenkaku-escape "3") "3") +(its-defrule (concat zenkaku-escape "4") "4") +(its-defrule (concat zenkaku-escape "5") "5") +(its-defrule (concat zenkaku-escape "6") "6") +(its-defrule (concat zenkaku-escape "7") "7") +(its-defrule (concat zenkaku-escape "8") "8") +(its-defrule (concat zenkaku-escape "9") "9") + +(its-defrule (concat zenkaku-escape "A") "A") +(its-defrule (concat zenkaku-escape "B") "B") +(its-defrule (concat zenkaku-escape "C") "C") +(its-defrule (concat zenkaku-escape "D") "D") +(its-defrule (concat zenkaku-escape "E") "E") +(its-defrule (concat zenkaku-escape "F") "F") +(its-defrule (concat zenkaku-escape "G") "G") +(its-defrule (concat zenkaku-escape "H") "H") +(its-defrule (concat zenkaku-escape "I") "I") +(its-defrule (concat zenkaku-escape "J") "J") +(its-defrule (concat zenkaku-escape "K") "K") +(its-defrule (concat zenkaku-escape "L") "L") +(its-defrule (concat zenkaku-escape "M") "M") +(its-defrule (concat zenkaku-escape "N") "N") +(its-defrule (concat zenkaku-escape "O") "O") +(its-defrule (concat zenkaku-escape "P") "P") +(its-defrule (concat zenkaku-escape "Q") "Q") +(its-defrule (concat zenkaku-escape "R") "R") +(its-defrule (concat zenkaku-escape "S") "S") +(its-defrule (concat zenkaku-escape "T") "T") +(its-defrule (concat zenkaku-escape "U") "U") +(its-defrule (concat zenkaku-escape "V") "V") +(its-defrule (concat zenkaku-escape "W") "W") +(its-defrule (concat zenkaku-escape "X") "X") +(its-defrule (concat zenkaku-escape "Y") "Y") +(its-defrule (concat zenkaku-escape "Z") "Z") + +(its-defrule (concat zenkaku-escape "a") "a") +(its-defrule (concat zenkaku-escape "b") "b") +(its-defrule (concat zenkaku-escape "c") "c") +(its-defrule (concat zenkaku-escape "d") "d") +(its-defrule (concat zenkaku-escape "e") "e") +(its-defrule (concat zenkaku-escape "f") "f") +(its-defrule (concat zenkaku-escape "g") "g") +(its-defrule (concat zenkaku-escape "h") "h") +(its-defrule (concat zenkaku-escape "i") "i") +(its-defrule (concat zenkaku-escape "j") "j") +(its-defrule (concat zenkaku-escape "k") "k") +(its-defrule (concat zenkaku-escape "l") "l") +(its-defrule (concat zenkaku-escape "m") "m") +(its-defrule (concat zenkaku-escape "n") "n") +(its-defrule (concat zenkaku-escape "o") "o") +(its-defrule (concat zenkaku-escape "p") "p") +(its-defrule (concat zenkaku-escape "q") "q") +(its-defrule (concat zenkaku-escape "r") "r") +(its-defrule (concat zenkaku-escape "s") "s") +(its-defrule (concat zenkaku-escape "t") "t") +(its-defrule (concat zenkaku-escape "u") "u") +(its-defrule (concat zenkaku-escape "v") "v") +(its-defrule (concat zenkaku-escape "w") "w") +(its-defrule (concat zenkaku-escape "x") "x") +(its-defrule (concat zenkaku-escape "y") "y") +(its-defrule (concat zenkaku-escape "z") "z") + +(its-defrule (concat zenkaku-escape " ") " ") +(its-defrule (concat zenkaku-escape "!") "!") +(its-defrule (concat zenkaku-escape "@") "@") +(its-defrule (concat zenkaku-escape "#") "#") +(its-defrule (concat zenkaku-escape "$") "$") +(its-defrule (concat zenkaku-escape "%") "%") +(its-defrule (concat zenkaku-escape "^") "^") +(its-defrule (concat zenkaku-escape "&") "&") +(its-defrule (concat zenkaku-escape "*") "*") +(its-defrule (concat zenkaku-escape "(") "(") +(its-defrule (concat zenkaku-escape ")") ")") +(its-defrule (concat zenkaku-escape "-") "-") +(its-defrule (concat zenkaku-escape "=") "=") +(its-defrule (concat zenkaku-escape "`") "`") +(its-defrule (concat zenkaku-escape "\\") "¥") +(its-defrule (concat zenkaku-escape "|") "|") +(its-defrule (concat zenkaku-escape "_") "_") +(its-defrule (concat zenkaku-escape "+") "+") +(its-defrule (concat zenkaku-escape "~") " ̄") +(its-defrule (concat zenkaku-escape "[") "[") +(its-defrule (concat zenkaku-escape "]") "]") +(its-defrule (concat zenkaku-escape "{") "{") +(its-defrule (concat zenkaku-escape "}") "}") +(its-defrule (concat zenkaku-escape ":") ":") +(its-defrule (concat zenkaku-escape ";") ";") +(its-defrule (concat zenkaku-escape "\"") "”") +(its-defrule (concat zenkaku-escape "'") "’") +(its-defrule (concat zenkaku-escape "<") "<") +(its-defrule (concat zenkaku-escape ">") ">") +(its-defrule (concat zenkaku-escape "?") "?") +(its-defrule (concat zenkaku-escape "/") "/") +(its-defrule (concat zenkaku-escape ",") ",") +(its-defrule (concat zenkaku-escape ".") ".") + +;;; +;;; Hankaku inputs +;;; + +;;(defvar escd '("-" "," "." "/" ";" ":" "[" "\\" "]" "^" "~")) +;;(its-defrule '("x" escd) '(escd)) + + +(defvar digit-characters + '( "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" )) + +(defvar symbol-characters + '( " " "!" "@" "#" "$" "%" "^" "&" "*" "(" ")" + "-" "=" "`" "\\" "|" "_" "+" "~" "[" "]" "{" "}" + ":" ";" "\"" "'" "<" ">" "?" "/" "," "." )) + +(defvar downcase-alphabets + '("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")) + +(defvar upcase-alphabets + '("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")) + +(dolist (digit digit-characters) + (its-defrule (concat hankaku-escape digit) digit)) + +(dolist (symbol symbol-characters) + (its-defrule (concat hankaku-escape symbol) symbol)) + +(dolist (downcase downcase-alphabets) + (its-defrule (concat hankaku-escape downcase) downcase)) + +(dolist (upcase upcase-alphabets) + (its-defrule (concat hankaku-escape upcase) upcase)) + +;;; proposal key bindings for JIS symbols +;;; 90.3.2 by jiro@math.keio.ac.jp (TANAKA Jiro) + +(its-defrule "z1" "○") (its-defrule "z!" "●") +(its-defrule "z2" "▽") (its-defrule "z@" "▼") +(its-defrule "z3" "△") (its-defrule "z#" "▲") +(its-defrule "z4" "□") (its-defrule "z$" "■") +(its-defrule "z5" "◇") (its-defrule "z%" "◆") +(its-defrule "z6" "☆") (its-defrule "z^" "★") +(its-defrule "z7" "◎") (its-defrule "z&" "£") +(its-defrule "z8" "¢") (its-defrule "z*" "×") +(its-defrule "z9" "♂") (its-defrule "z(" "【") +(its-defrule "z0" "♀") (its-defrule "z)" "】") +(its-defrule "z-" "~") (its-defrule "z_" "∴") ; z- +(its-defrule "z=" "≠") (its-defrule "z+" "±") +(its-defrule "z\\" "\") (its-defrule "z|" "∥") +(its-defrule "z`" "´") (its-defrule "z~" "¨") + +(its-defrule "zq" "《") (its-defrule "zQ" "〈") +(its-defrule "zw" "》") (its-defrule "zW" "〉") +; e +(its-defrule "zr" "々") (its-defrule "zR" "仝") ; zr +(its-defrule "zt" "〆") (its-defrule "zT" "§") +; y u i o +(its-defrule "zp" "〒") (its-defrule "zP" "↑") ; zp +(its-defrule "z[" "『") (its-defrule "z{" "〔") ; z[ +(its-defrule "z]" "』") (its-defrule "z}" "〕") ; z] + +; a +(its-defrule "zs" "ヽ") (its-defrule "zS" "ヾ") +(its-defrule "zd" "ゝ") (its-defrule "zD" "ゞ") +(its-defrule "zf" "〃") (its-defrule "zF" "→") +(its-defrule "zg" "‐") (its-defrule "zG" "―") +(its-defrule "zh" "←") +(its-defrule "zj" "↓") +(its-defrule "zk" "↑") +(its-defrule "zl" "→") +(its-defrule "z;" "゛") (its-defrule "z:" "゜") +(its-defrule "z\'" "‘") (its-defrule "z\"" "“") + +; z +(its-defrule "zx" ":-") (its-defrule "zX" ":-)") +(its-defrule "zc" "〇") (its-defrule "zC" "℃") ; zc +(its-defrule "zv" "※") (its-defrule "zV" "÷") +(its-defrule "zb" "°") (its-defrule "zB" "←") +(its-defrule "zn" "′") (its-defrule "zN" "↓") +(its-defrule "zm" "″") (its-defrule "zM" "〓") +(its-defrule "z," "‥") (its-defrule "z<" "≦") +(its-defrule "z." "…") (its-defrule "z>" "≧") ; z. +(its-defrule "z/" "・") (its-defrule "z?" "∞") ; z/ + +;;; Commented out by K.Handa. Already defined in a different way. +;(its-defrule "va" "ヴァ") +;(its-defrule "vi" "ヴィ") +;(its-defrule "vu" "ヴ") +;(its-defrule "ve" "ヴェ") +;(its-defrule "vo" "ヴォ") --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/its/kanainput.el 2007-06-03 23:21:07 +0000 @@ -0,0 +1,193 @@ +;; Basic translation table to input KANA with ASCII keyboard +;; Created by DEMIZU Norotishi <nori-d@is.aist-nara.ac.jp> on 1994.1.26 +;; $Id: kanainput.el,v 1.2 1994/02/04 13:19:38 nori-d Exp nori-d $ + +;; +;; 配布条件は GNU GENERAL PUBLIC LICENSE に従います。 +;; +;; これは ASCII 配列のキーボードでかな入力で仮名漢字変換をするための +;; 変換ルールを記した lisp です。使い方は次の通りです。 +;; (load "its/kanainput") +;; (setq its:*standard-modes* +;; (append (list (its:get-mode-map "kanainput")) +;; its:*standard-modes*)) +;; (setq-default its:*current-map* (its:get-mode-map "kanainput")) +;; + +;; +;; 一般の JIS かなと違うところは次です。 +;; ・ 「ろ」が "|" の位置に。本来の「ろ」の位置にキーがないため。(不便) +;; ・ 「ー」が多くのアスキーキーボードでは期待と違う位置にある。(不便) +;; ・ `「' が `[' の位置に。ASCII の "[" に気持ちを合わせた。 +;; ・ `」' が `]' の位置に。ASCII の "]" に気持ちを合わせた。 +;; ・ 「?」が "?" の位置に。ASCII の "?" に気持ちを合わせた。 +;; ・ 「・」が ":" の位置に。「?」を "?" と同じ位置にするためずらした。 +;; +;; 全角文字、半角文字、JIS 記号入力の部分は its/hira.el と同じにしました。 +;; 入力のための prefix は以下の通り。 +;; Q: 全角入力 (Quote と覚える) ; k-zenkaku-escape で定義可能 +;; A: 半角入力 (Ascii と覚える) ; k-hankaku-escape で定義可能 +;; S: 記号入力 (Symbol と覚える) ; k-symbols-escape で定義可能 +;; +;;「かな入力時の配列」 +;; ぬ! ふ@ あぁ うぅ えぇ おぉ やゃ ゆゅ よょ わを ほろ へ+ ー~ +;; た__ て__ いぃ すす かヵ んん なな にに らら せせ ”「 ゜」 +;; ち__ と__ しし はは きき くく まま のの りり れ・ けヶ むろ +;; つっ ささ そそ ひひ ここ みみ もも ね、 る。 め? +;; +;;「記号入力時の配列」(proposed by TANAKA Jiro <jiro@math.keio.ac.jp> 90.3.2) +;; ○● ▽▼ △▲ □■ ◇◆ ☆★ ◎£ ¢× ♂【 ♀】 ~∴ ≠± ´¨ +;; 《〈 》〉 ____ 々仝 〆§ ¥__ ____ ____ ____ 〒↑ 『〔 』〕 +;; ____ヽヾ ゝゞ 〃→ ‐― ←__ ↓_ ↑ ̄ →__ ゛゜ ‘“ \∥ +;; ____ :-:-)〇℃ ※÷ °← ′↓ ″〓 ‥≦ …≧ ・∞ +;; +;;「想定している ASCII キーボードの配列」(半角、全角入力時も) +;; 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+ `~ +;; qQ wW eE rR tT yY uU iI oO pP [{ ]} +;; aA sS dD fF gG hH jJ kK lL ;: '" \| +;; zZ xX cC vV bB nN mM ,< .> /? +;; +;; kanainput.el 1.1 -> 1.2: +;; o 記号入力 prefix を "X" から "S" にした。 +;; o 以下の入力方法を簡単にするため変更した。 +;; 「ゐ」 "W4E" --> "WE" +;; 「ゑ」 "W4%" --> "W%" +;; 「ヴ」 "W4[" --> "W[" +;; o 以下の入力結果を変更した。本物の Quote にするため。 +;; "Q\\" 「¥」-->「\」 +;; "Q~" 「 ̄」-->「~」 +;; o 以下のルールを追加した。 +;; "Sy" -->「¥」 +;; "SJ" -->「_」 +;; "Sk" -->「 ̄」 +;; o 各ルールについて its-defrule を書いていたのを、 +;; 簡単のため表ベースにした。 +;; + +(its-define-mode "kanainput" "か" t) +(defvar k-zenkaku-escape "Q") ; 全角入力の prefix +(defvar k-hankaku-escape "A") ; 半角入力の prefix +(defvar k-symbols-escape "S") ; 記号入力の prefix + + +(defun its:make-terminal-state-kanainput (map input action state) + (cond((its:standard-actionp action) (action-output action)) + (t nil))) + +(let ((its:make-terminal-state 'its:make-terminal-state-kanainput)) + ;; かな入力用 + (dolist (normal-pair + '( + ;; 清音 + ("3" "あ") ("e" "い") ("4" "う") ("5" "え") ("6" "お") + ("t" "か") ("g" "き") ("h" "く") ("'" "け") ("b" "こ") + ("x" "さ") ("d" "し") ("r" "す") ("p" "せ") ("c" "そ") + ("q" "た") ("a" "ち") ("z" "つ") ("w" "て") ("s" "と") + ("u" "な") ("i" "に") ("1" "ぬ") ("," "ね") ("k" "の") + ("f" "は") ("v" "ひ") ("2" "ふ") ("=" "へ") ("-" "ほ") + ("j" "ま") ("n" "み") ("\\" "む") ("/" "め") ("m" "も") + ("7" "や") ("8" "ゆ") ("9" "よ") + ("o" "ら") ("l" "り") ("." "る") (";" "れ") ("|" "ろ") + ("0" "わ") ("WE" "ゐ") ("W%" "ゑ") (")" "を") + ("y" "ん") + ;; 濁音 + ("t[" "が") ("g[" "ぎ") ("h[" "ぐ") ("'[" "げ") ("b[" "ご") + ("x[" "ざ") ("d[" "じ") ("r[" "ず") ("p[" "ぜ") ("c[" "ぞ") + ("q[" "だ") ("a[" "ぢ") ("z[" "づ") ("w[" "で") ("s[" "ど") + ("f[" "ば") ("v[" "び") ("2[" "ぶ") ("=[" "べ") ("-[" "ぼ") + ;; 半濁音 + ("f]" "ぱ") ("v]" "ぴ") ("2]" "ぷ") ("=]" "ぺ") ("-]" "ぽ") + ;; 小さな字 + ("#" "ぁ") ("E" "ぃ") ("$" "ぅ") ("%" "ぇ") ("^" "ぉ") + ("&" "ゃ") ("*" "ゅ") ("(" "ょ") + ("T" "ヵ") ("\"" "ヶ") ("Z" "っ") ("W0" "ゎ") ("W#" "ゎ") + ;; その他 + ("W[" "ヴ") ("W" "う") + ;; 記号 + ("<" "、") (">" "。") (":" "・") ("?" "?") + ("{" "「") ("}" "」") ("[" "゛") ("]" "゜") ("`" "ー") + ;; シフトキー押下時の扱い + ("G" "き") ("H" "く") ("B" "こ") + ("X" "さ") ("D" "し") ("R" "す") ("P" "せ") ("C" "そ") + ("U" "な") ("I" "に") ("K" "の") + ("F" "は") ("V" "ひ") + ("J" "ま") ("N" "み") ("M" "も") + ("O" "ら") ("L" "り") + ("Y" "ん") + ("!" "!") ("@" "@") ("+" "+") ("~" "~") + ("_" "ろ");;; 「ろ」があるキーボード用 + )) + (its-defrule (car normal-pair) (car (cdr normal-pair)))) + + ;; 全角入力 + (dolist (zenkaku-pair + '( + (" " " ") ("!" "!") ("\"" "”") ("#" "#") ; 20--24 + ("$" "$") ("%" "%") ("&" "&") ("'" "’") ; 25--27 + ("(" "(") (")" ")") ("*" "*") ("+" "+") ; 28--2b + ("," ",") ("-" "-") ("." ".") ("/" "/") ; 2c--2f + ("0" "0") ("1" "1") ("2" "2") ("3" "3") ; 30--33 + ("4" "4") ("5" "5") ("6" "6") ("7" "7") ; 34--37 + ("8" "8") ("9" "9") (":" ":") (";" ";") ; 38--3b + ("<" "<") ("=" "=") (">" ">") ("?" "?") ; 3c--3f + ("@" "@") ("A" "A") ("B" "B") ("C" "C") ; 40--43 + ("D" "D") ("E" "E") ("F" "F") ("G" "G") ; 44--47 + ("H" "H") ("I" "I") ("J" "J") ("K" "K") ; 48--4b + ("L" "L") ("M" "M") ("N" "N") ("O" "O") ; 4c--4f + ("P" "P") ("Q" "Q") ("R" "R") ("S" "S") ; 50--53 + ("T" "T") ("U" "U") ("V" "V") ("W" "W") ; 54--57 + ("X" "X") ("Y" "Y") ("Z" "Z") ("[" "[") ; 58--5a + ("\\" "\") ("]" "]") ("^" "^") ("_" "_") ; 5b--5f + ("`" "`") ("a" "a") ("b" "b") ("c" "c") ; 60--63 + ("d" "d") ("e" "e") ("f" "f") ("g" "g") ; 64--67 + ("h" "h") ("i" "i") ("j" "j") ("k" "k") ; 68--6b + ("l" "l") ("m" "m") ("n" "n") ("o" "o") ; 6c--6f + ("p" "p") ("q" "q") ("r" "r") ("s" "s") ; 70--73 + ("t" "t") ("u" "u") ("v" "v") ("w" "w") ; 74--77 + ("x" "x") ("y" "y") ("z" "z") ("{" "{") ; 78--7b + ("|" "|") ("}" "}") ("~" "~") ; 7c--7e + )) + (its-defrule (concat k-zenkaku-escape (car zenkaku-pair)) + (car (cdr zenkaku-pair)))) + + ;; 半角入力 + (dolist (character + '( "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" + " " "!" "@" "#" "$" "%" "^" "&" "*" "(" ")" + "-" "=" "`" "\\" "|" "_" "+" "~" "[" "]" "{" "}" + ":" ";" "\"" "'" "<" ">" "?" "/" "," "." + "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" + "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 k-hankaku-escape character) character)) + + ;;; proposal key bindings for JIS symbols + ;;; 90.3.2 by jiro@math.keio.ac.jp (TANAKA Jiro) + ;;; 「¥」、「 ̄」、「_」 are added + ;;; 94.2.4 by nori-d@is.aist-nara.ac.jp (DEMIZU Noritoshi) + (dolist (symbols-pair + '( + ("1" "○") ("2" "▽") ("3" "△") ("4" "□") ("5" "◇") + ("6" "☆") ("7" "◎") ("8" "¢") ("9" "♂") ("0" "♀") + ("-" "~") ("=" "≠") ("\\" "\") ("`" "´") + ("!" "●") ("@" "▼") ("#" "▲") ("$" "■") ("%" "◆") + ("^" "★") ("&" "£") ("*" "×") ("(" "【") (")" "】") + ("_" "∴") ("+" "±") ("|" "∥") ("~" "¨") + ("q" "《") ("w" "》") ("r" "々") ("t" "〆") ("y" "¥") + ("Q" "〈") ("W" "〉") ("R" "仝") ("T" "§") + ("p" "〒") ("[" "『") ("]" "』") + ("P" "↑") ("{" "〔") ("}" "〕") + ("s" "ヽ") ("d" "ゝ") ("f" "〃") ("g" "‐") + ("S" "ヾ") ("D" "ゞ") ("F" "→") ("G" "―") + ("h" "←") ("j" "↓") ("k" "↑") ("l" "→") + ("J" "_") ("K" " ̄") + (";" "゛") (":" "゜") ("\'" "‘") ("\"" "“") + ("x" ":-") ("c" "〇") ("v" "※") ("b" "°") ("n" "′") + ("X" ":-)") ("C" "℃") ("V" "÷") ("B" "←") ("N" "↓") + ("m" "″") ("," "‥") ("." "…") ("/" "・") + ("M" "〓") ("<" "≦") (">" "≧") ("?" "∞") + )) + (its-defrule (concat k-symbols-escape (car symbols-pair)) + (car (cdr symbols-pair)))) +) --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/its/kata.el 2007-06-03 23:21:07 +0000 @@ -0,0 +1,513 @@ +;; Basic Roma-to-KataKana Translation Table for Egg +;; Coded by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp) + +;; This file is part of Egg on Nemacs (Japanese Environment) + +;; Egg is distributed in the forms of patches to GNU +;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC +;; LICENSE which is distributed along with GNU Emacs by the +;; Free Software Foundation. + +;; 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 EMACS GENERAL PUBLIC LICENSE for +;; more details. + +;; You should have received a copy of the GNU EMACS GENERAL +;; PUBLIC LICENSE along with Nemacs; see the file COPYING. +;; If not, write to the Free Software Foundation, 675 Mass +;; Ave, Cambridge, MA 02139, USA. + +;; 90.3.2 modified for Nemacs Ver.3.3.1 +;; by jiro@math.keio.ac.jp (TANAKA Jiro) +;; proposal of keybinding for JIS symbols +;; 92.3.16 modified for Mule Ver.0.9.1 by K.Handa <handa@etl.go.jp> +;; 92.3.23 modified for Mule Ver.0.9.1 by K.Handa <handa@etl.go.jp> +;; defrule -> its-defrule, define-its-mode -> its-define-mode + +;; 92.3.16 by K.Handa +;;(define-its-mode "roma-kata" " aア" t) +(its-define-mode "roma-kata" "ア" t) + +(dolist (aa '("k" "s" "t" "h" "y" "r" "w" "g" "z" "d" "b" + "p" "c" "f" "j" "v")) + (its-defrule (concat aa aa) "ッ" aa)) + +(its-defrule "tch" "ッ" "ch") + +(dolist (q1 '("b" "m" "p")) + (its-defrule (concat "m" q1) "ン" q1)) + +(its-defrule "N" "ン") + +(defvar enable-double-n-syntax nil "*Enable \"nn\" input for \"ン\" ") + +(its-defrule-conditional "n" + ((not enable-double-n-syntax) "ン") + (t nil)) +(its-defrule-conditional "nn" + ( enable-double-n-syntax "ン") + (t nil)) + +(its-defrule "n'" "ン") + +(let ((small '"x" )) + (its-defrule (concat small "a") "ァ") + (its-defrule (concat small "i") "ィ") + (its-defrule (concat small "u") "ゥ") + (its-defrule (concat small "e") "ェ") + (its-defrule (concat small "o") "ォ") + (its-defrule (concat small "ya") "ャ") + (its-defrule (concat small "yu") "ュ") + (its-defrule (concat small "yo") "ョ") + (its-defrule (concat small "tu") "ッ") + (its-defrule (concat small "tsu") "ッ") + (its-defrule (concat small "wa") "ヮ") + ) + +(its-defrule "a" "ア") +(its-defrule "i" "イ") +(its-defrule "u" "ウ") +(its-defrule "e" "エ") +(its-defrule "o" "オ") +(its-defrule "ka" "カ") +(its-defrule "ki" "キ") +(its-defrule "ku" "ク") +(its-defrule "ke" "ケ") +(its-defrule "ko" "コ") +(its-defrule "kya" "キャ") +(its-defrule "kyu" "キュ") +(its-defrule "kye" "キェ") +(its-defrule "kyo" "キョ") +(its-defrule "sa" "サ") +(its-defrule "si" "シ") +(its-defrule "su" "ス") +(its-defrule "se" "セ") +(its-defrule "so" "ソ") +(its-defrule "sya" "シャ") +(its-defrule "syu" "シュ") +(its-defrule "sye" "シェ") +(its-defrule "syo" "ショ") +(its-defrule "sha" "シャ") +(its-defrule "shi" "シ") +(its-defrule "shu" "シュ") +(its-defrule "she" "シェ") +(its-defrule "sho" "ショ") +(its-defrule "ta" "タ") +(its-defrule "ti" "チ") +(its-defrule "tu" "ツ") +(its-defrule "te" "テ") +(its-defrule "to" "ト") +(its-defrule "tya" "チャ") +(its-defrule "tyi" "ティ") +(its-defrule "tyu" "チュ") +(its-defrule "tye" "チェ") +(its-defrule "tyo" "チョ") +(its-defrule "tsu" "ツ") +(its-defrule "cha" "チャ") +(its-defrule "chi" "チ") +(its-defrule "chu" "チュ") +(its-defrule "che" "チェ") +(its-defrule "cho" "チョ") +(its-defrule "na" "ナ") +(its-defrule "ni" "ニ") +(its-defrule "nu" "ヌ") +(its-defrule "ne" "ネ") +(its-defrule "no" "ノ") +(its-defrule "nya" "ニャ") +(its-defrule "nyu" "ニュ") +(its-defrule "nye" "ニェ") +(its-defrule "nyo" "ニョ") +(its-defrule "ha" "ハ") +(its-defrule "hi" "ヒ") +(its-defrule "hu" "フ") +(its-defrule "he" "ヘ") +(its-defrule "ho" "ホ") +(its-defrule "hya" "ヒャ") +(its-defrule "hyu" "ヒュ") +(its-defrule "hye" "ヒェ") +(its-defrule "hyo" "ヒョ") +(its-defrule "fa" "ファ") +(its-defrule "fi" "フィ") +(its-defrule "fu" "フ") +(its-defrule "fe" "フェ") +(its-defrule "fo" "フォ") +(its-defrule "ma" "マ") +(its-defrule "mi" "ミ") +(its-defrule "mu" "ム") +(its-defrule "me" "メ") +(its-defrule "mo" "モ") +(its-defrule "mya" "ミャ") +(its-defrule "myu" "ミュ") +(its-defrule "mye" "ミェ") +(its-defrule "myo" "ミョ") +(its-defrule "ya" "ヤ") +(its-defrule "yi" "イ") +(its-defrule "yu" "ユ") +(its-defrule "ye" "イェ") +(its-defrule "yo" "ヨ") +(its-defrule "ra" "ラ") +(its-defrule "ri" "リ") +(its-defrule "ru" "ル") +(its-defrule "re" "レ") +(its-defrule "ro" "ロ") +(its-defrule "la" "ラ") +(its-defrule "li" "リ") +(its-defrule "lu" "ル") +(its-defrule "le" "レ") +(its-defrule "lo" "ロ") +(its-defrule "rya" "リャ") +(its-defrule "ryu" "リュ") +(its-defrule "rye" "リェ") +(its-defrule "ryo" "リョ") +(its-defrule "lya" "リャ") +(its-defrule "lyu" "リュ") +(its-defrule "lye" "リェ") +(its-defrule "lyo" "リョ") +(its-defrule "wa" "ワ") +(its-defrule "wi" "ヰ") +(its-defrule "wu" "ウ") +(its-defrule "we" "ヱ") +(its-defrule "wo" "ヲ") +(its-defrule "ga" "ガ") +(its-defrule "gi" "ギ") +(its-defrule "gu" "グ") +(its-defrule "ge" "ゲ") +(its-defrule "go" "ゴ") +(its-defrule "gya" "ギャ") +(its-defrule "gyu" "ギュ") +(its-defrule "gye" "ギェ") +(its-defrule "gyo" "ギョ") +(its-defrule "za" "ザ") +(its-defrule "zi" "ジ") +(its-defrule "zu" "ズ") +(its-defrule "ze" "ゼ") +(its-defrule "zo" "ゾ") +(its-defrule "zya" "ジャ") +(its-defrule "zyu" "ジュ") +(its-defrule "zye" "ジェ") +(its-defrule "zyo" "ジョ") +(its-defrule "ja" "ジャ") +(its-defrule "ji" "ジ") +(its-defrule "ju" "ジュ") +(its-defrule "je" "ジェ") +(its-defrule "jo" "ジョ") +(its-defrule "da" "ダ") +(its-defrule "di" "ヂ") +(its-defrule "du" "ヅ") +(its-defrule "de" "デ") +(its-defrule "do" "ド") +(its-defrule "dya" "ヂャ") +(its-defrule "dyi" "ディ") +(its-defrule "dyu" "ヂュ") +(its-defrule "dye" "ヂェ") +(its-defrule "dyo" "ヂョ") +(its-defrule "ba" "バ") +(its-defrule "bi" "ビ") +(its-defrule "bu" "ブ") +(its-defrule "be" "ベ") +(its-defrule "bo" "ボ") +(its-defrule "va" "ヴァ") +(its-defrule "vi" "ヴィ") +(its-defrule "vu" "ヴ") +(its-defrule "ve" "ヴェ") +(its-defrule "vo" "ヴォ") +(its-defrule "bya" "ビャ") +(its-defrule "byu" "ビュ") +(its-defrule "bye" "ビェ") +(its-defrule "byo" "ビョ") +(its-defrule "pa" "パ") +(its-defrule "pi" "ピ") +(its-defrule "pu" "プ") +(its-defrule "pe" "ペ") +(its-defrule "po" "ポ") +(its-defrule "pya" "ピャ") +(its-defrule "pyu" "ピュ") +(its-defrule "pye" "ピェ") +(its-defrule "pyo" "ピョ") +(its-defrule "kwa" "クヮ") +(its-defrule "kwi" "クィ") +(its-defrule "kwu" "ク") +(its-defrule "kwe" "クェ") +(its-defrule "kwo" "クォ") +(its-defrule "gwa" "グヮ") +(its-defrule "gwi" "グィ") +(its-defrule "gwu" "グ") +(its-defrule "gwe" "グェ") +(its-defrule "gwo" "グォ") +(its-defrule "tsa" "ツァ") +(its-defrule "tsi" "ツィ") +(its-defrule "tse" "ツェ") +(its-defrule "tso" "ツォ") +(its-defrule "xka" "ヵ") +(its-defrule "xke" "ヶ") +(its-defrule "xti" "ティ") +(its-defrule "xdi" "ディ") +(its-defrule "xdu" "ドゥ") +(its-defrule "xde" "デェ") +(its-defrule "xdo" "ドォ") +;(its-defrule "xwa" "ヮ") +(its-defrule "xwi" "ウィ") +(its-defrule "xwe" "ウェ") +(its-defrule "xwo" "ウォ") + +;;; Zenkaku Symbols + +(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 "-" "ー") ;;; JIS 213c ;;;(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 "/" "/") + +(defvar use-kuten-for-period t "*ピリオドを句点に変換する") +(defvar use-touten-for-comma t "*コンマを読点に変換する") + +(its-defrule-conditional "." + (use-kuten-for-period "。") + (t ".")) + +(its-defrule-conditional "," + (use-touten-for-comma "、") + (t ",")) + +;;; Escape character to Zenkaku inputs + +(defvar zenkaku-escape "Z") + +;;; Escape character to Hankaku inputs + +(defvar hankaku-escape "~") +;;; +;;; Zenkaku inputs +;;; + +(its-defrule (concat zenkaku-escape "0") "0") +(its-defrule (concat zenkaku-escape "1") "1") +(its-defrule (concat zenkaku-escape "2") "2") +(its-defrule (concat zenkaku-escape "3") "3") +(its-defrule (concat zenkaku-escape "4") "4") +(its-defrule (concat zenkaku-escape "5") "5") +(its-defrule (concat zenkaku-escape "6") "6") +(its-defrule (concat zenkaku-escape "7") "7") +(its-defrule (concat zenkaku-escape "8") "8") +(its-defrule (concat zenkaku-escape "9") "9") + +(its-defrule (concat zenkaku-escape "A") "A") +(its-defrule (concat zenkaku-escape "B") "B") +(its-defrule (concat zenkaku-escape "C") "C") +(its-defrule (concat zenkaku-escape "D") "D") +(its-defrule (concat zenkaku-escape "E") "E") +(its-defrule (concat zenkaku-escape "F") "F") +(its-defrule (concat zenkaku-escape "G") "G") +(its-defrule (concat zenkaku-escape "H") "H") +(its-defrule (concat zenkaku-escape "I") "I") +(its-defrule (concat zenkaku-escape "J") "J") +(its-defrule (concat zenkaku-escape "K") "K") +(its-defrule (concat zenkaku-escape "L") "L") +(its-defrule (concat zenkaku-escape "M") "M") +(its-defrule (concat zenkaku-escape "N") "N") +(its-defrule (concat zenkaku-escape "O") "O") +(its-defrule (concat zenkaku-escape "P") "P") +(its-defrule (concat zenkaku-escape "Q") "Q") +(its-defrule (concat zenkaku-escape "R") "R") +(its-defrule (concat zenkaku-escape "S") "S") +(its-defrule (concat zenkaku-escape "T") "T") +(its-defrule (concat zenkaku-escape "U") "U") +(its-defrule (concat zenkaku-escape "V") "V") +(its-defrule (concat zenkaku-escape "W") "W") +(its-defrule (concat zenkaku-escape "X") "X") +(its-defrule (concat zenkaku-escape "Y") "Y") +(its-defrule (concat zenkaku-escape "Z") "Z") + +(its-defrule (concat zenkaku-escape "a") "a") +(its-defrule (concat zenkaku-escape "b") "b") +(its-defrule (concat zenkaku-escape "c") "c") +(its-defrule (concat zenkaku-escape "d") "d") +(its-defrule (concat zenkaku-escape "e") "e") +(its-defrule (concat zenkaku-escape "f") "f") +(its-defrule (concat zenkaku-escape "g") "g") +(its-defrule (concat zenkaku-escape "h") "h") +(its-defrule (concat zenkaku-escape "i") "i") +(its-defrule (concat zenkaku-escape "j") "j") +(its-defrule (concat zenkaku-escape "k") "k") +(its-defrule (concat zenkaku-escape "l") "l") +(its-defrule (concat zenkaku-escape "m") "m") +(its-defrule (concat zenkaku-escape "n") "n") +(its-defrule (concat zenkaku-escape "o") "o") +(its-defrule (concat zenkaku-escape "p") "p") +(its-defrule (concat zenkaku-escape "q") "q") +(its-defrule (concat zenkaku-escape "r") "r") +(its-defrule (concat zenkaku-escape "s") "s") +(its-defrule (concat zenkaku-escape "t") "t") +(its-defrule (concat zenkaku-escape "u") "u") +(its-defrule (concat zenkaku-escape "v") "v") +(its-defrule (concat zenkaku-escape "w") "w") +(its-defrule (concat zenkaku-escape "x") "x") +(its-defrule (concat zenkaku-escape "y") "y") +(its-defrule (concat zenkaku-escape "z") "z") + +(its-defrule (concat zenkaku-escape " ") " ") +(its-defrule (concat zenkaku-escape "!") "!") +(its-defrule (concat zenkaku-escape "@") "@") +(its-defrule (concat zenkaku-escape "#") "#") +(its-defrule (concat zenkaku-escape "$") "$") +(its-defrule (concat zenkaku-escape "%") "%") +(its-defrule (concat zenkaku-escape "^") "^") +(its-defrule (concat zenkaku-escape "&") "&") +(its-defrule (concat zenkaku-escape "*") "*") +(its-defrule (concat zenkaku-escape "(") "(") +(its-defrule (concat zenkaku-escape ")") ")") +(its-defrule (concat zenkaku-escape "-") "-") +(its-defrule (concat zenkaku-escape "=") "=") +(its-defrule (concat zenkaku-escape "`") "`") +(its-defrule (concat zenkaku-escape "\\") "¥") +(its-defrule (concat zenkaku-escape "|") "|") +(its-defrule (concat zenkaku-escape "_") "_") +(its-defrule (concat zenkaku-escape "+") "+") +(its-defrule (concat zenkaku-escape "~") " ̄") +(its-defrule (concat zenkaku-escape "[") "[") +(its-defrule (concat zenkaku-escape "]") "]") +(its-defrule (concat zenkaku-escape "{") "{") +(its-defrule (concat zenkaku-escape "}") "}") +(its-defrule (concat zenkaku-escape ":") ":") +(its-defrule (concat zenkaku-escape ";") ";") +(its-defrule (concat zenkaku-escape "\"") "”") +(its-defrule (concat zenkaku-escape "'") "’") +(its-defrule (concat zenkaku-escape "<") "<") +(its-defrule (concat zenkaku-escape ">") ">") +(its-defrule (concat zenkaku-escape "?") "?") +(its-defrule (concat zenkaku-escape "/") "/") +(its-defrule (concat zenkaku-escape ",") ",") +(its-defrule (concat zenkaku-escape ".") ".") + +;;; +;;; Hankaku inputs +;;; + +;;(defvar escd '("-" "," "." "/" ";" ":" "[" "\\" "]" "^" "~")) +;;(its-defrule '("x" escd) '(escd)) + + +(defvar digit-characters + '( "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" )) + +(defvar symbol-characters + '( " " "!" "@" "#" "$" "%" "^" "&" "*" "(" ")" + "-" "=" "`" "\\" "|" "_" "+" "~" "[" "]" "{" "}" + ":" ";" "\"" "'" "<" ">" "?" "/" "," "." )) + +(defvar downcase-alphabets + '("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")) + +(defvar upcase-alphabets + '("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")) + +(dolist (digit digit-characters) + (its-defrule (concat hankaku-escape digit) digit)) + +(dolist (symbol symbol-characters) + (its-defrule (concat hankaku-escape symbol) symbol)) + +(dolist (downcase downcase-alphabets) + (its-defrule (concat hankaku-escape downcase) downcase)) + +(dolist (upcase upcase-alphabets) + (its-defrule (concat hankaku-escape upcase) upcase)) + +;;; proposal key bindings for JIS symbols +;;; 90.3.2 by jiro@math.keio.ac.jp (TANAKA Jiro) + +(its-defrule "z1" "○") (its-defrule "z!" "●") +(its-defrule "z2" "▽") (its-defrule "z@" "▼") +(its-defrule "z3" "△") (its-defrule "z#" "▲") +(its-defrule "z4" "□") (its-defrule "z$" "■") +(its-defrule "z5" "◇") (its-defrule "z%" "◆") +(its-defrule "z6" "☆") (its-defrule "z^" "★") +(its-defrule "z7" "◎") (its-defrule "z&" "£") +(its-defrule "z8" "¢") (its-defrule "z*" "×") +(its-defrule "z9" "♂") (its-defrule "z(" "【") +(its-defrule "z0" "♀") (its-defrule "z)" "】") +(its-defrule "z-" "~") (its-defrule "z_" "∴") ; z- +(its-defrule "z=" "≠") (its-defrule "z+" "±") +(its-defrule "z\\" "\") (its-defrule "z|" "∥") +(its-defrule "z`" "´") (its-defrule "z~" "¨") + +(its-defrule "zq" "《") (its-defrule "zQ" "〈") +(its-defrule "zw" "》") (its-defrule "zW" "〉") +; e +(its-defrule "zr" "々") (its-defrule "zR" "仝") ; zr +(its-defrule "zt" "〆") (its-defrule "zT" "§") +; y u i o +(its-defrule "zp" "〒") (its-defrule "zP" "↑") ; zp +(its-defrule "z[" "『") (its-defrule "z{" "〔") ; z[ +(its-defrule "z]" "』") (its-defrule "z}" "〕") ; z] + +; a +(its-defrule "zs" "ヽ") (its-defrule "zS" "ヾ") +(its-defrule "zd" "ゝ") (its-defrule "zD" "ゞ") +(its-defrule "zf" "〃") (its-defrule "zF" "→") +(its-defrule "zg" "‐") (its-defrule "zG" "―") +(its-defrule "zh" "←") +(its-defrule "zj" "↓") +(its-defrule "zk" "↑") +(its-defrule "zl" "→") +(its-defrule "z;" "゛") (its-defrule "z:" "゜") +(its-defrule "z\'" "‘") (its-defrule "z\"" "“") + +; z +(its-defrule "zx" ":-") (its-defrule "zX" ":-)") +(its-defrule "zc" "〇") (its-defrule "zC" "℃") ; zc +(its-defrule "zv" "※") (its-defrule "zV" "÷") +(its-defrule "zb" "°") (its-defrule "zB" "←") +(its-defrule "zn" "′") (its-defrule "zN" "↓") +(its-defrule "zm" "″") (its-defrule "zM" "〓") +(its-defrule "z," "‥") (its-defrule "z<" "≦") +(its-defrule "z." "…") (its-defrule "z>" "≧") ; z. +(its-defrule "z/" "・") (its-defrule "z?" "∞") ; z/ + +;;; Commented out by K.Handa. Already defined in a different way. +;(its-defrule "va" "ヴァ") +;(its-defrule "vi" "ヴィ") +;(its-defrule "vu" "ヴ") +;(its-defrule "ve" "ヴェ") +;(its-defrule "vo" "ヴォ") --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/its/zenkaku.el 2007-06-03 23:21:07 +0000 @@ -0,0 +1,236 @@ +;; Basic Roma-to-Kana Translation Table for Egg +;; Coded by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp) + +;; This file is part of Egg on Nemacs (Japanese Environment) + +;; Egg is distributed in the forms of patches to GNU +;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC +;; LICENSE which is distributed along with GNU Emacs by the +;; Free Software Foundation. + +;; 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 EMACS GENERAL PUBLIC LICENSE for +;; more details. + +;; You should have received a copy of the GNU EMACS GENERAL +;; PUBLIC LICENSE along with Nemacs; see the file COPYING. +;; If not, write to the Free Software Foundation, 675 Mass +;; Ave, Cambridge, MA 02139, USA. + +;; 92.3.16 modified for Mule Ver.0.9.1 by K.Handa <handa@etl.go.jp> +;; 92.3.23 modified for Mule Ver.0.9.1 by K.Handa <handa@etl.go.jp> +;; defrule -> its-defrule, define-its-mode -> its-define-mode +;;; 92.12.31 modified for Mule Ver.0.9.7.1 +;;; by A.Tanaka <aries@ecs.isl.melco.co.jp> +;;; Mode indicator of "zenkaku-upcase" fixed. + +;; 92.3.16 by K.Handa +;;(define-its-mode "zenkaku-downcase" " aa" t) +(its-define-mode "zenkaku-downcase" "a" t) + +(its-defrule "0" "0") +(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 "A" "A") +(its-defrule "B" "B") +(its-defrule "C" "C") +(its-defrule "D" "D") +(its-defrule "E" "E") +(its-defrule "F" "F") +(its-defrule "G" "G") +(its-defrule "H" "H") +(its-defrule "I" "I") +(its-defrule "J" "J") +(its-defrule "K" "K") +(its-defrule "L" "L") +(its-defrule "M" "M") +(its-defrule "N" "N") +(its-defrule "O" "O") +(its-defrule "P" "P") +(its-defrule "Q" "Q") +(its-defrule "R" "R") +(its-defrule "S" "S") +(its-defrule "T" "T") +(its-defrule "U" "U") +(its-defrule "V" "V") +(its-defrule "W" "W") +(its-defrule "X" "X") +(its-defrule "Y" "Y") +(its-defrule "Z" "Z") + +(its-defrule "a" "a") +(its-defrule "b" "b") +(its-defrule "c" "c") +(its-defrule "d" "d") +(its-defrule "e" "e") +(its-defrule "f" "f") +(its-defrule "g" "g") +(its-defrule "h" "h") +(its-defrule "i" "i") +(its-defrule "j" "j") +(its-defrule "k" "k") +(its-defrule "l" "l") +(its-defrule "m" "m") +(its-defrule "n" "n") +(its-defrule "o" "o") +(its-defrule "p" "p") +(its-defrule "q" "q") +(its-defrule "r" "r") +(its-defrule "s" "s") +(its-defrule "t" "t") +(its-defrule "u" "u") +(its-defrule "v" "v") +(its-defrule "w" "w") +(its-defrule "x" "x") +(its-defrule "y" "y") +(its-defrule "z" "z") + +(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 "<" "<") +(its-defrule ">" ">") +(its-defrule "?" "?") +(its-defrule "/" "/") +(its-defrule "," ",") +(its-defrule "." ".") + +;;; +;;; +;;; + +(its-define-mode "zenkaku-upcase" "A" t) ;92.12.31 by A.Tanaka + +(its-defrule "0" "0") +(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 "A" "A") +(its-defrule "B" "B") +(its-defrule "C" "C") +(its-defrule "D" "D") +(its-defrule "E" "E") +(its-defrule "F" "F") +(its-defrule "G" "G") +(its-defrule "H" "H") +(its-defrule "I" "I") +(its-defrule "J" "J") +(its-defrule "K" "K") +(its-defrule "L" "L") +(its-defrule "M" "M") +(its-defrule "N" "N") +(its-defrule "O" "O") +(its-defrule "P" "P") +(its-defrule "Q" "Q") +(its-defrule "R" "R") +(its-defrule "S" "S") +(its-defrule "T" "T") +(its-defrule "U" "U") +(its-defrule "V" "V") +(its-defrule "W" "W") +(its-defrule "X" "X") +(its-defrule "Y" "Y") +(its-defrule "Z" "Z") + +(its-defrule "a" "A") +(its-defrule "b" "B") +(its-defrule "c" "C") +(its-defrule "d" "D") +(its-defrule "e" "E") +(its-defrule "f" "F") +(its-defrule "g" "G") +(its-defrule "h" "H") +(its-defrule "i" "I") +(its-defrule "j" "J") +(its-defrule "k" "K") +(its-defrule "l" "L") +(its-defrule "m" "M") +(its-defrule "n" "N") +(its-defrule "o" "O") +(its-defrule "p" "P") +(its-defrule "q" "Q") +(its-defrule "r" "R") +(its-defrule "s" "S") +(its-defrule "t" "T") +(its-defrule "u" "U") +(its-defrule "v" "V") +(its-defrule "w" "W") +(its-defrule "x" "X") +(its-defrule "y" "Y") +(its-defrule "z" "Z") + +(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 "<" "<") +(its-defrule ">" ">") +(its-defrule "?" "?") +(its-defrule "/" "/") +(its-defrule "," ",") +(its-defrule "." ".") + --- emacs-22.1/lisp/loadup.el~ 2007-01-21 03:53:11 +0000 +++ emacs-22.1/lisp/loadup.el 2007-06-03 23:21:07 +0000 @@ -128,6 +128,28 @@ (update-coding-systems-internal) +;; Mule default configuration file +;; EGG specific setup +(if (boundp 'EGG) + (progn + (setq wnn-server-type 'jserver) + (load "egg") + (load "its/han-kata") + (load "its/hira") + (load "its/kata") + (load "its/hankaku") + (load "its/zenkaku") + (setq-default its:*current-map* (its:get-mode-map "roma-kana")) + (setq its:*standard-modes* + (append + (list (its:get-mode-map "roma-kana") + (its:get-mode-map "roma-kata") + (its:get-mode-map "downcase") + (its:get-mode-map "upcase") + (its:get-mode-map "zenkaku-downcase") + (its:get-mode-map "zenkaku-upcase")) + its:*standard-modes*)))) + (load "indent") (load "window") (load "frame") @@ -148,6 +170,7 @@ (load "select"))) (load "emacs-lisp/timer") (load "isearch") +(load "isearch-ext") (load "rfn-eshadow") (message "%s" (garbage-collect)) @@ -213,6 +236,26 @@ (load "ediff-hook") (if (fboundp 'x-show-tip) (load "tooltip")) +;;; 87.7.15, 88.6.20, 89.3.22, 91.11.4, 92.10.19 modified by K.Handa +(if (boundp 'EGG) ;; For EGG user only + (progn ; 92.5.19 by T.Shingu + ;(load "egg") + (cond ((boundp 'WNN) ; 92.7.8 by K.Handa and Y.Kawabe + ; 95.6.1 by S.Tomura + (load "wnn-egg") ; 95.6.1 by S.Tomura + (setq egg-default-startup-file "eggrc-wnn")) ; 95.6.1 by S.Tomura + ((boundp 'SJ3) + (load "sj3-client") + (load "sj3-egg") + (setq egg-default-startup-file "eggrc-sj3")) + (t (error + "You should define WNN4 or SJ3 in mconfig.h."))) + (garbage-collect))) +(if (boundp 'CANNA) + (progn + (autoload 'canna "canna" nil t nil) + (garbage-collect))) + (message "%s" (garbage-collect)) ;If you want additional libraries to be preloaded and their --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/mule-inst.el 2007-06-03 23:21:07 +0000 @@ -0,0 +1,63 @@ +;; Loaded while creating/installing Mule. +;; Copyright (C) 1992 Free Software Foundation, Inc. +;; This file is part of Mule (MULtilingual Enhancement of GNU Emacs). + +;; Mule is free software distributed in the form of patches to GNU Emacs. +;; 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 1, or (at your option) +;; any later version. + +;; Mule 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, 675 Mass Ave, Cambridge, MA 02139, USA. + +;;; 92.3.16 created for Mule Ver.0.9.0 by K.Handa <handa@etl.go.jp> +;;; 92.4.6 modified for Mule Ver.0.9.3 by K.Handa <handa@etl.go.jp> +;;; Files to be byte-compiled are supplied by command line args. +;;; Load .el file instead of .elc file if it is patched. +;;; 92.7.27 modified for Mule Ver.0.9.5 by K.Handa <handa@etl.go.jp> +;;; purify-flag is set to nil. +;;; 92.11.22 modified for Mule Ver.0.9.7 by K.Handa <handa@etl.go.jp> +;;; Original mule-bytecomp.el and dump-charsets (in mult-util.el) +;;; is merged into this file. +;;; 93.2.11 modified for Mule Ver.0.9.7.1 by S.Tatsukawa <tatsu_s@ch.hp.com> +;;; version.el is loaded for bytecompe 2.05. + +;; Byte compile all files which are patched or created for Mule + +(defun load-necessary-files () + (message "Loading necessary files for byte-compile...") + (let (command-line-args) + (load "loadup.el"))) + +(let ((args command-line-args) + (command-line-args-left nil)) + (while (and args (null (string-match "mule-inst" (car args)))) + (setq args (cdr args))) + (setq args (cdr args)) + (while args + (let ((el (car args)) elc) + (if (string-match "\\.elc$" el) + (setq elc el el (substring el 0 -1)) + (if (string-match "quail/.*\\.el$" el) + (setq elc (concat el "c")))) + (if (and elc (file-newer-than-file-p el elc)) + (progn + ;;(if (and (file-exists-p elc) (file-writable-p elc)) + ;; Removing this in advance is safer if ELC is a link. + ;;(delete-file elc)) + (setq command-line-args-left + (cons el command-line-args-left))))) + (setq args (cdr args))) + (if (null command-line-args-left) + (kill-emacs 0) + (load-necessary-files) + (setq command-line-args-left (nreverse command-line-args-left)) + (let ((byte-compile-warnings nil)) + (batch-byte-compile)))) --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/sj3-client.el 2007-06-03 23:21:07 +0000 @@ -0,0 +1,1296 @@ +;; Sj3 server interface for Egg +;; Coded by K.Ishii, Sony Corp. (kiyoji@sm.sony.co.jp) + +;; This file is part of Egg on Mule (Multilingual Environment) + +;; Egg is distributed in the forms of patches to GNU +;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC +;; LICENSE which is distributed along with GNU Emacs by the +;; Free Software Foundation. + +;; 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 EMACS GENERAL PUBLIC LICENSE for +;; more details. + +;; You should have received a copy of the GNU EMACS GENERAL +;; PUBLIC LICENSE along with Nemacs; see the file COPYING. +;; If not, write to the Free Software Foundation, 675 Mass +;; Ave, Cambridge, MA 02139, USA. + +;;; 1998-10-02 Ported to Emacs 20.3.90. +;;; 1998-10-10 Revised. + +;;; +;;; Mule - Sj3 server interface in elisp +;;; + +(provide 'sj3-client) + +;;;; 修正メモ;; + +;;; Aug-4-94 by K.Ishii +;;; Bug fixed in sj3-put-kata. + +;;; Apr-6-94 by N.Tanaka +;;; Add version 2(japanese EUC) protocol + +;;; Jun-16-93 by H.Shirasaki <sirasaki@rd.ecip.osaka-u.ac.jp> +;;; In sj3-bunsetu-yomi-equal, typo fixed. + +;;; Apr-6-93 by T.Saneto <sanewo@pdp.crl.sony.co.jp> +;;; Bug fixed in sj3-bunsetu-yomi-equal. + +;;; Mar-19-93 by K.Ishii +;;; Changed sj3-server-dict-info for edit-dict + +;;; Aug-6-92 by K.Ishii +;;; 日本語判定に lc-jp を使うように変更 + +;;; Jul-30-92 by K.Ishii +;;; 長い文章を変換するときに起こる "Args out of range" エラーの修正 +;;; 登録した動詞の削除ができるように sj3-server-dict-info の修正 +;;; sj3serv に渡すプログラム名の変更 + +;;; Jun-2-92 by K.Ishii +;;; Mule 用に変更 + +;;; Dec-12-91 by K.Ishii +;;; 文節学習がうまくできないことがあるため、sj3-result-buffer を変更 +;;; +;;; sj3-get-stdy で "Count exceed." エラーを良く起こすので削除 + +;;; Nov-26-91 by K.Ishii +;;; sj3-server-open で host_name と user_name を渡す順番の修正 +;;; +;;; sj3-server-henkan-next を実行してよく起こる "Count exceed." という +;;; バグの修正 +;;; +;;; sj3-server-henkan-next で一括変換と文節変換で第一候補が違った場合 +;;; に起こるバグの修正(これに伴い文節学習 sj3-server-b-study の修正) + +;;; +;;; Sj3 deamon command constants +;;; + +(defconst SJ3_OPEN 1 "利用者登録") +(defconst SJ3_CLOSE 2 "利用者削除") +;;; +(defconst SJ3_DICADD 11 "辞書追加") +(defconst SJ3_DICDEL 12 "辞書削除") +;;; +(defconst SJ3_OPENSTDY 21 "学習ファイルオープン") +(defconst SJ3_CLOSESTDY 22 "学習ファイルクローズ") +(defconst SJ3_STDYSIZE 23 "") +;;; +(defconst SJ3_LOCK 31 "辞書ロック") +(defconst SJ3_UNLOCK 32 "辞書アンロック") +;;; +(defconst SJ3_BEGIN 41 "変換開始") +(defconst SJ3_BEGIN_EUC 111 "変換開始") +;;; +(defconst SJ3_TANCONV 51 "再変換(文節伸縮)") +(defconst SJ3_TANCONV_EUC 112 "再変換(文節伸縮)") +(defconst SJ3_KOUHO 54 "候補") +(defconst SJ3_KOUHO_EUC 115 "候補") +(defconst SJ3_KOUHOSU 55 "候補数") +(defconst SJ3_KOUHOSU_EUC 116 "候補数") +;;; +(defconst SJ3_STDY 61 "文節学習") +(defconst SJ3_END 62 "文節長学習") +(defconst SJ3_END_EUC 117 "文節長学習") +;;; +(defconst SJ3_WREG 71 "単語登録") +(defconst SJ3_WREG_EUC 118 "単語登録") +(defconst SJ3_WDEL 72 "単語削除") +(defconst SJ3_WDEL_EUC 119 "単語削除") +;;; +(defconst SJ3_MKDIC 81 "") +(defconst SJ3_MKSTDY 82 "") +(defconst SJ3_MKDIR 83 "") +(defconst SJ3_ACCESS 84 "") +;;; +(defconst SJ3_WSCH 91 "単語検索") +(defconst SJ3_WSCH_EUC 120 "単語検索") +(defconst SJ3_WNSCH 92 "") +(defconst SJ3_WNSCH_EUC 121 "") +;;; +(defconst SJ3_VERSION 103 "") + +;;; Sj3 server version error +(defconst SJ3_DifferentVersion 11 "") +(defvar *sj3-current-server-version* nil) + +(defvar sj3-server-buffer nil "Buffer associated with Sj3 server process.") + +(defvar sj3-server-process nil "Sj3 Kana Kanji hankan process.") + +(defvar sj3-command-tail-position nil) +(defvar sj3-command-buffer nil) + +(defvar sj3-result-buffer nil) +(defvar sj3-henkan-string nil) +(defvar sj3-bunsetu-suu nil) + +(defvar sj3-return-code nil) +(defvar sj3-error-code nil) + +(defvar sj3-stdy-size nil) +(defvar sj3-user-dict-list nil) +(defvar sj3-sys-dict-list nil) +(defvar sj3-yomi-llist nil) + +;;; +;;; Macro(s) +;;; + +(defmacro sj3-save-buffer-multibyte-and-enable (&rest body) + "Save multibyte flag; set multibyte flag; execute BODY; +restore multibyte flag. Executes BODY just like `progn'." + `(let ((flag enable-multibyte-characters)) + (unwind-protect + (progn + (set-buffer-multibyte default-enable-multibyte-characters) + ,@body) + (set-buffer-multibyte flag)))) + +;;; +;;; Put data into buffer +;;; + +(defun sj3-put-4byte (integer) + (insert (logand 255 (ash integer -24)) + (logand 255 (ash integer -16)) + (logand 255 (ash integer -8)) + (logand 255 (ash integer 0)) )) + +(defun sj3-put-string (str) + (insert str 0)) + +(defun sj3-put-string* (str) + (let ((sstr (if (= *sj3-current-server-version* 2) + (encode-coding-string str 'euc-japan) + (encode-coding-string str 'sjis)))) + (insert sstr 0))) + +;;; +;;; Get data from buffer +;;; + +(defun sj3-get-4byte () + + (let ((c 0) (point (point))) + ;;;(goto-char (point-min)) + (while (< (point-max) (+ point 4)) + (accept-process-output) + (if (= c 10) (if t (progn (sit-for 0) (setq c 0)) (error "Count exceed."))) + (setq c (1+ c))) + (goto-char point)) + + (let ((point (point))) + (if (not (or (and (= (char-after point) 0) + (< (char-after (+ point 1)) 128)) + (and (= (char-after point) 255) + (<= 128 (char-after (+ point 1)))))) + (error "sj3-get-4byte: integer range overflow.")) + (prog1 + (logior + (lsh (- (logxor (char-after point) 128) 128) 24) + (lsh (char-after (+ point 1)) 16) + (lsh (char-after (+ point 2)) 8) + (lsh (char-after (+ point 3)) 0)) + (goto-char (+ (point) 4))))) + +(defun sj3-get-byte () + (let ((c 0) (point (point))) + (while (< (point-max) (1+ point)) + (accept-process-output) + (if (= c 10) (if t (progn (sit-for 0) (setq c 0)) (error "Count exceed."))) + (setq c (1+ c))) + (goto-char point) + (prog1 + (lsh (char-after point) 0) + (forward-char 1)))) + +(defun sj3-get-string () + (let ((point (point))) + (skip-chars-forward "^\0") + (let ((c 0)) + (while (eobp) + (accept-process-output) + (if (= c 10) (if t (progn (sit-for 0) (setq c 0)) (error "Count exceed"))) + (setq c (1+ c)) + (skip-chars-forward "^\0"))) + (prog1 + (buffer-substring point (point)) + (forward-char 1)))) + +(defalias 'sj3-get-string* 'sj3-get-convert-string) + +(defun sj3-get-convert-string () + (let ((point (point)) (c 0) str) + (while (not (search-forward "\0" nil t)) + (accept-process-output) + (goto-char point) + (if (= c 10) (if t (progn (sit-for 0) (setq c 0)) (error "Count exceed"))) + (setq c (1+ c))) + (setq str (buffer-substring point (1- (point)))) + (if (= *sj3-current-server-version* 2) + (decode-coding-string str 'euc-japan) + (decode-coding-string str 'sjis)))) + +(defun sj3-get-stdy () + (let ((c 0) (point (point))) + (while (< (point-max) (+ point sj3-stdy-size)) + (accept-process-output) + (if (>= c 10) (progn (sit-for 0) (setq c 0))) ;;; delete error + (setq c (1+ c))) + (goto-char (+ point sj3-stdy-size)) + (buffer-substring point (point)))) + +;;; +;;; Sj3 Server Command Primitives +;;; + +(defun sj3-command-start (command) + (set-buffer sj3-command-buffer) + (goto-char (point-min)) + (if (not (= (point-max) (+ sj3-command-tail-position 1024))) + (error "sj3 command start error")) + (delete-region (point-min) sj3-command-tail-position) + (sj3-put-4byte command)) + +(defun sj3-command-reset () + (save-excursion + (set-process-coding-system sj3-server-process 'binary 'binary) + (set-buffer sj3-command-buffer) + (buffer-disable-undo sj3-command-buffer) + (erase-buffer) + (setq sj3-command-tail-position (point-min)) + (let ((max 1024) (i 0)) + (while (< i max) + (insert 0) + (setq i (1+ i)))))) + +(defun sj3-command-end () + (set-buffer sj3-server-buffer) + (erase-buffer) + (set-buffer sj3-command-buffer) + (setq sj3-command-tail-position (point)) +;; (process-send-region sj3-server-process (point-min) +;; (+ (point-min) (lsh (1+ (lsh (- (point) (point-min)) -10)) 10))) + (process-send-region sj3-server-process (point-min) (1+ (point))) + ) + +;;; +;;; Sj3 Server Reply primitives +;;; + +(defun sj3-get-result () + (set-buffer sj3-server-buffer) + (condition-case () + (accept-process-output sj3-server-process) + (error nil)) + (goto-char (point-min))) + +(defun sj3-get-return-code () + (setq sj3-return-code (sj3-get-4byte)) + (setq sj3-error-code (if (= sj3-return-code 0) nil + (sj3-error-symbol sj3-return-code))) + (if sj3-error-code nil + sj3-return-code)) + +;;; +;;; Sj3 Server Interface: sj3-server-open +;;; + +;(defvar *sj3-server-max-kana-string-length* 1000) +;(defvar *sj3-server-max-bunsetu-suu* 1000) + +(defvar *sj3-server-version* 2) +(setq *sj3-server-version* 2) +(defvar *sj3-program-name* "sj3-egg-m") +(defvar *sj3-service-name* "sj3") + +(defun sj3-server-open (server-host-name login-name) + (if (sj3-server-active-p) t + (let ((server_version *sj3-server-version*) + (sj3serv_name + (if (or (null server-host-name) + (equal server-host-name "") + (equal server-host-name "unix")) + (system-name) + server-host-name)) + (user_name + (if (or (null login-name) (equal login-name "")) + (user-login-name) + login-name)) + (host_name (system-name)) + (program_name + (format "%d.%s" + (string-to-number (substring (make-temp-name "") 1 6)) + *sj3-program-name*))) + (setq sj3-server-buffer (get-buffer-create " [Sj3 Output Buffer] ")) + (setq sj3-server-process + (condition-case var + (open-network-stream "Sj3" sj3-server-buffer + sj3serv_name *sj3-service-name* ) + (error + (cond((string-match "Unknown host" (car (cdr var))) + (setq sj3-error-code (list ':SJ3_UNKNOWN_HOST + sj3serv_name))) + ((string-match "Unknown service" (car (cdr var))) + (setq sj3-error-code (list ':SJ3_UNKNOWN_SERVICE + *sj3-service-name*))) + (t ;;; "Host ... not respoding" + (setq sj3-error-code ':SJ3_SOCK_OPEN_FAIL))) + nil))) + (if (null sj3-server-process) + (progn + (kill-buffer sj3-server-buffer) + nil) + (set-process-query-on-exit-flag sj3-server-process nil) + (setq sj3-command-buffer (get-buffer-create " [Sj3 Command Buffer] ")) + (setq sj3-result-buffer (get-buffer-create " [Sj3 Result Buffer] ")) + + (save-excursion + (set-process-coding-system + sj3-server-process 'binary 'binary) + (progn + (set-buffer sj3-server-buffer) + (set-buffer-multibyte nil) + (buffer-disable-undo sj3-server-buffer) + ) + (progn + (set-buffer sj3-result-buffer) + (set-buffer-multibyte t) + (buffer-disable-undo sj3-result-buffer)) + (progn + (set-buffer sj3-command-buffer) + (set-buffer-multibyte nil) + (buffer-disable-undo sj3-command-buffer) + (erase-buffer) + (setq sj3-command-tail-position (point-min)) + (let ((max 1024) (i 0)) + (while (< i max) + (insert 0) + (setq i (1+ i))))) + (sj3-clear-dict-list) + (sj3-command-start SJ3_OPEN) + (sj3-put-4byte server_version) + (sj3-put-string host_name) + (sj3-put-string user_name) + (sj3-put-string program_name) + (sj3-command-end) + (sj3-get-result) + (sj3-get-return-code) + (if (= sj3-return-code SJ3_DifferentVersion) + (progn (sj3-command-start SJ3_OPEN) + (sj3-put-4byte 1) + (sj3-put-string host_name) + (sj3-put-string user_name) + (sj3-put-string program_name) + (sj3-command-end) + (sj3-get-result) + (sj3-get-return-code) + (if (not (= sj3-return-code 0)) + (sj3-connection-error) + nil) + ) + nil) + (if (or (= sj3-return-code 0) (> -1 sj3-return-code)) + (progn (setq *sj3-current-server-version* 1) + (if (not (= sj3-return-code 0)) + (setq *sj3-current-server-version* (- 0 sj3-return-code)) + nil) + (sj3-get-stdy-size) + ) + nil) + ))))) + +(defun sj3-server-active-p () + (and sj3-server-process + (eq (process-status sj3-server-process) 'open))) + +(defun sj3-connection-error () + (setq sj3-error-code ':sj3-no-connection) + (setq sj3-return-code -1) + nil) + +(defun sj3-zero-arg-command (op) + (if (sj3-server-active-p) + (progn + (sj3-command-start op) + (sj3-command-end) + (sj3-get-result) + (sj3-get-return-code)) + (sj3-connection-error))) + +(defun sj3-server-close () + (let (dict-no) + (while (and (sj3-server-active-p) (setq dict-no (car sj3-sys-dict-list))) + (sj3-server-close-dict dict-no) + (setq sj3-sys-dict-list (cdr sj3-sys-dict-list))) + (while (and (sj3-server-active-p) (setq dict-no (car sj3-user-dict-list))) + (sj3-server-close-dict dict-no) + (setq sj3-user-dict-list (cdr sj3-user-dict-list))) + (sj3-clear-dict-list)) + (sj3-server-close-stdy) + (sj3-zero-arg-command SJ3_CLOSE) + (if (sj3-server-active-p) + (delete-process sj3-server-process)) + (if sj3-server-buffer + (kill-buffer sj3-server-buffer)) + (if sj3-command-buffer + (kill-buffer sj3-command-buffer)) + (if sj3-result-buffer + (kill-buffer sj3-result-buffer)) + (setq sj3-server-process nil) + (setq sj3-server-buffer nil) + (setq sj3-command-buffer nil) + (setq sj3-result-buffer nil)) + +(defun sj3-clear-dict-list () + (setq sj3-sys-dict-list nil) + (setq sj3-user-dict-list nil)) + +;; Remove Wnn's stuff. +(remove-hook 'kill-emacs-hook 'wnn-egg:kill-emacs-function) + +(defun sj3-egg:kill-emacs-function () + (if (sj3-server-active-p) + (sj3-server-close))) + +(add-hook 'kill-emacs-hook 'sj3-egg:kill-emacs-function) + +(defun sj3-get-stdy-size () + (sj3-zero-arg-command SJ3_STDYSIZE) + (if (not (= sj3-return-code 0)) nil + (setq sj3-stdy-size (sj3-get-4byte)))) + +(defun sj3-put-stdy-dmy () + (let ((i 0)) + (while (< i sj3-stdy-size) + (insert 0) + (setq i (1+ i))))) + +;;; Sj3 Result Buffer's layout: +;;; +;;; { length:4 kana 0 kouhoSuu:4 kouhoNo:4 +;;; {studyData kanji 0 } ... +;;; } +;;; 0 0 0 0 + +(defun sj3-skip-length () + (goto-char (+ (point) 4))) + +(defun sj3-skip-4byte () + (goto-char (+ (point) 4))) + +(defun sj3-skip-yomi () + (skip-chars-forward "^\0") (forward-char 1)) + +(defun sj3-skip-stdy () + (goto-char (+ (point) sj3-stdy-size))) + +;;; +;;; entry function +;;; +(defun sj3-server-henkan-begin (henkan-string) + (if (not (sj3-server-active-p)) (sj3-connection-error) + (let ((inhibit-quit t) mb-str) + (save-excursion + (setq sj3-henkan-string henkan-string) + (if (= *sj3-current-server-version* 2) + (setq mb-str (encode-coding-string henkan-string 'euc-japan)) + (setq mb-str (encode-coding-string henkan-string 'sjis))) + (set-buffer sj3-result-buffer) + (erase-buffer) + (setq sj3-bunsetu-suu 0) + (setq sj3-yomi-llist nil) + (goto-char (point-min)) + (if (= *sj3-current-server-version* 2) + (sj3-command-start SJ3_BEGIN_EUC) + (sj3-command-start SJ3_BEGIN) + ) + (sj3-put-string mb-str) + (sj3-command-end) + (sj3-get-result) + (sj3-get-return-code) + (if (not (= sj3-return-code 0)) nil + (let ((yp 0) p0 yl offset ystr stdk) + (sj3-get-4byte) + (set-buffer sj3-result-buffer) + (delete-region (point) (point-max)) + (setq p0 (point)) + (insert sj3-henkan-string 0 0 0 0) + (goto-char p0) + (set-buffer sj3-server-buffer) + (while (> (setq yl (sj3-get-byte)) 0) + (setq ystr (substring mb-str yp (+ yp yl)) + yp (+ yp yl)) + (sj3-save-buffer-multibyte-and-enable + (if (= *sj3-current-server-version* 2) + (setq yl (length (decode-coding-string ystr 'euc-japan))) + (setq yl (length (decode-coding-string ystr 'sjis))))) + (setq stdk (concat (sj3-get-stdy) + (sj3-get-convert-string) + "\C-@")) + (set-buffer sj3-result-buffer) + (setq p0 (point)) + (forward-char yl) + (setq sj3-yomi-llist (append sj3-yomi-llist (list yl))) + (insert 0) ;;; yomi + (sj3-put-4byte 1) ;;; kouho suu + (sj3-put-4byte 0) ;;; current kouho number + (insert stdk) ;;; study data and kanji strings + (setq offset (- (point) p0)) + (goto-char p0) (sj3-put-4byte offset) + (goto-char (+ (point) offset)) + (setq sj3-return-code (1+ sj3-return-code)) + (set-buffer sj3-server-buffer)) + (setq sj3-bunsetu-suu sj3-return-code))))))) +;;; +;;; entry function +;;; +(defun sj3-server-henkan-quit () t) + +(defun sj3-get-yomi-suu-org () + (if (setq sj3-yomi-llist (cdr sj3-yomi-llist)) + (car sj3-yomi-llist) + 0)) + +;;; +;;; entry function +;;; +(defun sj3-server-henkan-end (bunsetu-no) + (if (not (sj3-server-active-p)) (sj3-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (let (length ystr len kouho-no kouho-suu p0 (ylist nil)) + (set-buffer sj3-result-buffer) + (goto-char (point-min)) + (let ((max (if (and (integerp bunsetu-no) + (<= 0 bunsetu-no) + (<= bunsetu-no sj3-bunsetu-suu)) + bunsetu-no + sj3-bunsetu-suu)) + (i 0)) + (while (< i max) + (setq length (sj3-get-4byte)) + (setq p0 (point)) + (setq ystr (sj3-get-string)) + (setq len (1- (- (point) p0))) + (setq kouho-suu (sj3-get-4byte)) ;;; kouho suu + (setq kouho-no (sj3-get-4byte)) + (if (and (> kouho-no 0) + (< kouho-no (- kouho-suu 2)) + (> kouho-suu 3)) + (sj3-server-b-study kouho-no)) + (setq ylist (cons (list len ystr kouho-suu (point)) ylist)) + (goto-char (+ p0 length)) + (setq i (1+ i))) + (setq ylist (nreverse ylist)) + (setq i 1) + (let ((yp 0) (op 0) (ydata (car ylist)) (ol (car sj3-yomi-llist))) + (while (< i max) + (let ((yl (nth 0 ydata))) + (setq ylist (cdr ylist)) + (if (and (= yp op) (= yl ol)) + (let ((pp (+ yp yl))) + (setq yp pp) + (setq op pp) + (setq ydata (car ylist)) + (setq ol (sj3-get-yomi-suu-org))) + (let ((str (nth 1 ydata)) + (ent (nth 2 ydata))) + (setq ydata (car ylist)) + (setq yp (+ yp yl)) + (while (< op yp) + (setq op (+ op ol)) + (setq ol (sj3-get-yomi-suu-org))) + (if (or (= ent 2) (= (nth 2 ydata) 2)) nil + (let ((sub (- op yp)) (yl1 (nth 0 ydata))) + (set-buffer sj3-result-buffer) + (goto-char (nth 3 ydata)) + (sj3-server-cl-study str (nth 1 ydata)) + (if (and (not (= sub yl1)) (not (= sub (- yl1 ol)))) + nil + (setq i (1+ i)) + (setq ylist (cdr ylist)) + (setq ydata (car ylist)) + (if (= sub yl1) nil + (setq op (+ op ol)) + (setq ol (sj3-get-yomi-suu-org)))))))) + (setq i (1+ i)))) + (if (or (null ydata) (= (nth 0 ydata) ol) (= (nth 2 ydata) 2)) + sj3-return-code + (goto-char (nth 3 ydata)) + (sj3-server-cl-study (nth 1 ydata) ""))))))))) + +(defun sj3-server-cl-study (str1 str2) + (if (not (sj3-server-active-p)) (sj3-connection-error) + (save-excursion + (if (= *sj3-current-server-version* 2) + (sj3-command-start SJ3_END_EUC) + (sj3-command-start SJ3_END)) + (sj3-put-string* str1) + (sj3-put-string* str2) + (if (string= str2 "") (sj3-put-stdy-dmy) + (let (p0) + (set-buffer sj3-result-buffer) + (setq p0 (point)) + (set-buffer sj3-command-buffer) + (insert-buffer-substring sj3-result-buffer p0 (+ p0 sj3-stdy-size)))) + (sj3-command-end) + (sj3-get-result) + (sj3-get-return-code)))) + +(defun sj3-server-b-study (no) + (if (not (sj3-server-active-p)) (sj3-connection-error) + (save-excursion + (let ((i 0) p0) + (set-buffer sj3-result-buffer) + (while (< i no) + (sj3-skip-stdy) + (sj3-skip-yomi) + (setq i (1+ i))) + (setq p0 (point)) + (sj3-command-start SJ3_STDY) + (insert-buffer-substring sj3-result-buffer p0 (+ p0 sj3-stdy-size)) + (sj3-command-end) + (sj3-get-result) + (sj3-get-return-code))))) + +(defun sj3-result-goto-bunsetu (bunsetu-no) + (goto-char (point-min)) + (let (length (i 0)) + (while (< i bunsetu-no) + (setq length (sj3-get-4byte)) + (goto-char (+ (point) length)) + (setq i (1+ i))))) + +;;; +;;; entry function +;;; +(defun sj3-server-henkan-kakutei (bunsetu-no jikouho-no) + (cond((not (sj3-server-active-p)) (sj3-connection-error)) + ((or (< bunsetu-no 0) (<= sj3-bunsetu-suu bunsetu-no)) + nil) + (t + (let ((inhibit-quit t)) + (save-excursion + (set-buffer sj3-result-buffer) + (let (kouho-suu) + (sj3-result-goto-bunsetu bunsetu-no) + (sj3-skip-length) + (sj3-skip-yomi) + (setq kouho-suu (sj3-get-4byte)) + (if (or (< jikouho-no 0) (<= kouho-suu jikouho-no)) nil + (delete-char 4) (sj3-put-4byte jikouho-no) + t))))))) + +;;; +;;; entry function +;;; +(defun sj3-server-henkan-next (bunsetu-no) + (if (not (sj3-server-active-p)) (sj3-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (let (p0 p1 kouho-suu length ystr) + (set-buffer sj3-result-buffer) + (sj3-result-goto-bunsetu bunsetu-no) + (sj3-skip-length) + (setq p0 (point)) + (setq ystr (sj3-get-string)) + (setq p1 (point)) + (setq kouho-suu (sj3-get-4byte)) + (if (> kouho-suu 1) t + (let ((ksuu (sj3-server-henkan-kouho ystr)) (startp 0)) + (if (< ksuu 0) sj3-return-code + (let (kanji stdk i) + (set-buffer sj3-result-buffer) + (sj3-skip-4byte) + (sj3-skip-stdy) + (setq kanji (sj3-get-string)) + (if (> ksuu 1) + (progn + (setq i 1) + (set-buffer sj3-server-buffer) + (sj3-get-4byte) + (setq startp (point) + stdk (sj3-get-stdy)) + (let ((kkanji (sj3-get-string*))) + (if (equal kanji kkanji) + (setq startp (point) + stdk "") + (setq stdk (concat stdk kkanji "\0")) + (setq ksuu (1+ ksuu)) + (setq i (1+ i)))) + (while (< i ksuu) + (sj3-get-4byte) + (delete-char -4) + (setq stdk (concat stdk + (sj3-get-stdy) + (sj3-get-convert-string) + "\C-@")) + (setq i (1+ i))) + )) + (set-buffer sj3-result-buffer) + (if (> startp 0) + (insert stdk)) + (sj3-put-kata ystr) + (insert ystr 0) + (setq length (- (point) p0)) + (goto-char p1) + (delete-char 4) + (if (<= ksuu 0)(sj3-put-4byte 3) ;;; + (sj3-put-4byte (+ ksuu 2))) ;;; put kouho-suu + (goto-char p0) + (delete-char -4) + (sj3-put-4byte length)) + t)))))))) + +(defun sj3-server-henkan-kouho (str) + (if (not (sj3-server-active-p)) -1 + (let ((mb-str (if (= *sj3-current-server-version* 2) + (encode-coding-string str 'euc-japan) + (encode-coding-string str 'sjis))) + len kouho-suu) + (setq len (length mb-str)) + (setq kouho-suu (sj3-server-henkan-kouho-suu len mb-str)) + (if (<= kouho-suu 0) nil + (if (= *sj3-current-server-version* 2) + (sj3-command-start SJ3_KOUHO_EUC) + (sj3-command-start SJ3_KOUHO)) + (sj3-put-4byte len) + (sj3-put-string mb-str) + (sj3-command-end) + (sj3-get-result) + (sj3-get-return-code) + ;;(if (not (= sj3-return-code 0)) -1) + ) + kouho-suu))) + +(defun sj3-put-kata (str) + (sj3-save-buffer-multibyte-and-enable + (setq str (string-as-multibyte (copy-sequence str))) + (let ((i 0) (len (length str)) ch) + (while (< i len) + (setq ch (aref str i)) + (aset str i + (if (and (/= ?ー ch) + (string-match "\\cH" (char-to-string ch))) + (japanese-katakana ch) + ch)) + (setq i (1+ i))) + (insert str 0)))) + +(defun sj3-server-henkan-kouho-suu (yomi-length yomi) + (if (not (sj3-server-active-p)) -1 + (save-excursion + (if (= *sj3-current-server-version* 2) + (sj3-command-start SJ3_KOUHOSU_EUC) + (sj3-command-start SJ3_KOUHOSU)) + (sj3-put-4byte yomi-length) + (sj3-put-string yomi) + (sj3-command-end) + (sj3-get-result) + (sj3-get-return-code) + (if (not (= sj3-return-code 0)) -1 + (sj3-get-4byte))))) + +;;; +;;; entry function +;;; +(defun sj3-server-bunsetu-henkou (bunsetu-no bunsetu-length) + (cond((not (sj3-server-active-p)) (sj3-connection-error)) + ((or (< bunsetu-no 0) (<= sj3-bunsetu-suu bunsetu-no)) + nil) + (t + (let ((inhibit-quit t)) + (save-excursion + (let (yp0 p0 p1 str len1 len2 bunsetu-suu (bno bunsetu-no)) + (set-buffer sj3-result-buffer) + (setq yp0 (sj3-yomi-point bunsetu-no)) + (setq p0 (point)) + (setq str (sj3-get-yomi yp0 bunsetu-length)) + (setq len1 (length str)) + (setq bunsetu-suu sj3-bunsetu-suu) + (let (point length) + (setq len2 len1) + (while (and (< bno sj3-bunsetu-suu) (> len2 0)) + (setq length (sj3-get-4byte)) + (setq point (point)) + (skip-chars-forward "^\0") + (setq len2 (- len2 (- (point) point))) + (goto-char (+ point length)) + (setq bno (1+ bno)))) + (setq p1 (point)) + (delete-region p0 p1) + (setq sj3-bunsetu-suu (- sj3-bunsetu-suu (- bno bunsetu-no))) + (if (= (sj3-put-tanconv str) 0) + (if (not (= len2 0)) + (let ((len (- 0 len2)) (yp1 (+ yp0 len1)) + ystr mb-str) + (if (or (> bno (1+ bunsetu-no)) (= bno bunsetu-suu)) + (setq ystr (sj3-get-yomi yp1 len)) + (let (ll length i) + (set-buffer sj3-result-buffer) + (setq p0 (point)) + (setq length (sj3-get-4byte)) + (skip-chars-forward "^\0") + (setq ll (+ len (- (point) (+ p0 4)))) + (setq p1 (+ p0 (+ length 4))) + (setq ystr (sj3-get-yomi yp1 ll)) + (setq mb-str (if (= *sj3-current-server-version* 2) + (encode-coding-string ystr 'euc-japan) + (encode-coding-string ystr 'sjis))) + (setq i (sj3-server-henkan-kouho-suu + (length mb-str) mb-str)) + (set-buffer sj3-result-buffer) + (if (= i 0) (setq ystr (sj3-get-yomi yp1 len)) + (delete-region p0 p1) + (setq sj3-bunsetu-suu (1- sj3-bunsetu-suu)) + (setq len ll)) + (goto-char p0))) + (sj3-put-tanconv ystr)))) + (if (= sj3-return-code -1) nil + sj3-bunsetu-suu))))))) + +(defun sj3-put-tanconv (str) + (let ((point (point)) len ksuu + (mb-str (if (= *sj3-current-server-version* 2) + (encode-coding-string str 'euc-japan) + (encode-coding-string str 'sjis)))) + (setq len (length mb-str)) + (setq ksuu (sj3-server-henkan-kouho-suu len mb-str)) + (if (>= ksuu 0) + (let (offset) + (set-buffer sj3-result-buffer) + (insert str 0) + (if (or (= ksuu 0) + (not (sj3-server-tanconv len mb-str))) + (put-kata-and-hira str) + (let (stdk) + (set-buffer sj3-result-buffer) + (sj3-put-4byte 1) + (sj3-put-4byte 0) + (set-buffer sj3-server-buffer) + (sj3-get-4byte) + (setq stdk (concat + (sj3-get-stdy) + (sj3-get-convert-string) + "\C-@")) + (set-buffer sj3-result-buffer) + (insert stdk))) + (set-buffer sj3-result-buffer) + (setq offset (- (point) point)) + (goto-char point) (sj3-put-4byte offset) + (goto-char (+ (point) offset)) + (setq sj3-bunsetu-suu (1+ sj3-bunsetu-suu)))) + sj3-return-code)) + +(defun sj3-server-tanconv (len str) + (if (not (sj3-server-active-p)) (sj3-connection-error) + (let ((inhibit-quit t)) + (if (= *sj3-current-server-version* 2) + (sj3-command-start SJ3_TANCONV_EUC) + (sj3-command-start SJ3_TANCONV)) + (sj3-put-4byte len) + (sj3-put-string str) + (sj3-command-end) + (sj3-get-result) + (sj3-get-return-code)))) + +(defun put-kata-and-hira (str) + (sj3-put-4byte 2) + (sj3-put-4byte 0) + (sj3-put-stdy-dmy) + (sj3-put-kata str) + (sj3-save-buffer-multibyte-and-enable + (insert str 0))) + +(defun sj3-get-yomi (offset length) + (substring sj3-henkan-string offset (+ offset length))) + +(defun sj3-bunsetu-suu () sj3-bunsetu-suu) + +(defun sj3-bunsetu-kanji (bunsetu-no &optional buffer) + (let ((savebuffer (current-buffer))) + (unwind-protect + (progn + (set-buffer sj3-result-buffer) + (if (or (< bunsetu-no 0) + (<= sj3-bunsetu-suu bunsetu-no)) + nil + (sj3-result-goto-bunsetu bunsetu-no) + (sj3-skip-length) + (sj3-skip-yomi) + + (let ((i 0) + (rksuu (- (sj3-get-4byte) 2)) ;;; real kouho-suu + (max (sj3-get-4byte))) ;;; kouho-number + (sj3-skip-stdy) + (while (< i max) + (sj3-skip-yomi) + (setq i (1+ i)) + (if (< i rksuu) + (sj3-skip-stdy)))) + + (let (p1 string) + (setq p1 (point)) + (skip-chars-forward "^\0") + (setq string (buffer-substring p1 (point))) + (forward-char 1) + (if (null buffer) + string + (set-buffer buffer) + (insert string) + nil)))) + (set-buffer savebuffer)))) + +(defun sj3-bunsetu-kanji-length (bunsetu-no) + (save-excursion + (set-buffer sj3-result-buffer) + (if (or (< bunsetu-no 0) + (<= sj3-bunsetu-suu bunsetu-no)) + nil + (sj3-result-goto-bunsetu bunsetu-no) + (sj3-skip-length) + (sj3-skip-yomi) + + (let ((i 0) + (rksuu (- (sj3-get-4byte) 2)) ;;; real kouho-suu + (max (sj3-get-4byte))) ;;; kouho-number + (sj3-skip-stdy) + (while (< i max) + (sj3-skip-yomi) + (setq i (1+ i)) + (if (< i rksuu) + (sj3-skip-stdy)))) + + (let (p1) + (setq p1 (point)) + (skip-chars-forward "^\0") + (save-restriction + (narrow-to-region p1 (point)) + (- (point-max) (point-min))))))) + +(defun sj3-bunsetu-yomi-moji-suu (bunsetu-no) + (save-excursion + (set-buffer sj3-result-buffer) + (if (or (< bunsetu-no 0) + (<= sj3-bunsetu-suu bunsetu-no)) + nil + (sj3-result-goto-bunsetu bunsetu-no) + (sj3-skip-length) + (let ((c 0)) + (while (not (zerop (char-after))) + (forward-char 1) + (setq c (1+ c))) + c)))) + +(defun sj3-yomi-point (bunsetu-no) + (let ((i 0) (len 0) point length) + (goto-char (point-min)) + (while (< i bunsetu-no) + (setq length (sj3-get-4byte)) + (setq point (point)) + (skip-chars-forward "^\0") + (setq len (+ len (- (point) point))) + (goto-char (+ point length)) + (setq i (1+ i))) + len)) + +(defun sj3-bunsetu-yomi (bunsetu-no &optional buffer) + (let ((savebuff (current-buffer))) + (unwind-protect + (progn + (set-buffer sj3-result-buffer) + (if (or (< bunsetu-no 0) + (<= sj3-bunsetu-suu bunsetu-no)) + nil + (sj3-result-goto-bunsetu bunsetu-no) + (sj3-skip-length) + (let (p1 p2 ) + (setq p1 (point)) + (skip-chars-forward "^\0") + (if (null buffer ) (buffer-substring p1 (point)) + (setq p2 (point)) + (set-buffer buffer) + (insert-buffer-substring sj3-result-buffer p1 p2) + t)))) + (set-buffer savebuff)))) + +(defun sj3-bunsetu-yomi-equal (bunsetu-no yomi) + (save-excursion + (set-buffer sj3-result-buffer) + (if (or (< bunsetu-no 0) + (<= sj3-bunsetu-suu bunsetu-no)) + nil + (sj3-result-goto-bunsetu bunsetu-no) + (sj3-skip-length) + (looking-at (regexp-quote yomi))))) ;93.4.6 by T.Saneto + +(defun sj3-bunsetu-kouho-suu (bunsetu-no) + (save-excursion + (set-buffer sj3-result-buffer) + (if (or (< bunsetu-no 0) + (<= sj3-bunsetu-suu bunsetu-no)) + nil + (sj3-result-goto-bunsetu bunsetu-no) + (sj3-skip-length) + (sj3-skip-yomi) + (sj3-get-4byte)))) + +(defun sj3-bunsetu-kouho-list (bunsetu-no) + (save-excursion + (set-buffer sj3-result-buffer) + (if (or (< bunsetu-no 0) + (<= sj3-bunsetu-suu bunsetu-no)) + nil + (sj3-result-goto-bunsetu bunsetu-no) + (sj3-skip-length) + (sj3-skip-yomi) + (let ((max (sj3-get-4byte)) (i 0) (result nil) p0) + (sj3-skip-4byte) ;;; current kouhou number + (sj3-skip-stdy) + (while (< i max) + (setq p0 (point)) + (skip-chars-forward "^\0") + (setq result + (cons (concat (buffer-substring p0 (point))) + result)) + (forward-char 1) + (setq i (1+ i)) + (if (< i (- max 2)) + (sj3-skip-stdy))) + (nreverse result))))) + +(defun sj3-bunsetu-kouho-number (bunsetu-no) + (save-excursion + (set-buffer sj3-result-buffer) + (if (or (< bunsetu-no 0) + (<= sj3-bunsetu-suu bunsetu-no)) + nil + (sj3-result-goto-bunsetu bunsetu-no) + (sj3-skip-length) + (sj3-skip-yomi) + (sj3-skip-4byte) + (sj3-get-4byte))) + ) + +(defun sj3-simple-command (op arg) + (if (sj3-server-active-p) + (let ((inhibit-quit t)) + (progn + (sj3-command-start op) + (sj3-put-4byte arg) + (sj3-command-end) + (sj3-get-result) + (sj3-get-return-code))) + (sj3-connection-error))) + +(defun sj3-server-open-dict (dict-file-name password) + (if (not (sj3-server-active-p))(sj3-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (sj3-command-start SJ3_DICADD) + (sj3-put-string dict-file-name) + (if (stringp password) + (sj3-put-string password) + (sj3-put-string 0)) + (sj3-command-end) + (sj3-get-result) + (sj3-get-return-code) + (if (not (= sj3-return-code 0)) nil + (let ((dict-no (sj3-get-4byte))) + (if (stringp password) + (setq sj3-user-dict-list + (append sj3-user-dict-list (list dict-no))) + (setq sj3-sys-dict-list + (append sj3-sys-dict-list (list dict-no)))) + dict-no)))))) + +(defun sj3-server-close-dict (dict-no) + (if (not (sj3-server-active-p))(sj3-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (sj3-command-start SJ3_DICDEL) + (sj3-put-4byte dict-no) + (sj3-command-end) + (sj3-get-result) + (sj3-get-return-code))))) + +(defun sj3-server-make-dict (dict-file-name) + (if (not (sj3-server-active-p))(sj3-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (sj3-command-start SJ3_MKDIC) + (sj3-put-string dict-file-name) + (sj3-put-4byte 2048) ;;; Index length + (sj3-put-4byte 2048) ;;; Length + (sj3-put-4byte 256) ;;; Number + (sj3-command-end) + (sj3-get-result) + (sj3-get-return-code))))) + +(defun sj3-server-open-stdy (stdy-file-name) + (if (not (sj3-server-active-p))(sj3-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (sj3-command-start SJ3_OPENSTDY) + (sj3-put-string stdy-file-name) + (sj3-put-string 0) + (sj3-command-end) + (sj3-get-result) + (sj3-get-return-code))))) + +(defun sj3-server-close-stdy () + (sj3-zero-arg-command SJ3_CLOSESTDY)) + +(defun sj3-server-make-stdy (stdy-file-name) + (if (not (sj3-server-active-p))(sj3-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (sj3-command-start SJ3_MKSTDY) + (sj3-put-string stdy-file-name) + (sj3-put-4byte 2048) ;;; Number + (sj3-put-4byte 1) ;;; Step + (sj3-put-4byte 2048) ;;; Length + (sj3-command-end) + (sj3-get-result) + (sj3-get-return-code))))) + +(defun sj3-server-dict-add (dictno kanji yomi bunpo) + (if (not (sj3-server-active-p))(sj3-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (if (= *sj3-current-server-version* 2) + (sj3-command-start SJ3_WREG_EUC) + (sj3-command-start SJ3_WREG)) + (sj3-put-4byte dictno) + (sj3-put-string* yomi) + (sj3-put-string* kanji) + (sj3-put-4byte bunpo) + (sj3-command-end) + (sj3-get-result) + (sj3-get-return-code))))) + +(defun sj3-server-dict-delete (dictno kanji yomi bunpo) + (if (not (sj3-server-active-p)) (sj3-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (if (= *sj3-current-server-version* 2) + (sj3-command-start SJ3_WDEL_EUC) + (sj3-command-start SJ3_WDEL)) + (sj3-put-4byte dictno) + (sj3-put-string* yomi) + (sj3-put-string* kanji) + (sj3-put-4byte bunpo) + (sj3-command-end) + (sj3-get-result) + (sj3-get-return-code))))) + +(defun sj3-server-dict-info (dict-no) + (if (not (sj3-server-active-p)) (sj3-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (let ((result nil)) + (set-buffer sj3-server-buffer) + (if (= *sj3-current-server-version* 2) + (sj3-simple-command SJ3_WSCH_EUC dict-no) + (sj3-simple-command SJ3_WSCH dict-no)) + (while (= sj3-return-code 0) + ;;; (sj3-get-4byte) + (setq result (cons (list (sj3-get-string*) + (sj3-get-string*) (sj3-get-4byte)) result)) + (if (= *sj3-current-server-version* 2) + (sj3-simple-command SJ3_WNSCH_EUC dict-no) + (sj3-simple-command SJ3_WNSCH dict-no))) + (if (= sj3-return-code 111) + (setq sj3-error-code nil)) + (nreverse result)))))) + +(defun sj3-server-make-directory (dir-name) + (if (not (sj3-server-active-p)) (sj3-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (sj3-command-start SJ3_MKDIR) + (sj3-put-string dir-name) + (sj3-command-end) + (sj3-get-result) + (sj3-get-return-code))))) + +(defun sj3-server-file-access (file-name access-mode) + (if (not (sj3-server-active-p)) (sj3-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (sj3-command-start SJ3_ACCESS) + (sj3-put-string file-name) + (sj3-put-4byte access-mode) + (sj3-command-end) + (sj3-get-result) + (setq sj3-error-code nil) + (sj3-get-4byte))))) + +(defun sj3_lock () + (sj3-zero-arg-command SJ3_LOCK)) + +(defun sj3_unlock () + (sj3-zero-arg-command SJ3_UNLOCK)) + +(defun sj3_version () + (sj3-zero-arg-command SJ3_VERSION)) + +(defconst *sj3-error-alist* + '( + (1 :SJ3_SERVER_DEAD + "サーバが死んでいます。") + (2 :SJ3_SOCK_OPEN_FAIL + "socketのopenに失敗しました。") + (6 :SJ3_ALLOC_FAIL + "メモリallocで失敗しました。") + (7 :SJ3_ILLEGAL_COMMAND + "コマンドが間違っている") + (12 :SJ3_BAD_HOST + " ホスト名がない ") + (13 :SJ3_BAD_USER + " ユーザ名がない ") + (31 :SJ3_NOT_A_DICT + "正しい辞書ではありません。") + (35 :SJ3_NO_EXIST + "ファイルが存在しません。") + (37 :SJ3_OPENF_ERR + "ファイルがオープンできません。") + (39 :SJ3_PARAMR + "ファイルの読み込み権限がありません。") + (40 :SJ3_PARAMW + "ファイルの書き込み権限がありません。") + (71 :SJ3_NOT_A_USERDICT + "指定されて辞書は、ユーザー辞書ではありません。") + (72 :SJ3_RDONLY + "リードオンリーの辞書に登録しようとしました。") + (74 :SJ3_BAD_YOMI + "読みに不適当な文字が含まれています。") + (75 :SJ3_BAD_KANJI + "漢字に不適当な文字が含まれています。") + (76 :SJ3_BAD_HINSHI + "指定された品詞番号がありません。") + (82 :SJ3_WORD_ALREADY_EXIST + "指定された単語はすでに存在しています。") + (84 :SJ3_JISHOTABLE_FULL + "辞書テーブルが一杯です。") + (92 :SJ3_WORD_NO_EXIST + "指定された単語が存在しません。") + (102 :SJ3_MKDIR_FAIL + " ディレクトリを作り損なった ") + )) + +(defun sj3-error-symbol (code) + (let ((pair (assoc code *sj3-error-alist*))) + (if (null pair) + (list ':sj3-unknown-error-code code) + (car (cdr pair))))) --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/sj3-egg.el 2007-06-03 23:21:07 +0000 @@ -0,0 +1,1438 @@ +;; Kana Kanji Conversion Protocol Package for Egg +;; Coded by K.Ishii, Sony Corp. (kiyoji@sm.sony.co.jp) + +;; This file is part of Egg on Mule (Multilingal Environment) + +;; Egg is distributed in the forms of patches to GNU +;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC +;; LICENSE which is distributed along with GNU Emacs by the +;; Free Software Foundation. + +;; 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 EMACS GENERAL PUBLIC LICENSE for +;; more details. + +;; You should have received a copy of the GNU EMACS GENERAL +;; PUBLIC LICENSE along with Nemacs; see the file COPYING. +;; If not, write to the Free Software Foundation, 675 Mass +;; Ave, Cambridge, MA 02139, USA. + +;;; 1998-09-23 Ported to Emacs 20.3.90. +;;; 1998-10-10 Revised. + +;;; +;;; sj3-egg.el +;;; +;;; 「たまご」の sj3 バージョン +;;; かな漢字変換サーバに sj3serv を使います。 +;;; +;;; sj3-egg に関する提案、虫情報は kiyoji@sm.sony.co.jp にお送り下さい。 +;;; +;;; 石井 清次 + +(require 'egg) +(provide 'sj3-egg) +(if (not (boundp 'SJ3)) + (require 'sj3-client)) + +;;;; 修正メモ;; +;;;; Jul-20-93 by age@softlab.is.tsukuba.ac.jp (Eiji FURUKAWA) +;;;; Bug fixed in diced-add, *sj3-bunpo-menu* and +;;;; set-egg-henkan-mode-format. + +;;;; Mar-19-93 by K.Ishii +;;;; DicEd is changed, edit-dict-item -> edit-dict + +;;;; Aug-6-92 by K.Ishii +;;;; length を string-width に変更 + +;;;; Jul-30-92 by K.Ishii +;;;; set-default-usr-dic-directory で作る辞書ディレクトリ名の修正 +;;;; jserver-host-name, 環境変数 JSERVER の削除 +;;;; + +;;;; Jul-7-92 by Y.Kawabe +;;;; jserver-host-name をセットする際に環境変数 SJ3SERV も調べる。 +;;;; sj3fns.el のロードをやめる。 + +;;;; Jun-2-92 by K.Ishii +;;;; sj3-egg.el を wnn-egg.el と同様に分割 + +;;;; May-14-92 by K.Ishii +;;;; Mule の wnn-egg.el を sj3serv との通信用に修正 + +;;;---------------------------------------------------------------------- +;;; +;;; Version control routine +;;; +;;;---------------------------------------------------------------------- + +(defvar sj3-egg-version "3.00" "Version number of this version of Egg. ") +;;; Last modified date: Thu Aug 4 21:18:11 1994 + +;;;---------------------------------------------------------------------- +;;; +;;; KKCP package: Kana Kanji Conversion Protocol +;;; +;;; KKCP to SJ3SERV interface; +;;; +;;;---------------------------------------------------------------------- + +(defvar *KKCP:error-flag* t) + +(defun KKCP:error (errorCode &rest form) + (cond((eq errorCode ':SJ3_SOCK_OPEN_FAIL) + (notify "EGG: %s 上に SJ3SERV がありません。" (or (get-sj3-host-name) "local")) + (if debug-on-error + (error "EGG: No SJ3SERV on %s is running." (or (get-sj3-host-name) "local")) + (error "EGG: %s 上に SJ3SERV がありません。" (or (get-sj3-host-name) "local")))) + ((eq errorCode ':SJ3_SERVER_DEAD) + (notify "EGG: %s 上のSJ3SERV が死んでいます。" (or (get-sj3-host-name) "local")) + (if debug-on-error + (error "EGG: SJ3SERV on %s is dead." (or (get-sj3-host-name) "local")) + (error "EGG: %s 上の SJ3SERV が死んでいます。" (or (get-sj3-host-name) "local")))) + ((and (consp errorCode) + (eq (car errorCode) ':SJ3_UNKNOWN_HOST)) + (notify "EGG: ホスト %s がみつかりません。" (car(cdr errorCode))) + (if debug-on-error + (error "EGG: Host %s is unknown." (car(cdr errorCode))) + (error "EGG: ホスト %s がみつかりません。" (car(cdr errorCode))))) + ((and (consp errorCode) + (eq (car errorCode) ':SJ3_UNKNOWN_SERVICE)) + (notify "EGG: Network service %s がみつかりません。" (car(cdr errorCode))) + (if debug-on-error + (error "EGG: Service %s is unknown." (car(cdr errorCode))) + (error "EGG: Network service %s がみつかりません。" (cdr errorCode)))) + (t + (notify "KKCP: 原因 %s で %s に失敗しました。" errorCode form) + (if debug-on-error + (error "KKCP: %s failed because of %s." form errorCode) + (error "KKCP: 原因 %s で %s に失敗しました。" errorCode form))))) + +(defun KKCP:server-open (hostname loginname) + (let ((result (sj3-server-open hostname loginname))) + (cond((null sj3-error-code) result) + (t (KKCP:error sj3-error-code 'KKCP:server-open hostname loginname))))) + +(defun KKCP:use-dict (dict &optional passwd) + (let ((result (sj3-server-open-dict dict passwd))) + (cond((null sj3-error-code) result) + ((eq sj3-error-code ':sj3-no-connection) + (EGG:open-sj3) + (KKCP:use-dict dict passwd)) + ((null *KKCP:error-flag*) result) + (t (KKCP:error sj3-error-code + 'kkcp:use-dict dict))))) + +(defun KKCP:make-dict (dict) + (let ((result (sj3-server-make-dict dict))) + (cond((null sj3-error-code) result) + ((eq sj3-error-code ':sj3-no-connection) + (EGG:open-sj3) + (KKCP:make-dict dict)) + ((null *KKCP:error-flag*) result) + (t (KKCP:error sj3-error-code + 'kkcp:make-dict dict))))) + +(defun KKCP:use-stdy (stdy) + (let ((result (sj3-server-open-stdy stdy))) + (cond((null sj3-error-code) result) + ((eq sj3-error-code ':sj3-no-connection) + (EGG:open-sj3) + (KKCP:use-stdy stdy)) + ((null *KKCP:error-flag*) result) + (t (KKCP:error sj3-error-code + 'kkcp:use-stdy stdy))))) + +(defun KKCP:make-stdy (stdy) + (let ((result (sj3-server-make-stdy stdy))) + (cond((null sj3-error-code) result) + ((eq sj3-error-code ':sj3-no-connection) + (EGG:open-sj3) + (KKCP:make-stdy stdy)) + ((null *KKCP:error-flag*) result) + (t (KKCP:error sj3-error-code + 'kkcp:make-stdy stdy))))) + +(defun KKCP:henkan-begin (henkan-string) + (let ((result (sj3-server-henkan-begin henkan-string))) + (cond((null sj3-error-code) result) + ((eq sj3-error-code ':sj3-no-connection) + (EGG:open-sj3) + (KKCP:henkan-begin henkan-string)) + ((null *KKCP:error-flag*) result) + (t (KKCP:error sj3-error-code 'KKCP:henkan-begin henkan-string))))) + +(defun KKCP:henkan-next (bunsetu-no) + (let ((result (sj3-server-henkan-next bunsetu-no))) + (cond ((null sj3-error-code) result) + ((eq sj3-error-code ':sj3-no-connection) + (EGG:open-sj3) + (KKCP:henkan-next bunsetu-no)) + ((null *KKCP:error-flag*) result) + (t (KKCP:error sj3-error-code 'KKCP:henkan-next bunsetu-no))))) + +(defun KKCP:henkan-kakutei (bunsetu-no jikouho-no) + ;;; NOTE: 次候補リストが設定されていることを確認して使用すること。 + (let ((result (sj3-server-henkan-kakutei bunsetu-no jikouho-no))) + (cond ((null sj3-error-code) result) + ((eq sj3-error-code ':sj3-no-connection) + (EGG:open-sj3) + (KKCP:henkan-kakutei bunsetu-no jikouho-no)) + ((null *KKCP:error-flag*) result) + (t (KKCP:error sj3-error-code 'KKCP:henkan-kakutei bunsetu-no jikouho-no))))) + +(defun KKCP:bunsetu-henkou (bunsetu-no bunsetu-length) + (let ((result (sj3-server-bunsetu-henkou bunsetu-no bunsetu-length))) + (cond ((null sj3-error-code) result) + ((eq sj3-error-code ':sj3-no-connection) + (EGG:open-sj3) + (KKCP:bunsetu-henkou bunsetu-no bunsetu-length)) + ((null *KKCP:error-flag*) result) + (t (KKCP:error sj3-error-code 'kkcp:bunsetu-henkou bunsetu-no bunsetu-length))))) + + +(defun KKCP:henkan-quit () + (let ((result (sj3-server-henkan-quit))) + (cond ((null sj3-error-code) result) + ((eq sj3-error-code ':sj3-no-connection) + (EGG:open-sj3) + (KKCP:henkan-quit)) + ((null *KKCP:error-flag*) result) + (t (KKCP:error sj3-error-code 'KKCP:henkan-quit))))) + +(defun KKCP:henkan-end (&optional bunsetuno) + (let ((result (sj3-server-henkan-end bunsetuno))) + (cond ((null sj3-error-code) result) + ((eq sj3-error-code ':sj3-no-connection) + (EGG:open-sj3) + (KKCP:henkan-end bunsetuno)) + ((null *KKCP:error-flag*) result) + (t (KKCP:error sj3-error-code 'KKCP:henkan-end))))) + +(defun KKCP:dict-add (dictno kanji yomi bunpo) + (let ((result (sj3-server-dict-add dictno kanji yomi bunpo))) + (cond ((null sj3-error-code) result) + ((eq sj3-error-code ':sj3-no-connection) + (EGG:open-sj3) + (KKCP:dict-add dictno kanji yomi bunpo)) + ((null *KKCP:error-flag*) result) + (t (KKCP:error sj3-error-code 'KKCP:dict-add dictno kanji yomi bunpo))))) + +(defun KKCP:dict-delete (dictno kanji yomi bunpo) + (let ((result (sj3-server-dict-delete dictno kanji yomi bunpo))) + (cond ((null sj3-error-code) result) + ((eq sj3-error-code ':sj3-no-connection) + (EGG:open-sj3) + (KKCP:dict-delete dictno kanji yomi bunpo)) + ((null *KKCP:error-flag*) result) + (t (KKCP:error sj3-error-code 'KKCP:dict-delete dictno kanji yomi bunpo))))) + +(defun KKCP:dict-info (dictno) + (let ((result (sj3-server-dict-info dictno))) + (cond ((null sj3-error-code) result) + ((eq sj3-error-code ':sj3-no-connection) + (EGG:open-sj3) + (KKCP:dict-info dictno)) + ((null *KKCP:error-flag*) result) + (t (KKCP:error sj3-error-code 'KKCP:dict-info dictno))))) + +(defun KKCP:make-directory (pathname) + (let ((result (sj3-server-make-directory pathname))) + (cond ((null sj3-error-code) result) + ((eq sj3-error-code ':sj3-no-connection) + (EGG:open-sj3) + (KKCP:make-directory pathname)) + ((null *KKCP:error-flag*) result) + (t (KKCP:error sj3-error-code 'kkcp:make-directory pathname))))) + +(defun KKCP:file-access (pathname mode) + (let ((result (sj3-server-file-access pathname mode))) + (cond ((null sj3-error-code) + (if (= result 0) t nil)) + ((eq sj3-error-code ':sj3-no-connection) + (EGG:open-sj3) + (KKCP:file-access pathname mode)) + ((null *KKCP:error-flag*) result) + (t (KKCP:error sj3-error-code 'kkcp:file-access pathname mode))))) + +(defun KKCP:server-close () + (let ((result (sj3-server-close))) + (cond ((null sj3-error-code) result) + ((null *KKCP:error-flag*) result) + (t (KKCP:error sj3-error-code 'KKCP:server-close))))) + +;;;---------------------------------------------------------------------- +;;; +;;; Kana Kanji Henkan +;;; +;;;---------------------------------------------------------------------- + +;;; +;;; Entry functions for egg-startup-file +;;; + +(defvar *default-sys-dic-directory* (if (file-directory-p "/usr/sony/dict") + "/usr/sony/dict/sj3" + "/usr/local/lib/sj3/dict")) + +(defun set-default-sys-dic-directory (pathname) + "システム辞書の標準directory PATHNAMEを指定する。 +PATHNAMEは環境変数を含んでよい。" + + (setq pathname (substitute-in-file-name pathname)) + + (if (not (file-name-absolute-p pathname)) + (error "Default directory must be absolute pathname") + (if (null (KKCP:file-access pathname 0)) + (error + (format "System Default directory(%s) がありません。" pathname)) + (setq *default-sys-dic-directory* (file-name-as-directory pathname))))) + +(defvar *default-usr-dic-directory* + (if (file-directory-p "/usr/sony/dict/sj3/user") + "/usr/sony/dict/sj3/user/$USER" + "/usr/local/lib/sj3/dict/user/$USER")) + +(defun set-default-usr-dic-directory (pathname) + "利用者辞書の標準directory PATHNAMEを指定する。 +PATHNAMEは環境変数を含んでよい。" + + (setq pathname (file-name-as-directory (substitute-in-file-name pathname))) + + (if (not (file-name-absolute-p pathname)) + (error "Default directory must be absolute pathname") + (if (null (KKCP:file-access pathname 0)) + (let ((updir (file-name-directory (substring pathname 0 -1)))) + (if (null (KKCP:file-access updir 0)) + (error + (format "User Default directory(%s) がありません。" pathname)) + (if (yes-or-no-p (format "User Default directory(%s) を作りますか?" pathname)) + (progn + (KKCP:make-directory (directory-file-name pathname)) + (notify "User Default directory(%s) を作りました。" pathname)) + nil ;;; do nothing + )))) + (setq *default-usr-dic-directory* pathname))) + +(defun setsysdic (dict) + (let ((dictfile + (concat (if (not (file-name-absolute-p dict)) + *default-sys-dic-directory* + "") + dict))) + (egg:setsysdict (expand-file-name dictfile)))) + +(defun setusrdic (dict) + (let ((dictfile + (concat (if (not (file-name-absolute-p dict)) + *default-usr-dic-directory* + "") + dict))) + (egg:setusrdict (expand-file-name dictfile)))) + +(defvar egg:*dict-list* nil) + +(defun setusrstdy (stdy) + (let ((stdyfile + (concat (if (not (file-name-absolute-p stdy)) + *default-usr-dic-directory* + "") + stdy))) + (egg:setusrstdy (expand-file-name stdyfile)))) + +(defun egg:setsysdict (dict) + (cond((assoc (file-name-nondirectory dict) egg:*dict-list*) + (beep) + (notify "既に同名のシステム辞書 %s が登録されています。" + (file-name-nondirectory dict)) + ) + ((null (KKCP:file-access dict 0)) + (beep) + (notify "システム辞書 %s がありません。" dict)) + (t(let* ((*KKCP:error-flag* nil) + (rc (KKCP:use-dict dict))) + (if (null rc) + (error "EGG: setsysdict failed. :%s" dict) + (setq egg:*dict-list* + (cons (cons (file-name-nondirectory dict) dict) + egg:*dict-list*))))))) + +;;; dict-no --> dict-name +(defvar egg:*usr-dict* nil) + +;;; dict-name --> dict-no +(defvar egg:*dict-menu* nil) + +(defmacro push-end (val loc) + (list 'push-end-internal val (list 'quote loc))) + +(defun push-end-internal (val loc) + (set loc + (if (eval loc) + (nconc (eval loc) (cons val nil)) + (cons val nil)))) + +(defun egg:setusrdict (dict) + (cond((assoc (file-name-nondirectory dict) egg:*dict-list*) + (beep) + (notify "既に同名の利用者辞書 %s が登録されています。" + (file-name-nondirectory dict)) + ) + ((null (KKCP:file-access dict 0)) + (notify "利用者辞書 %s がありません。" dict) + (if (yes-or-no-p (format "利用者辞書 %s を作りますか?" dict)) + (let ((*KKCP:error-flag* nil)) + (if (KKCP:make-dict dict) + (progn + (notify "利用者辞書 %s を作りました。" dict) + (let* ((*KKCP:error-flag* nil) + (dict-no (KKCP:use-dict dict ""))) + (cond((numberp dict-no) + (setq egg:*usr-dict* + (cons (cons dict-no dict) egg:*usr-dict*)) + (push-end (cons (file-name-nondirectory dict) + dict-no) egg:*dict-menu*)) + (t (error "EGG: setusrdict failed. :%s" dict))))) + (error "EGG: setusrdict failed. : %s" dict))))) + (t (let* ((*KKCP:error-flag* nil) + (dict-no (KKCP:use-dict dict ""))) + (cond((numberp dict-no) + (setq egg:*usr-dict* (cons(cons dict-no dict) + egg:*usr-dict*)) + (push-end (cons (file-name-nondirectory dict) dict-no) + egg:*dict-menu*) + (setq egg:*dict-list* + (cons (cons (file-name-nondirectory dict) dict) + egg:*dict-list*))) + (t (error "EGG: setusrdict failed. : %s" dict))))))) + +(defun egg:setusrstdy (stdy) + (cond((null (KKCP:file-access stdy 0)) + (notify "学習ファイル %s がありません。" stdy) + (if (yes-or-no-p (format "学習ファイル %s を作りますか?" stdy)) + (if (null (KKCP:make-stdy stdy)) + (error "EGG: setusrstdy failed. : %s" stdy) + (notify "学習ファイル %s を作りました。" stdy) + (if (null (KKCP:use-stdy stdy)) + (error "EGG: setusrstdy failed. : %s" stdy)) + ))) + (t (if (null (KKCP:use-stdy stdy)) + (error "EGG: setusrstdy failed. : %s" stdy))))) + + +;;; +;;; SJ3 interface +;;; + +(eval-when-compile (defvar sj3-host-name)) + +(defun get-sj3-host-name () + (cond((and (boundp 'sj3-host-name) (stringp sj3-host-name)) + sj3-host-name) + ((and (boundp 'sj3serv-host-name) + (stringp (symbol-value 'sj3serv-host-name))) + (symbol-value 'sj3serv-host-name)) + (t (or (getenv "SJ3SERV") "localhost")))) ; 92.7.7 by Y.Kawabe + +(defalias 'get-sj3serv-host-name 'get-sj3-host-name) + +(defun set-sj3-host-name (name) + (interactive "sHost name: ") + (let ((*KKCP:error-flag* nil)) + (disconnect-sj3)) + (setq sj3-host-name name) + ) + +(defvar egg-default-startup-file "eggrc-sj3" + "*Egg startup file name (system default)") + +(defvar egg-startup-file ".eggrc-sj3" + "*Egg startup file name.") + +(defvar egg-startup-file-search-path (append '("~" ".") load-path) + "*List of directories to search for start up file to load.") + +(defun egg:search-file (filename searchpath) + (let ((result nil)) + (if (null (file-name-directory filename)) + (let ((path searchpath)) + (while (and path (null result )) + (let ((file (substitute-in-file-name + (expand-file-name filename (if (stringp (car path)) (car path) nil))))) + (if (file-exists-p file) (setq result file) + (setq path (cdr path)))))) + (let((file (substitute-in-file-name (expand-file-name filename)))) + (if (file-exists-p file) (setq result file)))) + result)) + +(defun EGG:open-sj3 () + (KKCP:server-open (or (get-sj3-host-name) (system-name)) + (user-login-name)) + (setq egg:*usr-dict* nil + egg:*dict-list* nil + egg:*dict-menu* nil) + (notify "ホスト %s の SJ3 を起動しました。" (or (get-sj3-host-name) "local")) + (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 (load-file eggrc) + (progn + (KKCP:server-close) + (error + "egg-startup-file-search-path 上に egg-startup-file がありません。" + ))))) + +(defun disconnect-sj3 () + (interactive) + (KKCP:server-close)) + +(defun close-sj3 () + (interactive) + (KKCP:server-close)) + +;;; +;;; Kanji henkan +;;; + +(defvar egg:*kanji-kanabuff* nil) + +(defvar *bunsetu-number* nil) + +(defun bunsetu-su () + (sj3-bunsetu-suu)) + +(defun bunsetu-length (number) + (sj3-bunsetu-yomi-moji-suu number)) + +;; #### This looks like a stupid multi-byte kludge. +(defun kanji-moji-suu (str) + "Do Not Call This." + (length str)) + +(defun bunsetu-position (number) + (let ((pos egg:*region-start*) (i 0)) + (while (< i number) + (setq pos (+ pos (bunsetu-kanji-length i) (length egg:*bunsetu-kugiri*))) + (setq i (1+ i))) + pos)) + +(defun bunsetu-kanji-length (bunsetu-no) + (sj3-bunsetu-kanji-length bunsetu-no)) + +(defun bunsetu-kanji (number) + (sj3-bunsetu-kanji number)) + +(defun bunsetu-kanji-insert (bunsetu-no) + (sj3-bunsetu-kanji bunsetu-no (current-buffer))) + +(defun bunsetu-set-kanji (bunsetu-no kouho-no) + (sj3-server-henkan-kakutei bunsetu-no kouho-no)) + +(defun bunsetu-yomi (number) + (sj3-bunsetu-yomi number)) + +(defun bunsetu-yomi-insert (bunsetu-no) + (sj3-bunsetu-yomi bunsetu-no (current-buffer))) + +(defun bunsetu-yomi-equal (number yomi) + (sj3-bunsetu-yomi-equal number yomi)) + +(defun bunsetu-kouho-suu (bunsetu-no) + (let ((no (sj3-bunsetu-kouho-suu bunsetu-no))) + (if (< 1 no) no + (KKCP:henkan-next bunsetu-no) + (sj3-bunsetu-kouho-suu bunsetu-no)))) + +(defun bunsetu-kouho-list (number) + (let ((no (bunsetu-kouho-suu number))) + (if (= no 1) + (KKCP:henkan-next number)) + (sj3-bunsetu-kouho-list number))) + +(defun bunsetu-kouho-number (bunsetu-no) + (sj3-bunsetu-kouho-number bunsetu-no)) + +;;;; +;;;; User entry : henkan-region, henkan-paragraph, henkan-sentence +;;;; + +(defvar egg:*bunsetu-face* nil "*文節表示に用いる face または nil") +(make-variable-buffer-local + (defvar egg:*bunsetu-overlay* nil "文節の表示に使う overlay")) + +(defvar egg:*bunsetu-kugiri* " " "*文節の区切りを示す文字列") + + +(defvar egg:*henkan-face* nil "*変換領域を表示する face または nil") +(make-variable-buffer-local + (defvar egg:*henkan-overlay* nil "変換領域の表示に使う overlay")) + +(defvar egg:*henkan-open* "|" "*変換の始点を示す文字列") +(defvar egg:*henkan-close* "|" "*変換の終点を示す文字列") + +(defvar egg:henkan-mode-in-use nil) +(make-variable-buffer-local 'egg:henkan-mode-in-use) +(set-default 'egg:henkan-mode-in-use nil) +(put 'egg:henkan-mode-in-use 'permanent-local t) + +(defun egg:henkan-face-on () + (if (overlayp egg:*henkan-overlay*) nil + (setq egg:*henkan-overlay* (make-overlay 1 1 nil)) + (overlay-put egg:*henkan-overlay* 'face egg:*henkan-face*) ) + (move-overlay egg:*henkan-overlay* egg:*region-start* egg:*region-end* (current-buffer)) ) + +(defun egg:henkan-face-off () + (and (overlayp egg:*henkan-overlay*) + (delete-overlay egg:*henkan-overlay*) )) + +(defun henkan-region (start end) + (interactive "r") + (if (interactive-p) (set-mark (point))) ;;; to be fixed + (henkan-region-internal start end)) + +(defvar henkan-mode-indicator "漢") + +(defun henkan-region-internal (start end) + "regionをかな漢字変換する。" + (or egg:henkan-mode-in-use + (let ((finished nil)) + (unwind-protect + (progn + (setq egg:henkan-mode-in-use t + egg:*kanji-kanabuff* (buffer-substring-no-properties + start end)) + (setq *bunsetu-number* 0) + (let ((result (KKCP:henkan-begin egg:*kanji-kanabuff*))) + (if result + (progn + (mode-line-egg-mode-update henkan-mode-indicator) + (goto-char start) + (or (markerp egg:*region-start*) + (setq egg:*region-start* (make-marker))) + (or (markerp egg:*region-end*) + (setq egg:*region-end* + (set-marker-insertion-type (make-marker) t))) + (if (null (marker-position egg:*region-start*)) + (progn + ;;(buffer-disable-undo (current-buffer)) + (goto-char start) + (delete-region start end) + (suspend-undo) + (insert egg:*henkan-open*) + (set-marker egg:*region-start* (point)) + (insert egg:*henkan-close*) + (set-marker egg:*region-end* egg:*region-start*) + (goto-char egg:*region-start*) + ) + (egg:fence-face-off) + (delete-region + (- egg:*region-start* (length egg:*fence-open*)) + egg:*region-start*) + (delete-region + egg:*region-end* + (+ egg:*region-end* (length egg:*fence-close*))) + (goto-char egg:*region-start*) + (insert egg:*henkan-open*) + (set-marker egg:*region-start* (point)) + (goto-char egg:*region-end*) + (let ((point (point))) + (insert egg:*henkan-close*) + (set-marker egg:*region-end* point)) + (goto-char start) + (delete-region start end) + ) + (henkan-insert-kouho 0) + (egg:henkan-face-on) + (egg:bunsetu-face-on *bunsetu-number*) + (henkan-goto-bunsetu 0)))) + (setq finished t)) + (or finished + (setq egg:henkan-mode-in-use nil)))))) + +(defun henkan-paragraph () + "Kana-kanji henkan paragraph at or after point." + (interactive ) + (save-excursion + (forward-paragraph) + (let ((end (point))) + (backward-paragraph) + (henkan-region-internal (point) end )))) + +(defun henkan-sentence () + "Kana-kanji henkan sentence at or after point." + (interactive ) + (save-excursion + (forward-sentence) + (let ((end (point))) + (backward-sentence) + (henkan-region-internal (point) end )))) + +(defun henkan-word () + "Kana-kanji henkan word at or after point." + (interactive) + (save-excursion + (re-search-backward "\\b\\w" nil t) + (let ((start (point))) + (re-search-forward "\\w\\b" nil t) + (henkan-region-internal start (point))))) + +;;; +;;; Kana Kanji Henkan Henshuu mode +;;; + +(defun set-egg-henkan-mode-format (open close kugiri &optional henkan-face bunsetu-face) + "変換 mode の表示方法を設定する。OPEN は変換の始点を示す文字列または nil。 +CLOSEは変換の終点を示す文字列または nil。 +KUGIRIは文節の区切りを表示する文字列または nil。 +HENKAN-FACE が指定されて nil でなければ、変換区間を表示する face として使われる。 +BUNSETU-FACE が指定されて nil でなければ、注目している文節を表示する face として使われる" + + (interactive (list (read-string "変換開始文字列: ") + (read-string "変換終了文字列: ") + (read-string "文節区切り文字列: ") + (cdr (assoc (completing-read "変換区間表示属性: " egg:*face-alist*) + egg:*face-alist*)) + (cdr (assoc (completing-read "文節区間表示属性: " egg:*face-alist*) + egg:*face-alist*)) + )) + + (if (and (or (stringp open) (null open)) + (or (stringp close) (null close)) + (or (stringp kugiri) (null kugiri)) + (or (null henkan-face) (memq henkan-face (face-list))) + (or (null bunsetu-face) (memq henkan-face (face-list)))) + (progn + (setq egg:*henkan-open* (or open "") + egg:*henkan-close* (or close "") + egg:*bunsetu-kugiri* (or kugiri "") + egg:*henkan-face* henkan-face + egg:*bunsetu-face* bunsetu-face) + (if (overlayp egg:*henkan-overlay*) + (overlay-put egg:*henkan-overlay* 'face egg:*henkan-face*)) + (if (overlayp egg:*bunsetu-overlay*) + (overlay-put egg:*bunsetu-overlay* 'face egg:*bunsetu-face*)) + + t) + (error "Wrong type of arguments: %1 %2 %3 %4 %5" open close kugiri henkan-face bunsetu-face))) + +(defun henkan-insert-kouho (bunsetu-no) + (let ((max (bunsetu-su)) (i bunsetu-no)) + (while (< i max) + (bunsetu-kanji-insert i) + (insert egg:*bunsetu-kugiri* ) + (setq i (1+ i))) + (if (< bunsetu-no max) (delete-char (- (length egg:*bunsetu-kugiri*)))))) + +(defun henkan-kakutei () + (interactive) + (egg:bunsetu-face-off) + (egg:henkan-face-off) + (setq egg:henkan-mode-in-use nil) + (setq egg:*in-fence-mode* nil) + (delete-region (- egg:*region-start* (length egg:*henkan-open*)) + egg:*region-start*) + (delete-region egg:*region-start* egg:*region-end*) + (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*henkan-close*))) + (goto-char egg:*region-start*) + (resume-undo-list) + (let ((i 0) (max (bunsetu-su))) + (while (< i max) + ;;;(KKCP:henkan-kakutei i (bunsetu-kouho-number i)) + (bunsetu-kanji-insert i) + (if (not overwrite-mode) + (undo-boundary)) + (setq i (1+ i)) + )) + (KKCP:henkan-end) + (egg:quit-egg-mode) + ) + +(defun henkan-kakutei-before-point () + (interactive) + (egg:bunsetu-face-off) + (egg:henkan-face-off) + (delete-region egg:*region-start* egg:*region-end*) + (goto-char egg:*region-start*) + (let ((i 0) (max *bunsetu-number*)) + (while (< i max) + ;;;(KKCP:henkan-kakutei i (bunsetu-kouho-number i)) + (bunsetu-kanji-insert i) + (if (not overwrite-mode) + (undo-boundary)) + (setq i (1+ i)) + )) + (KKCP:henkan-end *bunsetu-number*) + (delete-region (- egg:*region-start* (length egg:*henkan-open*)) + egg:*region-start*) + (insert egg:*fence-open*) + (set-marker egg:*region-start* (point)) + (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*henkan-close*))) + (goto-char egg:*region-end*) + (let ((point (point))) + (insert egg:*fence-close*) + (set-marker egg:*region-end* point)) + (goto-char egg:*region-start*) + (egg:fence-face-on) + (let ((point (point)) + (i *bunsetu-number*) (max (bunsetu-su))) + (while (< i max) + (bunsetu-yomi-insert i) + (setq i (1+ i))) + ;;;(insert "|") + ;;;(insert egg:*fence-close*) + ;;;(set-marker egg:*region-end* (point)) + (goto-char point)) + (setq egg:*mode-on* t) + ;;;(use-global-map fence-mode-map) + ;;;(use-local-map nil) + (setq egg:henkan-mode-in-use nil) + (egg:mode-line-display)) + +(defun egg:set-bunsetu-face (no face switch) + (if (not switch) + (egg:bunsetu-face-off) ;; JIC + (if (overlayp egg:*bunsetu-overlay*) nil + (setq egg:*bunsetu-overlay* (make-overlay 1 1 nil)) + (overlay-put egg:*bunsetu-overlay* 'face egg:*bunsetu-face*)) + (move-overlay egg:*bunsetu-overlay* + (if (eq face 'modeline) + (let ((point (bunsetu-position no))) + (1+ point)) + (bunsetu-position no)) + + (if (= no (1- (bunsetu-su))) + egg:*region-end* + (- (bunsetu-position (1+ no)) + (length egg:*bunsetu-kugiri*))) + (current-buffer)))) + +(defun egg:bunsetu-face-on (no) + (egg:set-bunsetu-face no egg:*bunsetu-face* t)) + +(defun egg:bunsetu-face-off () + ;; delete henkan overlay from the current buffer. + (and (overlayp egg:*bunsetu-overlay*) + (delete-overlay egg:*bunsetu-overlay*)) ) + +(defun henkan-goto-bunsetu (number) + (setq *bunsetu-number* + (check-number-range number 0 (1- (bunsetu-su)))) + (goto-char (bunsetu-position *bunsetu-number*)) + (egg:bunsetu-face-on *bunsetu-number*) + ) + +(defun henkan-forward-bunsetu () + (interactive) + (henkan-goto-bunsetu (1+ *bunsetu-number*)) + ) + +(defun henkan-backward-bunsetu () + (interactive) + (henkan-goto-bunsetu (1- *bunsetu-number*)) + ) + +(defun henkan-first-bunsetu () + (interactive) + (henkan-goto-bunsetu 0)) + +(defun henkan-last-bunsetu () + (interactive) + (henkan-goto-bunsetu (1- (bunsetu-su))) + ) + +(defun check-number-range (i min max) + (cond((< i min) max) + ((< max i) min) + (t i))) + +(defun henkan-hiragana () + (interactive) + (henkan-goto-kouho (- (bunsetu-kouho-suu *bunsetu-number*) 1))) + +(defun henkan-katakana () + (interactive) + (henkan-goto-kouho (- (bunsetu-kouho-suu *bunsetu-number*) 2))) + +(defun henkan-next-kouho () + (interactive) + (henkan-goto-kouho (1+ (bunsetu-kouho-number *bunsetu-number*)))) + +(defun henkan-previous-kouho () + (interactive) + (henkan-goto-kouho (1- (bunsetu-kouho-number *bunsetu-number*)))) + +(defun henkan-goto-kouho (kouho-number) + (let ((point (point)) + (yomi (bunsetu-yomi *bunsetu-number*)) + (i *bunsetu-number*) + (max (bunsetu-su))) + (setq kouho-number + (check-number-range kouho-number + 0 + (1- (bunsetu-kouho-suu *bunsetu-number*)))) + (while (< i max) + (if (bunsetu-yomi-equal i yomi) + (let ((p1 (bunsetu-position i))) + (delete-region p1 + (+ p1 (bunsetu-kanji-length i))) + (goto-char p1) + (bunsetu-set-kanji i kouho-number) + (bunsetu-kanji-insert i))) + (setq i (1+ i))) + (goto-char point)) + (egg:bunsetu-face-on *bunsetu-number*)) + +(defun henkan-bunsetu-chijime () + (interactive) + (or (= (bunsetu-length *bunsetu-number*) 1) + (bunsetu-length-henko (1- (bunsetu-length *bunsetu-number*))))) + +(defun henkan-bunsetu-nobasi () + (interactive) + (if (not (= (1+ *bunsetu-number*) (bunsetu-su))) + (bunsetu-length-henko (1+ (bunsetu-length *bunsetu-number*))))) + +(defun henkan-saishou-bunsetu () + (interactive) + (bunsetu-length-henko 1)) + +(defun henkan-saichou-bunsetu () + (interactive) + (let ((max (bunsetu-su)) (i *bunsetu-number*) + (l 0)) + (while (< i max) + (setq l (+ l (bunsetu-length i))) + (setq i (1+ i))) + (bunsetu-length-henko l))) + +(defun bunsetu-length-henko (length) + (let ((r (KKCP:bunsetu-henkou *bunsetu-number* length))) + (cond(r + (delete-region + (bunsetu-position *bunsetu-number*) egg:*region-end*) + (goto-char (bunsetu-position *bunsetu-number*)) + (henkan-insert-kouho *bunsetu-number*) + (henkan-goto-bunsetu *bunsetu-number*)) + (t + (egg:bunsetu-face-on *bunsetu-number*))))) + +(defun henkan-quit () + (interactive) + (egg:bunsetu-face-off) + (egg:henkan-face-off) + (delete-region (- egg:*region-start* (length egg:*henkan-open*)) + egg:*region-start*) + (delete-region egg:*region-start* egg:*region-end*) + (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*henkan-close*))) + (goto-char egg:*region-start*) + (insert egg:*fence-open*) + (set-marker egg:*region-start* (point)) + (insert egg:*kanji-kanabuff*) + (let ((point (point))) + (insert egg:*fence-close*) + (set-marker egg:*region-end* point) + ) + (goto-char egg:*region-end*) + (egg:fence-face-on) + (KKCP:henkan-quit) + (setq egg:*mode-on* t) + (setq egg:henkan-mode-in-use nil) + (setq egg:*in-fence-mode* t) + (egg:mode-line-display) + ) + +(defun henkan-select-kouho () + (interactive) + (if (not (eq (selected-window) (minibuffer-window))) + (let ((kouho-list (bunsetu-kouho-list *bunsetu-number*)) + menu) + (setq menu + (list 'menu "次候補:" + (let ((l kouho-list) (r nil) (i 0)) + (while l + (setq r (cons (cons (car l) i) r)) + (setq i (1+ i)) + (setq l (cdr l))) + (reverse r)))) + (henkan-goto-kouho + (menu:select-from-menu menu + (bunsetu-kouho-number *bunsetu-number*)))) + (beep))) + +(defun henkan-kakutei-and-self-insert () + (interactive) + (setq unread-command-events (list last-command-event)) + (henkan-kakutei)) + + +(defvar henkan-mode-map (append '(keymap (t . undefined) + (?\C-x keymap (t . undefined))) + function-key-map)) + +(defvar henkan-mode-esc-map + (let (map) + (cond ((keymapp (setq map (lookup-key henkan-mode-map + (vector meta-prefix-char)))) + map) + ((keymapp (setq map (lookup-key henkan-mode-map [escape]))) + map) + (t + (make-sparse-keymap))))) + +(or (keymapp (lookup-key henkan-mode-map (vector meta-prefix-char))) + (define-key henkan-mode-map (vector meta-prefix-char) henkan-mode-esc-map)) +(or (keymapp (lookup-key henkan-mode-map [escape])) + (define-key henkan-mode-map [escape] henkan-mode-esc-map)) + +(substitute-key-definition 'egg-self-insert-command + 'henkan-kakutei-and-self-insert + henkan-mode-map global-map) + +(dolist (elem '((" " henkan-next-kouho) + ("\177" henkan-quit) + ("\C-@" henkan-next-kouho) + ("\C-\ " undefined);; predefined by wnn-egg.el + ("\C-a" henkan-first-bunsetu) + ("\C-b" henkan-backward-bunsetu) + ("\C-c" henkan-quit) + ("\C-e" henkan-last-bunsetu) + ("\C-f" henkan-forward-bunsetu) + ("\C-g" henkan-quit) + ("\C-h" henkan-help-command) + ("\C-i" henkan-bunsetu-chijime) + ("\C-k" henkan-kakutei-before-point) + ("\C-l" henkan-kakutei) + ("\C-m" henkan-kakutei) + ("\C-n" henkan-next-kouho) + ("\C-o" henkan-bunsetu-nobasi) + ("\C-p" henkan-previous-kouho) + ("\C-t" undefined);; predefined by wnn-egg.el + ("\C-v" undefined);; predefined by wnn-egg.el + ("\C-w" undefined);; predefined by wnn-egg.el + ("\C-z" undefined);; predefined by wnn-egg.el + + ([backspace] henkan-quit) + ([clear] henkan-quit) + ([delete] henkan-quit) + ([down] henkan-next-kouho) + ([help] henkan-help-command) + ([left] henkan-backward-bunsetu) + ([next] henkan-next-kouho) + ([prior] henkan-previous-kouho) + ([return] henkan-kakutei) + ([right] henkan-forward-bunsetu) + ([up] henkan-previous-kouho))) + (apply 'define-key henkan-mode-map elem)) + +(dolist (elem '(([t] undefined);; default binding + ("<" henkan-saishou-bunsetu) + (">" henkan-saichou-bunsetu) + ("h" henkan-hiragana) + ("i" henkan-bunsetu-chijime) + ("k" henkan-katakana) + ("o" henkan-bunsetu-nobasi) + ("s" henkan-select-kouho) + ("z" undefined);; predefined by wnn-egg.el + )) + (apply 'define-key henkan-mode-esc-map elem)) + +(or (assq 'egg:henkan-mode-in-use minor-mode-map-alist) + (setq minor-mode-map-alist + (cons (cons 'egg:henkan-mode-in-use henkan-mode-map) + minor-mode-map-alist))) + +(defun henkan-help-command () + "Display documentation fo henkan-mode." + (interactive) + (with-output-to-temp-buffer "*Help*" + (princ (substitute-command-keys henkan-mode-document-string)) + (print-help-return-message))) + +(defvar henkan-mode-document-string "漢字変換モード: +文節移動 + \\[henkan-first-bunsetu]\t先頭文節\t\\[henkan-last-bunsetu]\t後尾文節 + \\[henkan-backward-bunsetu]\t直前文節\t\\[henkan-forward-bunsetu]\t直後文節 +変換変更 + 次候補 \\[henkan-previous-kouho] \t前候補 \\[henkan-next-kouho] + 文節伸し \\[henkan-bunsetu-nobasi] \t文節縮め \\[henkan-bunsetu-chijime] + 変換候補選択 \\[henkan-select-kouho] +変換確定 + 全文節確定 \\[henkan-kakutei] \t直前文節まで確定 \\[henkan-kakutei-before-point] +変換中止 \\[henkan-quit] +") + +;;;---------------------------------------------------------------------- +;;; +;;; Dictionary management Facility +;;; +;;;---------------------------------------------------------------------- + +;;; +;;; 辞書登録 +;;; + +;;;; +;;;; User entry: toroku-region +;;;; + +(defun remove-regexp-in-string (regexp string) + (cond((not(string-match regexp string)) + string) + (t(let ((str nil) + (ostart 0) + (oend (match-beginning 0)) + (nstart (match-end 0))) + (setq str (concat str (substring string ostart oend))) + (while (string-match regexp string nstart) + (setq ostart nstart) + (setq oend (match-beginning 0)) + (setq nstart (match-end 0)) + (setq str (concat str (substring string ostart oend)))) + str)))) + +(defun toroku-region (start end) + (interactive "r") + (if (not (sj3-server-active-p)) + (EGG:open-sj3)) + (let*((kanji + (remove-regexp-in-string "[\0-\37]" (buffer-substring start end))) + (yomi (egg:read-hiragana-string + (format "辞書登録『%s』 読み :" kanji))) + (type (menu:select-from-menu *sj3-bunpo-menu*)) + (dict-no + (menu:select-from-menu (list 'menu "登録辞書名:" egg:*dict-menu*)))) + ;;;(if (string-match "[\0-\177]" kanji) + ;;; (error "Kanji string contains hankaku character. %s" kanji)) + ;;;(if (string-match "[\0-\177]" yomi) + ;;; (error "Yomi string contains hankaku character. %s" yomi)) + (KKCP:dict-add dict-no kanji yomi type) + (let ((hinshi (nth 1 (assq type *sj3-bunpo-code*))) + (gobi (nth 2 (assq type *sj3-bunpo-code*))) + (dict-name (cdr (assq dict-no egg:*usr-dict*)))) + (notify "辞書項目『%s』(%s: %s)を%sに登録しました。" + (if gobi (concat kanji " " gobi) kanji) + (if gobi (concat yomi " " gobi) yomi) + hinshi dict-name)))) + + + +;;; (lsh 1 18) +(defvar *sj3-bunpo-menu* + '(menu "品詞:" + (("名詞" . + (menu "品詞:名詞:" + (("名詞" . 1) + ("名詞(お…)" . 2) + ("名詞(ご…)" . 3) + ("名詞(…的/化)" . 4) + ("名詞(お…する)" . 5) + ("名詞(…する)" . 6) + ("名詞(ご…する)" . 7) + ("名詞(…な/に)" . 8) + ("名詞(お…な/に)" . 9) + ("名詞(ご…な/に)" . 10) + ("名詞(副詞)" . 11)))) + ("代名詞" . 12) + ("苗字" . 21) + ("名前" . 22) + ("地名" . 24) + ("県/区名" . 25) + ("動詞" . + (menu "品詞:動詞:" + (("サ変語幹" . 80) + ("ザ変語幹" . 81) + ("一段不変化部" . 90) + ("カ行五段語幹" . 91) + ("ガ行五段語幹" . 92) + ("サ行五段語幹" . 93) + ("タ行五段語幹" . 94) + ("ナ行五段語幹" . 95) + ("バ行五段語幹" . 96) + ("マ行五段語幹" . 97) + ("ラ行五段語幹" . 98) + ("ワ行五段語幹" . 99)))) + ("連体詞" . 26) + ("接続詞" . 27) + ("助数詞" . 29) + ("数詞" . 30) + ("接頭語" . 31) + ("接尾語" . 36) + ("副詞" . 45) + ("副詞2" . 46) + ("形容詞語幹" . 60) + ("形容動詞語幹" . 71) + ("単漢字" . 189)))) + +(defvar *sj3-bunpo-code* + '( + ( 1 "名詞" ) + ( 2 "名詞(お…)" ) + ( 3 "名詞(ご…)" ) + ( 4 "名詞(…的/化)" "的" nil) + ( 5 "名詞(お…する)" "する" nil) + ( 6 "名詞(…する)" "する" nil) + ( 7 "名詞(ご…する)" "する" nil) + ( 8 "名詞(…な/に)" "な/に" nil) + ( 9 "名詞(お…な/に)" "な/に" nil) + ( 10 "名詞(ご…な/に)" "な/に" nil) + ( 11 "名詞(副詞)" ) + ( 12 "代名詞" ) + ( 21 "苗字" ) + ( 22 "名前" ) + ( 24 "地名" ) + ( 25 "県/区名" ) + ( 26 "連体詞" ) + ( 27 "接続詞" ) + ( 29 "助数詞" ) + ( 30 "数詞" ) + ( 31 "接頭語" ) + ( 36 "接尾語" ) + ( 45 "副詞" ) + ( 46 "副詞2" ) + ( 60 "形容詞語幹" "い" ("" "" "" "" "")) + ( 71 "形容動詞語幹" "に" ("" "" "" "" "") ) + ( 80 "サ変語幹" "する" ("" "" "" "" "")) + ( 81 "ザ変語幹" "ずる" ("" "" "" "" "")) + ( 90 "一段不変化部" "る" ("" "" "" "" "")) + ( 91 "カ行五段語幹" "く" ("かない" "きます" "く" "くとき" "け")) + ( 92 "ガ行五段語幹" "ぐ" ("がない" "ぎます" "" "" "")) + ( 93 "サ行五段語幹" "す" ("" "" "" "" "")) + ( 94 "タ行五段語幹" "つ" ("" "" "" "" "")) + ( 95 "ナ行五段語幹" "ぬ" ("" "" "" "" "")) + ( 96 "バ行五段語幹" "ぶ" ("" "" "" "" "")) + ( 97 "マ行五段語幹" "む" ("" "" "" "" "")) + ( 98 "ラ行五段語幹" "る" ("" "" "" "" "")) + ( 99 "ワ行五段語幹" "う" ("" "" "" "" "")) + ( 189 "単漢字" ) + ( 190 "不定" ) + ( 1000 "その他" ) + )) + +;;; +;;; 辞書編集系 DicEd +;;; + +(defvar *diced-window-configuration* nil) + +(defvar *diced-dict-info* nil) + +(defvar *diced-dno* nil) + +;;;;; +;;;;; User entry : edit-dict +;;;;; + +;; predefined by wnn-egg.el +(fmakunbound 'edit-dict-item) + +(defun edit-dict () + (interactive) + (if (not (sj3-server-active-p)) + (EGG:open-sj3)) + (let*((dict-no + (menu:select-from-menu (list 'menu "辞書名:" egg:*dict-menu*))) + (dict-name (file-name-nondirectory + (cdr (assq dict-no egg:*usr-dict*)))) + (dict-info (KKCP:dict-info dict-no))) + (if (null dict-info) + (message "辞書: %s に登録されている項目はありません。" dict-name) + (progn + (setq *diced-dno* dict-no) + (setq *diced-window-configuration* (current-window-configuration)) + (pop-to-buffer "*Nihongo Dictionary Information*") + (setq major-mode 'diced-mode) + (setq mode-name "Diced") + (setq mode-line-buffer-identification + (concat "DictEd: " dict-name + (make-string + (max 0 (- 17 (string-width dict-name))) ? ) + )) + (sit-for 0) ;; will redislay. + ;;;(use-global-map diced-mode-map) + (use-local-map diced-mode-map) + (diced-display dict-info) + )))) + +(defun diced-redisplay () + (let ((dict-info (KKCP:dict-info *diced-dno*))) + (if (null dict-info) + (progn + (message "辞書: %s に登録されている項目はありません。" + (file-name-nondirectory + (cdr (assq *diced-dno* egg:*usr-dict*)))) + (diced-quit)) + (diced-display dict-info)))) + +(defun diced-display (dict-info) + ;;; (values (list (record yomi kanji bunpo))) + ;;; 0 1 2 + (setq *diced-dict-info* dict-info) + (setq buffer-read-only nil) + (erase-buffer) + (let ((l-yomi + (apply 'max + (mapcar (function (lambda (l) (string-width (nth 0 l)))) + dict-info))) + (l-kanji + (apply 'max + (mapcar (function (lambda (l) (string-width (nth 1 l)))) + dict-info)))) + (while dict-info + (let*((yomi (nth 0 (car dict-info))) + (kanji (nth 1 (car dict-info))) + (bunpo (nth 2 (car dict-info))) + (gobi (nth 2 (assq bunpo *sj3-bunpo-code*))) + (hinshi (nth 1 (assq bunpo *sj3-bunpo-code*)))) + + (insert " " yomi) + (if gobi (insert " " gobi)) + (insert-char ? + (- (+ l-yomi 10) (string-width yomi) + (if gobi (+ 1 (string-width gobi)) 0))) + (insert kanji) + (if gobi (insert " " gobi)) + (insert-char ? + (- (+ l-kanji 10) (string-width kanji) + (if gobi (+ 1 (string-width gobi)) 0))) + (insert hinshi ?\n) + (setq dict-info (cdr dict-info)))) + (goto-char (point-min))) + (setq buffer-read-only t)) + +(defun diced-add () + (interactive) + (diced-execute t) + (let*((kanji (egg:read-kanji-string "漢字:")) + (yomi (egg:read-hiragana-string "読み:")) + (bunpo (menu:select-from-menu *sj3-bunpo-menu*)) + (gobi (nth 2 (assq bunpo *sj3-bunpo-code*))) + (hinshi (nth 1 (assq bunpo *sj3-bunpo-code*))) + (item (if gobi (concat kanji " " gobi) kanji)) + (item-yomi (if gobi (concat yomi " " gobi) yomi)) + (dict-name (cdr (assq *diced-dno* egg:*usr-dict*)))) + (if (notify-yes-or-no-p "辞書項目『%s』(%s: %s)を%sに登録します。" + item item-yomi hinshi (file-name-nondirectory dict-name)) + (progn + (KKCP:dict-add *diced-dno* kanji yomi bunpo) + (notify "辞書項目『%s』(%s: %s)を%sに登録しました。" + item item-yomi hinshi dict-name) + (diced-redisplay))))) + +(defun diced-delete () + (interactive) + (beginning-of-line) + (if (eq (char-after) ? ) + (let ((buffer-read-only nil)) + (delete-char 1) (insert "D") (backward-char 1)))) + +(defun diced-undelete () + (interactive) + (beginning-of-line) + (if (eq (char-after) ?D) + (let ((buffer-read-only nil)) + (delete-char 1) (insert " ") (backward-char 1)) + (beep))) + +(defun diced-quit () + (interactive) + (setq buffer-read-only nil) + (erase-buffer) + (setq buffer-read-only t) + (bury-buffer (get-buffer "*Nihongo Dictionary Information*")) + (set-window-configuration *diced-window-configuration*) + ) + +(defun diced-execute (&optional display) + (interactive) + (goto-char (point-min)) + (let ((no 0)) + (while (not (eobp)) + (if (eq (char-after) ?D) + (let* ((dict-item (nth no *diced-dict-info*)) + (yomi (nth 0 dict-item)) + (kanji (nth 1 dict-item)) + (bunpo (nth 2 dict-item)) + (gobi (nth 2 (assq bunpo *sj3-bunpo-code*))) + (hinshi (nth 1 (assq bunpo *sj3-bunpo-code*))) + (dict-name (cdr (assq *diced-dno* egg:*usr-dict*))) + (item (if gobi (concat kanji " " gobi) kanji)) + (item-yomi (if gobi (concat yomi " " gobi) yomi))) + (if (notify-yes-or-no-p "辞書項目『%s』(%s: %s)を%sから削除します。" + item item-yomi hinshi (file-name-nondirectory + dict-name)) + (progn + (KKCP:dict-delete *diced-dno* kanji yomi bunpo) + (notify "辞書項目『%s』(%s: %s)を%sから削除しました。" + item item-yomi hinshi dict-name) + )))) + (setq no (1+ no)) + (forward-line 1))) + (forward-line -1) + (if (not display) (diced-redisplay))) + +(defun diced-next-line () + (interactive) + (beginning-of-line) + (forward-line 1) + (if (eobp) (progn (beep) (forward-line -1)))) + +(defun diced-end-of-buffer () + (interactive) + (goto-char (point-max)) + (forward-line -1)) + +(defun diced-scroll-down () + (interactive) + (scroll-down) + (if (eobp) (forward-line -1))) + +(defun diced-mode () + "Mode for \"editing\" dictionaries. +In diced, you are \"editing\" a list of the entries in dictionaries. +You can move using the usual cursor motion commands. +Letters no longer insert themselves. Instead, + +Type a to Add new entry. +Type d to flag an entry for Deletion. +Type n to move cursor to Next entry. +Type p to move cursor to Previous entry. +Type q to Quit from DicEd. +Type u to Unflag an entry (remove its D flag). +Type x to eXecute the deletions requested. +" + ) + +(defvar diced-mode-map (make-sparse-keymap)) + +(dolist (elem '(("a" diced-add) + ("d" diced-delete) + ("n" diced-next-line) + ("p" previous-line) + ("q" diced-quit) + ("u" diced-undelete) + ("x" diced-execute) + + ("\C-h" help-command) + ("\C-n" diced-next-line) + ("\C-p" previous-line) + ("\C-u");; predefined by wnn-egg.el + ("\C-v" scroll-up) + + ([down] diced-next-line) + ([help] help-command) + ([next] diced-next-line) + ([prior] previous-line) + ([up] previous-line) + + ("\e<" beginning-of-buffer) + ("\e>" diced-end-of-buffer) + ("\eh");; predefined by wnn-egg.el + ("\ev" diced-scroll-down))) + (define-key diced-mode-map (car elem) (nth 1 elem))) + +;;; End of sj3-egg.el +;; 92.7.7 by Y.Kawabe -- commented out +;; (if (boundp 'SJ3) +;; (load-library "sj3fns")) --- emacs-22.1/lisp/startup.el~ 2007-05-14 14:56:29 +0000 +++ emacs-22.1/lisp/startup.el 2007-06-03 23:21:07 +0000 @@ -1305,10 +1305,18 @@ (defun fancy-splash-tail () "Insert the tail part of the splash screen into the current buffer." (let ((fg (if (eq (frame-parameter nil 'background-mode) 'dark) - "cyan" "darkblue"))) + "cyan" "darkblue")) + (version (with-temp-buffer + (insert "This is " + (mapconcat 'identity (split-string (emacs-version)) + " ")) + (let ((fill-column (- (window-width) 2)) + (fill-prefix " ")) + (fill-region (point-min) (point-max))) + (buffer-substring 9 (point-max))))) (fancy-splash-insert :face `(variable-pitch :foreground ,fg) "\nThis is " - (emacs-version) + version "\n" :face '(variable-pitch :height 0.5) "Copyright (C) 2007 Free Software Foundation, Inc.") --- emacs-22.1/lisp/textmodes/picture.el~ 2007-01-21 03:53:09 +0000 +++ emacs-22.1/lisp/textmodes/picture.el 2007-06-03 23:21:07 +0000 @@ -166,6 +166,28 @@ (interactive) (picture-set-motion 1 0)) +;;; 89.9.7 patch by K.Handa +(defun picture-movement-wnw () + "Move up and left and left after self-inserting character in Picture mode." + (interactive) + (picture-set-motion -1 -2)) + +(defun picture-movement-ene () + "Move up and right and right after self-inserting character in Picture mode." + (interactive) + (picture-set-motion -1 2)) + +(defun picture-movement-wsw () + "Move down and left and left after self-inserting character in Picture mode." + (interactive) + (picture-set-motion 1 -2)) + +(defun picture-movement-ese () + "Move down and right and right after self-inserting character in Picture mode." + (interactive) + (picture-set-motion 1 2)) +;;; end of patch + (defun picture-movement-nw (&optional arg) "Move up and left after self-inserting character in Picture mode. With prefix argument, move up and two-column left." @@ -274,6 +296,70 @@ (picture-update-desired-column (not (eq this-command last-command))) (picture-insert last-command-event arg)) ; Always a character in this case. +;;; 89.9.7 by K.Handa +(defun picture-insert-after-hook (begin end) + "Called as a hook after a string is inserted into the current buffer. +Two arguments BEGIN and END point the head and tail of just inserted string." + (let ((str (buffer-substring begin end))) + (delete-region begin end) + (picture-insert-string str))) + +(defun picture-delete-text-in-column (from to) + "Delete the text between column FROM and TO (exclusive) of the current line. +Nil of FORM or TO means the current column. +If there's a charcter across the borders, the character is replaced with +the same width of spaces before deleting." + (save-excursion + (let (p1 p2) + (if from + (progn + (setq p1 (move-to-column from)) + (if (> p1 from) + (progn + (delete-char -1) + (insert-char ? (- p1 (current-column))) + (forward-char (- from p1)))))) + (setq p1 (point)) + (if to + (progn + (setq p2 (move-to-column to)) + (if (> p2 to) + (progn + (delete-char -1) + (insert-char ? (- p2 (current-column))) + (forward-char (- to p2)))))) + (setq p2 (point)) + (delete-region p1 p2)))) + +(defun picture-insert-string (str) ; 91.11.25, 92.7.10 by K.Handa + "Insert characters in STR one by one in place of character previously +at the cursor while moving cursor in the direction you previously specified +with the commands picture-movement-right, picture-movement-up, etc. +Do \\[command-apropos] picture-movement to see those commands." + (interactive "sInsert string: ") + (let ((len (length str))) + (if (> len 0) + (let* ((idx 0) + (c (aref str idx)) + (width (char-width c)) + clm) + (while idx ; Set to nil at the end of loop + (setq clm (current-column)) + (picture-delete-text-in-column clm (+ clm width)) + (insert c) + (forward-char -1) + (setq idx (1+ idx)) + (if (< idx len) + (setq c (aref str idx) width (char-width c)) + (setq idx nil)) + (if (/= picture-vertical-step 0) + (picture-move) + (if (> picture-horizontal-step 0) + (forward-char 1) + (move-to-column-force (- clm width)))) + ))))) +;;; end of patch + (defun picture-clear-column (arg) "Clear out ARG columns after point without moving." (interactive "p") @@ -596,11 +682,17 @@ (if (not picture-mode-map) (progn (setq picture-mode-map (make-keymap)) - (picture-substitute 'self-insert-command 'picture-self-insert) - (picture-substitute 'completion-separator-self-insert-command - 'picture-self-insert) - (picture-substitute 'completion-separator-self-insert-autofilling - 'picture-self-insert) + (let ((picture-self-insert (cond ((featurep 'canna) + 'canna-self-insert-command) + ((boundp 'EGG) ; 89.9.7 by K.Handa + 'egg-self-insert-command) + (t + 'picture-self-insert)))) + (picture-substitute 'self-insert-command picture-self-insert) + (picture-substitute 'completion-separator-self-insert-command + picture-self-insert) + (picture-substitute 'completion-separator-self-insert-autofilling + picture-self-insert)) (picture-substitute 'forward-char 'picture-forward-column) (picture-substitute 'backward-char 'picture-backward-column) (picture-substitute 'delete-char 'picture-clear-column) @@ -634,6 +726,13 @@ (define-key picture-mode-map "\C-c>" 'picture-movement-right) (define-key picture-mode-map "\C-c^" 'picture-movement-up) (define-key picture-mode-map "\C-c." 'picture-movement-down) + ;;; 89.9.7 by K.Handa + (define-key picture-mode-map "\C-ck" 'picture-insert-string) + (define-key picture-mode-map "\C-c~" 'picture-movement-wnw) + (define-key picture-mode-map "\C-c\"" 'picture-movement-ene) + (define-key picture-mode-map "\C-c?" 'picture-movement-wsw) + (define-key picture-mode-map "\C-c|" 'picture-movement-ese) + ;;; end of patch (define-key picture-mode-map "\C-c`" 'picture-movement-nw) (define-key picture-mode-map "\C-c'" 'picture-movement-ne) (define-key picture-mode-map "\C-c/" 'picture-movement-sw) @@ -657,6 +756,8 @@ (defvar picture-mode-old-mode-name) (defvar picture-mode-old-major-mode) (defvar picture-mode-old-truncate-lines) +(defvar picture-mode-old-self-insert-after-hook) +(defvar self-insert-after-hook) ;;;###autoload (defun picture-mode () @@ -743,6 +844,13 @@ (default-value 'picture-tab-chars)) (make-local-variable 'picture-vertical-step) (make-local-variable 'picture-horizontal-step) + ;;; 89.9.17 patch by K.Handa + (set (make-local-variable 'picture-mode-old-self-insert-after-hook) + (if (boundp 'self-insert-after-hook) + self-insert-after-hook)) + (set (make-local-variable 'self-insert-after-hook) + 'picture-insert-after-hook) + ;;; end of patch (set (make-local-variable 'picture-mode-old-truncate-lines) truncate-lines) (setq truncate-lines t) (picture-set-motion 0 1) @@ -768,6 +876,9 @@ (setq mode-name picture-mode-old-mode-name) (use-local-map picture-mode-old-local-map) (setq major-mode picture-mode-old-major-mode) + ;;; 89.9.17 patch by K.Handa + (setq self-insert-after-hook picture-mode-old-self-insert-after-hook) + ;;; end of patch (kill-local-variable 'tab-stop-list) (setq truncate-lines picture-mode-old-truncate-lines) (force-mode-line-update) --- emacs-22.1/lisp/version.el~ 2007-06-02 04:23:57 +0000 +++ emacs-22.1/lisp/version.el 2007-06-03 23:21:07 +0000 @@ -55,8 +55,8 @@ (interactive "P") (let ((version-string (format (if (not (interactive-p)) - "GNU Emacs %s (%s%s%s)\n of %s on %s" - "GNU Emacs %s (%s%s%s) of %s on %s") + "GNU Emacs %s (%s%s%s, emcws)\n of %s on %s" + "GNU Emacs %s (%s%s%s, emcws) of %s on %s") emacs-version system-configuration (cond ((featurep 'motif) @@ -88,6 +88,12 @@ (purecopy (concat "\n$Id: " (subst-char-in-string ?\n ?\s (emacs-version)) " $\n"))) +;;; Canna+Wnn+Sj3 version +(provide 'emcws) + +(defconst emcws-version "200706010358" "\ +Version numbers of this version of Emcws.") + ;;Local variables: ;;version-control: never ;;End: --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/wnn-client.el 2007-06-03 23:21:07 +0000 @@ -0,0 +1,1176 @@ +;; Wnn3 server interface for Egg +;; Coded by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp) + +;; This file is part of Egg on Mule (Multilingual Environment) + +;; Egg is distributed in the forms of patches to GNU +;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC +;; LICENSE which is distributed along with GNU Emacs by the +;; Free Software Foundation. + +;; 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 EMACS GENERAL PUBLIC LICENSE for +;; more details. + +;; You should have received a copy of the GNU EMACS GENERAL +;; PUBLIC LICENSE along with Nemacs; see the file COPYING. +;; If not, write to the Free Software Foundation, 675 Mass +;; Ave, Cambridge, MA 02139, USA. + +;;; +;;; Nemacs - Wnn V3 server interface in elisp +;;; + +;;; 93.4.6 modified for Mule Ver.0.9.7.1 +;;; by T.Saneto <sanewo@pdp.crl.sony.co.jp> +;;; Bug in wnn-bunsetu-yomi-equal fixed. + +(provide 'wnn-client) + +;;; +;;; Wnn deamon command constants +;;; + +(defconst JD_OPEN_IN 9 "変換") ;;; V3.0 +(defconst JD_OPEN 1 "利用者登録") +(defconst JD_CLOSE 2 "利用者削除") +(defconst JD_BEGIN 3 "変換開始") +(defconst JD_END 4 "頻度更新") +;;; +(defconst JD_NEXT 17 "次候補") ;;; 0x11 +(defconst JD_RECONV 18 "再変換(文字列変更)") ;;; 0x12 +(defconst JD_TANCONV 19 "再変換(文節伸縮)") ;;; 0x13 +;;; +(defconst JD_UDP 33 "") ;;; 0x21 +(defconst JD_UDCHG 34 "利用者辞書変更") ;;; 0x22 +(defconst JD_FREQSV 35 "辞書退避") ;;; 0x23 +(defconst JD_DICADD 36 "辞書追加") ;;; 0x24 +(defconst JD_DICDEL 37 "辞書削除") ;;; 0x25 +(defconst JD_DICINFO 38 "辞書情報") ;;; 0x26 +(defconst JD_DICSTAT 39 "") ;;; 0x27 V3.0 + +(defconst JD_WDEL 49 "単語削除") ;;; 0x31 +(defconst JD_WSCH 50 "単語検索") ;;; 0x32 +(defconst JD_WREG 51 "単語登録") ;;; 0x33 +(defconst JD_WHDEL 52 "") ;;; 0x34 + +(defconst JD_SETEVF 65 "変換方式変更") ;;; 0x41 +(defconst JD_GETEVF 66 "変換方式情報") ;;; 0x42 + +(defconst JD_MKDIR 81 "") ;;; 0x51 V3.0 +(defconst JD_ACCESS 82 "") ;;; 0x52 V3.0 +(defconst JD_WHO 83 "利用者一覧") ;;; 0x53 V3.0 +(defconst JD_VERSION 84 "") ;;; 0x54 V3.0 + + +(defvar wnn-server-buffer nil "Buffer associated with Wnn server process.") + +(defvar wnn-server-process nil "Wnn Kana Kanji hankan process.") + +(defvar wnn-command-tail-position nil) +(defvar wnn-command-buffer nil) + +(defvar wnn-result-buffer nil) +(defvar wnn-henkan-string nil) +(defvar wnn-bunsetu-suu nil) + +(defvar wnn-return-code nil) +(defvar wnn-error-code nil) + +;;; +;;; Put data into buffer +;;; + +(defun wnn-put-4byte (integer) + (insert (if (<= 0 integer) 0 255) + (logand 255 (lsh integer -16)) + (logand 255 (lsh integer -8)) + (logand 255 integer))) + +(defun wnn-put-string (str) + (insert str 0)) + +(defun wnn-put-string* (str) + (let ((size (length str)) + (i 0)) + (while (< i size) + (if (<= 128 (aref str i)) + (progn (insert (aref str i) (aref str (1+ i))) + (setq i (+ i 2))) + (progn (insert 0 (aref str i)) + (setq i (1+ i)))))) + (insert 0 0)) + +(defun wnn-put-bit-position (pos) + (if (< pos 24) (wnn-put-4byte (lsh 1 pos)) + (insert (lsh 1 (- pos 24)) 0 0 0))) + +;;; +;;; Get data from buffer +;;; + +(defun wnn-get-4byte () + + (let ((c 0) (point (point))) + ;;;(goto-char (point-min)) + (while (< (point-max) (+ point 4)) + (accept-process-output) + (if (= c 10) (error "Count exceed.")) + (setq c (1+ c))) + (goto-char point)) + + (let ((point (point))) + (if (not (or (and (= (char-after point) 0) + (< (char-after (+ point 1)) 128)) + (and (= (char-after point) 255) + (<= 128 (char-after (+ point 1)))))) + (error "wnn-get-4byte: integer range overflow.")) + (prog1 + (logior + (lsh (char-after point) 24) + (lsh (char-after (+ point 1)) 16) + (lsh (char-after (+ point 2)) 8) + (lsh (char-after (+ point 3)) 0)) + (goto-char (+ (point) 4))))) + +(defun wnn-peek-4byte () + + (let ((c 0) (point (point))) + ;;;(goto-char (point-min)) + (while (< (point-max) (+ point 4)) + (accept-process-output) + (if (= c 10) (error "Count exceed.")) + (setq c (1+ c))) + (goto-char point)) + + (let ((point (point))) + (if (not (or (and (= (char-after point) 0) + (< (char-after (+ point 1)) 128)) + (and (= (char-after point) 255) + (<= 128 (char-after (+ point 1)))))) + (error "wnn-get-4byte: integer range overflow.")) + (prog1 + (logior + (lsh (char-after point) 24) + (lsh (char-after (+ point 1)) 16) + (lsh (char-after (+ point 2)) 8) + (lsh (char-after (+ point 3)) 0))))) + + +(defun wnn-get-bit-positions () + + (let ((c 0) (point (point))) + ;;;(goto-char (point-min)) + (while (< (point-max) (+ point 4)) + (accept-process-output) + (if (= c 10) (error "Count exceed.")) + (setq c (1+ c))) + (goto-char point)) + + (let* ((point (point)) + (left (+ (lsh (char-after point) 8) + (char-after (+ point 1)))) + (right (+ (lsh (char-after (+ point 2)) 8) + (char-after (+ point 3)))) + (result)) + (forward-char 4) + (let ((i 0)) + (while (< 0 right) + (if (zerop (logand 1 right)) nil + (setq result (cons i result))) + (setq right (lsh right -1)) + (setq i (1+ i))) + (setq i 16) + (while (< 0 left) + (if (zerop (logand 1 left)) nil + (setq result (cons i result))) + (setq left (lsh left -1)) + (setq i (1+ i)))) + (if (= (length result) 1) + (car result) + (nreverse result)))) + +(defun wnn-get-string () + (let ((point (point))) + (skip-chars-forward "^\0") + (let ((c 0)) + (while (not (= (following-char) 0)) + (forward-char -1) + (accept-process-output) + (if (= c 10) (error "Count exceed")) + (setq c (1+ c)) + (skip-chars-forward "^\0"))) + (prog1 + (buffer-substring point (point)) + (forward-char 1)))) + +(defun wnn-get-string* () + (let ((point (point))) + (let ((c 0)) + (while (not (search-forward "\0\0" nil t)) + (accept-process-output) + (goto-char point) + (if (= c 10) (error "Count exceed")) + (setq c (1+ c)))) + (goto-char point) + (if (= (following-char) 0) (delete-char 1) + (forward-char 1)) + (while (< 0 (following-char)) + (forward-char 1) + (if (= (following-char) 0) (delete-char 1) + (forward-char 1))) + (prog1 + (buffer-substring point (point)) + (forward-char 1)))) + +;;; +;;; Wnn Server Command Primitives +;;; + +(defun wnn-command-start (command) + (set-buffer wnn-command-buffer) + (goto-char (point-min)) + (if (not (= (point-max) (+ wnn-command-tail-position 1024))) + (error "wnn command start error")) + (delete-region (point-min) wnn-command-tail-position) + (wnn-put-4byte command)) + +(defun wnn-command-reset () + (save-excursion + (progn + ;;; for Nemacs 3.0 and later +;; (if (fboundp 'set-process-kanji-code) +;; (set-process-kanji-code wnn-server-process 0)) + (set-buffer wnn-command-buffer) +;; (setq kanji-flag nil) +;; (setq kanji-fileio-code 0) ;;; for Nemacs 2.1 + (buffer-disable-undo wnn-command-buffer) + (erase-buffer) + (setq wnn-command-tail-position (point-min)) + (let ((max 1024) (i 0)) + (while (< i max) + (insert 0) + (setq i (1+ i))))))) + +(defun wnn-command-end () + (set-buffer wnn-server-buffer) + (erase-buffer) + (set-buffer wnn-command-buffer) + (setq wnn-command-tail-position (point)) + (process-send-region wnn-server-process (point-min) + (+ (point-min) (lsh (1+ (lsh (- (point) (point-min)) -10)) 10))) + ) + +;;; +;;; Wnn Server Reply primitives +;;; + +(defun wnn-get-result () + (set-buffer wnn-server-buffer) + (condition-case () + (accept-process-output wnn-server-process) + (error nil)) + (goto-char (point-min))) + +(defun wnn-get-return-code () + (setq wnn-return-code (wnn-get-4byte)) + (setq wnn-error-code (if (= wnn-return-code -1) + (wnn-error-symbol (wnn-get-4byte)) + nil)) + (if wnn-error-code nil + wnn-return-code)) + +;;; +;;; Wnn Server Interface: wnn-server-open +;;; + +(defvar *wnn-server-max-kana-string-length* 1000) +(defvar *wnn-server-max-bunsetu-suu* 1000) + +(defvar *wnn-service-name* "wnn") + +(defun wnn-server-open (server-host-name login-name) + (if (wnn-server-active-p) t + (let ((kana_len *wnn-server-max-kana-string-length*) + (klist_len *wnn-server-max-bunsetu-suu*) + (jserver_name + (if (or (null server-host-name) + (equal server-host-name "") + (equal server-host-name "unix")) + (system-name) + server-host-name)) + (user_name + (if (or (null login-name) (equal login-name "")) + (user-login-name) + login-name)) + (host_name (system-name))) + (setq wnn-server-process + (condition-case var + (open-network-stream "Wnn V3" " [Wnn V3 Output Buffer] " + jserver_name *wnn-service-name* ) + (error + (cond((string-match "Unknown host" (car (cdr var))) + (setq wnn-error-code (list ':WNN_UNKNOWN_HOST + jserver_name))) + ((string-match "Unknown service" (car (cdr var))) + (setq wnn-error-code (list ':WNN_UNKNOWN_SERVICE + *wnn-service-name*))) + (t ;;; "Host ... not respoding" + (setq wnn-error-code ':WNN_SOCK_OPEN_FAIL))) + nil))) + (if (null wnn-server-process) nil + (setq wnn-server-buffer (get-buffer " [Wnn V3 Output Buffer] ")) + (setq wnn-command-buffer (get-buffer-create " [Wnn V3 Command Buffer] ")) + (setq wnn-result-buffer (get-buffer-create " [Wnn V3 Result Buffer] ")) + + (save-excursion + ;;; for Nemacs 3.0 +;; (if (fboundp 'set-process-kanji-code) +;; (set-process-kanji-code wnn-server-process 0)) + (progn + (set-buffer wnn-server-buffer) +;; (setq kanji-flag nil) + ;;; for Nemacs 2.1 +;; (setq kanji-fileio-code 0) + (buffer-disable-undo wnn-server-buffer) + ) + (progn + (set-buffer wnn-result-buffer) +;; (setq kanji-flag nil) + ;;; for Nemacs 2.1 +;; (setq kanji-fileio-code 0) + (buffer-disable-undo wnn-result-buffer)) + (progn + (set-buffer wnn-command-buffer) +;; (setq kanji-flag nil) + ;;; for Nemacs 2.1 +;; (setq kanji-fileio-code 0) + (buffer-disable-undo wnn-command-buffer) + (erase-buffer) + (setq wnn-command-tail-position (point-min)) + (let ((max 1024) (i 0)) + (while (< i max) + (insert 0) + (setq i (1+ i))))) + (wnn-command-start JD_OPEN_IN) + (wnn-put-4byte kana_len) + (wnn-put-4byte klist_len) + (wnn-put-string user_name) + (wnn-put-string host_name) + (wnn-command-end) + (wnn-get-result) + (wnn-get-return-code)))))) + +(defun wnn-server-active-p () + (and wnn-server-process + (eq (process-status wnn-server-process) 'open))) + +(defun wnn-connection-error () + (setq wnn-error-code ':wnn-no-connection) + (setq wnn-return-code -1) + nil) + +(defun wnn-zero-arg-command (op) + (if (wnn-server-active-p) + (save-excursion + (wnn-command-start op) + (wnn-command-end) + (wnn-get-result) + (wnn-get-return-code)) + (wnn-connection-error))) + +(defun wnn-server-close () + (wnn-zero-arg-command JD_CLOSE)) + +;;; Wnn Result Buffer's layout: +;;; +;;; { length:4 kana 0 kouhoSuu:4 kouhoNo:4 +;;; {jihoNo:4 serialNo:4 jirituGo 0 fuzokuGo 0 } ... +;;; } +;;; 0 0 0 0 + +(defun wnn-skip-length () + (goto-char (+ (point) 4))) + +(defun wnn-skip-4byte () + (goto-char (+ (point) 4))) + +(defun wnn-skip-yomi () + (skip-chars-forward "^\0") (forward-char 1)) + +(defun wnn-skip-kouho () + (goto-char (+ (point) 8)) + (skip-chars-forward "^\0") (forward-char 1) + (skip-chars-forward "^\0") (forward-char 1) + ) + +(defun wnn-forward-char (n) + (let ((i 1)) + (while (<= i n) + (if (<= 128 (following-char)) + (forward-char 2) + (forward-char 1)) + (setq i (1+ i))))) + +;;; +;;; entry function +;;; +(defun wnn-server-henkan-begin (henkan-string) + (if (not (wnn-server-active-p)) (wnn-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (setq wnn-henkan-string henkan-string) + (set-buffer wnn-result-buffer) + (erase-buffer) + (setq wnn-bunsetu-suu 0) + (goto-char (point-min)) + (wnn-command-start JD_BEGIN) + (wnn-put-string* henkan-string) + (wnn-command-end) + (wnn-get-result) + (wnn-henkan-recieve))))) + +;;; +;;; entry function +;;; +(defun wnn-server-henkan-quit () t) + +;;; +;;; entry function +;;; +(defun wnn-server-henkan-end (bunsetu-no) + (if (not (wnn-server-active-p)) (wnn-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (let (length jisho-no serial-no kouho-no p0) + (wnn-command-start JD_END) + (set-buffer wnn-result-buffer) + (goto-char (point-min)) + (let ((max (if (and (integerp bunsetu-no) + (<= 0 bunsetu-no) + (<= bunsetu-no wnn-bunsetu-suu)) + bunsetu-no + wnn-bunsetu-suu)) + (i 0)) + (while (< i max) + (setq length (wnn-get-4byte)) + (setq p0 (point)) + (wnn-skip-yomi) + (wnn-skip-4byte) ;;; kouho suu + (setq kouho-no (wnn-get-4byte)) + (let ((j 0)) + (while (< j kouho-no) + (wnn-skip-kouho) + (setq j (1+ j)))) + (setq jisho-no (wnn-get-4byte)) + (setq serial-no (wnn-get-4byte)) + (goto-char (+ p0 length)) + (set-buffer wnn-command-buffer) + (insert 0 ) + (wnn-put-4byte jisho-no) + (wnn-put-4byte serial-no) + (set-buffer wnn-result-buffer) + (setq i (1+ i))))) + (set-buffer wnn-command-buffer) + (insert 255) + (wnn-command-end) + (wnn-get-result) + (wnn-get-return-code))))) + +(defun wnn-result-goto-bunsetu (bunsetu-no) + (goto-char (point-min)) + (let (length (i 0)) + (while (< i bunsetu-no) + (setq length (wnn-get-4byte)) + (goto-char (+ (point) length)) + (setq i (1+ i))))) + +;;; +;;; entry function +;;; +(defun wnn-server-henkan-kakutei (bunsetu-no jikouho-no) + (cond((not (wnn-server-active-p)) (wnn-connection-error)) + ((or (< bunsetu-no 0) (<= wnn-bunsetu-suu bunsetu-no)) + nil) + (t + (let ((inhibit-quit t)) + (save-excursion + (set-buffer wnn-result-buffer) + (let (kouho-suu) + (wnn-result-goto-bunsetu bunsetu-no) + (wnn-skip-length) + (wnn-skip-yomi) + (setq kouho-suu (wnn-get-4byte)) + (if (or (< jikouho-no 0) (<= kouho-suu jikouho-no)) nil + (delete-char 4) (wnn-put-4byte jikouho-no) + t))))))) + +;;; +;;; entry function +;;; +(defun wnn-server-henkan-next (bunsetu-no) + (if (not (wnn-server-active-p)) (wnn-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (let (p0 p1 kouho-suu length yomi0 yomi1) + (set-buffer wnn-result-buffer) + (wnn-result-goto-bunsetu bunsetu-no) + (setq length (wnn-get-4byte)) + (setq p0 (point)) + (setq p1 (+ p0 length)) + (setq yomi0 (point)) + (wnn-skip-yomi) + (setq yomi1 (point)) + (setq kouho-suu (wnn-peek-4byte)) + (cond((< 1 kouho-suu) t) + (t + (wnn-command-start JD_NEXT) + (wnn-put-4byte bunsetu-no) + (wnn-command-end) + (wnn-get-result) + (wnn-get-return-code) + (if (= wnn-return-code -1) wnn-return-code + (let (jl jisho-no serial-no kanji) + (set-buffer wnn-result-buffer) + (delete-region (point) p1) + (wnn-put-4byte wnn-return-code) + (wnn-put-4byte 0) ;;; current jikouho number + (set-buffer wnn-server-buffer) + (while (not (= (setq jl (wnn-get-4byte)) -1)) + (setq jisho-no (wnn-get-4byte) + serial-no (wnn-get-4byte) + kanji (wnn-get-string*)) + (set-buffer wnn-result-buffer) + (wnn-put-4byte jisho-no) + (wnn-put-4byte serial-no) + (insert kanji 0) + (let ((p1 (point)) fuzoku) + (goto-char yomi0) + (wnn-forward-char jl) + (setq fuzoku (point)) + (goto-char p1) + (insert-buffer-substring wnn-result-buffer fuzoku yomi1)) + (set-buffer wnn-server-buffer)) + (set-buffer wnn-result-buffer) + (setq length (- (point) p0)) + (goto-char p0) (delete-char -4) + (wnn-put-4byte length)) + t)))))))) + +;;(defun jd_reconv (bunsetu-no new-kana) +;; (if (not (wnn-server-active-p)) (wnn-connection-error) +;; (if (= bunsetu-no 0) (jd_begin kana) +;; (let ((inhibit-quit t)) +;; (save-excursion +;; (wnn-command-start JD_RECONV) +;; (wnn-put-4byte bunsetu-no) +;; (wnn-put-string* new-kana) +;; (wnn-command-end) +;; (wnn-get-result) +;; (wnn-henkan-recieve bunsetu-no)))))) + +;;; +;;; entry function +;;; +(defun wnn-server-bunsetu-henkou (bunsetu-no bunsetu-length) + (cond((not (wnn-server-active-p)) (wnn-connection-error)) + ((or (< bunsetu-no 0) (<= wnn-bunsetu-suu bunsetu-no)) + nil) + (t + (let ((inhibit-quit t)) + (save-excursion + (set-buffer wnn-result-buffer) + (wnn-result-goto-bunsetu bunsetu-no) + (wnn-command-start JD_TANCONV) + (wnn-put-4byte bunsetu-no) + (wnn-put-4byte bunsetu-length) + (wnn-command-end) + (wnn-get-result) + (setq wnn-bunsetu-suu bunsetu-no) + (wnn-henkan-recieve)))))) + +(defun wnn-henkan-recieve () + (wnn-get-return-code) + (if (= wnn-return-code -1) nil + (let (p0 p1 length s-ichi jl fl jisho-no serial-no kanji fuzokugo) + (setq wnn-bunsetu-suu (+ wnn-bunsetu-suu wnn-return-code)) + (if (zerop wnn-return-code) nil + (setq s-ichi (wnn-peek-4byte)) + (set-buffer wnn-result-buffer) + (delete-region (point) (point-max)) + (setq p0 (point)) + (insert wnn-henkan-string 0 0 0 0) + (goto-char p0) + (wnn-forward-char s-ichi) + (delete-region p0 (point)) + (set-buffer wnn-server-buffer) + (while (not (= (setq s-ichi (wnn-get-4byte)) -1)) + (setq jl (wnn-get-4byte) + fl (wnn-get-4byte) + jisho-no (wnn-get-4byte) + serial-no (wnn-get-4byte) + kanji (wnn-get-string*)) + (set-buffer wnn-result-buffer) + (setq p0 (point)) + (wnn-forward-char jl) + (setq p1 (point)) + (wnn-forward-char fl) + (setq fuzokugo (buffer-substring p1 (point))) + (insert 0) ;;; yomi + (wnn-put-4byte 1) ;;; kouho suu + (wnn-put-4byte 0) ;;; current kouho number + (wnn-put-4byte jisho-no) + (wnn-put-4byte serial-no) + (insert kanji 0 fuzokugo 0) + (setq length (- (point) p0)) + (goto-char p0) (wnn-put-4byte length) + (goto-char (+ (point) length)) + (set-buffer wnn-server-buffer))))) + wnn-return-code) + +(defun wnn-bunsetu-suu () wnn-bunsetu-suu) + +(defun wnn-bunsetu-kanji (bunsetu-no &optional buffer) + (let ((savebuffer (current-buffer))) + (unwind-protect + (progn + (set-buffer wnn-result-buffer) + (if (or (< bunsetu-no 0) + (<= wnn-bunsetu-suu bunsetu-no)) + nil + (wnn-result-goto-bunsetu bunsetu-no) + (wnn-skip-length) + (wnn-skip-yomi) + + (wnn-skip-4byte) ;;; kouho-suu + (let ((i 0) (max (wnn-get-4byte))) + (while (< i max) + (wnn-skip-kouho) + (setq i (1+ i)))) + + (let ( p1 p2 p3 ) + (goto-char (+ (point) 4 4)) + (setq p1 (point)) + (skip-chars-forward "^\0") (setq p2 (point)) + (forward-char 1) (skip-chars-forward "^\0") + (setq p3 (point)) + (if (null buffer) + (concat (buffer-substring p1 p2) (buffer-substring (1+ p2) p3)) + (set-buffer buffer) + (insert-buffer-substring wnn-result-buffer p1 p2) + (insert-buffer-substring wnn-result-buffer (1+ p2) p3) + nil)))) + (set-buffer savebuffer)))) + +(defun wnn-bunsetu-kanji-length (bunsetu-no) + (save-excursion + (set-buffer wnn-result-buffer) + (if (or (< bunsetu-no 0) + (<= wnn-bunsetu-suu bunsetu-no)) + nil + (wnn-result-goto-bunsetu bunsetu-no) + (wnn-skip-length) + (wnn-skip-yomi) + + (wnn-skip-4byte) ;;; kouho-suu + (let ((i 0) (max (wnn-get-4byte))) + (while (< i max) + (wnn-skip-kouho) + (setq i (1+ i)))) + + (let ( p1 p3 ) + (goto-char (+ (point) 4 4)) + (setq p1 (point)) + (skip-chars-forward "^\0")(forward-char 1) (skip-chars-forward "^\0") + (setq p3 (point)) + (- p3 p1 1))))) + +(defun wnn-bunsetu-yomi-moji-suu (bunsetu-no) + (save-excursion + (set-buffer wnn-result-buffer) + (if (or (< bunsetu-no 0) + (<= wnn-bunsetu-suu bunsetu-no)) + nil + (wnn-result-goto-bunsetu bunsetu-no) + (wnn-skip-length) + (let ((c 0) ch) + (while (not (zerop (setq ch (following-char)))) + (if (<= 128 ch) (forward-char 2) + (forward-char 1)) + (setq c (1+ c))) + c)))) + +(defun wnn-bunsetu-yomi (bunsetu-no &optional buffer) + (let ((savebuff (current-buffer))) + (unwind-protect + (progn + (set-buffer wnn-result-buffer) + (if (or (< bunsetu-no 0) + (<= wnn-bunsetu-suu bunsetu-no)) + nil + (wnn-result-goto-bunsetu bunsetu-no) + (wnn-skip-length) + (let (p1 p2 ) + (setq p1 (point)) + (skip-chars-forward "^\0") + (if (null buffer ) (buffer-substring p1 (point)) + (setq p2 (point)) + (set-buffer buffer) + (insert-buffer-substring wnn-result-buffer p1 p2) + t)))) + (set-buffer savebuff)))) + +(defun wnn-bunsetu-yomi-equal (bunsetu-no yomi) + (save-excursion + (set-buffer wnn-result-buffer) + (if (or (< bunsetu-no 0) + (<= wnn-bunsetu-suu bunsetu-no)) + nil + (wnn-result-goto-bunsetu bunsetu-no) + (wnn-skip-length) + (looking-at yomi)))) ; 93.4.6 by T.Saneto + +(defun wnn-bunsetu-kouho-suu (bunsetu-no) + (save-excursion + (set-buffer wnn-result-buffer) + (if (or (< bunsetu-no 0) + (<= wnn-bunsetu-suu bunsetu-no)) + nil + (wnn-result-goto-bunsetu bunsetu-no) + (wnn-skip-length) + (wnn-skip-yomi) + (wnn-get-4byte)))) + +(defun wnn-bunsetu-kouho-list (bunsetu-no) + (save-excursion + (set-buffer wnn-result-buffer) + (if (or (< bunsetu-no 0) + (<= wnn-bunsetu-suu bunsetu-no)) + nil + (wnn-result-goto-bunsetu bunsetu-no) + (wnn-skip-length) + (wnn-skip-yomi) + (let ((max (wnn-get-4byte)) (i 0) (result nil) p0 p1) + (wnn-skip-4byte) ;;; current kouhou number + (while (< i max) + (wnn-skip-4byte) (wnn-skip-4byte) + (setq p0 (point)) + (skip-chars-forward "^\0") + (setq p1 (point)) + (forward-char 1) + (skip-chars-forward "^\0") + (setq result + (cons (concat (buffer-substring p0 p1) + (buffer-substring (1+ p1) (point))) + result)) + (forward-char 1) + (setq i (1+ i))) + (nreverse result))))) + +(defun wnn-bunsetu-kouho-number (bunsetu-no) + (save-excursion + (set-buffer wnn-result-buffer) + (if (or (< bunsetu-no 0) + (<= wnn-bunsetu-suu bunsetu-no)) + nil + (wnn-result-goto-bunsetu bunsetu-no) + (wnn-skip-length) + (wnn-skip-yomi) + (wnn-skip-4byte) + (wnn-get-4byte))) + ) + +(defun wnn-bunsetu-kouho-kanji (bunsetu-no kouho-no) + (save-excursion + (set-buffer wnn-result-buffer) + (if (or (< bunsetu-no 0) + (<= wnn-bunsetu-suu bunsetu-no)) + nil + (wnn-result-goto-bunsetu bunsetu-no) + (wnn-skip-length) (wnn-skip-yomi) + (let ((kouho-suu (wnn-get-4byte))) + (if (or (< kouho-no 0) (<= kouho-suu kouho-no)) + nil + (wnn-skip-4byte) ;;; current kouho number + (let ((i 0)) + (while (< i kouho-no) + (wnn-skip-kouho) + (setq i (1+ i)))) + (let ( p1 p2 p3 ) + (goto-char (+ (point) 4 4)) + (setq p1 (point)) + (skip-chars-forward "^\0") (setq p2 (point)) + (forward-char 1) (skip-chars-forward "^\0") + (setq p3 (point)) + (concat (buffer-substring p1 p2) (buffer-substring (1+ p2) p3)))))))) + +(defun wnn-bunsetu-kouho-inspect (bunsetu-no kouho-no) + (save-excursion + (set-buffer wnn-result-buffer) + (if (or (< bunsetu-no 0) + (<= wnn-bunsetu-suu bunsetu-no)) + nil + (let (p0 p1 kouho-suu jiritugo fuzokugo yomi jishono serial ) + (wnn-result-goto-bunsetu bunsetu-no) + (wnn-skip-length) + (setq p0 (point)) + (wnn-skip-yomi) + (setq p1 (1- (point))) + (setq kouho-suu (wnn-get-4byte)) + (if (or (< kouho-no 0) (<= kouho-suu kouho-no)) + nil + (wnn-skip-4byte) ;;; current kouho number + (let ((i 0)) + (while (< i kouho-no) + (wnn-skip-kouho) + (setq i (1+ i)))) + (setq jishono (wnn-get-4byte)) + (setq serial (wnn-get-4byte)) + (setq jiritugo (wnn-get-string)) + (setq fuzokugo (wnn-get-string)) + (goto-char p1) + (if (not (equal "" fuzokugo)) (search-backward fuzokugo p0)) + (setq yomi (buffer-substring p0 (point))) + (list jiritugo fuzokugo yomi jishono serial)))))) + +(defun wnn-simple-command (op arg) + (if (wnn-server-active-p) + (let ((inhibit-quit t)) + (save-excursion + (wnn-command-start op) + (wnn-put-4byte arg) + (wnn-command-end) + (wnn-get-result) + (wnn-get-return-code))) + (wnn-connection-error))) + +(defun jd_udp (dict-no) + (wnn-simple-command JD_UDP dict-no)) + +(defun wnn-server-set-current-dict (dict-no) + (wnn-simple-command JD_UDCHG dict-no)) + +(defun wnn-server-dict-save () + (wnn-zero-arg-command JD_FREQSV)) + +(defun wnn-server-use-dict (dict-file-name hindo-file-name priority readonly-flag) + (if (not (wnn-server-active-p))(wnn-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (wnn-command-start JD_DICADD) + (wnn-put-string dict-file-name) + (wnn-put-string hindo-file-name) + (wnn-put-4byte priority) + (wnn-put-4byte (if readonly-flag 1 0)) + (wnn-command-end) + (wnn-get-result) + (wnn-get-return-code))))) + +(defun jd_dicdel (dict-no) + (wnn-simple-command JD_DICDEL dict-no)) + +(defun jd_dicinfo () + (if (not (wnn-server-active-p)) (wnn-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (wnn-command-start JD_DICINFO) + (wnn-command-end) + (wnn-get-result) + (let ((dic-no 0) (result nil)) + (while (not (= (setq dic-no (wnn-get-4byte)) -1)) + (setq result + (cons (list + dic-no + (wnn-get-4byte) ;;; ttl_hindo + (wnn-get-4byte) ;;; dic_type + (wnn-get-4byte) ;;; udp + (wnn-get-4byte) ;;; dic_size + (wnn-get-4byte) ;;; prioritry + (wnn-get-4byte) ;;; readonly no:0 yes:1 + (wnn-get-string) ;;; dic_name + (wnn-get-string) ;;; hindo_name + ) + result)) + (nreverse result))))))) + +(defun jd_dicstat (file-name) + (if (not (wnn-server-active-p)) (wnn-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (wnn-command-start JD_DICSTAT) + (wnn-put-string file-name) + (wnn-command-end) + (wnn-get-result) + (wnn-get-return-code))))) + +(defun wnn-server-dict-delete (serial-no yomi) + (if (not (wnn-server-active-p)) (wnn-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (wnn-command-start JD_WDEL) + (wnn-put-4byte serial-no) + (wnn-put-string* yomi) + (wnn-command-end) + (wnn-get-result) + (wnn-get-return-code))))) + +(defun wnn-server-dict-info (yomi) + (if (not (wnn-server-active-p)) (wnn-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (wnn-command-start JD_WSCH) + (wnn-put-string* yomi) + (wnn-command-end) + (wnn-get-result) + (wnn-get-return-code) + (if (= wnn-return-code -1) nil + (let ((hindo 0) bunpo jisho serial kanji (result nil)) + (while (not (= (setq hindo (wnn-get-4byte)) -1)) + (setq bunpo (wnn-get-bit-positions)) + (setq jisho (wnn-get-4byte)) + (setq serial (wnn-get-4byte)) + (setq kanji (wnn-get-string*)) + (setq result + (if (integerp bunpo) + (cons (list kanji bunpo hindo jisho serial) + result) + (append + (mapcar (function (lambda (x) + (list kanji x hindo jisho serial))) + bunpo) + result)))) + (nreverse result))))))) + +(defun wnn-server-dict-add (kanji yomi bunpo) + (if (not (wnn-server-active-p))(wnn-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (wnn-command-start JD_WREG) + (wnn-put-bit-position bunpo) + (wnn-put-4byte 129) ;;; 0x81 hindo always 1 with imatukattayo bit.(jl.c) + (wnn-put-string* kanji) + (wnn-put-string* yomi) + (wnn-command-end) + (wnn-get-result) + (wnn-get-return-code))))) + +(defun jd_whdel (serial-no yomi bunpo) + (if (not (wnn-server-active-p)) (wnn-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (wnn-command-start JD_WHDEL) + (wnn-put-4byte serial-no) + (wnn-put-string* yomi) + (wnn-put-4byte bunpo) + (wnn-command-end) + (wnn-get-result) + (wnn-get-return-code))))) + +(defun jd_setevf (bunsetu-su p1 p2 p3 p4 p5) + (if (not (wnn-server-active-p)) (wnn-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (wnn-command-start JD_SETEVF) + (wnn-put-4byte bunsetu-su) + (wnn-put-4byte p1) + (wnn-put-4byte p2) + (wnn-put-4byte p3) + (wnn-put-4byte p4) + (wnn-put-4byte p5) + (wnn-put-4byte 0);; p6 + (wnn-put-4byte 0);; p7 + (wnn-put-4byte 0);; p8 + (wnn-put-4byte 0);; p9 + (wnn-put-4byte 0);; p10 + (wnn-command-end) + (wnn-get-result) + (wnn-get-return-code))))) + +(defun jd_getevf () + (if (not (wnn-server-active-p)) (wnn-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (wnn-command-start JD_GETEVF) + (wnn-command-end) + (wnn-get-result) + (prog1 + (list + (wnn-get-4byte) ;;; bunsetu-su + (wnn-get-4byte) ;;; p1 + (wnn-get-4byte) ;;; p2 + (wnn-get-4byte) ;;; p3 + (wnn-get-4byte) ;;; p4 + (wnn-get-4byte) ;;; p5 + ) + (wnn-get-4byte);; p6 + (wnn-get-4byte);; p7 + (wnn-get-4byte);; p8 + (wnn-get-4byte);; p9 + (wnn-get-4byte);; p10 + ))))) + +(defun wnn-server-make-directory (dir-name) + (if (not (wnn-server-active-p)) (wnn-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (wnn-command-start JD_MKDIR) + (wnn-put-string dir-name) + (wnn-command-end) + (wnn-get-result) + (wnn-get-return-code))))) + +(defun wnn-server-file-access (file-name access-mode) + (if (not (wnn-server-active-p)) (wnn-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (wnn-command-start JD_ACCESS) + (wnn-put-4byte access-mode) + (wnn-put-string file-name) + (wnn-command-end) + (wnn-get-result) + (setq wnn-return-code (wnn-get-4byte)) + (setq wnn-error-code nil) + wnn-return-code)))) + +(defun jd_who () + (if (not (wnn-server-active-p)) (wnn-connection-error) + (let ((inhibit-quit t)) + (save-excursion + (wnn-command-start JD_WHO) + (wnn-command-end) + (wnn-get-result) + (let ( number user host result) + (while (not (= (setq number (wnn-get-4byte)) -1)) + (setq result + (cons + (list number (wnn-get-string) (wnn-get-string)) + result))) + (nreverse result)))))) + +(defun jd_version () + (wnn-zero-arg-command JD_VERSION)) + +(defconst *wnn-error-alist* + '( + (1 :WNN_NO_EXIST + "ファイルが存在しません。") + (2 :WNN_NOT_USERDICT + "正しいユーザー辞書ではありません。") + (3 :WNN_MALLOC_ERR + "メモリallocで失敗しました。") + (4 :WNN_NOT_SYSTEM + "正しいシステム辞書ではありません。") + (5 :WNN_NOT_A_DICT + "正しい辞書ではありません。") + (6 :WNN_FILE_NO_SPECIFIED + "ファイル名が指定されていません。") + (8 :WNN_HINDO_FILE_NOT_SPECIFIED + "システム辞書に対して、頻度ファイルの指定がありません。") + (9 :WNN_JISHOTABLE_FULL + "辞書テーブルが一杯です。") + (10 :WNN_HINDO_NO_MATCH + "頻度ファイルが、指定された辞書の頻度ファイルではありません。") + (11 :WNN_PARAMR + "ファイルの読み込み権限がありません。") + (12 :WNN_HJT_FULL + "グローバル頻度テーブルが一杯です。") + (13 :WNN_JT_FULL + "グローバル辞書テーブルが一杯です。") + (15 :WNN_PARAMW + "ファイルに対する書き込み権限がありません。") + (16 :WNN_OPENF_ERR + "ファイルがオープンできません。") +;;; 辞書削除関係のエラー + (20 :WNN_DICT_NOT_USED + "その番号の辞書は、使われていません。") +;;; ユーザー辞書変更関係のエラー +;;; +;;;WNN_DICT_NOT_USED +;;; + (21 :WNN_NOT_A_USERDICT + "指定されて辞書は、ユーザー辞書ではありません。") + (22 :WNN_READONLY + "リードオンリーの辞書は、カレントユーザー辞書にはできません。") +;;; 辞書セーブ関係のエラー +;;; +;;; WNN_PARAMW +;;; WNN_OPENF_ERR +;;; 変換時のエラー +;;; jishobiki.c + (30 :WNN_JMT_FULL + "辞書テーブルがあふれています。 ") + + (31 :WNN_LONG_MOJIRETSU + "変換しようとする文字列が長過ぎます。") + (32 :WNN_WKAREA_FULL + "付属語解析領域が不足しています。") + (33 :WNN_KAREA_FULL + "解析領域が不足しています。") + +;;; 単語登録時のエラー + (40 :WNN_YOMI_LONG + "読みが長過ぎます。") + (41 :WNN_KANJI_LONG + "漢字が長過ぎます。") + (42 :WNN_BAD_YOMI + "読みに不適当な文字が含まれています。") + (43 :WNN_NO_YOMI + "読みの長さが0です。") + (44 :WNN_NO_CURRENT + "カレント辞書が存在しません。") + (45 :WNN_RDONLY + "リードオンリーの辞書に登録しようとしました。") + +;;; 単語削除時、品詞削除時のエラー +;;; +;;;WNN_NO_CURRENT +;;;WNN_RDONLY +;;; + (50 :WNN_WORD_NO_EXIST + "指定された単語が存在しません。") + +;;; 次候補時のエラー + (55 :WNN_JIKOUHO_TOO_MANY + "次候補のエントリーの個数がおお過ぎます。") + +;;; 初期化の時のエラー + (60 :WNN_MALLOC_INITIALIZE + "メモリallocで失敗しました。") + +;;; 単語検索時のエラー +;;; +;;;WNN_BAD_YOMI +;;;WNN_JMT_FULL +;;; + + (68 :WNN_SOME_ERROR + " 何かのエラーが起こりました。") + (69 :WNN_SONOTA + "バグが発生している模様です。") + (70 :WNN_JSERVER_DEAD + "サーバが死んでいます。") + (71 :WNN_ALLOC_FAIL + "jd_beginでallocに失敗") + (72 :WNN_SOCK_OPEN_FAIL + "jd_beginでsocketのopenに失敗") + + (73 :WNN_RCV_SPACE_OVER + "受信スペースからデータがはみだした") + (74 :WNN_MINUS_MOJIRETSU + "文字列の長さの指定が負である") +;;; V3.0 + (80 :WNN_MKDIR_FAIL + " ディレクトリを作り損なった ") + (81 :WNN_BAD_USER + " ユーザ名がない ") + (82 :WNN_BAD_HOST + " ホスト名がない ") + )) + +(defun wnn-error-symbol (code) + (let ((pair (assoc code *wnn-error-alist*))) + (if (null pair) + (list ':wnn-unknown-error-code code) + (car (cdr pair))))) --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/lisp/wnn-egg.el 2007-06-03 23:21:07 +0000 @@ -0,0 +1,2014 @@ +;;; wnn-egg.el --- a inputting method communicating with [jck]server + +;; Author: Satoru Tomura (tomura@etl.go.jp), and +;; Toshiaki Shingu (shingu@cpr.canon.co.jp) +;; Keywords: inputting method + +;; This file is part of Egg on Mule (Multilingual Environment) + +;; 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, 675 Mass Ave, Cambridge, MA 02139, USA. + +;;; Commentary: + +;;; Modified for Wnn V4 and Wnn6 by Satoru Tomura(tomura@etl.go.jp) +;;; Modified for Wnn6 by OMRON +;;; Written by Toshiaki Shingu (shingu@cpr.canon.co.jp) +;;; Modified for Wnn V4 library on wnn4v3-egg.el + +;;; たまご「たかな」バージョン +;;; 「たかな」とは漬け物のたかなではありません。 +;;; 「たまごよ/かしこく/なーーれ」の略をとって命名しました。 +;;; Wnn V4 の jl ライブラリを使います。 +;;; ライブラリとのインターフェースは wnnfns.c で定義されています。 + +;;; 修正メモ + +;;; 94/2/3 kWnn support by H.Kuribayashi +;;; 93/11/24 henkan-select-kouho: bug fixed +;;; 93/7/22 hinsi-from-menu updated +;;; 93/5/12 remove-regexp-in-string +;;; fixed by Shuji NARAZAKI <narazaki@csce.kyushu-u.ac.jp> +;;; 93/4/22 set-wnn-host-name, set-cwnn-host-name +;;; 93/4/5 EGG:open-wnn, close-wnn modified by tsuiki. +;;; 93/4/2 wnn-param-set +;;; 93/4/2 modified along with wnn4fns.c +;;; 93/3/3 edit-dict-item: bug fixed +;;; 93/1/8 henkan-help-command modified. +;;; 92/12/1 buffer local 'wnn-server-type' and 'cwnn-zhuyin' +;;; so as to support individual its mode with multiple buffers. +;;; 92/11/26 set-cserver-host-name fixed. +;;; 92/11/26 its:{previous,next}-mode by <yasutome@ics.osaka-u.ac.jp> +;;; 92/11/25 set-wnn-host-name was changed to set-{j,c}server-host-name. +;;; 92/11/25 redefined its:select-mode and its:select-mode-from-menu +;;; defined in egg.el to run hook with its mode selection. +;;; 92/11/20 bug fixed related to henkan mode attribute. +;;; 92/11/12 get-wnn-host-name and set-wnn-host-name were changed. +;;; 92/11/10 (set-dict-comment) bug fixed +;;; 92/10/27 (henkan-region-internal) display message if error occurs. +;;; 92/9/28 completely modified for chinese trandlation. +;;; 92/9/28 diced-{use,hindo-set} bug fixed <tetsuya@rabbit.is.s.u-tokyo.ac.jp> +;;; 92/9/22 touroku-henkan-mode by <tsuiki@sfc.keio.ac.jp> +;;; 92/9/18 rewrite wnn-dict-add to support password files. +;;; 92/9/8 henkan-region-internal was modified. +;;; 92/9/8 henkan-mode-map " " 'henkan-next-kouho-dai -> 'henkan-next-kouho +;;; 92/9/7 henkan-mode-map "\C-h" 'help-command -> 'henkan-help-command (Shuji Narazaki) +;;; 92/9/3 wnn-server-get-msg without wnn-error-code. +;;; 92/9/3 get-wnn-lang-name was modified. +;;; 92/8/19 get-wnn-lang-name の変更 (by T.Matsuzawa) +;;; 92/8/5 Bug in henkan-kakutei-first-char fixed. (by Y.Kasai) +;;; 92/7/17 set-egg-henkan-format の変更 +;;; 92/7/17 egg:error の引数を format &rest args に変更 +;;; 92/7/17 henkan/gyaku-henkan-word の修正 +;;; 92/7/17 henkan/gyaku-henkan-paragraph/sentence/word で、 +;;; 表示が乱れるのを修正(save-excursion をはずす) +;;; 92.7.14 Unnecessary '*' in comments of variables deleted. (by T.Ito) +;;; 92/7/10 henkan-kakutei-first-char を追加、C-@ に割り当て。(by K.Handa) +;;; 92/7/8 overwrite-mode のサポート(by K. Handa) +;;; 92/6/30 startup file 周りの変更 +;;; 92/6/30 変換モードのアトリビュートに bold を追加 +;;; (by ITO Toshiyuki <toshi@his.cpl.melco.co.jp>) +;;; 92/6/22 空文字列を変換すると落ちるバグを修正 +;;; 92/5/20 set-egg-henkan-mode-format の bug fix +;;; 92/5/20 egg:set-bunsetu-attribute が大文節で正しく動くように変更 +;;; 92/5/19 version 0 +;;; ---------------------------------------------------------------- + +;;; Code: + +(eval-and-compile + (make-variable-buffer-local 'wnn-server-type) + (make-variable-buffer-local 'cwnn-zhuyin)) + +(defvar egg:*sho-bunsetu-face* nil "*小文節表示に用いる face または nil") +(make-variable-buffer-local + (defvar egg:*sho-bunsetu-overlay* nil "小文節の表示に使う overlay")) + +(defvar egg:*sho-bunsetu-kugiri* "-" "*小文節の区切りを示す文字列") + +(defvar egg:*dai-bunsetu-face* nil "*大文節表示に用いる face または nil") +(make-variable-buffer-local + (defvar egg:*dai-bunsetu-overlay* nil "大文節の表示に使う overlay")) + +(defvar egg:*dai-bunsetu-kugiri* " " "*大文節の区切りを示す文字列") + +(defvar egg:*henkan-face* nil "*変換領域を表示する face または nil") +(make-variable-buffer-local + (defvar egg:*henkan-overlay* nil "変換領域の表示に使う overlay")) + +(defvar egg:*henkan-open* "|" "*変換の始点を示す文字列") +(defvar egg:*henkan-close* "|" "*変換の終点を示す文字列") + +(make-variable-buffer-local + (defvar egg:henkan-mode-in-use nil "buffer が変換中の時 t")) + +;;; ---------------------------------------------------------------- +;;; 以下の its mode 関係の関数は、egg.el で定義されているが、 +;;; たかなでは its mode の切替えに同期して、jserver/cserver, +;;; pinyin/zhuyin の切替えも行ないたいので、再定義している。 +;;; 従って、egg.el, wnn-egg.el の順にロードしなければならない。 + + +(defun its:select-mode (name) + (interactive (list (completing-read "ITS mode: " its:*mode-alist*))) + (if (its:get-mode-map name) + (progn + (setq its:*current-map* (its:get-mode-map name)) + (egg:mode-line-display) + (run-hooks 'its:select-mode-hook)) + (beep)) + ) + +(defun its:select-mode-from-menu () + (interactive) + (setcar (nthcdr 2 its:*select-mode-menu*) its:*mode-alist*) + (setq its:*current-map* (menu:select-from-menu its:*select-mode-menu*)) + (egg:mode-line-display) + (run-hooks 'its:select-mode-hook)) + +(defvar its:select-mode-hook + (function + (lambda () + (cond ((eq its:*current-map* (its:get-mode-map "roma-kana")) + (setq wnn-server-type 'jserver)) + ((eq its:*current-map* (its:get-mode-map "PinYin")) + (setq wnn-server-type 'cserver) + (setq cwnn-zhuyin nil)) + ((eq its:*current-map* (its:get-mode-map "zhuyin")) + (setq wnn-server-type 'cserver) + (setq cwnn-zhuyin t)) + ((eq its:*current-map* (its:get-mode-map "hangul")) + (setq wnn-server-type 'kserver)) + )))) + +(defun its:next-mode () + (interactive) + (let ((pos (its:find its:*current-map* its:*standard-modes*))) + (setq its:*current-map* + (nth (% (1+ pos) (length its:*standard-modes*)) + its:*standard-modes*)) + (egg:mode-line-display) + (run-hooks 'its:select-mode-hook))) + +(defun its:previous-mode () + (interactive) + (let ((pos (its:find its:*current-map* its:*standard-modes*))) + (setq its:*current-map* + (nth (1- (if (= pos 0) (length its:*standard-modes*) pos)) + its:*standard-modes*)) + (egg:mode-line-display) + (run-hooks 'its:select-mode-hook))) + +(defun read-current-its-string (prompt &optional initial-input henkan) + (if henkan + (read-from-minibuffer prompt initial-input) + (egg:read-hiragana-string prompt initial-input))) + +;;;---------------------------------------------------------------------- +;;; +;;; Kana Kanji Henkan +;;; +;;;---------------------------------------------------------------------- + +(defvar wnn-host-name nil "Jserver host name currently connected") +(defvar cwnn-host-name nil "Cserver host name currently connected") +(defvar kwnn-host-name nil "Kserver host name currently connected") +(defvar jserver-list nil "*List of jserver host name") +(defvar cserver-list nil "*List of cserver host name") +(defvar kserver-list nil "*List of kserver host name") +(defvar jserver-host-name nil) + +(defvar egg:*sai-henkan-start* nil) +(defvar egg:*sai-henkan-end* nil) +(defvar egg:*old-bunsetu-suu* nil) + +(defun wnn-egg:kill-emacs-function () + (let ((wnn-server-type)) + (setq wnn-server-type 'jserver) + (close-wnn) + (setq wnn-server-type 'cserver) + (close-wnn) + (setq wnn-server-type 'kserver) + (close-wnn))) + +(add-hook 'kill-emacs-hook 'wnn-egg:kill-emacs-function) + +;; FIXME! +;; =================================================================== +;; Solaris 2.6 + Gcc 3.3 で作った Emcws 22 を Solaris 2.6 に付属してい +;; る Wnn6 の jserver とともに使うと、サーバーとの接続を開始するときに +;; "0:BAD ERRORNO!!! " というエラーを生じます。直接の原因は eggrc-wnn +;; にある wnn6-jserver-setup 関数が set-freq-func-mode 関数を経由して +;; 実行する (wnn-server-set-freq-func-mode 4) が nil を返すことにあり +;; ます。同じ Solaris 2.6 の環境で作った Emcws 21.4 では問題ありません。 +;; +;; 以下の対策は 0 というエラー番号をエラーだと見なさないようにするもの +;; で、唯一の根拠は「こうすれば動く」ということだけです。従って、これ +;; が他の環境でも有効なのか、あるいは害が無いのかは未確認です。 + +;;(defun egg:error (form &rest mesg) +;; (apply 'notify (or form "%s") mesg) +;; (apply 'error (or form "%s") mesg)) +(defun egg:error (form &rest mesg) + (if (equal form "0:BAD ERRORNO!!! ") + nil + (apply 'notify (or form "%s") mesg) + (apply 'error (or form "%s") mesg))) +;; =================================================================== + +(defvar *egg-message-alist* + '((jserver + ((open-wnn "ホスト %s の Wnn を起動しました") + (no-rcfile "%s 上に egg-startup-file がありません。") + (file-saved "Wnnの頻度情報・辞書情報を退避しました。") + (henkan-mode-indicator "漢") + (begin-henkan "変換開始文字列: ") + (end-henkan "変換終了文字列: ") + (kugiri-dai "大文節区切り文字列: ") + (kugiri-sho "小文節区切り文字列: ") + (face-henkan "変換区間表示属性: ") + (face-dai "大文節区間表示属性: ") + (face-sho "小文節区間表示属性: ") + (jikouho "次候補:") + (off-msg "%s %s(%s:%s)を off しました。") + (henkan-help "漢字変換モード: +文節移動 + \\[henkan-first-bunsetu]\t先頭文節\t\\[henkan-last-bunsetu]\t後尾文節 + \\[henkan-backward-bunsetu]\t直前文節\t\\[henkan-forward-bunsetu]\t直後文節 +変換変更 + 大文節次候補 \\[henkan-next-kouho-dai]\t小文節次候補 \\[henkan-next-kouho-sho] + 前候補 \\[henkan-previous-kouho] \t次候補 \\[henkan-next-kouho] + 大文節伸し \\[henkan-bunsetu-nobasi-dai] \t大文節縮め \\[henkan-bunsetu-chijime-dai] + 小文節伸し \\[henkan-bunsetu-nobasi-sho] \t小文節縮め \\[henkan-bunsetu-chijime-sho] + 大文節変換候補選択 \\[henkan-select-kouho-dai] \t小文節変換候補選択 \\[henkan-select-kouho-sho] +変換確定 + 全文節確定 \\[henkan-kakutei] \t直前文節まで確定 \\[henkan-kakutei-before-point] +変換中止 \\[henkan-quit] +") + (hinsimei "品詞名:") + (jishotouroku-yomi "辞書登録『%s』 読み :") + (touroku-jishomei "登録辞書名:" ) + (registerd "辞書項目『%s』(%s: %s)を%sに登録しました。" ) + (yomi "よみ:") +; (no-yomi "『%s』の辞書項目はありません。") + (no-yomi "辞書項目『%s』はありません。") + (jisho "辞書:") + (hindo " 頻度:") + (kanji "漢字:") + (register-notify "辞書項目『%s』(%s: %s)を%sに登録します。") + (cannot-remove "システム辞書項目は削除できません。") + (enter-hindo "頻度を入れて下さい: ") + (remove-notify "辞書項目%s(%s)を%sから削除します。") + (removed "辞書項目%s(%s)を%sから削除しました。") + (jishomei "辞書名:" ) + (comment "コメント: ") + (jisho-comment "辞書:%s: コメント:%s") + (param ("N ( 大 ) 文節解析のN" + "大文節中の小文節の最大数" + "幹語の頻度のパラメータ" + "小文節長のパラメータ" + "幹語長のパラメータ" + "今使ったよビットのパラメータ" + "辞書のパラメータ" + "小文節の評価値のパラメータ" + "大文節長のパラメータ" + "小文節数のパラメータ" + "疑似品詞 数字の頻度" + "疑似品詞 カナの頻度" + "疑似品詞 英数の頻度" + "疑似品詞 記号の頻度" + "疑似品詞 閉括弧の頻度" + "疑似品詞 付属語の頻度" + "疑似品詞 開括弧の頻度")) + )) + (cserver + ((open-wnn "Host %s �$AIO5D cWnn �$ARQ>-Fp6/AK") + (no-rcfile "�$ATZ%s �$AIOC;SP egg-startup-file") + (file-saved "Wnn�$A5DF56HND<~:M4G5dPEO"RQ>-MK3vAK") + (henkan-mode-indicator "�$A::") + (begin-henkan "�$A1d;;?*J<WV7{AP: ") + (end-henkan "�$A1d;;=aJxWV7{AP: ") + (kugiri-dai "�$A4JWi7V8nWV7{AP: ") + (kugiri-sho "�$A5%4J7V8nWV7{AP: ") + (face-henkan "�$A1d;;Gx<d1mJ>JtPT: ") + (face-dai "�$A4JWiGx<d1mJ>JtPT: ") + (face-sho "�$A5%4JGx<d1mJ>JtPT: ") + (jikouho "�$A4N:nQ!:") + (off-msg "%s %s(%s:%s)�$ARQ1; off �$A5tAK") + (henkan-help "�$A::WV1d;;D#J=: +�$A4JWiRF6/ + \\[henkan-first-bunsetu]\t�$AOHM74JWi\t\\[henkan-last-bunsetu]\t�$A=aN24JWi + \\[henkan-backward-bunsetu]\t�$AG0R;8v4JWi\t\\[henkan-forward-bunsetu]\t�$AOBR;8v4JWi +�$A1d;;1d8| + �$A4JWi4N:nQ! \\[henkan-next-kouho-dai]\t�$A5%4J4N:nQ! \\[henkan-next-kouho-sho] + �$AG0:nQ! \\[henkan-previous-kouho] \t�$A4N:nQ! \\[henkan-next-kouho] + �$A4JWi@)U9 \\[henkan-bunsetu-nobasi-dai] \t�$A4JWiJUKu \\[henkan-bunsetu-chijime-dai] + �$A5%4J@)U9 \\[henkan-bunsetu-nobasi-sho] \t�$A5%4JJUKu \\[henkan-bunsetu-chijime-sho] + �$A4JWi1d;;:r295DQ!Tq \\[henkan-select-kouho-dai] \t�$A5%4J1d;;:r295DQ!Tq \\[henkan-select-kouho-sho] + �$A1d;;:r295DQ!Tq \\[henkan-select-kouho-dai] +�$A1d;;H76( + �$AH+NDH76( \\[henkan-kakutei] \t�$AIOR;4JWiN*V95DH76( \\[henkan-kakutei-before-point] +�$AM#V91d;; \\[henkan-quit] +") + (hinsimei "�$A4JPTC{:") + (jishotouroku-yomi "�$A4G5d5GB<!:%s�$A!;F47( :") + (touroku-jishomei "�$A5GB<4G5dC{:" ) + (registerd "�$A4G5dOnD?!:%s�$A!;(%s: %s)�$ARQ1;5GB<5= %s �$AVPAK" ) + (yomi "�$AF47(:") +; (no-yomi "�$A!:%s�$A!;5D4G5dOnD?2;4fTZ") + (no-yomi "�$A4G5dOnD?!:%s�$A!;2;4fTZ") + (jisho "�$A4G5d:") + (hindo " �$AF56H:") + (kanji "�$A::WV:") + (register-notify "�$A4G5dOnD?!:%s�$A!;(%s: %s)�$A=+R*1;5GB<5= %s �$AVP") + (cannot-remove "�$AO5M34G5dOn2;D\O{3}") + (enter-hindo "�$AGkJdHkF56H: ") + (remove-notify "�$A4G5dOnD?%s(%s)�$A=+R*4S %s �$AVPO{3}") + (removed "�$A4G5dOnD?%s(%s)�$ARQ>-4S%s�$AVPO{3}AK") + (jishomei "�$A4G5dC{:" ) + (comment "�$AW"JM: ") + (jisho-comment "�$A4G5d:%s: �$AW"JM:%s") + (param ("�$A=bNv4JWi8vJ}" + "�$A4JWiVP4J5DWn4s8vJ}" + "�$AF56HH(V5" + "�$A4J3$6HH(V5" + "�$AKDIyU}H76HH(V5" + "�$A8U2ESC9}H(V5" + "�$AWV5dSEOH<6H(V5" + "�$A4JF@<[>yV5H(V5" + "�$A4JWi3$H(V5" + "�$A4JWiVP4JJ}H(V5" + "�$AJ}WV5DF56H" + "�$AS"NDWVD85DF56H" + "�$A<G:E5DF56H" + "�$A?*@(;!5DF56H" + "�$A1U@(;!5DF56H" + "�$AWn4s:r298vJ}" + "�$A18SC" + )) + )) + (kserver + ((open-wnn "�$(CH#=:F. %s �$(C@G kWnn �$(C8& �$(CQ&TQG_@>4O4Y.") + (no-rcfile "%s �$(C?! egg-startup-file �$(C@L �$(C>x@>4O4Y.") + (file-saved "kWnn �$(C@G �$(C^:SxoW\C!$^vnpoW\C8& �$(C?E0e@>4O4Y.") + (henkan-mode-indicator "�$(CyS") + (begin-henkan "�$(C\(|5 �$(CKRc7 �$(CY~m.fj: ") + (end-henkan "�$(C\(|5 �$(Cp{Vu �$(CY~m.fj: ") + (kugiri-dai "�$(CS^Y~o= �$(CO!\, �$(CY~m.fj: ") + (kugiri-sho "�$(Ca3Y~o= �$(CO!\, �$(CY~m.fj: ") + (face-henkan "�$(C\(|5 �$(CO!J` �$(CxvcF �$(CaU`u: ") + (face-dai "�$(CS^Y~o= �$(CO!J` �$(CxvcF �$(CaU`u: ") + (face-sho "�$(Ca3Y~o= �$(CO!J` �$(CxvcF �$(CaU`u: ") + (jikouho "�$(C4Y@= �$(C}&\M:") + (off-msg "%s %s(%s:%s)�$(C@; off �$(CG_@>4O4Y.") + (henkan-help "�$(CySm. �$(C\(|5 �$(C8p5e: +�$(CY~o= �$(Cl9TQ + \\[henkan-first-bunsetu]\t�$(C`;Ti �$(CY~o=\t\\[henkan-last-bunsetu]\t�$(C}-Z- �$(CY~o= + \\[henkan-backward-bunsetu]\t�$(CrAnq �$(CY~o=\t\\[henkan-forward-bunsetu]\t�$(CrA}- �$(CY~o= +�$(C\(|5 �$(C\(LZ + �$(CS^Y~o= �$(C4Y@= �$(C}&\M \\[henkan-next-kouho-dai]\t�$(Ca3Y~o= �$(C4Y@= �$(C}&\M \\[henkan-next-kouho-sho] + �$(Cnq �$(C}&\M \\[henkan-previous-kouho] \t�$(C4Y@= �$(C}&\M \\[henkan-next-kouho] + �$(CS^Y~o= �$(C|*S^ \\[henkan-bunsetu-nobasi-dai] \t�$(CS^Y~o= �$(Cuja3 \\[henkan-bunsetu-chijime-dai] + �$(Ca3Y~o= �$(C|*S^ \\[henkan-bunsetu-nobasi-sho] \t�$(Ca3Y~o= �$(Cuja3 \\[henkan-bunsetu-chijime-sho] + �$(CS^Y~o= �$(C\(|5 �$(C4Y@= �$(C}&\M \\[henkan-select-kouho-dai] \t�$(Ca3Y~o= �$(C\(|5 �$(C4Y@= �$(C}&\M \\[henkan-select-kouho-sho] +�$(C\(|5 �$(C|,oR + �$(CnoY~o= �$(C|,oR \\[henkan-kakutei] \t�$(CrAnq �$(CY~o=1nAv �$(C|,oR \\[henkan-kakutei-before-point] +�$(C\(|5 �$(Cqir- \\[henkan-quit] +") + (hinsimei "�$(Cy!^rY#: ") + (jishotouroku-yomi "�$(C^vnp �$(CTtVb!:%s�$(C!; �$(CGQ1[: ") + (touroku-jishomei "�$(CTtVb �$(C^vnpY#: " ) + (registerd "�$(C^vnp �$(Cz#YM!:%s�$(C!;(%s: %s)�$(C@; %s�$(C?! �$(CTtVbG_@>4O4Y." ) + (yomi "�$(CGQ1[: ") +; (no-yomi "�$(C!:%s�$(C!;@G �$(C^vnp �$(Cz#YM@L �$(C>x@>4O4Y.") + (no-yomi "�$(C^vnp �$(Cz#YM �$(C!:%s�$(C!;@L �$(C>x@>4O4Y.") + (jisho "�$(C^vnp: ") + (hindo " �$(C^:Sx: ") + (kanji "�$(CySm.: ") + (register-notify "�$(C^vnp �$(Cz#YM �$(C!:%s�$(C!;(%s: %s)�$(C@; %s�$(C?! �$(CTtVbGO0Z@>4O4Y.") + (cannot-remove "�$(C=C=:E[ �$(C^vnpz#YM@: �$(Ca<K[GR �$(C<v �$(C>x@>4O4Y.") + (enter-hindo "�$(C^:Sx8& �$(Cl}UtGO=J=C?@: ") + (remove-notify "�$(C^vnpz#YM %s(%s)�$(C@; %s�$(C:NEM �$(Ca<K[GO0Z@>4O4Y.") + (removed "�$(C^vnp �$(Cz#YM %s(%s)�$(C@; %s�$(C:NEM �$(Ca<K[G_@>4O4Y.") + (jishomei "�$(C^vnpY#: " ) + (comment "�$(CqI`7: ") + (jisho-comment "�$(C^vnp:%s: �$(CqI`7:%s") + (param ("N (�$(CS^)�$(CY~o= �$(Cz0`0@G N" + "�$(CS^Y~o= �$(C>H@G �$(Ca3Y~o= �$(C<v@G �$(CuLS^b&" + "�$(CJOe^@G �$(C^:Sx �$(CFP7/9LEM" + "�$(Ca3Y~o= �$(C1f@L �$(CFP7/9LEM" + "�$(CJOe^@G �$(C1f@L �$(CFP7/9LEM" + "�$(Cq~PQ �$(C^EiDG_@>4O4Y �$(C:qF. �$(CFP7/9LEM" + "�$(C^vnp@G �$(CFP7/9LEM" + "�$(Ca3Y~o=@G �$(CxDJ$v7 �$(CFP7/9LEM" + "�$(CS^Y~o= �$(C1f@L �$(CFP7/9LEM" + "�$(Ca3Y~o= �$(Cb& �$(CFP7/9LEM" + "�$(CJ#_L �$(Cy!^r: �$(Cb&m.@G �$(C^:Sx" + "�$(CJ#_L �$(Cy!^r: �$(CGQ1[@G �$(C^:Sx" + "�$(CJ#_L �$(Cy!^r: �$(CgHb&m.@G �$(C^:Sx" + "�$(CJ#_L �$(Cy!^r: �$(CQ@{\@G �$(C^:Sx" + "�$(CJ#_L �$(Cy!^r: �$(CxMN@{A@G �$(C^:Sx" + "�$(CJ#_L �$(Cy!^r: �$(C]>aUe^@G �$(C^:Sx" + "�$(CJ#_L �$(Cy!^r: �$(CKRN@{A@G �$(C^:Sx")) + )) + )) + +(defun egg:msg-get (message) + (or + (nth 1 (assoc message (nth 1 (assoc wnn-server-type *egg-message-alist*)))) + (format "No message. Check *egg-message-alist* %s %s" + wnn-server-type message))) + +;;; +;;; Entry functions for egg-startup-file +;;; + +;(defvar wnn-lang-name nil) +;(defvar default-wnn-lang-name "ja_JP") ; 92.8.19 by T.Matsuzawa + +(defvar skip-wnn-setenv-if-env-exist nil + "skip wnn environment setting when the same name environment exists") + +(defmacro push-end (val loc) + (list 'push-end-internal val (list 'quote loc))) + +(defun push-end-internal (val loc) + (set loc + (if (eval loc) + (nconc (eval loc) (cons val nil)) + (cons val nil)))) + +(defun is-wnn6-server () + (= (wnn-server-version) 61697)) + +(defun is-wnn7-server () + (= (wnn-server-version) 61698)) + +(defun add-wnn-dict (dfile hfile priority dmode hmode &optional dpaswd hpaswd) +; (open-wnn-if-disconnected) + (if (null (wnn-server-dict-add + (substitute-in-file-name dfile) + (substitute-in-file-name hfile) + priority dmode hmode dpaswd hpaswd)) + (egg:error (wnn-server-get-msg)))) + +(defun set-wnn-fuzokugo (ffile) +; (open-wnn-if-disconnected) + (if (null (wnn-server-fuzokugo-set (substitute-in-file-name ffile))) + (egg:error (wnn-server-get-msg)))) + +(defun set-wnn-param (&rest param) + (interactive) +; (open-wnn-if-disconnected) + (let ((current-param (wnn-server-get-param)) + (new-param) + (message (egg:msg-get 'param))) + (while current-param + (setq new-param + (cons + (if (or (null param) (null (car param))) + (string-to-number + (read-from-minibuffer (concat (car message) ": ") + (int-to-string (car current-param)))) + (car param)) + new-param)) + (setq current-param (cdr current-param) + message (cdr message) + param (if param (cdr param) nil))) + (apply 'wnn-server-set-param (nreverse new-param)))) + +;; +;; for Wnn6 +;; +(defun add-wnn-fisys-dict (dfile hfile hmode &optional hpaswd) +; (open-wnn-if-disconnected) + (if (null (wnn-server-fisys-dict-add + (substitute-in-file-name dfile) + (substitute-in-file-name hfile) + hmode hpaswd)) + (egg:error (wnn-server-get-msg)))) + +(defun add-wnn-fiusr-dict (dfile hfile dmode hmode &optional dpaswd hpaswd) +; (open-wnn-if-disconnected) + (if (null (wnn-server-fiusr-dict-add + (substitute-in-file-name dfile) + (substitute-in-file-name hfile) + dmode hmode dpaswd hpaswd)) + (egg:error (wnn-server-get-msg)))) + +(defun add-wnn-notrans-dict (dfile priority dmode &optional dpaswd) +; (open-wnn-if-disconnected) + (if (null (wnn-server-notrans-dict-add + (substitute-in-file-name dfile) + priority dmode dpaswd)) + (egg:error (wnn-server-get-msg)))) + +(defun add-wnn-bmodify-dict (dfile priority dmode &optional dpaswd) +; (open-wnn-if-disconnected) + (if (null (wnn-server-bmodify-dict-add + (substitute-in-file-name dfile) + priority dmode dpaswd)) + (egg:error (wnn-server-get-msg)))) + +(defun set-last-is-first-mode (mode) +; (open-wnn-if-disconnected) + (if (null (wnn-server-set-last-is-first + mode)) + (egg:error (wnn-server-get-msg)))) + +(defun set-complex-conv-mode (mode) +; (open-wnn-if-disconnected) + (if (null (wnn-server-set-complex-conv-mode + mode)) + (egg:error (wnn-server-get-msg)))) + +(defun set-okuri-learn-mode (mode) +; (open-wnn-if-disconnected) + (if (null (wnn-server-set-okuri-learn-mode + mode)) + (egg:error (wnn-server-get-msg)))) + +(defun set-okuri-flag (mode) +; (open-wnn-if-disconnected) + (if (null (wnn-server-set-okuri-flag + mode)) + (egg:error (wnn-server-get-msg)))) + +(defun set-prefix-learn-mode (mode) +; (open-wnn-if-disconnected) + (if (null (wnn-server-set-prefix-learn-mode + mode)) + (egg:error (wnn-server-get-msg)))) + +(defun set-prefix-flag (mode) +; (open-wnn-if-disconnected) + (if (null (wnn-server-set-prefix-flag + mode)) + (egg:error (wnn-server-get-msg)))) + +(defun set-suffix-learn-mode (mode) +; (open-wnn-if-disconnected) + (if (null (wnn-server-set-suffix-learn-mode + mode)) + (egg:error (wnn-server-get-msg)))) + +(defun set-common-learn-mode (mode) +; (open-wnn-if-disconnected) + (if (null (wnn-server-set-common-learn-mode + mode)) + (egg:error (wnn-server-get-msg)))) + +(defun set-freq-func-mode (mode) +; (open-wnn-if-disconnected) + (if (null (wnn-server-set-freq-func-mode + mode)) + (egg:error (wnn-server-get-msg)))) + +(defun set-numeric-mode (mode) +; (open-wnn-if-disconnected) + (if (null (wnn-server-set-numeric-mode + mode)) + (egg:error (wnn-server-get-msg)))) + +(defun set-alphabet-mode (mode) +; (open-wnn-if-disconnected) + (if (null (wnn-server-set-alphabet-mode + mode)) + (egg:error (wnn-server-get-msg)))) + +(defun set-symbol-mode (mode) +; (open-wnn-if-disconnected) + (if (null (wnn-server-set-symbol-mode + mode)) + (egg:error (wnn-server-get-msg)))) + +(defun set-yuragi-mode (mode) +; (open-wnn-if-disconnected) + (if (null (wnn-server-set-yuragi-mode + mode)) + (egg:error (wnn-server-get-msg)))) + +(defun wnn6-reset-prev-info () +; (open-wnn-if-disconnected) + (if (null (wnn-reset-previous-info)) + (egg:error (wnn-server-get-msg)))) + +;;; +;;; WNN interface +;;; + +(defmacro make-host-list (name list) + `(cons ,name (delete ,name ,list))) + +(defun set-wnn-host-name (name) + (interactive "sHost name: ") + (let ((wnn-server-type 'jserver)) (close-wnn)) + (setq jserver-list + (make-host-list + name (or jserver-list (list (or wnn-host-name + jserver-host-name + (getenv "JSERVER") + "localhost")))))) + +(defalias 'set-jserver-host-name 'set-wnn-host-name) + +(defun set-cwnn-host-name (name) + (interactive "sHost name: ") + (let ((wnn-server-type 'cserver)) (close-wnn)) + (setq cserver-list + (make-host-list + name (or cserver-list (list (or cwnn-host-name + (getenv "CSERVER") + "localhost")))))) + +(defalias 'set-cserver-host-name 'set-cwnn-host-name) + +(defun set-kwnn-host-name (name) + (interactive "sHost name: ") + (let ((wnn-server-type 'kserver)) (close-wnn)) + (setq kserver-list + (make-host-list + name (or kserver-list (list (or kwnn-host-name + (getenv "KSERVER") + "localhost")))))) + +(defalias 'set-kserver-host-name 'set-kwnn-host-name) + +(defun open-wnn-if-disconnected () + (if (null (wnn-server-isconnect)) + (let ((hostlist + (cond ((eq wnn-server-type 'jserver) + (or jserver-list + (list (or wnn-host-name + jserver-host-name + (getenv "JSERVER") + "localhost")))) + ((eq wnn-server-type 'cserver) + (or cserver-list + (list (or cwnn-host-name + (getenv "CSERVER") + "localhost")))) + ((eq wnn-server-type 'kserver) + (or kserver-list + (list (or kwnn-host-name + (getenv "KSERVER") + "localhost")))))) + (loginname (user-login-name))) + (catch 'succ + (while hostlist + (let ((hostname (car hostlist))) + (if (wnn-server-open hostname loginname) + (progn + (cond ((eq wnn-server-type 'jserver) + (setq wnn-host-name hostname)) + ((eq wnn-server-type 'cserver) + (setq cwnn-host-name hostname)) + ((eq wnn-server-type 'kserver) + (setq kwnn-host-name hostname))) + (throw 'succ hostname)))) + (setq hostlist (cdr hostlist))) + (egg:error (wnn-server-get-msg)))))) + +(defvar egg-default-startup-file "eggrc" + "*Egg startup file name (system default)") + +(defvar egg-startup-file ".eggrc" + "*Egg startup file name.") + +;;; 92/6/30, by K.Handa +(defvar egg-startup-file-search-path '("~" ".") + "*List of directories to search for egg-startup-file +whose name defaults to .eggrc.") + +(defun egg:search-file (filename searchpath) + (if (file-name-directory filename) + (let ((file (substitute-in-file-name (expand-file-name filename)))) + (if (file-exists-p file) file nil)) + (catch 'answer + (while searchpath + (let ((path (car searchpath))) + (if (stringp path) + (let ((file (substitute-in-file-name + (expand-file-name filename path)))) + (if (file-exists-p file) (throw 'answer file))))) + (setq searchpath (cdr searchpath))) + nil))) + +(defun EGG:open-wnn () + (let ((host (open-wnn-if-disconnected))) + (notify (egg:msg-get 'open-wnn) + (or host "local")) + (let* ((path (append egg-startup-file-search-path load-path)) + (eggrc (or (egg:search-file egg-startup-file path) + (egg:search-file egg-default-startup-file load-path)))) + (if (or (null skip-wnn-setenv-if-env-exist) + (null (wnn-server-dict-list))) + (if eggrc (load-file eggrc) + (let ((wnnenv-sticky nil)) (wnn-server-close)) + (egg:error (egg:msg-get 'no-rcfile) path))) + (run-hooks 'egg:open-wnn-hook)))) + +(defun disconnect-wnn () + (interactive) + (if (wnn-server-isconnect) (wnn-server-close))) + +(defun close-wnn () + (interactive) + (if (wnn-server-isconnect) + (progn + (wnn-server-set-rev nil) + (if (wnn-server-dict-save) + (message (egg:msg-get 'file-saved)) + (message (wnn-server-get-msg))) + (sit-for 0) + (wnn-server-set-rev t) + (if (wnn-server-dict-save) + (message (egg:msg-get 'file-saved)) + (message (wnn-server-get-msg))) + (sit-for 0) + (wnn-server-close) + (run-hooks 'egg:close-wnn-hook)))) + +(defun set-wnn-reverse (arg) +; (open-wnn-if-disconnected) + (wnn-server-set-rev arg)) + +;;; +;;; Kanji henkan +;;; + +(defvar egg:*kanji-kanabuff* nil) +(defvar egg:*dai* t) +(defvar *bunsetu-number* nil) +(defvar *zenkouho-suu* nil) +(defvar *zenkouho-offset* nil) + +(defun bunsetu-length-sho (number) + (cdr (wnn-server-bunsetu-yomi number))) + +(defun bunsetu-length (number) + (let ((max (wnn-server-dai-end number)) + (i (1+ number)) + (l (bunsetu-length-sho number))) + (while (< i max) + (setq l (+ l (bunsetu-length-sho i))) + (setq i (1+ i))) + l)) + +(defun bunsetu-position (number) + (let ((pos egg:*region-start*) (i 0)) + (while (< i number) + (setq pos (+ pos (length (bunsetu-kanji i)) + (if (wnn-server-dai-top (1+ i)) + (length egg:*dai-bunsetu-kugiri*) + (length egg:*sho-bunsetu-kugiri*)))) + (setq i (1+ i))) + pos)) + +(defun bunsetu-kanji (number) (car (wnn-server-bunsetu-kanji number))) + +(defun bunsetu-yomi (number) (car (wnn-server-bunsetu-yomi number))) + +;; Undef functions which might have been defined in sj3-egg.el. +(eval-when-compile + (fmakunbound 'bunsetu-kouho-suu) + (fmakunbound 'bunsetu-kouho-list) + (fmakunbound 'bunsetu-kouho-number)) + +(defun bunsetu-kouho-suu (bunsetu-number init) + (if (or init (/= (wnn-server-zenkouho-bun) bunsetu-number)) + (setq *zenkouho-offset* (wnn-server-zenkouho bunsetu-number egg:*dai*))) + (setq *zenkouho-suu* (wnn-server-zenkouho-suu))) + +(defun bunsetu-kouho-list (bunsetu-number init) + (if (or init (/= (wnn-server-zenkouho-bun) bunsetu-number)) + (setq *zenkouho-offset* (wnn-server-zenkouho bunsetu-number egg:*dai*))) + (let ((i (1- (setq *zenkouho-suu* (wnn-server-zenkouho-suu)))) + (val nil)) + (while (<= 0 i) + (setq val (cons (wnn-server-get-zenkouho i) val)) + (setq i (1- i))) + val)) + +(defun bunsetu-kouho-number (bunsetu-number init) + (if (or init (/= (wnn-server-zenkouho-bun) bunsetu-number)) + (setq *zenkouho-offset* (wnn-server-zenkouho bunsetu-number egg:*dai*))) + *zenkouho-offset*) + +;; +;; for Wnn7 +;; +(defun wnn7-set-boin-kabusoku (mode) + (or (wnn-boin-kabusoku mode) + (egg:error (wnn-server-get-msg)))) + +(defun wnn7-set-shiin-choka (mode) + (or (wnn-shiin-choka mode) + (egg:error (wnn-server-get-msg)))) + +(defun wnn7-set-n-choka (mode) + (or (wnn-n-choka mode) + (egg:error (wnn-server-get-msg)))) + +(defun wnn7-set-nihongo-kosei (mode) + (or (wnn-nihongo-kosei mode) + (egg:error (wnn-server-get-msg)))) + +(defun wnn7-henkan-synonym () ;from wnn7egg-cnv.el + (interactive) + ;;(setq wnn7-rensou-touroku t) ;prediction not implemented + ;(setq *zenkouho-offset* (bunsetu-kouho-number *bunsetu-number* nil)) + (if ;(wnn7-server-synonym *bunsetu-number* *zenkouho-offset* egg:*dai*) + (setq *zenkouho-offset* (wnn-server-synonym *bunsetu-number* egg:*dai*)) + (henkan-select-kouho-dai) + (egg:error (wnn-server-get-msg)))) + +;;;; +;;;; User entry : henkan-region, henkan-paragraph, henkan-sentence +;;;; + +(defun egg:henkan-face-on () + ;; Make an overlay if henkan overlay does not exist. + ;; Move henkan overlay to henkan region. + (if egg:*henkan-face* + (progn + (if (overlayp egg:*henkan-overlay*) + nil + (setq egg:*henkan-overlay* (make-overlay 1 1 nil nil t)) + (overlay-put egg:*henkan-overlay* 'face egg:*henkan-face*)) + (move-overlay egg:*henkan-overlay* egg:*region-start* egg:*region-end*)))) + +(defun egg:henkan-face-off () + ;; detach henkan overlay from the current buffer. + (and egg:*henkan-face* + (overlayp egg:*henkan-overlay*) + (delete-overlay egg:*henkan-overlay*) )) + +;(defvar henkan-mode-indicator "漢") + +;; Undef functions which might have been defined in sj3-egg.el. +(eval-when-compile + (fmakunbound 'henkan-insert-kouho) + (fmakunbound 'egg:bunsetu-face-on) + (fmakunbound 'henkan-region-internal)) + +(defun henkan-insert-kouho (start number) + (let ((i start)) + (while (< i number) + (insert (car (wnn-server-bunsetu-kanji i)) + (if (= (1+ i) number) + "" + (if (wnn-server-dai-top (1+ i)) + egg:*dai-bunsetu-kugiri* + egg:*sho-bunsetu-kugiri*))) + (setq i (1+ i))))) + +(defun egg:bunsetu-face-on () + ;; make dai-bunsetu overlay and sho-bunsetu overlay if they do not exist. + ;; put thier faces to overlays and move them to each bunsetu. + (let* ((bunsetu-begin *bunsetu-number*) + (bunsetu-end) + (bunsetu-suu (wnn-server-bunsetu-suu))) +; dai bunsetu + (if egg:*dai-bunsetu-face* + (progn + (if (overlayp egg:*dai-bunsetu-overlay*) + nil + (setq egg:*dai-bunsetu-overlay* (make-overlay 1 1)) + (overlay-put egg:*dai-bunsetu-overlay* 'face egg:*dai-bunsetu-face*)) + (setq bunsetu-end (wnn-server-dai-end *bunsetu-number*)) + (while (not (wnn-server-dai-top bunsetu-begin)) + (setq bunsetu-begin (1- bunsetu-begin))) + (move-overlay egg:*dai-bunsetu-overlay* + (bunsetu-position bunsetu-begin) + (+ (bunsetu-position (1- bunsetu-end)) + (length (bunsetu-kanji (1- bunsetu-end))))))) +; sho bunsetu + (if egg:*sho-bunsetu-face* + (progn + (if (overlayp egg:*sho-bunsetu-overlay*) + nil + (setq egg:*sho-bunsetu-overlay* (make-overlay 1 1)) + (overlay-put egg:*sho-bunsetu-overlay* 'face egg:*sho-bunsetu-face*)) + (setq bunsetu-end (1+ *bunsetu-number*)) + (move-overlay egg:*sho-bunsetu-overlay* + (let ((point (bunsetu-position *bunsetu-number*))) + (if (eq egg:*sho-bunsetu-face* 'modeline) + (1+ point) + point)) + (+ (bunsetu-position (1- bunsetu-end)) + (length (bunsetu-kanji (1- bunsetu-end))))))))) + +(defun henkan-region-internal (start end &optional rev) + ;; region をかな漢字変換する + (if egg:henkan-mode-in-use nil + (let ((finished nil)) + (unwind-protect + (progn + (setq egg:henkan-mode-in-use t) + (if (null (wnn-server-isconnect)) (EGG:open-wnn)) + (setq egg:*kanji-kanabuff* (buffer-substring start end)) + ;;; for Wnn6 + (if (and (is-wnn6-server) + (not (and + egg:*henkan-fence-mode* + *in-cont-flag*))) + (progn + (wnn6-reset-prev-info))) + + (setq *bunsetu-number* 0) + (setq egg:*dai* t) ; 92.9.8 by T.shingu + (wnn-server-set-rev rev) + (let ((result (wnn-server-henkan-begin egg:*kanji-kanabuff*))) + (if (null result) + (egg:error (wnn-server-get-msg)) + (if (> result 0) + (progn + (mode-line-egg-mode-update (egg:msg-get 'henkan-mode-indicator)) + (goto-char start) + (or (markerp egg:*region-start*) + (setq egg:*region-start* (make-marker))) + (or (markerp egg:*region-end*) + (progn + (setq egg:*region-end* (make-marker)) + (set-marker-insertion-type egg:*region-end* t))) + (if (null (marker-position egg:*region-start*)) + (progn + (delete-region start end) + (suspend-undo) + (goto-char start) + (insert egg:*henkan-open*) + (set-marker egg:*region-start* (point)) + (insert egg:*henkan-close*) + (set-marker egg:*region-end* egg:*region-start*) + (goto-char egg:*region-start*) + ) + (progn + (egg:fence-face-off) + (delete-region (- egg:*region-start* (length egg:*fence-open*)) + egg:*region-start*) + (delete-region egg:*region-end* + (+ egg:*region-end* (length egg:*fence-close*))) + (goto-char egg:*region-start*) + (insert egg:*henkan-open*) + (set-marker egg:*region-start* (point)) + (goto-char egg:*region-end*) + (let ((point (point))) + (insert egg:*henkan-close*) + (set-marker egg:*region-end* point)) + (goto-char start) + (delete-region start end) + )) + (henkan-insert-kouho 0 result) + (egg:henkan-face-on) + (egg:bunsetu-face-on) + (henkan-goto-bunsetu 0) + (run-hooks 'egg:henkan-start-hook))))) + (setq finished t)) + (or finished (setq egg:henkan-mode-in-use nil) + (resume-undo-list))))) + ) + +(defun henkan-region (start end) + "Convert a text in the region between START and END from kana to kanji." + (interactive "r") + (if (interactive-p) (set-mark (point))) ;;; to be fixed + (henkan-region-internal start end)) + +(defun gyaku-henkan-region (start end) + "Convert a text in the region between START and END from kanji to kana." + (interactive "r") + (if (interactive-p) (set-mark (point))) ;;; to be fixed + (henkan-region-internal start end t)) + +(defun henkan-paragraph () + "Convert the current paragraph from kana to kanji." + (interactive) + (forward-paragraph) + (let ((end (point))) + (backward-paragraph) + (henkan-region-internal (point) end))) + +(defun gyaku-henkan-paragraph () + "Convert the current paragraph from kanji to kana." + (interactive) + (forward-paragraph) + (let ((end (point))) + (backward-paragraph) + (henkan-region-internal (point) end t))) + +(defun henkan-sentence () + "Convert the current sentence from kana to kanji." + (interactive) + (forward-sentence) + (let ((end (point))) + (backward-sentence) + (henkan-region-internal (point) end))) + +(defun gyaku-henkan-sentence () + "Convert the current sentence from kanji to kana." + (interactive) + (forward-sentence) + (let ((end (point))) + (backward-sentence) + (henkan-region-internal (point) end t))) + +(defun henkan-word () + "Convert the current word from kana to kanji." + (interactive) + (re-search-backward "\\<" nil t) + (let ((start (point))) + (re-search-forward "\\>" nil t) + (henkan-region-internal start (point)))) + +(defun gyaku-henkan-word () + "Convert the current word from kanji to kana." + (interactive) + (re-search-backward "\\<" nil t) + (let ((start (point))) + (re-search-forward "\\>" nil t) + (henkan-region-internal start (point) t))) + +;;; +;;; Kana Kanji Henkan Henshuu mode +;;; + +;; Undef function which might have been defined in sj3-egg.el. +(eval-when-compile + (fmakunbound 'set-egg-henkan-mode-format)) + +(defun set-egg-henkan-mode-format (open close kugiri-dai kugiri-sho + &optional henkan-face dai-bunsetu-face sho-bunsetu-face) + "変換 mode の表示方法を設定する。OPEN は変換の始点を示す文字列または nil。 +CLOSEは変換の終点を示す文字列または nil。 +KUGIRI-DAIは大文節の区切りを表示する文字列または nil。 +KUGIRI-SHOは小文節の区切りを表示する文字列または nil。 +optional HENKAN-FACE は変換区間を表示する face または nil +optional DAI-BUNSETU-FACE は大文節区間を表示する face または nil +optional SHO-BUNSETU-FACE は小文節区間を表示する face または nil" + + (interactive (list (read-string (egg:msg-get 'begin-henkan)) + (read-string (egg:msg-get 'end-henkan)) + (read-string (egg:msg-get 'kugiri-dai)) + (read-string (egg:msg-get 'kugiri-sho)) + (cdr (assoc (completing-read (egg:msg-get 'face-henkan) + egg:*face-alist*) + egg:*face-alist*)) + (cdr (assoc (completing-read (egg:msg-get 'face-dai) + egg:*face-alist*) + egg:*face-alist*)) + (cdr (assoc (completing-read (egg:msg-get 'face-sho) + egg:*face-alist*) + egg:*face-alist*)) + )) + (if (or (stringp open) (null open)) + (setq egg:*henkan-open* (or open "")) + (egg:error "Wrong type of arguments(open): %s" open)) + + (if (or (stringp close) (null close)) + (setq egg:*henkan-close* (or close "")) + (egg:error "Wrong type of arguments(close): %s" close)) + + (if (or (stringp kugiri-dai) (null kugiri-dai)) + (setq egg:*dai-bunsetu-kugiri* (or kugiri-dai "")) + (egg:error "Wrong type of arguments(kugiri-dai): %s" kugiri-dai)) + + (if (or (stringp kugiri-sho) (null kugiri-sho)) + (setq egg:*sho-bunsetu-kugiri* (or kugiri-sho "")) + (egg:error "Wrong type of arguments(kugiri-sho): %s" kugiri-sho)) + + (if (or (null henkan-face) (memq henkan-face (face-list))) + (progn + (setq egg:*henkan-face* henkan-face) + (if (overlayp egg:*henkan-overlay*) + (overlay-put egg:*henkan-overlay* 'face egg:*henkan-face*))) + (egg:error "Wrong type of arguments(henkan-face): %s" henkan-face)) + + (if (or (null dai-bunsetu-face) (memq dai-bunsetu-face (face-list))) + (progn + (setq egg:*dai-bunsetu-face* dai-bunsetu-face) + (if (overlayp egg:*dai-bunsetu-overlay*) + (overlay-put egg:*dai-bunsetu-overlay* 'face egg:*dai-bunsetu-face*))) + (egg:error "Wrong type of arguments(dai-bunsetu-face): %s" dai-bunsetu-face)) + + (if (or (null sho-bunsetu-face) (memq sho-bunsetu-face (face-list))) + (progn + (setq egg:*sho-bunsetu-face* sho-bunsetu-face) + (if (overlayp egg:*sho-bunsetu-overlay*) + (overlay-put egg:*sho-bunsetu-overlay* 'face egg:*sho-bunsetu-face*))) + (egg:error "Wrong type of arguments(sho-bunsetu-face): %s" sho-bunsetu-face)) + ) + +(defun henkan-kakutei () + (interactive) + (egg:bunsetu-face-off) + (egg:henkan-face-off) + (setq egg:henkan-mode-in-use nil) + (setq egg:*in-fence-mode* nil) + (delete-region (- egg:*region-start* (length egg:*henkan-open*)) + egg:*region-start*) + (delete-region egg:*region-start* egg:*region-end*) + (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*henkan-close*))) + (goto-char egg:*region-start*) + (setq egg:*sai-henkan-start* (point)) + (resume-undo-list) + (let ((i 0) (max (wnn-server-bunsetu-suu))) + (setq egg:*old-bunsetu-suu* max) + (while (< i max) + (insert (car (wnn-server-bunsetu-kanji i ))) + (if (not overwrite-mode) + (undo-boundary)) + (setq i (1+ i)) + )) + (setq egg:*sai-henkan-end* (point)) + (wnn-server-hindo-update) +;; (when egg-predict-status ;prediction not implemented +;; (egg-predict-inc-kakutei-length) +;; (or wnn7-rensou-touroku +;; (egg-predict-toroku))) +;; (setq wnn7-rensou-touroku nil) + (egg:quit-egg-mode) + (run-hooks 'egg:henkan-end-hook) + ) + +;; 92.7.10 by K.Handa +(defun henkan-kakutei-first-char () + "確定文字列の最初の一文字だけ挿入する。" + (interactive) + (egg:bunsetu-face-off) + (egg:henkan-face-off) + (setq egg:henkan-mode-in-use nil) + (setq egg:*in-fence-mode* nil) + (delete-region (- egg:*region-start* (length egg:*henkan-open*)) + egg:*region-start*) + (delete-region egg:*region-start* egg:*region-end*) + (delete-region egg:*region-end* (+ egg:*region-end* + ;; 92.8.5 by Y.Kasai + (length egg:*henkan-close*))) + (goto-char egg:*region-start*) + (resume-undo-list) + (insert (car (wnn-server-bunsetu-kanji 0))) + (if (not overwrite-mode) + (undo-boundary)) + (goto-char egg:*region-start*) + (forward-char 1) + (delete-region (point) egg:*region-end*) + (wnn-server-hindo-update) + (egg:quit-egg-mode) + ) +;; end of patch + +(defun henkan-kakutei-before-point () + (interactive) + (egg:bunsetu-face-off) + (egg:henkan-face-off) + (delete-region egg:*region-start* egg:*region-end*) + (goto-char egg:*region-start*) + (let ((i 0) (max *bunsetu-number*)) + (while (< i max) + (insert (car (wnn-server-bunsetu-kanji i ))) + (if (not overwrite-mode) + (undo-boundary)) + (setq i (1+ i)) + )) + (wnn-server-hindo-update *bunsetu-number*) + (delete-region (- egg:*region-start* (length egg:*henkan-open*)) + egg:*region-start*) + (insert egg:*fence-open*) + (set-marker egg:*region-start* (point)) + (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*henkan-close*))) + (goto-char egg:*region-end*) + (let ((point (point))) + (insert egg:*fence-close*) + (set-marker egg:*region-end* point)) + (goto-char egg:*region-start*) + (egg:fence-face-on) + (let ((point (point)) + (i *bunsetu-number*) (max (wnn-server-bunsetu-suu))) + (while (< i max) + (insert (car (wnn-server-bunsetu-yomi i))) + (setq i (1+ i))) + ;;;(insert "|") + ;;;(insert egg:*fence-close*) + ;;;(set-marker egg:*region-end* (point)) + (goto-char point)) + (setq egg:*mode-on* t) + (setq egg:henkan-mode-in-use nil) + (egg:mode-line-display)) + +(defun sai-henkan () + (interactive) + (if egg:henkan-mode-in-use nil + (let ((finished nil)) + (unwind-protect + (progn + (setq egg:henkan-mode-in-use t) + (mode-line-egg-mode-update (egg:msg-get 'henkan-mode-indicator)) + (goto-char egg:*sai-henkan-start*) + (delete-region egg:*sai-henkan-start* egg:*sai-henkan-end*) + (suspend-undo) + (goto-char egg:*sai-henkan-start*) + (insert egg:*henkan-open*) + (set-marker egg:*region-start* (point)) + (insert egg:*henkan-close*) + (set-marker egg:*region-end* egg:*region-start*) + (goto-char egg:*region-start*) + (henkan-insert-kouho 0 egg:*old-bunsetu-suu*) + (egg:henkan-face-on) + (egg:bunsetu-face-on) + (henkan-goto-bunsetu 0) + (setq finished t)) + (or finished (setq egg:henkan-mode-in-use nil) + (resume-undo-list))))) + ) + +(defun egg:bunsetu-face-off () + (and egg:*dai-bunsetu-face* + (overlayp egg:*dai-bunsetu-overlay*) + (delete-overlay egg:*dai-bunsetu-overlay*)) + (and egg:*sho-bunsetu-face* + (overlayp egg:*sho-bunsetu-overlay*) + (delete-overlay egg:*sho-bunsetu-overlay*)) + ) + +(defun henkan-goto-bunsetu (number) + (setq *bunsetu-number* + (check-number-range number 0 (1- (wnn-server-bunsetu-suu)))) + (goto-char (bunsetu-position *bunsetu-number*)) +; (egg:move-bunsetu-overlay) + (egg:bunsetu-face-on) + ) + +(defun henkan-forward-bunsetu () + (interactive) + (henkan-goto-bunsetu (1+ *bunsetu-number*)) + ) + +(defun henkan-backward-bunsetu () + (interactive) + (henkan-goto-bunsetu (1- *bunsetu-number*)) + ) + +(defun henkan-first-bunsetu () + (interactive) + (henkan-goto-bunsetu 0)) + +(defun henkan-last-bunsetu () + (interactive) + (henkan-goto-bunsetu (1- (wnn-server-bunsetu-suu))) + ) + +(defun check-number-range (i min max) + (cond((< i min) max) + ((< max i) min) + (t i))) + +(defun henkan-hiragana () + (interactive) + (henkan-goto-kouho (- (bunsetu-kouho-suu *bunsetu-number* nil) 1))) + +(defun henkan-katakana () + (interactive) + (henkan-goto-kouho (- (bunsetu-kouho-suu *bunsetu-number* nil) 2))) + +(defun henkan-next-kouho () + (interactive) + (henkan-goto-kouho (1+ (bunsetu-kouho-number *bunsetu-number* nil)))) + +(defun henkan-next-kouho-dai () + (interactive) + (let ((init (not egg:*dai*))) + (setq egg:*dai* t) + (henkan-goto-kouho (1+ (bunsetu-kouho-number *bunsetu-number* init))))) + +(defun henkan-next-kouho-sho () + (interactive) + (let ((init egg:*dai*)) + (setq egg:*dai* nil) + (henkan-goto-kouho (1+ (bunsetu-kouho-number *bunsetu-number* init))))) + +(defun henkan-previous-kouho () + (interactive) + (henkan-goto-kouho (1- (bunsetu-kouho-number *bunsetu-number* nil)))) + +(defun henkan-previous-kouho-dai () + (interactive) + (let ((init (not egg:*dai*))) + (setq egg:*dai* t) + (henkan-goto-kouho (1- (bunsetu-kouho-number *bunsetu-number* init))))) + +(defun henkan-previous-kouho-sho () + (interactive) + (let ((init egg:*dai*)) + (setq egg:*dai* nil) + (henkan-goto-kouho (1- (bunsetu-kouho-number *bunsetu-number* init))))) + +(defun henkan-goto-kouho (kouho-number) +; (egg:bunsetu-face-off) + (let ((point (point)) + (yomi (bunsetu-yomi *bunsetu-number*)) + (max) + (min)) + (setq kouho-number + (check-number-range kouho-number + 0 + (1- (length (bunsetu-kouho-list + *bunsetu-number* nil))))) + (setq *zenkouho-offset* kouho-number) + (wnn-server-henkan-kakutei kouho-number egg:*dai*) + (setq max (wnn-server-bunsetu-suu)) + (setq min (max 0 (1- *bunsetu-number*))) + (delete-region + (bunsetu-position min) egg:*region-end*) + (goto-char (bunsetu-position min)) + (henkan-insert-kouho min max) + (goto-char point)) +; (egg:move-bunsetu-overlay) + (egg:bunsetu-face-on) + (egg:henkan-face-on) + ) + +(defun henkan-bunsetu-chijime-dai () + (interactive) + (setq egg:*dai* t) + (or (= (bunsetu-length *bunsetu-number*) 1) + (bunsetu-length-henko (1- (bunsetu-length *bunsetu-number*))))) + +(defun henkan-bunsetu-chijime-sho () + (interactive) + (setq egg:*dai* nil) + (or (= (bunsetu-length-sho *bunsetu-number*) 1) + (bunsetu-length-henko (1- (bunsetu-length-sho *bunsetu-number*))))) + +(defun henkan-bunsetu-nobasi-dai () + (interactive) + (setq egg:*dai* t) + (let ((i *bunsetu-number*) + (max (wnn-server-bunsetu-suu)) + (len (bunsetu-length *bunsetu-number*)) + (maxlen 0)) + (while (< i max) + (setq maxlen (+ maxlen (cdr (wnn-server-bunsetu-yomi i)))) + (setq i (1+ i))) + (if (not (= len maxlen)) + (bunsetu-length-henko (1+ len))))) + +(defun henkan-bunsetu-nobasi-sho () + (interactive) + (setq egg:*dai* nil) + (let ((i *bunsetu-number*) + (max (wnn-server-bunsetu-suu)) + (len (bunsetu-length-sho *bunsetu-number*)) + (maxlen 0)) + (while (< i max) + (setq maxlen (+ maxlen (cdr (wnn-server-bunsetu-yomi i)))) + (setq i (1+ i))) + (if (not (= len maxlen)) + (bunsetu-length-henko (1+ len))))) + +; (if (not (= (1+ *bunsetu-number*) (wnn-server-bunsetu-suu))) +; (bunsetu-length-henko (1+ (bunsetu-length *bunsetu-number*))))) + + +(defun henkan-saishou-bunsetu () + (interactive) + (bunsetu-length-henko 1)) + +(defun henkan-saichou-bunsetu () + (interactive) + (let ((max (wnn-server-bunsetu-suu)) (i *bunsetu-number*) + (l 0)) + (while (< i max) + (setq l (+ l (bunsetu-length-sho i))) + (setq i (1+ i))) + (bunsetu-length-henko l))) + +(defun bunsetu-length-henko (length) + (let ((i 0) + (r (wnn-server-bunsetu-henkou *bunsetu-number* length egg:*dai*)) + (start (max 0 (1- *bunsetu-number*)))) + (cond((null r) + (egg:error (wnn-server-get-msg))) + ((> r 0) +; (egg:henkan-face-off) +; (egg:bunsetu-face-off) + (delete-region + (bunsetu-position start) egg:*region-end*) + (goto-char (bunsetu-position start)) + (henkan-insert-kouho start r) + (henkan-goto-bunsetu *bunsetu-number*))))) + +(defun henkan-quit () + (interactive) + (egg:bunsetu-face-off) + (egg:henkan-face-off) + (delete-region (- egg:*region-start* (length egg:*henkan-open*)) + egg:*region-start*) + (delete-region egg:*region-start* egg:*region-end*) + (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*henkan-close*))) + (goto-char egg:*region-start*) + (insert egg:*fence-open*) + (set-marker egg:*region-start* (point)) + (insert egg:*kanji-kanabuff*) + (let ((point (point))) + (insert egg:*fence-close*) + (set-marker egg:*region-end* point) + ) + (goto-char egg:*region-end*) + (egg:fence-face-on) + (wnn-server-henkan-quit) + (setq egg:*mode-on* t) + (setq egg:henkan-mode-in-use nil) + (setq egg:*in-fence-mode* t) + (egg:mode-line-display) + ) + +;; Undef function which might have been defined in sj3-egg.el. +(eval-when-compile + (fmakunbound 'henkan-select-kouho)) + +(defun henkan-select-kouho (init) + (if (not (eq (selected-window) (minibuffer-window))) + (let ((kouho-list (bunsetu-kouho-list *bunsetu-number* init)) + menu) + (setq menu + (list 'menu (egg:msg-get 'jikouho) + (let ((l kouho-list) (r nil) (i 0)) + (while l + (setq r (cons (cons (car l) i) r)) + (setq i (1+ i)) + (setq l (cdr l))) + (reverse r)))) + (henkan-goto-kouho + (menu:select-from-menu menu + (bunsetu-kouho-number *bunsetu-number* nil)))) + (beep))) + +(defun henkan-select-kouho-dai () + (interactive) + (let ((init (not egg:*dai*))) + (setq egg:*dai* t) + (henkan-select-kouho init))) + +(defun henkan-select-kouho-sho () + (interactive) + (let ((init egg:*dai*)) + (setq egg:*dai* nil) + (henkan-select-kouho init))) + +(defun henkan-word-off () + (interactive) + (let ((info (wnn-server-inspect *bunsetu-number*))) + (if (null info) + (notify (wnn-server-get-msg)) + (progn + (let ((dic-list (wnn-server-dict-list))) + (if (null dic-list) + (notify (wnn-server-get-msg)) + (progn + (let* ((kanji (nth 0 info)) + (yomi (nth 1 info)) + (serial (nth 3 info)) + (jisho-no (nth 2 info)) + (jisho-name (nth 2 (assoc jisho-no dic-list)))) + (if (wnn-server-word-use jisho-no serial) + (notify (egg:msg-get 'off-msg) + kanji yomi jisho-name serial) + (egg:error (wnn-server-get-msg))))))))))) + +(defun henkan-kakutei-and-self-insert () + (interactive) + (setq unread-command-events (list last-command-event)) + (henkan-kakutei)) + +(defvar henkan-mode-map (append '(keymap (t . undefined) + (?\C-x keymap (t . undefined))) + function-key-map)) + +(defvar henkan-mode-esc-map + (or (lookup-key henkan-mode-map (vector meta-prefix-char)) + (lookup-key henkan-mode-map [escape]) + (make-sparse-keymap))) + +(or (lookup-key henkan-mode-map (vector meta-prefix-char)) + (define-key henkan-mode-map (vector meta-prefix-char) henkan-mode-esc-map)) +(or (lookup-key henkan-mode-map [escape]) + (define-key henkan-mode-map [escape] henkan-mode-esc-map)) + +(substitute-key-definition 'egg-self-insert-command + 'henkan-kakutei-and-self-insert + henkan-mode-map global-map) + +(dolist (elem '(;;(" " henkan-next-kouho-dai) ; 92.9.8 by T.Shingu + (" " henkan-next-kouho) ; 92.7.10 by K.Handa + ("\177" henkan-quit) + ("\C-@" henkan-kakutei-first-char) + ("\C-\ " henkan-kakutei-first-char) + ("\C-a" henkan-first-bunsetu) + ("\C-b" henkan-backward-bunsetu) + ("\C-c" henkan-quit) + ("\C-e" henkan-last-bunsetu) + ("\C-f" henkan-forward-bunsetu) + ("\C-g" henkan-quit) + ("\C-h" henkan-help-command) + ("\C-i" henkan-bunsetu-chijime-dai) + ("\C-k" henkan-kakutei-before-point) + ("\C-l" henkan-kakutei) + ("\C-m" henkan-kakutei) + ("\C-n" henkan-next-kouho) + ("\C-o" henkan-bunsetu-nobasi-dai) + ("\C-p" henkan-previous-kouho) + ("\C-t" toroku-henkan-mode) + ("\C-v" henkan-inspect-bunsetu) + ("\C-w" henkan-next-kouho-dai) + ("\C-z" henkan-next-kouho-sho) + + ([backspace] henkan-quit) + ([clear] henkan-quit) + ([delete] henkan-quit) + ([down] henkan-next-kouho) + ([help] henkan-help-command) + ([left] henkan-backward-bunsetu) + ([next] henkan-next-kouho) + ([prior] henkan-previous-kouho) + ([return] henkan-kakutei) + ([right] henkan-forward-bunsetu) + ([up] henkan-previous-kouho))) + (apply 'define-key henkan-mode-map elem)) + +(dolist (elem '(([t] undefined);; default binding + ("<" henkan-saishou-bunsetu) + (">" henkan-saichou-bunsetu) + ("h" henkan-hiragana) + ;;("i" henkan-inspect-bunsetu) + ("i" henkan-bunsetu-chijime-sho) + ("k" henkan-katakana) + ("o" henkan-bunsetu-nobasi-sho) + ;("r" wnn7-henkan-synonym) + ("s" henkan-select-kouho-dai) + ("z" henkan-select-kouho-sho))) + (apply 'define-key henkan-mode-esc-map elem)) + +(or (assq 'egg:henkan-mode-in-use minor-mode-map-alist) + (setq minor-mode-map-alist + (cons (cons 'egg:henkan-mode-in-use henkan-mode-map) + minor-mode-map-alist))) + + +(defun henkan-help-command () + "Display documentation for henkan-mode." + (interactive) + (let ((buf "*Help*")) + (if (eq (get-buffer buf) (current-buffer)) + (henkan-quit) + (with-output-to-temp-buffer buf + ;;(princ (substitute-command-keys henkan-mode-document-string)) + (princ (substitute-command-keys (egg:msg-get 'henkan-help))) + (print-help-return-message))))) + +;;;---------------------------------------------------------------------- +;;; +;;; Dictionary management Facility +;;; +;;;---------------------------------------------------------------------- + +;;; +;;; 辞書登録 +;;; + +;;;; +;;;; User entry: toroku-region +;;;; + +(defun remove-regexp-in-string (regexp string) + (cond((not(string-match regexp string)) + string) + (t(let ((str nil) + (ostart 0) + (oend (match-beginning 0)) + (nstart (match-end 0))) + (setq str (concat str (substring string ostart oend))) + (while (string-match regexp string nstart) + (setq ostart nstart) + (setq oend (match-beginning 0)) + (setq nstart (match-end 0)) + (setq str (concat str (substring string ostart oend)))) + (concat str (substring string nstart)))))) + +(defun hinsi-from-menu (dict-number name) + (let ((result (wnn-server-hinsi-list dict-number name)) +; (hinsi-pair) + (menu)) + (if (null result) + (egg:error (wnn-server-get-msg)) + (if (eq result 0) + name + (progn +; (setq hinsi-pair (mapcar '(lambda (x) (cons x x)) result)) +; (if (null (string= name "/")) +; (setq hinsi-pair (cons (cons "/" "/") hinsi-pair))) +; (setq menu (list 'menu (egg:msg-get 'hinsimei) hinsi-pair)) + (setq menu (list 'menu (egg:msg-get 'hinsimei) + (if (string= name "/") + result + (cons "/" result)))) + (hinsi-from-menu dict-number + (menu:select-from-menu menu))))))) + +(defun wnn-dict-name (dict-number dict-list) + (let* ((dict-info (assoc dict-number dict-list)) + (dict-comment (nth 2 dict-info))) + (if (string= dict-comment "") + (file-name-nondirectory (nth 1 dict-info)) + dict-comment))) + +(defun egg:toroku-word (yomi kanji interactive) + (let*((dic-list (wnn-server-dict-list)) + (writable-dic-list (wnn-server-hinsi-dicts -1)) + (dict-number + (menu:select-from-menu + (list 'menu (egg:msg-get 'touroku-jishomei) + (mapcar '(lambda (x) + (let ((y (car (assoc x dic-list)))) + (cons (wnn-dict-name y dic-list) y))) + writable-dic-list)))) + (hinsi-name (hinsi-from-menu dict-number "/")) + (hinsi-no (wnn-server-hinsi-number hinsi-name)) + (dict-name (wnn-dict-name dict-number dic-list))) + (if (or (not interactive) + (notify-yes-or-no-p (egg:msg-get 'register-notify) + kanji yomi hinsi-name dict-name)) + (if (wnn-server-word-add dict-number kanji yomi "" hinsi-no) + (notify (egg:msg-get 'registerd) kanji yomi hinsi-name dict-name) + (egg:error (wnn-server-get-msg)))))) + +(defun toroku-region (start end) + (interactive "r") + (if (null (wnn-server-isconnect)) (EGG:open-wnn)) + (wnn-server-set-rev nil) + (let*((kanji + (remove-regexp-in-string "[\0-\37]" (buffer-substring start end))) + (yomi (read-current-its-string + (format (egg:msg-get 'jishotouroku-yomi) kanji)))) + (egg:toroku-word yomi kanji nil))) + +(defun delete-space (string) + (let ((len (length string))) + (if (eq len 0) "" + (if (or (char-equal (aref string 0) ? ) (char-equal (aref string 0) ?-)) + (delete-space (substring string 1)) + (concat (substring string 0 1) (delete-space (substring string 1))))))) + + +(defun toroku-henkan-mode () + (interactive) + (let*((kanji + (read-current-its-string (egg:msg-get 'kanji) + (delete-space + (buffer-substring (point) egg:*region-end* )))) + (yomi (read-current-its-string + (format (egg:msg-get 'jishotouroku-yomi) kanji) + (let ((str "") + (i *bunsetu-number*) + (max (wnn-server-bunsetu-suu))) + (while (< i max) + (setq str (concat str (car (wnn-server-bunsetu-yomi i)) )) + (setq i (1+ i))) + str)))) + (egg:toroku-word yomi kanji nil))) + +;;; +;;; 辞書編集系 DicEd +;;; + +(defvar *diced-window-configuration* nil) + +(defvar *diced-dict-info* nil) + +(defvar *diced-yomi* nil) + +;;;;; +;;;;; User entry : edit-dict-item +;;;;; + +(defun edit-dict-item (yomi) + (interactive (list (read-current-its-string (egg:msg-get 'yomi)))) + (if (null (wnn-server-isconnect)) (EGG:open-wnn)) + (wnn-server-set-rev nil) + (let ((dict-info (wnn-server-word-search yomi)) + (current-wnn-server-type)) + (if (null dict-info) + (message (egg:msg-get 'no-yomi) yomi) + (progn + (setq current-wnn-server-type wnn-server-type) + (setq *diced-yomi* yomi) + (setq *diced-window-configuration* (current-window-configuration)) + (pop-to-buffer "*Nihongo Dictionary Information*") + (setq wnn-server-type current-wnn-server-type) + (setq major-mode 'diced-mode) + (setq mode-name "Diced") + (setq mode-line-buffer-identification + (concat "DictEd: " yomi + (make-string (max 0 (- 17 (string-width yomi))) ? ))) + (sit-for 0) ;; will redislay. + ;;;(use-global-map diced-mode-map) + (use-local-map diced-mode-map) + (diced-display dict-info) + )))) + +(defun diced-redisplay () + (wnn-server-set-rev nil) + (let ((dict-info (wnn-server-word-search *diced-yomi*))) + (if (null dict-info) + (progn + (message (egg:msg-get 'no-yomi) *diced-yomi*) + (diced-quit)) + (diced-display dict-info)))) + +(defun diced-display (dict-info) + ;;; (values (list (record kanji bunpo hindo dict-number serial-number))) + ;;; 0 1 2 3 4 + (setq dict-info + (sort dict-info + (function (lambda (x y) + (or (< (nth 1 x) (nth 1 y)) + (if (= (nth 1 x) (nth 1 y)) + (or (> (nth 2 x) (nth 2 y)) + (if (= (nth 2 x) (nth 2 y)) + (< (nth 3 x) (nth 3 y)))))))))) + (setq *diced-dict-info* dict-info) + (setq buffer-read-only nil) + (erase-buffer) + (let ((l-kanji + (apply 'max + (mapcar (function (lambda (l) (string-width (nth 0 l)))) + dict-info))) + (l-bunpo + (apply 'max + (mapcar (function(lambda (l) + (string-width (wnn-server-hinsi-name (nth 1 l))))) + dict-info))) + (dict-list (wnn-server-dict-list)) + (writable-dict-list (wnn-server-hinsi-dicts -1))) + (while dict-info + (let*((kanji (nth 0 (car dict-info))) + (bunpo (nth 1 (car dict-info))) + (hinshi (wnn-server-hinsi-name bunpo)) + (hindo (nth 2 (car dict-info))) + (dict-number (nth 3 (car dict-info))) + (dict-name (wnn-dict-name dict-number dict-list)) + (sys-dict-p (null (memq dict-number writable-dict-list))) + (serial-number (nth 4 (car dict-info)))) + (insert (if sys-dict-p " *" " ")) + (insert kanji) + (insert-char ? + (- (+ l-kanji 10) (string-width kanji))) + (insert hinshi) + (insert-char ? (- (+ l-bunpo 2) (string-width hinshi))) + (insert (egg:msg-get 'jisho) (file-name-nondirectory dict-name) + "/" (int-to-string serial-number) + (egg:msg-get 'hindo) (int-to-string hindo) ?\n ) + (setq dict-info (cdr dict-info)))) + (goto-char (point-min))) + (setq buffer-read-only t)) + +(defun diced-add () + (interactive) + (diced-execute t) + (let*((kanji (read-from-minibuffer (egg:msg-get 'kanji)))) + (egg:toroku-word *diced-yomi* kanji t) + (diced-redisplay))) + +(defun diced-delete () + (interactive) + (beginning-of-line) + (if (= (char-after (1+ (point))) ?* ) + (progn (message (egg:msg-get 'cannot-remove)) (beep)) + (if (= (following-char) ? ) + (let ((buffer-read-only nil)) + (delete-char 1) (insert "D") (backward-char 1)) + ))) + + +(defun diced-undelete () + (interactive) + (beginning-of-line) + (if (= (following-char) ?D) + (let ((buffer-read-only nil)) + (delete-char 1) (insert " ") (backward-char 1)) + (beep))) + +(defun diced-redisplay-hindo (dict-number serial-number) + (let ((hindo)) + (setq buffer-read-only nil) + (beginning-of-line) + (re-search-forward "\\([0-9\-]+\\)\\(\n\\)") + (delete-region (match-beginning 1) (match-end 1)) + (setq hindo (nth 3 (wnn-server-word-info dict-number serial-number))) + (goto-char (match-beginning 1)) + (insert (int-to-string hindo)) + (beginning-of-line) + (setq buffer-read-only t))) + +(defun diced-use () + (interactive) + (let* ((dict-item (nth + (+ (count-lines (point-min) (point)) + (if (= (current-column) 0) 1 0) + -1) + *diced-dict-info*)) + (hindo (nth 2 dict-item)) + (dict-number (nth 3 dict-item)) + (serial-number (nth 4 dict-item)) + ) + (if (null (wnn-server-word-use dict-number serial-number)) + (egg:error (wnn-server-get-msg))) + (diced-redisplay-hindo dict-number serial-number))) + +(defun diced-hindo-set (&optional newhindo) + (interactive) + (if (null newhindo) + (setq newhindo (read-minibuffer (egg:msg-get 'enter-hindo)))) + (let* ((dict-item (nth + (+ (count-lines (point-min) (point)) + (if (= (current-column) 0) 1 0) + -1) + *diced-dict-info*)) + (hindo (nth 2 dict-item)) + (dict-number (nth 3 dict-item)) + (serial-number (nth 4 dict-item)) + ) + (if (null (wnn-server-word-hindo-set dict-number serial-number newhindo)) + (egg:error (wnn-server-get-msg))) + (diced-redisplay-hindo dict-number serial-number))) + +(defun diced-quit () + (interactive) + (setq buffer-read-only nil) + (erase-buffer) + (setq buffer-read-only t) + (bury-buffer (get-buffer "*Nihongo Dictionary Information*")) + (set-window-configuration *diced-window-configuration*) + ) + +(defun diced-execute (&optional display) + (interactive) + (goto-char (point-min)) + (let ((no 0)) + (while (not (eobp)) + (if (= (following-char) ?D) + (let* ((dict-item (nth no *diced-dict-info*)) + (kanji (nth 0 dict-item)) + (bunpo (nth 1 dict-item)) + (hinshi (wnn-server-hinsi-name bunpo)) + (hindo (nth 2 dict-item)) + (dict-number (nth 3 dict-item)) + (dict-name (wnn-dict-name dict-number (wnn-server-dict-list))) + (sys-dict-p (null (memq dict-number (wnn-server-hinsi-dicts -1)))) + (serial-number (nth 4 dict-item)) + ) + (if (notify-yes-or-no-p (egg:msg-get 'remove-notify) + kanji hinshi dict-name) + (progn + (if (wnn-server-word-delete dict-number serial-number) + (notify (egg:msg-get 'removed) + kanji hinshi dict-name) + (egg:error (wnn-server-get-msg))) + )))) + (setq no (1+ no)) + (forward-line 1))) + (forward-line -1) + (if (not display) (diced-redisplay))) + +(defun diced-next-line () + (interactive) + (beginning-of-line) + (forward-line 1) + (if (eobp) (progn (beep) (forward-line -1)))) + +(defun diced-end-of-buffer () + (interactive) + (goto-char (point-max)) + (forward-line -1)) + +(defun diced-scroll-down () + (interactive) + (scroll-down) + (if (eobp) (forward-line -1))) + +(defun diced-mode () + "Mode for \"editing\" dictionaries. +In diced, you are \"editing\" a list of the entries in dictionaries. +You can move using the usual cursor motion commands. +Letters no longer insert themselves. Instead, + +Type a to Add new entry. +Type d to flag an entry for Deletion. +Type n to move cursor to Next entry. +Type p to move cursor to Previous entry. +Type q to Quit from DicEd. +Type C-u to Toggle the word to use/unuse. +Type u to Unflag an entry (remove its D flag). +Type x to eXecute the deletions requested. +" + ) + +(defvar diced-mode-map (make-sparse-keymap)) + +(dolist (elem '(("a" diced-add) + ("d" diced-delete) + ("n" diced-next-line) + ("p" previous-line) + ("q" diced-quit) + ;;("t" diced-use) + ("u" diced-undelete) + ("x" diced-execute) + + ("\C-h" help-command) + ("\C-n" diced-next-line) + ("\C-p" previous-line) + ("\C-u" diced-use) + ("\C-v" scroll-up) + + ([down] diced-next-line) + ([help] help-command) + ([next] diced-next-line) + ([prior] previous-line) + ([up] previous-line) + + ("\e<" beginning-of-buffer) + ("\e>" diced-end-of-buffer) + ("\eh" diced-hindo-set) + ("\ev" diced-scroll-down))) + (apply 'define-key diced-mode-map elem)) + +;;; +;;; set comment on dictionary +;;; + +(defun set-dict-comment () + (interactive) + (if (null (wnn-server-isconnect)) (EGG:open-wnn)) + (wnn-server-set-rev nil) + (let*((dic-list (wnn-server-dict-list)) + (writable-dic-list (wnn-server-hinsi-dicts -1)) + (dict-number + (menu:select-from-menu + (list 'menu (egg:msg-get 'jishomei) + (mapcar '(lambda (x) + (let ((y (assoc x dic-list))) + (cons (nth 1 y) (nth 0 y)))) + writable-dic-list)))) + (comment (read-from-minibuffer (egg:msg-get 'comment) + (wnn-dict-name dict-number dic-list)))) + (if (wnn-server-dict-comment dict-number comment) + (notify (egg:msg-get 'jisho-comment) + (wnn-dict-name dict-number dic-list) comment) + (egg:error (wnn-server-get-msg))))) + + +;;; +;;; Pure inspect facility +;;; + +(defun henkan-inspect-bunsetu () + (interactive) + (let ((info (wnn-server-inspect *bunsetu-number*))) + (if (null info) + (notify (wnn-server-get-msg)) + (progn + (let ((dic-list (wnn-server-dict-list))) + (if (null dic-list) + (notify (wnn-server-get-msg)) + (progn + (let ((hinsi (wnn-server-hinsi-name (nth 4 info))) + (kanji (nth 0 info)) + (yomi (nth 1 info)) + (serial (nth 3 info)) + (hindo (nth 5 info)) + (jisho (wnn-dict-name (nth 2 info) dic-list)) + (ima (nth 6 info)) + (hyoka (nth 7 info)) + (daihyoka (nth 8 info)) + (kangovect (nth 9 info))) + (notify-internal + (format "%s %s(%s %s:%s Freq:%s%s) S:%s D:%s V:%s " + kanji yomi hinsi jisho serial + (if (= ima 1) "*" " ") + hindo hyoka daihyoka kangovect) + t))))))))) + +(provide 'wnn-egg) + +;;; wnn-egg.el ends here --- emacs-22.1/src/Makefile.in~ 2007-03-21 14:31:24 +0000 +++ emacs-22.1/src/Makefile.in 2007-06-03 23:21:07 +0000 @@ -259,6 +259,30 @@ TOOLKIT_DEFINES = -DUSE_GTK #endif +#ifndef LIBS_MULE +# define LIBS_MULE +#endif /* LIBS_MULE */ + +#ifndef C_SWITCH_WNN +# define C_SWITCH_WNN +#endif /* C_SWITCH_WNN */ + +#ifndef LD_SWITCH_WNN +# define LD_SWITCH_WNN +#endif /* LD_SWITCH_WNN */ + +#ifndef C_SWITCH_CANNA +# define C_SWITCH_CANNA +#endif /* C_SWITCH_CANNA */ + +#ifndef LD_SWITCH_CANNA +# define LD_SWITCH_CANNA +#endif /* LD_SWITCH_CANNA */ + +#ifndef LD_SWITCH_CANNA_AUX +# define LD_SWITCH_CANNA_AUX +#endif /* LD_SWITCH_CANNA_AUX */ + #ifdef USE_X_TOOLKIT #define USE_@X_TOOLKIT_TYPE@ TOOLKIT_DEFINES = -DUSE_@X_TOOLKIT_TYPE@ @@ -281,7 +305,7 @@ /* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM since it may have -I options that should override those two. */ -ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${CFLAGS} +ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} C_SWITCH_WNN C_SWITCH_CANNA ${CFLAGS} .c.o: $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< @@ -537,7 +561,7 @@ /* Flags to pass to LD only for temacs. */ /* Do not split this line with a backslash. That can cause trouble with some cpps. */ -TEMACS_LDFLAGS = LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_TEMACS LD_SWITCH_MACHINE LD_SWITCH_MACHINE_TEMACS LD_SWITCH_SITE +TEMACS_LDFLAGS = LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_TEMACS LD_SWITCH_MACHINE LD_SWITCH_MACHINE_TEMACS LD_SWITCH_SITE LD_SWITCH_WNN LD_SWITCH_CANNA /* A macro which other sections of Makefile can redefine to munge the flags before they are passed to LD. This is helpful if you have @@ -579,11 +603,23 @@ emacsappsrc = ${srcdir}/../mac/Emacs.app/ #endif +#ifdef WNN +# define WNN_OBJ wnnfns.o +#else /* not WNN */ +# define WNN_OBJ +#endif /* not WNN */ + +#ifdef CANNA +# define CANNA_OBJ canna.o +#else /* not CANNA */ +# define CANNA_OBJ +#endif /* not CANNA */ + /* lastfile must follow all files whose initialized data areas should be dumped as pure by dump-emacs. */ obj= dispnew.o frame.o scroll.o xdisp.o $(XMENU_OBJ) window.o \ charset.o coding.o category.o ccl.o \ - cm.o term.o xfaces.o $(XOBJ) $(GTK_OBJ)\ + cm.o term.o xfaces.o $(XOBJ) $(GTK_OBJ) WNN_OBJ CANNA_OBJ\ emacs.o keyboard.o macros.o keymap.o sysdep.o \ buffer.o filelock.o insdel.o marker.o \ minibuf.o fileio.o dired.o filemode.o \ @@ -710,6 +746,40 @@ #define TOOLTIP_SUPPORT #endif +#ifdef WNN +#define WNN_SUPPORT ${lispsource}egg.elc ${lispsource}wnn-egg.elc +#define WNN_ELC ${dotdot}/lisp/egg.elc ${dotdot}/lisp/wnn-egg.elc +#else +#define WNN_SUPPORT +#define WNN_ELC +#endif + +#ifdef SJ3 +#define SJ3_SUPPORT ${lispsource}egg.elc ${lispsource}sj3-client.elc ${lispsource}sj3-egg.elc +#define SJ3_ELC ${dotdot}/lisp/sj3-client.elc ${dotdot}/lisp/sj3-egg.elc +#else +#define SJ3_SUPPORT +#define SJ3_ELC +#endif + +#ifdef CANNA +#define CANNA_SUPPORT ${lispsource}canna.elc +#define CANNA_ELC ${dotdot}/lisp/canna.elc +#else +#define CANNA_SUPPORT +#define CANNA_ELC +#endif + +#define MULE_SUPPORT_EXTRA \ + WNN_SUPPORT \ + SJ3_SUPPORT \ + CANNA_SUPPORT + +#define MULE_SOME_MACHINE_LISP \ + WNN_ELC \ + SJ3_ELC \ + CANNA_ELC + /* List of Lisp files loaded into the dumped Emacs. It is arranged like this because it is easier to generate it semi-mechanically from loadup.el this way. @@ -723,6 +793,9 @@ in SOME_MACHINE_LISP. */ lisp= \ + WNN_SUPPORT \ + SJ3_SUPPORT \ + CANNA_SUPPORT \ ${lispsource}abbrev.elc \ ${lispsource}buff-menu.elc \ ${lispsource}button.elc \ @@ -744,6 +817,7 @@ ${lispsource}help.elc \ ${lispsource}indent.elc \ ${lispsource}isearch.elc \ + ${lispsource}isearch-ext.elc \ ${lispsource}rfn-eshadow.elc \ ${lispsource}loadup.el \ ${lispsource}loaddefs.el \ @@ -803,6 +877,7 @@ ${lispsource}textmodes/fill.elc \ ${lispsource}textmodes/page.elc \ ${lispsource}textmodes/paragraphs.elc \ + ${lispsource}textmodes/picture.elc \ ${lispsource}textmodes/text-mode.elc \ ${lispsource}emacs-lisp/timer.elc \ ${lispsource}jka-cmpr-hook.elc \ @@ -841,6 +916,7 @@ ../lisp/help.elc \ ../lisp/indent.elc \ ../lisp/isearch.elc \ + ../lisp/isearch-ext.elc \ ../lisp/rfn-eshadow.elc \ ../lisp/loadup.el \ ../lisp/loaddefs.el \ @@ -927,7 +1003,8 @@ ${dotdot}/lisp/x-dnd.elc \ ${dotdot}/lisp/international/ccl.elc \ ${dotdot}/lisp/international/codepage.elc \ - ${dotdot}/lisp/international/fontset.elc + ${dotdot}/lisp/international/fontset.elc \ + MULE_SOME_MACHINE_LISP /* Construct full set of libraries to be linked. Note that SunOS needs -lm to come before -lc; otherwise, you get @@ -935,6 +1012,7 @@ with GCC, we might need gnulib again after them. */ LIBES = $(LOADLIBES) $(LIBS) $(LIBX) $(LIBSOUND) \ LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP \ + LIBS_MULE \ LIBS_DEBUG $(GETLOADAVG_LIBS) $(GNULIB_VAR) LIB_MATH LIB_STANDARD \ $(GNULIB_VAR) @@ -952,7 +1030,30 @@ all: emacs${EXEEXT} OTHER_FILES +/* 93.2.10 by K.Handa */ +#ifdef SUFFIX_BUG +elc-patched: +#else +.SUFFIXES: .elc .el +.el.elc: +#endif /* not SUFFIX_BUG */ +#ifdef MSDOS + coff2exe temacs${EXEEXT} + temacs${EXEEXT} -batch -l mule-inst.el ${lisp} +#else +#ifdef HAVE_SHM + ./temacs${EXEEXT} -nl -batch -l mule-inst.el ${lisp} +#else + ./temacs${EXEEXT} -batch -l mule-inst.el ${lisp} +#endif +#endif +/* end of patch */ + +#ifdef SUFFIX_BUG +emacs${EXEEXT}: temacs${EXEEXT} elc-patched ${etc}DOC ${lisp} +#else emacs${EXEEXT}: temacs${EXEEXT} ${etc}DOC ${lisp} +#endif #ifdef CANNOT_DUMP rm -f emacs${EXEEXT} ln temacs${EXEEXT} emacs${EXEEXT} --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/src/canna.c 2007-06-03 23:21:07 +0000 @@ -0,0 +1,1408 @@ +/* + CANNA interface for NEmacs + + This file is a part of Canna on Nemacs. + + Canna on Nemacs is distributed in the forms of patches + to Nemacs under the terms of the GNU EMACS GENERAL + PUBLIC LICENSE which is distributed along with GNU Emacs + by the Free Software Foundation. + + Canna on Nemacs 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 EMACS GENERAL PUBLIC + LICENSE for more details. + + You should have received a copy of the GNU EMACS GENERAL + PUBLIC LICENSE along with Nemacs; see the file COPYING. + If not, write to the Free Software Foundation, 675 Mass + Ave, Cambridge, MA 02139, USA. + + Authors: Akira Kon (kon@d1.bs2.mt.nec.co.jp) + Ichiro Hirakura (hirakura@uxp.bs2.mt.nec.co.jp) + + Functions defined in this file are + + (canna-key-proc key) + key: single STRING + RETURNS: + Length of converted string if no error occurs. + Error string if error occurs. + DESCRIPTION: + Convert a key input to a set of strings. The + strings contain both well-formed string and a + intermediate result to show the translation + information to a user. converted strings are + stored in specific variables. + + (canna-initialize) + RETURNS: + List of the following things: + - list of keys to toggle Japanese-mode + - error message + - list of warning messages + DESCRIPTION: + Initialize ``canna'', which is a kana-to-kanji + converter for GNU Emacs. The first arg + specifies if inserting space character between + BUNSETSU when candidates are displayed. The + second arg specifies server. The third arg + specifies a file which will be used as a + customization description. If nil is + specified for each arg, the default value will + be used. + + (canna-finalize) + RETURNS: + list of warning messages + DESCRIPTION: + finalize ``canna'', which is a kana-to-kanji + converter for GNU Emacs. This cause to write + miscellaneous informations to kana-to-kanji + dictionary. + + (canna-touroku-string string) + string: + String to register to a dictionary. + RETURNS: + The same thing returns as canna-key-proc does. + DESCRIPTION: + Register Kanji words into kana-to-kanji + conversion dictionary. + + (canna-set-width width) + width: + Column width of the place where the candidates + of kana-to-kanji conversion will be shown. + RETURNS: + nil + DESCRIPTION: + Set status-line width information, which is + used to display kanji candidates. + + (canna-change-mode num) + num: + The mode number of Canna. + RETURNS: + The same thing returns as canna-key-proc does. + DESCRIPTION: + Change Japanese pre-edit mode. + + (canna-store-yomi yomi roma) + yomi: + ``Yomi'' to be stored. + roma: + ``Romaji'' which corresponds to the ``Yomi''. + RETURNS: + The same thing returns as canna-key-proc does. + DESCRIPTION: + Store yomi characters as a YOMI of + kana-to-kanji conversion. + + (canna-do-function num ch) + num: + A function number to be called. + ch: + A character will be specified in order to feed + the character to the function if the function + needs a input character. + RETURNS: + The same thing returns as canna-key-proc does. + DESCRIPTION: + Do specified function at current mode. + + (canna-parse string) + string: + To be parsed. + RETURNS: + List of warning messages. + DESCRIPTION: + Parse customize string. + + (canna-query-mode) + RETURNS: + A string which indicate the current mode. + DESCRIPTION: + Get current mode string. + + Functions below are used for KKCP compatible library. These + functions provides a base kana-to-kanji conversion system for EGG. + These functions may be used when users want to change the engine + from Wnn to Canna without changing user interface of Japanese input. + + (canna-henkan-begin) + (canna-henkan-next) + (canna-bunsetu-henkou) + (canna-henkan-kakutei) + (canna-henkan-end) + (canna-henkan-quit) + + */ + +#ifndef lint +static char rcs_id[] = "$Id: canna.c,v 1.35 1994/03/15 08:00:03 kon Exp $"; +#endif + +#include <stdio.h> + +#include "config.h" +#include "lisp.h" +#include "buffer.h" +#ifdef CANNA_MULE +#include "charset.h" +#include "coding.h" +#endif + +#define CANNA3_7 +#ifdef CANNA3_7 +# define CANNA_NEW_WCHAR_AWARE +#endif + +#ifdef CANNA2 +#define IROHA_BC +#include "canna/jrkanji.h" +#include "canna/RK.h" +#else /* !CANNA2 */ +#include "iroha/jrkanji.h" +#include "iroha/RK.h" +#endif /* !CANNA2 */ +#ifndef CANNA3_7 +extern char *jrKanjiError; +#endif + +#define KEYTOSTRSIZE 2048 +static unsigned char buf[KEYTOSTRSIZE]; +static char **warning; + +static int Vcanna_empty_info, Vcanna_through_info; +static int Vcanna_underline; +static int Vcanna_inhibit_hankakukana; /* hir, 1994.12.5 */ + +static Lisp_Object Vcanna_kakutei_string; +static Lisp_Object Vcanna_kakutei_yomi; +static Lisp_Object Vcanna_kakutei_romaji; +static Lisp_Object Vcanna_henkan_string; +static int Vcanna_henkan_length; +static int Vcanna_henkan_revPos; +static int Vcanna_henkan_revLen; +static Lisp_Object Vcanna_ichiran_string; +static int Vcanna_ichiran_length; +static int Vcanna_ichiran_revPos; +static int Vcanna_ichiran_revLen; +static Lisp_Object Vcanna_mode_string; + +static int IRCP_context; + +#if __STDC__ +static Lisp_Object storeResults(unsigned char *, int, jrKanjiStatus *); +static Lisp_Object kanjiYomiList(int, int); +#else +static Lisp_Object storeResults(); +static Lisp_Object kanjiYomiList(); +#endif + +#ifdef CANNA_MULE +#if __STDC__ +static m2c(unsigned char *, int, unsigned char *); +static Lisp_Object mule_make_string(unsigned char *, int); +static mule_strlen(unsigned char *, int); +static count_char(unsigned char *,int, int, int, int *, int *, int *); +#else +static m2c(); +static Lisp_Object mule_make_string(); +static mule_strlen(); +static count_char(); +#endif +#define make_string mule_make_string +#endif + +/* Lisp functions definition */ + +DEFUN ("canna-key-proc", Fcanna_key_proc, Scanna_key_proc, + 1, 1, 0, +"Translate a key input to a set of strings. The strings contain both\n\ +well-formed string and intermediate result to show the translation\n\ +information to a user. Converted strings are stored in specific\n\ +variables.") + (ch) +Lisp_Object ch; +{ + jrKanjiStatus ks; + int len; + + CHECK_NUMBER (ch); + len = jrKanjiString(0, XINT (ch), buf, KEYTOSTRSIZE, &ks); + return storeResults(buf, len, &ks); +} + +static +Lisp_Object +storeResults(buf, len, ks) +unsigned char *buf; +int len; +jrKanjiStatus *ks; +{ + Lisp_Object val = Qnil; + + if (len < 0) { /* Error detected */ + val = make_string((unsigned char*)jrKanjiError, strlen(jrKanjiError)); + } + else { + /* �������������� */ + Vcanna_kakutei_string = make_string(buf, len); + val = make_number(len); + /* ��������������������������... */ + Vcanna_kakutei_yomi = Vcanna_kakutei_romaji = Qnil; + if (ks->info & KanjiYomiInfo) { + unsigned char *p = buf + len + 1; + int yomilen = strlen(p); + + if (len + yomilen + 1 < KEYTOSTRSIZE) { + int yomilen2; + + Vcanna_kakutei_yomi = make_string(p, yomilen); /* ���� */ + p += yomilen + 1; + yomilen2 = strlen(p); + if (len + yomilen + yomilen2 + 2 < KEYTOSTRSIZE) { + Vcanna_kakutei_romaji = make_string(p, yomilen2); /* �������� */ + } + } + } + + + /* ����������������������*/ + Vcanna_henkan_string = Qnil; + if (ks->length >= 0) { + Vcanna_henkan_string = make_string(ks->echoStr, ks->length); +#ifndef CANNA_MULE + Vcanna_henkan_length = ks->length; + Vcanna_henkan_revPos = ks->revPos; + Vcanna_henkan_revLen = ks->revLen; +#else /* CANNA_MULE */ + if (Vcanna_underline) { + Vcanna_henkan_length = mule_strlen(ks->echoStr,ks->length); + Vcanna_henkan_revPos = mule_strlen(ks->echoStr,ks->revPos); + Vcanna_henkan_revLen = mule_strlen(ks->echoStr+ks->revPos,ks->revLen); + } + else { + count_char(ks->echoStr, ks->length, ks->revPos, ks->revLen, + &Vcanna_henkan_length, &Vcanna_henkan_revPos, + &Vcanna_henkan_revLen); + } +#endif /* CANNA_MULE */ + } + + /* ���������� */ + Vcanna_ichiran_string = Qnil; + if (ks->info & KanjiGLineInfo && ks->gline.length >= 0) { + Vcanna_ichiran_string = make_string(ks->gline.line, ks->gline.length); +#ifndef CANNA_MULE + Vcanna_ichiran_length = ks->gline.length; + Vcanna_ichiran_revPos = ks->gline.revPos; + Vcanna_ichiran_revLen = ks->gline.revLen; +#else /* CANNA_MULE */ + count_char(ks->gline.line, ks->gline.length, + ks->gline.revPos, ks->gline.revLen, &Vcanna_ichiran_length, + &Vcanna_ichiran_revPos, &Vcanna_ichiran_revLen); +#endif /* CANNA_MULE */ + } + + /* ������������ */ + Vcanna_mode_string = Qnil; + if (ks->info & KanjiModeInfo) { + Vcanna_mode_string = make_string(ks->mode, strlen(ks->mode)); + } + + /* ������������ */ + Vcanna_empty_info = (ks->info & KanjiEmptyInfo) ? 1 : 0; + Vcanna_through_info = (ks->info & KanjiThroughInfo) ? 1 : 0; + } + + return val; +} + +DEFUN ("canna-set-bunsetsu-kugiri", Fcanna_set_bunsetsu, Scanna_set_bunsetsu, + 0, 1, 0, +"This function sets the clause separator.\n\ +If non-nil value is specified, the white space separator will be used.\n\ +No separator will be used otherwise.") + (num) + Lisp_Object num; +{ + int kugiri; /* �������������������� */ + + kugiri = NILP(num) ? 0 : 1; + + jrKanjiControl(0, KC_SETBUNSETSUKUGIRI, (char *)kugiri); + + return Qnil; +} + +/* + * Mule-canna.c of XEmacs-21.4.14 reads + * "For whatever reason, calling Fding directly from libCanna loses". + * In any case following glue is needed for new jrBeepFunc prototype. + */ +static int +call_Fding (void) +{ + Fding (Qnil); + return 0; +} + +DEFUN ("canna-initialize", Fcanna_initialize, Scanna_initialize, 0, 3, 0, +"Initialize ``canna'', which is a kana-to-kanji converter for GNU Emacs.\n\ +The first arg specifies if inserting space character between BUNSETSU when\n\ +candidates are displayed.\n\ +The second arg specifies server.\n\ +The third arg specifies a file which will be used as a customization\n\ +description.\n\ +If nil is specified for each arg, the default value will be used.") +(num, server, rcfile) +Lisp_Object num, server, rcfile; +{ + Lisp_Object val; + int res; + unsigned char **p, **q; + + int kugiri; /* �������������������� */ + + IRCP_context = -1; + + if (NILP(num)) { + kugiri = 1; + } + else { + CHECK_NUMBER(num); + kugiri = XINT(num); + kugiri = (kugiri == 1) ? 1 : 0; + } + + if (NILP(server)) { + jrKanjiControl(0, KC_SETSERVERNAME, (char *)0); + } + else { + char servername[256]; + + CHECK_STRING(server); + strncpy(servername, XSTRING(server)->data, XSTRING(server)->size); + servername[XSTRING(server)->size] = '\0'; + jrKanjiControl(0, KC_SETSERVERNAME, servername); + } + + if (NILP(rcfile)) { + jrKanjiControl(0, KC_SETINITFILENAME, (char *)0); + } + else { + char rcname[256]; + + CHECK_STRING(rcfile); + strncpy(rcname, XSTRING(rcfile)->data, XSTRING(rcfile)->size); + rcname[XSTRING(rcfile)->size] = '\0'; + jrKanjiControl(0, KC_SETINITFILENAME, rcname); + } + + warning = (char **)0; +#ifdef nec_ews_svr4 /* hir, 1994.2.24 */ + stop_polling (); +#endif /* nec_ews_svr4 */ + res = jrKanjiControl(0, KC_INITIALIZE, (char *)&warning); +#ifdef nec_ews_svr4 /* hir, 1994.2.24 */ + start_polling (); +#endif /* nec_ews_svr4 */ + val = Qnil; + if (warning) { + for (p = q = (unsigned char **)warning ; *q ; q++) + ; + while (p < q) { + q--; + val = Fcons(make_string(*q, strlen(*q)), val); + } + } + val = Fcons(val, Qnil); + + if (res == -1) { + val = Fcons(make_string((unsigned char*)jrKanjiError, + strlen(jrKanjiError)), val); + /* ������������������������������ */ + return Fcons(Qnil, val); + } + else { +#ifndef CANNA_JR_BEEP_FUNC_DECLARED + extern int (*jrBeepFunc) (void); +#endif + Lisp_Object CANNA_mode_keys(); + + jrBeepFunc = call_Fding; + +#ifdef KC_SETAPPNAME +#ifndef CANNA_MULE + jrKanjiControl(0, KC_SETAPPNAME, "nemacs"); +#else /* CANNA_MULE */ + jrKanjiControl(0, KC_SETAPPNAME, "mule"); +#endif /* CANNA_MULE */ +#endif /* KC_SETAPPNAME */ + + jrKanjiControl(0, KC_SETBUNSETSUKUGIRI, (char *)kugiri); + jrKanjiControl(0, KC_SETWIDTH, (char *)78); +#ifndef CANNA_MULE + jrKanjiControl(0, KC_INHIBITHANKAKUKANA, (char *)1); +#else /* hir, 1994.12.5 */ + /* mule ���������������������������� */ + if (Vcanna_inhibit_hankakukana) + jrKanjiControl(0, KC_INHIBITHANKAKUKANA, (char *)1); +#endif + jrKanjiControl(0, KC_YOMIINFO, (char *)2); /* ����: ���������������� */ + val = Fcons(Qnil, val); + return Fcons(CANNA_mode_keys(), val); + } +} + +DEFUN ("canna-finalize", Fcanna_finalize, Scanna_finalize, 0, 0, 0, +"finalize ``canna'', which is a kana-to-kanji converter for GNU Emacs.\n\ +This cause to write miscellaneous informations to kana-to-kanji dictionary.") +() +{ + Lisp_Object val; + unsigned char **p; + + jrKanjiControl(0, KC_FINALIZE, (char *)&warning); + + val = Qnil; + if (warning) { + for (p = (unsigned char**)warning ; *p ; p++) { + val = Fcons(make_string(*p, strlen(*p)), val); + } + } + val = Fcons(val, Qnil); + IRCP_context = -1; + return val; +} + +DEFUN ("canna-touroku-string", Fcanna_touroku_string, + Scanna_touroku_string, 1, 1, 0, +"Register Kanji words into kana-to-kanji conversion dictionary.") + (str) +Lisp_Object str; +{ + jrKanjiStatusWithValue ksv; + jrKanjiStatus ks; + int len; + Lisp_Object val; +#ifdef CANNA_MULE + unsigned char cbuf[4096]; +#endif + + CHECK_STRING(str); + ksv.buffer = (unsigned char *)buf; + ksv.bytes_buffer = KEYTOSTRSIZE; +#ifndef CANNA_MULE + ks.echoStr = XSTRING (str)->data; + ks.length = XSTRING (str)->size; +#else /* CANNA_MULE */ +#ifdef STRING_BYTES + m2c(XSTRING (str)->data, STRING_BYTES (XSTRING (str)), cbuf); +#else /* for byte indexing emacsen (Emacs 20.2) */ + m2c(XSTRING (str)->data, XSTRING (str)->size, cbuf); +#endif /* STRING_BYTES */ + ks.echoStr = cbuf; + ks.length = strlen(cbuf); +#endif /* CANNA_MULE */ + ksv.ks = &ks; + len = jrKanjiControl(0, KC_DEFINEKANJI, (char *)&ksv); + val = storeResults(buf, ksv.val, ksv.ks); + return val; +} + +DEFUN ("canna-set-width", Fcanna_set_width, + Scanna_set_width, 1, 1, 0, +"Set status-line width information, which is used to display \n\ +kanji candidates.") + (num) +Lisp_Object num; +{ + CHECK_NUMBER(num); + + jrKanjiControl(0, KC_SETWIDTH, (char *)XINT (num)); + return Qnil; +} + +DEFUN ("canna-change-mode", Fcanna_change_mode, + Scanna_change_mode, 1, 1, 0, +"Change Japanese pre-edit mode.") + (num) +Lisp_Object num; +{ + jrKanjiStatusWithValue ksv; + jrKanjiStatus ks; + Lisp_Object val; + + CHECK_NUMBER(num); + + ksv.buffer = (unsigned char *)buf; + ksv.bytes_buffer = KEYTOSTRSIZE; + ksv.ks = &ks; + ksv.val = XINT (num); + jrKanjiControl(0, KC_CHANGEMODE, (char *)&ksv); + val = storeResults(buf, ksv.val, ksv.ks); + return val; +} + +Lisp_Object +CANNA_mode_keys() +{ +#define CANNAWORKBUFSIZE 32 + char xxx[CANNAWORKBUFSIZE]; + Lisp_Object val; + int i, n; + + n = jrKanjiControl(0, KC_MODEKEYS, xxx); + val = Qnil; + for (i = n ; i > 0 ;) { + --i; + val = Fcons(make_number((int)(0xFF & (unsigned char)xxx[i])), val); + } + return val; +} + +DEFUN ("canna-store-yomi", Fcanna_store_yomi, Scanna_store_yomi, + 1, 2, 0, +"Store yomi characters as a YOMI of kana-to-kanji conversion.") + (yomi, roma) +Lisp_Object yomi, roma; +{ + jrKanjiStatusWithValue ksv; + jrKanjiStatus ks; + + CHECK_STRING(yomi); +#ifndef CANNA_MULE + strncpy(buf, XSTRING(yomi)->data, XSTRING(yomi)->size); + ks.length = XSTRING (yomi)->size; + buf[ks.length] = '\0'; +#else /* CANNA_MULE */ +#ifdef STRING_BYTES + m2c(XSTRING(yomi)->data, STRING_BYTES (XSTRING(yomi)), buf); +#else /* for byte indexing emacsen (Emacs 20.2) */ + m2c(XSTRING(yomi)->data, XSTRING(yomi)->size, buf); +#endif /* STRING_BYTES */ + ks.length = strlen(buf); +#endif /* CANNA_MULE */ + + if (NILP(roma)) { + ks.mode = 0; + } + else { + CHECK_STRING(roma); + +#ifndef CANNA_MULE + strncpy(buf + XSTRING(yomi)->size + 1, XSTRING(roma)->data, + XSTRING(roma)->size); + buf[XSTRING(yomi)->size + 1 + XSTRING(roma)->size] = '\0'; + ks.mode = (unsigned char *)(buf + XSTRING(yomi)->size + 1); +#else /* CANNA_MULE */ + ks.mode = (unsigned char *)(buf + ks.length + 1); +#ifdef STRING_BYTES + m2c(XSTRING(roma)->data, STRING_BYTES (XSTRING(roma)), ks.mode); +#else /* for byte indexing emacsen (Emacs 20.2) */ + m2c(XSTRING(roma)->data, XSTRING(roma)->size, ks.mode); +#endif /* STRING_BYTES */ +#endif /* CANNA_MULE */ + } + + ks.echoStr = (unsigned char *)buf; + ksv.buffer = (unsigned char *)buf; /* ������ */ + ksv.bytes_buffer = KEYTOSTRSIZE; + ksv.ks = &ks; + + jrKanjiControl(0, KC_STOREYOMI, (char *)&ksv); + + return storeResults(buf, ksv.val, ksv.ks); +} + +DEFUN ("canna-do-function", Fcanna_do_function, Scanna_do_function, + 1, 2, 0, +"Do specified function at current mode.") + (num, ch) +Lisp_Object num, ch; +{ + jrKanjiStatusWithValue ksv; + jrKanjiStatus ks; + Lisp_Object val; + + CHECK_NUMBER(num); + + if (NILP(ch)) { + *buf = '@'; + } + else { + CHECK_NUMBER(ch); + *buf = XINT (ch); + } + + ksv.buffer = (unsigned char *)buf; + ksv.bytes_buffer = KEYTOSTRSIZE; + ksv.ks = &ks; + ksv.val = XINT (num); + jrKanjiControl(0, KC_DO, (char *)&ksv); + val = storeResults(buf, ksv.val, ksv.ks); + return val; +} + +DEFUN ("canna-parse", Fcanna_parse, Scanna_parse, + 1, 1, 0, +"Parse customize string.") + (str) +Lisp_Object str; +{ + jrKanjiStatusWithValue ksv; + jrKanjiStatus ks; + Lisp_Object val; + unsigned char **p; + int n; + + CHECK_STRING(str); + +#ifndef CANNA_MULE + strncpy(buf, XSTRING(str)->data, XSTRING(str)->size); + buf[XSTRING(str)->size] = '\0'; +#else /* CANNA_MULE */ +#ifdef STRING_BYTES + m2c(XSTRING(str)->data, STRING_BYTES (XSTRING(str)), buf); +#else /* for byte indexing emacsen (Emacs 20.2) */ + m2c(XSTRING(str)->data, XSTRING(str)->size, buf); +#endif /* STRING_BYTES */ +#endif /* CANNA_MULE */ + p = (unsigned char**)buf; + n = jrKanjiControl(0, KC_PARSE, (char *)&p); + val = Qnil; + while (n > 0) { + n--; + val = Fcons(make_string(p[n], strlen(p[n])), val); + } + return val; +} + +DEFUN ("canna-query-mode", Fcanna_query_mode, Scanna_query_mode, + 0, 0, 0, +"Get current mode string.") + () +{ + unsigned char buf[256]; + + jrKanjiControl(0, KC_QUERYMODE, buf); + return make_string(buf, strlen(buf)); +} + +/* + * Functions following this line are for KKCP interface compatible + * library. These functions may be used by MILK system. + */ + +#define RKBUFSIZE 1024 + +static unsigned char yomibuf[RKBUFSIZE]; +static short kugiri[RKBUFSIZE / 2]; + +static confirmContext() +{ + if (IRCP_context < 0) { + int context; + + if ((context = jrKanjiControl(0, KC_GETCONTEXT, (char *)0)) == -1) { + return 0; + } + IRCP_context = context; + } + return 1; +} + +static byteLen(bun, len) +int bun, len; +{ + int i = 0, offset = 0, ch; + + if (0 <= bun && bun < RKBUFSIZE) { + offset = kugiri[bun]; + } + + while (len-- > 0 && (ch = (int)yomibuf[offset + i])) { + i++; + if (ch & 0x80) { + i++; + } + } + return i; +} + +DEFUN ("canna-henkan-begin", Fcanna_henkan_begin, Scanna_henkan_begin, + 1, 1, 0, +"����������������������������������������������������") + (yomi) + Lisp_Object yomi; +{ + int nbun; + Lisp_Object res; + + CHECK_STRING(yomi); + if (confirmContext() == 0) { + return Qnil; + } +#ifndef CANNA_MULE + strncpy(yomibuf, XSTRING(yomi)->data, XSTRING(yomi)->size); + yomibuf[XSTRING(yomi)->size] = '\0'; + nbun = RkBgnBun(IRCP_context, XSTRING(yomi)->data, XSTRING(yomi)->size, + (RK_XFER << RK_XFERBITS) | RK_KFER); +#else /* CANNA_MULE */ +#ifdef STRING_BYTES + m2c(XSTRING(yomi)->data, STRING_BYTES (XSTRING(yomi)), yomibuf); +#else /* for byte indexing emacsen (Emacs 20.2) */ + m2c(XSTRING(yomi)->data, XSTRING(yomi)->size, yomibuf); +#endif /* STRING_BYTES */ + nbun = RkBgnBun(IRCP_context, (char *)yomibuf, strlen(yomibuf), + (RK_XFER << RK_XFERBITS) | RK_KFER); +#endif /* CANNA_MULE */ + + return kanjiYomiList(IRCP_context, nbun); +} + +static Lisp_Object kanjiYomiList(context, nbun) +int context, nbun; +{ + Lisp_Object val, res = Qnil; + unsigned char RkBuf[RKBUFSIZE]; + int len, i, total; + + for (i = nbun ; i > 0 ; ) { + i--; + RkGoTo(context, i); + len = RkGetKanji(context, RkBuf, RKBUFSIZE); + val = make_string(RkBuf, len); + len = RkGetYomi(context, RkBuf, RKBUFSIZE); + res = Fcons(Fcons(val, make_string(RkBuf, len)), res); + if (i < RKBUFSIZE / 2) { + kugiri[i] = len; + } + } + for (i = 0, total = 0 ; i < nbun ; i++) { + int temp = kugiri[i]; + kugiri[i] = total; + total += temp; + } + return res; +} + +DEFUN ("canna-henkan-next", Fcanna_henkan_next, Scanna_henkan_next, + 1, 1, 0, +"������������������") + (bunsetsu) + Lisp_Object bunsetsu; +{ + int i, nbun, slen, len; + unsigned char *p, RkBuf[RKBUFSIZE]; + Lisp_Object res = Qnil, endp; + + CHECK_NUMBER(bunsetsu); + if (confirmContext() == 0) { + return Qnil; + } + RkGoTo(IRCP_context, XINT (bunsetsu)); + len = RkGetKanjiList(IRCP_context, RkBuf, RKBUFSIZE); + p = RkBuf; + for (i = 0 ; i < len ; i++) { + slen = strlen(p); + if (res == Qnil) { + endp = res = Fcons(make_string(p, slen), Qnil); + } + else { + endp = XCONS (endp)->u.cdr = Fcons(make_string(p, slen), Qnil); + } + p += slen + 1; + } + return res; +} + +DEFUN ("canna-bunsetu-henkou", Fcanna_bunsetu_henkou, Scanna_bunsetu_henkou, + 2, 2, 0, +"����������������������") + (bunsetsu, bunlen) + Lisp_Object bunsetsu, bunlen; +{ + int nbun, len; + + CHECK_NUMBER(bunsetsu); + CHECK_NUMBER(bunlen); + + nbun = XINT (bunsetsu); + if (confirmContext() == 0) { + return Qnil; + } + RkGoTo(IRCP_context, nbun); + len = byteLen(nbun, XINT(bunlen)); + return kanjiYomiList(IRCP_context, RkResize(IRCP_context, len)); +} + +DEFUN ("canna-henkan-kakutei", Fcanna_henkan_kakutei, Scanna_henkan_kakutei, + 2, 2, 0, +"����������") + (bun, kouho) +register Lisp_Object bun, kouho; +{ + if (confirmContext() == 0) { + return Qnil; + } + RkGoTo(IRCP_context, bun); + RkXfer(IRCP_context, kouho); + return Qt; +} + +DEFUN ("canna-henkan-end", Fcanna_henkan_end, Scanna_henkan_end, + 0, 0, 0, +"����������") + () +{ + if (confirmContext() == 0) { + return Qnil; + } + RkEndBun(IRCP_context, 1); /* ������������������������������������ */ + return Qt; +} + +DEFUN ("canna-henkan-quit", Fcanna_henkan_quit, Scanna_henkan_quit, + 0, 0, 0, +"����������") + () +{ + if (confirmContext() == 0) { + return Qnil; + } + RkEndBun(IRCP_context, 0); + return Qt; +} + +/* variables below this line is constants of Canna */ + +static int Vcanna_mode_AlphaMode = IROHA_MODE_AlphaMode; +static int Vcanna_mode_EmptyMode = IROHA_MODE_EmptyMode; +static int Vcanna_mode_KigoMode = IROHA_MODE_KigoMode; +static int Vcanna_mode_YomiMode = IROHA_MODE_YomiMode; +static int Vcanna_mode_JishuMode = IROHA_MODE_JishuMode; +static int Vcanna_mode_TankouhoMode = IROHA_MODE_TankouhoMode; +static int Vcanna_mode_IchiranMode = IROHA_MODE_IchiranMode; +static int Vcanna_mode_YesNoMode = IROHA_MODE_YesNoMode; +static int Vcanna_mode_OnOffMode = IROHA_MODE_OnOffMode; +#ifdef CANNA_MODE_AdjustBunsetsuMode +static int Vcanna_mode_AdjustBunsetsuMode = CANNA_MODE_AdjustBunsetsuMode; +#endif +#ifdef CANNA_MODE_ChikujiYomiMode +static int Vcanna_mode_ChikujiYomiMode = CANNA_MODE_ChikujiYomiMode; +static int Vcanna_mode_ChikujiTanMode = CANNA_MODE_ChikujiTanMode; +#endif + +static int Vcanna_mode_HenkanMode = IROHA_MODE_HenkanMode; +#ifdef CANNA_MODE_HenkanNyuryokuMode +static int Vcanna_mode_HenkanNyuryokuMode = CANNA_MODE_HenkanNyuryokuMode; +#endif +#ifdef CANNA_MODE_ZenHiraHenkanMode +static int Vcanna_mode_ZenHiraHenkanMode = CANNA_MODE_ZenHiraHenkanMode; +#ifdef CANNA_MODE_HanHiraHenkanMode +static int Vcanna_mode_HanHiraHenkanMode = CANNA_MODE_HanHiraHenkanMode; +#endif +static int Vcanna_mode_ZenKataHenkanMode = CANNA_MODE_ZenKataHenkanMode; +static int Vcanna_mode_HanKataHenkanMode = CANNA_MODE_HanKataHenkanMode; +static int Vcanna_mode_ZenAlphaHenkanMode = CANNA_MODE_ZenAlphaHenkanMode; +static int Vcanna_mode_HanAlphaHenkanMode = CANNA_MODE_HanAlphaHenkanMode; +#endif +static int Vcanna_mode_ZenHiraKakuteiMode = IROHA_MODE_ZenHiraKakuteiMode; +#ifdef CANNA_MODE_HanHiraKakuteiMode +static int Vcanna_mode_HanHiraKakuteiMode = CANNA_MODE_HanHiraKakuteiMode; +#endif +static int Vcanna_mode_ZenKataKakuteiMode = IROHA_MODE_ZenKataKakuteiMode; +static int Vcanna_mode_HanKataKakuteiMode = IROHA_MODE_HanKataKakuteiMode; +static int Vcanna_mode_ZenAlphaKakuteiMode = IROHA_MODE_ZenAlphaKakuteiMode; +static int Vcanna_mode_HanAlphaKakuteiMode = IROHA_MODE_HanAlphaKakuteiMode; +static int Vcanna_mode_HexMode = IROHA_MODE_HexMode; +static int Vcanna_mode_BushuMode = IROHA_MODE_BushuMode; +static int Vcanna_mode_ExtendMode = IROHA_MODE_ExtendMode; +static int Vcanna_mode_RussianMode = IROHA_MODE_RussianMode; +static int Vcanna_mode_GreekMode = IROHA_MODE_GreekMode; +static int Vcanna_mode_LineMode = IROHA_MODE_LineMode; +static int Vcanna_mode_ChangingServerMode = IROHA_MODE_ChangingServerMode; +static int Vcanna_mode_HenkanMethodMode = IROHA_MODE_HenkanMethodMode; +static int Vcanna_mode_DeleteDicMode = IROHA_MODE_DeleteDicMode; +static int Vcanna_mode_TourokuMode = IROHA_MODE_TourokuMode; +static int Vcanna_mode_TourokuEmptyMode = IROHA_MODE_TourokuEmptyMode; +static int Vcanna_mode_TourokuHinshiMode = IROHA_MODE_TourokuHinshiMode; +static int Vcanna_mode_TourokuDicMode = IROHA_MODE_TourokuDicMode; +static int Vcanna_mode_QuotedInsertMode = IROHA_MODE_QuotedInsertMode; +static int Vcanna_mode_BubunMuhenkanMode = IROHA_MODE_BubunMuhenkanMode; +static int Vcanna_mode_MountDicMode = IROHA_MODE_MountDicMode; + +static int Vcanna_fn_SelfInsert = IROHA_FN_SelfInsert; +static int Vcanna_fn_FunctionalInsert = IROHA_FN_FunctionalInsert; +static int Vcanna_fn_QuotedInsert = IROHA_FN_QuotedInsert; +static int Vcanna_fn_JapaneseMode = IROHA_FN_JapaneseMode; +static int Vcanna_fn_AlphaMode = IROHA_FN_AlphaMode; +static int Vcanna_fn_HenkanNyuryokuMode = IROHA_FN_HenkanNyuryokuMode; +static int Vcanna_fn_Forward = IROHA_FN_Forward; +static int Vcanna_fn_Backward = IROHA_FN_Backward; +static int Vcanna_fn_Next = IROHA_FN_Next; +static int Vcanna_fn_Prev = IROHA_FN_Prev; +static int Vcanna_fn_BeginningOfLine = IROHA_FN_BeginningOfLine; +static int Vcanna_fn_EndOfLine = IROHA_FN_EndOfLine; +static int Vcanna_fn_DeleteNext = IROHA_FN_DeleteNext; +static int Vcanna_fn_DeletePrevious = IROHA_FN_DeletePrevious; +static int Vcanna_fn_KillToEndOfLine = IROHA_FN_KillToEndOfLine; +static int Vcanna_fn_Henkan = IROHA_FN_Henkan; +static int Vcanna_fn_Kakutei = IROHA_FN_Kakutei; +static int Vcanna_fn_Extend = IROHA_FN_Extend; +static int Vcanna_fn_Shrink = IROHA_FN_Shrink; +#ifdef CANNA_FN_AdjustBunsetsu +static int Vcanna_fn_AdjustBunsetsu = CANNA_FN_AdjustBunsetsu; +#endif +static int Vcanna_fn_Quit = IROHA_FN_Quit; +static int Vcanna_fn_ConvertAsHex = IROHA_FN_ConvertAsHex; +static int Vcanna_fn_ConvertAsBushu = IROHA_FN_ConvertAsBushu; +static int Vcanna_fn_KouhoIchiran = IROHA_FN_KouhoIchiran; +static int Vcanna_fn_BubunMuhenkan = IROHA_FN_BubunMuhenkan; +static int Vcanna_fn_Zenkaku = IROHA_FN_Zenkaku; +static int Vcanna_fn_Hankaku = IROHA_FN_Hankaku; +static int Vcanna_fn_ToUpper = IROHA_FN_ToUpper; +static int Vcanna_fn_Capitalize = IROHA_FN_Capitalize; +static int Vcanna_fn_ToLower = IROHA_FN_ToLower; +static int Vcanna_fn_Hiragana = IROHA_FN_Hiragana; +static int Vcanna_fn_Katakana = IROHA_FN_Katakana; +static int Vcanna_fn_Romaji = IROHA_FN_Romaji; +#ifdef CANNA_FN_BaseHiragana +static int Vcanna_fn_BaseHiragana = CANNA_FN_BaseHiragana; +static int Vcanna_fn_BaseKatakana = CANNA_FN_BaseKatakana; +static int Vcanna_fn_BaseEisu = CANNA_FN_BaseEisu; +static int Vcanna_fn_BaseZenkaku = CANNA_FN_BaseZenkaku; +static int Vcanna_fn_BaseHankaku = CANNA_FN_BaseHankaku; +static int Vcanna_fn_BaseKana = CANNA_FN_BaseKana; +static int Vcanna_fn_BaseKakutei = CANNA_FN_BaseKakutei; +static int Vcanna_fn_BaseHenkan = CANNA_FN_BaseHenkan; +static int Vcanna_fn_BaseHiraKataToggle = CANNA_FN_BaseHiraKataToggle; +static int Vcanna_fn_BaseZenHanToggle = CANNA_FN_BaseZenHanToggle; +static int Vcanna_fn_BaseKanaEisuToggle = CANNA_FN_BaseKanaEisuToggle; +static int Vcanna_fn_BaseKakuteiHenkanToggle = + CANNA_FN_BaseKakuteiHenkanToggle; +static int Vcanna_fn_BaseRotateForward = CANNA_FN_BaseRotateForward; +static int Vcanna_fn_BaseRotateBackward = CANNA_FN_BaseRotateBackward; +#endif +static int Vcanna_fn_ExtendMode = IROHA_FN_ExtendMode; +static int Vcanna_fn_Touroku = IROHA_FN_Touroku; +static int Vcanna_fn_HexMode = IROHA_FN_HexMode; +static int Vcanna_fn_BushuMode = IROHA_FN_BushuMode; +static int Vcanna_fn_KigouMode = IROHA_FN_KigouMode; +#ifdef CANNA_FN_Mark +static int Vcanna_fn_Mark = CANNA_FN_Mark; +#endif +#ifdef CANNA_FN_TemporalMode +static int Vcanna_fn_TemporalMode = CANNA_FN_TemporalMode; +#endif + +static int Vcanna_key_Nfer = IROHA_KEY_Nfer; +static int Vcanna_key_Xfer = IROHA_KEY_Xfer; +static int Vcanna_key_Up = IROHA_KEY_Up; +static int Vcanna_key_Left = IROHA_KEY_Left; +static int Vcanna_key_Right = IROHA_KEY_Right; +static int Vcanna_key_Down = IROHA_KEY_Down; +static int Vcanna_key_Insert = IROHA_KEY_Insert; +static int Vcanna_key_Rollup = IROHA_KEY_Rollup; +static int Vcanna_key_Rolldown = IROHA_KEY_Rolldown; +static int Vcanna_key_Home = IROHA_KEY_Home; +static int Vcanna_key_Help = IROHA_KEY_Help; +static int Vcanna_key_KP_Key = IROHA_KEY_KP_Key; +static int Vcanna_key_Shift_Nfer = IROHA_KEY_Shift_Nfer; +static int Vcanna_key_Shift_Xfer = IROHA_KEY_Shift_Xfer; +static int Vcanna_key_Shift_Up = IROHA_KEY_Shift_Up; +static int Vcanna_key_Shift_Left = IROHA_KEY_Shift_Left; +static int Vcanna_key_Shift_Right = IROHA_KEY_Shift_Right; +static int Vcanna_key_Shift_Down = IROHA_KEY_Shift_Down; +static int Vcanna_key_Cntrl_Nfer = IROHA_KEY_Cntrl_Nfer; +static int Vcanna_key_Cntrl_Xfer = IROHA_KEY_Cntrl_Xfer; +static int Vcanna_key_Cntrl_Up = IROHA_KEY_Cntrl_Up; +static int Vcanna_key_Cntrl_Left = IROHA_KEY_Cntrl_Left; +static int Vcanna_key_Cntrl_Right = IROHA_KEY_Cntrl_Right; +static int Vcanna_key_Cntrl_Down = IROHA_KEY_Cntrl_Down; + +/*static*/ Lisp_Object VCANNA; /* hir@nec, 1992.5.21 */ + +syms_of_canna () +{ + DEFVAR_LISP ("CANNA", &VCANNA, ""); /* hir@nec, 1992.5.21 */ + VCANNA = Qt; /* hir@nec, 1992.5.21 */ + + defsubr (&Scanna_key_proc); + defsubr (&Scanna_initialize); + defsubr (&Scanna_finalize); + defsubr (&Scanna_touroku_string); + defsubr (&Scanna_set_width); + defsubr (&Scanna_change_mode); + defsubr (&Scanna_store_yomi); + defsubr (&Scanna_do_function); + defsubr (&Scanna_parse); + defsubr (&Scanna_query_mode); + defsubr (&Scanna_set_bunsetsu); + + DEFVAR_LISP("canna-kakutei-string", &Vcanna_kakutei_string, ""); + DEFVAR_LISP("canna-kakutei-yomi", &Vcanna_kakutei_yomi, ""); + DEFVAR_LISP("canna-kakutei-romaji", &Vcanna_kakutei_romaji, ""); + DEFVAR_LISP("canna-henkan-string", &Vcanna_henkan_string, ""); + DEFVAR_INT ("canna-henkan-length", &Vcanna_henkan_length, ""); + DEFVAR_INT ("canna-henkan-revpos", &Vcanna_henkan_revPos, ""); + DEFVAR_INT ("canna-henkan-revlen", &Vcanna_henkan_revLen, ""); + DEFVAR_LISP("canna-ichiran-string", &Vcanna_ichiran_string, ""); + DEFVAR_INT ("canna-ichiran-length", &Vcanna_ichiran_length, ""); + DEFVAR_INT ("canna-ichiran-revpos", &Vcanna_ichiran_revPos, ""); + DEFVAR_INT ("canna-ichiran-revlen", &Vcanna_ichiran_revLen, ""); + DEFVAR_LISP("canna-mode-string", &Vcanna_mode_string, ""); + + DEFVAR_BOOL ("canna-empty-info", &Vcanna_empty_info, "For canna"); + DEFVAR_BOOL ("canna-through-info", &Vcanna_through_info, "For canna"); + DEFVAR_BOOL ("canna-underline", &Vcanna_underline, "For canna"); + DEFVAR_BOOL ("canna-inhibit-hankakukana", &Vcanna_inhibit_hankakukana, + "For canna"); /* hir, 1994.12.5 */ + + defsubr (&Scanna_henkan_begin); + defsubr (&Scanna_henkan_next); + defsubr (&Scanna_bunsetu_henkou); + defsubr (&Scanna_henkan_kakutei); + defsubr (&Scanna_henkan_end); + defsubr (&Scanna_henkan_quit); + + DEFVAR_INT ("canna-mode-alpha-mode", &Vcanna_mode_AlphaMode, ""); + DEFVAR_INT ("canna-mode-empty-mode", &Vcanna_mode_EmptyMode, ""); + DEFVAR_INT ("canna-mode-kigo-mode", &Vcanna_mode_KigoMode, ""); + DEFVAR_INT ("canna-mode-yomi-mode", &Vcanna_mode_YomiMode, ""); + DEFVAR_INT ("canna-mode-jishu-mode", &Vcanna_mode_JishuMode, ""); + DEFVAR_INT ("canna-mode-tankouho-mode", &Vcanna_mode_TankouhoMode, ""); + DEFVAR_INT ("canna-mode-ichiran-mode", &Vcanna_mode_IchiranMode, ""); + DEFVAR_INT ("canna-mode-yes-no-mode", &Vcanna_mode_YesNoMode, ""); + DEFVAR_INT ("canna-mode-on-off-mode", &Vcanna_mode_OnOffMode, ""); +#ifdef CANNA_MODE_AdjustBunsetsuMode + DEFVAR_INT ("canna-mode-adjust-bunsetsu-mode", + &Vcanna_mode_AdjustBunsetsuMode, ""); +#endif +#ifdef CANNA_MODE_ChikujiYomiMode + DEFVAR_INT ("canna-mode-chikuji-yomi-mode", &Vcanna_mode_ChikujiYomiMode,""); + DEFVAR_INT ("canna-mode-chikuji-bunsetsu-mode", + &Vcanna_mode_ChikujiTanMode, ""); +#endif + + DEFVAR_INT ("canna-mode-henkan-mode", &Vcanna_mode_HenkanMode, ""); +#ifdef CANNA_MODE_HenkanNyuryokuMode + DEFVAR_INT ("canna-mode-henkan-nyuuryoku-mode", + &Vcanna_mode_HenkanNyuryokuMode, 0); +#endif +#ifdef CANNA_MODE_ZenHiraHenkanMode + DEFVAR_INT ("canna-mode-zen-hira-henkan-mode", + &Vcanna_mode_ZenHiraHenkanMode, ""); +#ifdef CANNA_MODE_HanHiraHenkanMode + DEFVAR_INT ("canna-mode-han-hira-henkan-mode", + &Vcanna_mode_HanHiraHenkanMode, ""); +#endif + DEFVAR_INT ("canna-mode-zen-kata-henkan-mode", + &Vcanna_mode_ZenKataHenkanMode, ""); + DEFVAR_INT ("canna-mode-han-kata-henkan-mode", + &Vcanna_mode_HanKataHenkanMode, ""); + DEFVAR_INT ("canna-mode-zen-alpha-henkan-mode", + &Vcanna_mode_ZenAlphaHenkanMode, ""); + DEFVAR_INT ("canna-mode-han-alpha-henkan-mode", + &Vcanna_mode_HanAlphaHenkanMode, ""); +#endif + DEFVAR_INT ("canna-mode-zen-hira-kakutei-mode", + &Vcanna_mode_ZenHiraKakuteiMode, ""); +#ifdef CANNA_MODE_HanHiraKakuteiMode + DEFVAR_INT ("canna-mode-han-hira-kakutei-mode", + &Vcanna_mode_HanHiraKakuteiMode, ""); +#endif + DEFVAR_INT ("canna-mode-zen-kata-kakutei-mode", + &Vcanna_mode_ZenKataKakuteiMode, ""); + DEFVAR_INT ("canna-mode-han-kata-kakutei-mode", + &Vcanna_mode_HanKataKakuteiMode, ""); + DEFVAR_INT ("canna-mode-zen-alpha-kakutei-mode", + &Vcanna_mode_ZenAlphaKakuteiMode, ""); + DEFVAR_INT ("canna-mode-han-alpha-kakutei-mode", + &Vcanna_mode_HanAlphaKakuteiMode, ""); + DEFVAR_INT ("canna-mode-hex-mode", &Vcanna_mode_HexMode, ""); + DEFVAR_INT ("canna-mode-bushu-mode", &Vcanna_mode_BushuMode, ""); + DEFVAR_INT ("canna-mode-extend-mode", &Vcanna_mode_ExtendMode, ""); + DEFVAR_INT ("canna-mode-russian-mode", &Vcanna_mode_RussianMode, ""); + DEFVAR_INT ("canna-mode-greek-mode", &Vcanna_mode_GreekMode, ""); + DEFVAR_INT ("canna-mode-line-mode", &Vcanna_mode_LineMode, ""); + DEFVAR_INT ("canna-mode-changing-server-mode", + &Vcanna_mode_ChangingServerMode, ""); + DEFVAR_INT ("canna-mode-henkan-method-mode", + &Vcanna_mode_HenkanMethodMode, ""); + DEFVAR_INT ("canna-mode-delete-dic-mode", &Vcanna_mode_DeleteDicMode, ""); + DEFVAR_INT ("canna-mode-touroku-mode", &Vcanna_mode_TourokuMode, ""); + DEFVAR_INT ("canna-mode-touroku-empty-mode", + &Vcanna_mode_TourokuEmptyMode, ""); + DEFVAR_INT ("canna-mode-touroku-hinshi-mode", + &Vcanna_mode_TourokuHinshiMode, ""); + DEFVAR_INT ("canna-mode-touroku-dic-mode", &Vcanna_mode_TourokuDicMode, ""); + DEFVAR_INT ("canna-mode-quoted-insert-mode", + &Vcanna_mode_QuotedInsertMode, ""); + DEFVAR_INT ("canna-mode-bubun-muhenkan-mode", + &Vcanna_mode_BubunMuhenkanMode, ""); + DEFVAR_INT ("canna-mode-mount-dic-mode", &Vcanna_mode_MountDicMode, ""); + + DEFVAR_INT ("canna-func-self-insert", &Vcanna_fn_SelfInsert ,""); + DEFVAR_INT ("canna-func-functional-insert", &Vcanna_fn_FunctionalInsert ,""); + DEFVAR_INT ("canna-func-quoted-insert", &Vcanna_fn_QuotedInsert ,""); + DEFVAR_INT ("canna-func-japanese-mode", &Vcanna_fn_JapaneseMode ,""); + DEFVAR_INT ("canna-func-alpha-mode", &Vcanna_fn_AlphaMode ,""); + DEFVAR_INT ("canna-func-henkan-nyuryoku-mode", + &Vcanna_fn_HenkanNyuryokuMode ,""); + DEFVAR_INT ("canna-func-forward", &Vcanna_fn_Forward ,""); + DEFVAR_INT ("canna-func-backward", &Vcanna_fn_Backward ,""); + DEFVAR_INT ("canna-func-next", &Vcanna_fn_Next ,""); + DEFVAR_INT ("canna-func-previous", &Vcanna_fn_Prev ,""); + DEFVAR_INT ("canna-func-beginning-of-line", &Vcanna_fn_BeginningOfLine ,""); + DEFVAR_INT ("canna-func-end-of-line", &Vcanna_fn_EndOfLine ,""); + DEFVAR_INT ("canna-func-delete-next", &Vcanna_fn_DeleteNext ,""); + DEFVAR_INT ("canna-func-delete_previous", &Vcanna_fn_DeletePrevious ,""); + DEFVAR_INT ("canna-func-kill-to-end-of-line", &Vcanna_fn_KillToEndOfLine,""); + DEFVAR_INT ("canna-func-henkan", &Vcanna_fn_Henkan ,""); + DEFVAR_INT ("canna-func-kakutei", &Vcanna_fn_Kakutei ,""); + DEFVAR_INT ("canna-func-extend", &Vcanna_fn_Extend ,""); + DEFVAR_INT ("canna-func-shrink", &Vcanna_fn_Shrink ,""); +#ifdef CANNA_FN_AdjustBunsetsu + DEFVAR_INT ("canna-func-adjust-bunsetsu", &Vcanna_fn_AdjustBunsetsu ,""); +#endif + DEFVAR_INT ("canna-func-quit", &Vcanna_fn_Quit ,""); + DEFVAR_INT ("canna-func-convert-as-hex", &Vcanna_fn_ConvertAsHex ,""); + DEFVAR_INT ("canna-func-convert-as-bushu", &Vcanna_fn_ConvertAsBushu ,""); + DEFVAR_INT ("canna-func-kouho-ichiran", &Vcanna_fn_KouhoIchiran ,""); + DEFVAR_INT ("canna-func-bubun-muhenkan", &Vcanna_fn_BubunMuhenkan ,""); + DEFVAR_INT ("canna-func-zenkaku", &Vcanna_fn_Zenkaku ,""); + DEFVAR_INT ("canna-func-hankaku", &Vcanna_fn_Hankaku ,""); + DEFVAR_INT ("canna-func-to-upper", &Vcanna_fn_ToUpper ,""); + DEFVAR_INT ("canna-func-capitalize", &Vcanna_fn_Capitalize ,""); + DEFVAR_INT ("canna-func-to-lower", &Vcanna_fn_ToLower ,""); + DEFVAR_INT ("canna-func-hiragana", &Vcanna_fn_Hiragana ,""); + DEFVAR_INT ("canna-func-katakana", &Vcanna_fn_Katakana ,""); + DEFVAR_INT ("canna-func-romaji", &Vcanna_fn_Romaji ,""); +#ifdef CANNA_FN_BaseHiragana + DEFVAR_INT ("canna-func-base-hiragana", &Vcanna_fn_BaseHiragana ,""); + DEFVAR_INT ("canna-func-base-katakana", &Vcanna_fn_BaseKatakana ,""); + DEFVAR_INT ("canna-func-base-eisu", &Vcanna_fn_BaseEisu ,""); + DEFVAR_INT ("canna-func-base-zenkaku", &Vcanna_fn_BaseZenkaku ,""); + DEFVAR_INT ("canna-func-base-hankaku", &Vcanna_fn_BaseHankaku ,""); + DEFVAR_INT ("canna-func-base-kana", &Vcanna_fn_BaseKana ,""); + DEFVAR_INT ("canna-func-base-kakutei", &Vcanna_fn_BaseKakutei ,""); + DEFVAR_INT ("canna-func-base-henkan", &Vcanna_fn_BaseHenkan ,""); + DEFVAR_INT ("canna-func-base-hiragana-katakana-toggle", + &Vcanna_fn_BaseHiraKataToggle ,""); + DEFVAR_INT ("canna-func-base-zenkaku-hankaku-toggle", + &Vcanna_fn_BaseZenHanToggle ,""); + DEFVAR_INT ("canna-func-base-kana-eisu-toggle", + &Vcanna_fn_BaseKanaEisuToggle ,""); + DEFVAR_INT ("canna-func-base-kakutei-henkan-toggle", + &Vcanna_fn_BaseKakuteiHenkanToggle ,""); + DEFVAR_INT ("canna-func-base-rotate-forward", + &Vcanna_fn_BaseRotateForward ,""); + DEFVAR_INT ("canna-func-base-rotate-backward", + &Vcanna_fn_BaseRotateBackward ,""); +#endif + DEFVAR_INT ("canna-func-extend-mode", &Vcanna_fn_ExtendMode ,""); + DEFVAR_INT ("canna-func-touroku", &Vcanna_fn_Touroku ,""); + DEFVAR_INT ("canna-func-hex-mode", &Vcanna_fn_HexMode ,""); + DEFVAR_INT ("canna-func-bushu-mode", &Vcanna_fn_BushuMode ,""); + DEFVAR_INT ("canna-func-kigo-mode", &Vcanna_fn_KigouMode ,""); +#ifdef CANNA_FN_Mark + DEFVAR_INT ("canna-func-mark", &Vcanna_fn_Mark ,""); +#endif +#ifdef CANNA_FN_TemporalMode + DEFVAR_INT ("canna-func-temporal-mode", &Vcanna_fn_TemporalMode ,""); +#endif + + DEFVAR_INT ("canna-key-nfer", &Vcanna_key_Nfer, ""); + DEFVAR_INT ("canna-key-xfer", &Vcanna_key_Xfer, ""); + DEFVAR_INT ("canna-key-up", &Vcanna_key_Up, ""); + DEFVAR_INT ("canna-key-left", &Vcanna_key_Left, ""); + DEFVAR_INT ("canna-key-right", &Vcanna_key_Right, ""); + DEFVAR_INT ("canna-key-down", &Vcanna_key_Down, ""); + DEFVAR_INT ("canna-key-insert", &Vcanna_key_Insert, ""); + DEFVAR_INT ("canna-key-rollup", &Vcanna_key_Rollup, ""); + DEFVAR_INT ("canna-key-rolldown", &Vcanna_key_Rolldown, ""); + DEFVAR_INT ("canna-key-home", &Vcanna_key_Home, ""); + DEFVAR_INT ("canna-key-help", &Vcanna_key_Help, ""); + DEFVAR_INT ("canna-key-kp-key", &Vcanna_key_KP_Key, ""); + DEFVAR_INT ("canna-key-shift-nfer", &Vcanna_key_Shift_Nfer, ""); + DEFVAR_INT ("canna-key-shift-xfer", &Vcanna_key_Shift_Xfer, ""); + DEFVAR_INT ("canna-key-shift-up", &Vcanna_key_Shift_Up, ""); + DEFVAR_INT ("canna-key-shift-left", &Vcanna_key_Shift_Left, ""); + DEFVAR_INT ("canna-key-shift-right", &Vcanna_key_Shift_Right, ""); + DEFVAR_INT ("canna-key-shift-down", &Vcanna_key_Shift_Down, ""); + DEFVAR_INT ("canna-key-control-nfer", &Vcanna_key_Cntrl_Nfer, ""); + DEFVAR_INT ("canna-key-control-xfer", &Vcanna_key_Cntrl_Xfer, ""); + DEFVAR_INT ("canna-key-control-up", &Vcanna_key_Cntrl_Up, ""); + DEFVAR_INT ("canna-key-control-left", &Vcanna_key_Cntrl_Left, ""); + DEFVAR_INT ("canna-key-control-right", &Vcanna_key_Cntrl_Right, ""); + DEFVAR_INT ("canna-key-control-down", &Vcanna_key_Cntrl_Down, ""); +} + +#ifdef CANNA_MULE +/* To handle MULE internal code and EUC. + I assume CANNA can handle only Japanese EUC. */ + +/* EUC multibyte string to MULE internal string */ + +static +c2mu(cp, l, mp) +char *cp; +int l; +char *mp; +{ + char ch, *ep = cp+l; + + while((cp < ep) && (ch = *cp)) { + if ((unsigned char)ch == ISO_CODE_SS2) { + *mp++ = charset_katakana_jisx0201; + cp++; + } + else if ((unsigned char)ch == ISO_CODE_SS3) { + *mp++ = charset_jisx0212; /* LCJP2; */ + cp++; + *mp++ = *cp++; + } + else if(ch & 0x80) { + *mp++ = charset_jisx0208; + *mp++ = *cp++; + } + *mp++ = *cp++; + } + *mp = 0; +} + +/* MULE internal string to EUC multibyte string */ + +static +m2c(mp, l, cp) +unsigned char *mp; +int l; +unsigned char *cp; +{ + unsigned char ch, *ep = mp + l;; + + while((mp < ep) && (ch = *mp++)) { +#if 0 + switch (ch) { + case charset_katakana_jisx0201: + *cp++ = ISO_CODE_SS2; + *cp++ = *mp++; + break; + case charset_jisx0212 /*LCJP2*/: + *cp++ = ISO_CODE_SS3; + case charset_jisx0208: + *cp++ = *mp++; + *cp++ = *mp++; + break; + default: + *cp++ = ch; + break; + } +#endif + if (ch == charset_katakana_jisx0201) { + *cp++ = ISO_CODE_SS2; + *cp++ = *mp++; + } else if (ch == charset_jisx0212) { /* LCJP2 */ + *cp++ = ISO_CODE_SS3; + *cp++ = *mp++; + *cp++ = *mp++; + } else if (ch == charset_jisx0208) { /* LCJP */ + *cp++ = *mp++; + *cp++ = *mp++; + } else { + *cp++ = ch; + } + } + *cp = 0; +} + +#undef make_string + +/* make_string after converting EUC string to MULE internal string */ +static +Lisp_Object +mule_make_string(p,l) +unsigned char *p; +int l; +{ + unsigned char cbuf[4096]; + + c2mu(p,l,cbuf); + return (make_string(cbuf,strlen(cbuf))); +} + +/* return the MULE internal string length of EUC string */ +static +mule_strlen(p,l) +unsigned char *p; +int l; +{ + unsigned char ch, *cp = p; + int len = 0; + + while((cp < p + l) && (ch = *cp)) { + if ((unsigned char)ch == ISO_CODE_SS2) { +#ifdef STRING_BYTES + len++; +#else + len += 2; +#endif + cp += 2; + } + else if ((unsigned char)ch == ISO_CODE_SS3) { +#ifdef STRING_BYTES + len++; +#else + len += 3; +#endif + cp += 3; + } + else if(ch & 0x80) { +#ifdef STRING_BYTES + len++; +#else + len += 3; +#endif + cp += 2; + } + else { + len++; + cp++; + } + } + return(len); +} + +/* count number of characters */ +static +count_char(p,len,pos,rev,clen,cpos,crev) +unsigned char *p; +int len,pos,rev,*clen,*cpos,*crev; +{ + unsigned char *q = p; + + *clen = *cpos = *crev = 0; + if (len == 0) return; + while (q < p + pos) { + (*clen)++; + (*cpos)++; + if (*q++ & 0x80) q++; + } + while (q < p + pos + rev) { + (*clen)++; + (*crev)++; + if (*q++ & 0x80) q++; + } + while (q < p + len) { + (*clen)++; + if (*q++ & 0x80) q++; + } +} +#endif /* CANNA_MULE */ --- emacs-22.1/src/charset.c~ 2007-01-21 04:18:16 +0000 +++ emacs-22.1/src/charset.c 2007-06-03 23:21:07 +0000 @@ -60,6 +60,7 @@ /* Declaration of special charsets. The values are set by Fsetup_special_charsets. */ int charset_latin_iso8859_1; /* ISO8859-1 (Latin-1) */ +int charset_jisx0212; /* JISX0212 appended by knak 1997.10.26 */ int charset_jisx0208_1978; /* JISX0208.1978 (Japanese Kanji old set) */ int charset_jisx0208; /* JISX0208.1983 (Japanese Kanji) */ int charset_katakana_jisx0201; /* JISX0201.Kana (Japanese Katakana) */ @@ -1701,6 +1702,7 @@ charset_latin_iso8859_1 = charset_id_internal ("latin-iso8859-1"); charset_jisx0208_1978 = charset_id_internal ("japanese-jisx0208-1978"); charset_jisx0208 = charset_id_internal ("japanese-jisx0208"); + charset_jisx0212 = charset_id_internal ("japanese-jisx0212"); /* appended by knak 1997.10.26 */ charset_katakana_jisx0201 = charset_id_internal ("katakana-jisx0201"); charset_latin_jisx0201 = charset_id_internal ("latin-jisx0201"); charset_big5_1 = charset_id_internal ("chinese-big5-1"); --- emacs-22.1/src/charset.h~ 2007-01-21 04:18:16 +0000 +++ emacs-22.1/src/charset.h 2007-06-03 23:21:07 +0000 @@ -126,6 +126,7 @@ #define CHARSET_8_BIT_GRAPHIC 0x80 /* 0xA0..0xFF */ extern int charset_latin_iso8859_1; /* ISO8859-1 (Latin-1) */ +extern int charset_jisx0212; /* JISX212 appended by knak 1997.10.26 */ extern int charset_jisx0208_1978; /* JISX0208.1978 (Japanese Kanji old set) */ extern int charset_jisx0208; /* JISX0208.1983 (Japanese Kanji) */ extern int charset_katakana_jisx0201; /* JISX0201.Kana (Japanese Katakana) */ --- emacs-22.1/src/config.in~ 2007-01-26 16:33:17 +0000 +++ emacs-22.1/src/config.in 2007-06-03 23:21:07 +0000 @@ -32,6 +32,15 @@ /* Define to 1 if the mktime function is broken. */ #undef BROKEN_MKTIME +/* flag whether to use Canna */ +#undef CANNA + +/* flag whether to use Canna2 */ +#undef CANNA2 + +/* flag whether to use Canna on Mule */ +#undef CANNA_MULE + /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ @@ -43,6 +52,12 @@ /* Define to 1 if using `getloadavg.c'. */ #undef C_GETLOADAVG +/* compile switch for Canna */ +#undef C_SWITCH_CANNA + +/* compile switch for Wnn */ +#undef C_SWITCH_WNN + /* Define C_SWITCH_X_SITE to contain any special flags your compiler may need to deal with X Windows. For instance, if you've defined HAVE_X_WINDOWS above and your X include files aren't in a place that your compiler can @@ -755,6 +770,15 @@ /* Define to use Kerberos 5 instead of Kerberos 4. */ #undef KERBEROS5 +/* link switch for Canna */ +#undef LD_SWITCH_CANNA + +/* link switch for Canna if -R option is needed */ +#undef LD_SWITCH_CANNA_AUX + +/* link switch for Wnn */ +#undef LD_SWITCH_WNN + /* Define LD_SWITCH_X_SITE to contain any special flags your loader may need to deal with X Windows. For instance, if you've defined HAVE_X_WINDOWS above and your X libraries aren't in a place that your loader can find on @@ -765,6 +789,9 @@ Solaris, for example). */ #undef LD_SWITCH_X_SITE_AUX +/* special library for Mule */ +#undef LIBS_MULE + /* Define to 1 if localtime caches TZ. */ #undef LOCALTIME_CACHE @@ -807,6 +834,9 @@ /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE +/* flag whether to use sj3 */ +#undef SJ3 + /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. @@ -850,6 +880,9 @@ XPointer or XPointer*. */ #undef XRegisterIMInstantiateCallback_arg6 +/* flag whether to use Wnn */ +#undef WNN + /* Define to 1 if on AIX 3. System headers sometimes define this. We just want to avoid a redefinition error message. */ @@ -1164,6 +1197,34 @@ #define BCMP memcmp #endif +#ifdef WNN +# define EGG +# define WNN_PURESIZE 30000 +#else /* not WNN */ +# define WNN_PURESIZE 0 +#endif /* not WNN */ + +#ifdef SJ3 +# define EGG +# define SJ3_PURESIZE 38000 +#else /* not SJ3 */ +# define SJ3_PURESIZE 0 +#endif /* not SJ3 */ + +#ifdef EGG +# define EGG_PURESIZE 32000 +#else /* not EGG */ +# define EGG_PURESIZE 0 +#endif /* not EGG */ + +#ifdef CANNA +# define CANNA2 +# define CANNA_MULE +# define CANNA_PURESIZE 18000 +#else /* not CANNA */ +# define CANNA_PURESIZE 0 +#endif /* not CANNA */ + #endif /* EMACS_CONFIG_H */ /* --- emacs-22.1/src/emacs.c~ 2007-04-22 03:45:41 +0000 +++ emacs-22.1/src/emacs.c 2007-06-03 23:21:07 +0000 @@ -116,6 +116,9 @@ least one symbol with that type, and then xbacktrace could fail. */ enum pvec_type gdb_pvec_type = PVEC_TYPE_MASK; +Lisp_Object VMULE, VEGG, VWNN, VSJ3; /* 92.7.8 by K.Handa and Y.Kawabe */ +/* 95.6.1 by S.Tomura */ + /* Command line args from shell, as list of strings. */ Lisp_Object Vcommand_line_args; @@ -1623,6 +1626,16 @@ syms_of_fontset (); #endif /* MAC_OSX && HAVE_CARBON */ + syms_of_mule (); /* 94.7.15 by K.Handa */ + +#ifdef WNN + syms_of_wnn (); +#endif +#ifdef CANNA + syms_of_canna (); +#endif /* CANNA */ +/* end of patch */ + #ifdef SYMS_SYSTEM SYMS_SYSTEM; #endif @@ -2521,5 +2534,35 @@ Vprevious_system_time_locale = Qnil; } +syms_of_mule () +{ +#if 0 + defsubr (&Sdefine_word_pattern); + + DEFVAR_BOOL ("re-short-flag", &re_short_flag, + "*T means regexp search success when the shortest match is found."); + re_short_flag = 0; + + DEFVAR_LISP ("MULE", &VMULE, ""); + VMULE = Qt; +#endif + +#ifdef EGG + DEFVAR_LISP ("EGG", &VEGG, ""); + VEGG = Qt; +/* 92.7.8 by K.Handa and Y.Kawabe */ +/* 95.6.1 by S.Tomura */ +#ifdef WNN + DEFVAR_LISP ("WNN", &VWNN, ""); + VWNN = Qt; +#else /* not WNN */ +#ifdef SJ3 + DEFVAR_LISP ("SJ3", &VSJ3, ""); + VSJ3 = Qt; +#endif /* SJ3 */ +#endif /* not WNN */ +#endif /* EGG */ +} + /* arch-tag: 7bfd356a-c720-4612-8ab6-aa4222931c2e (do not change this comment) */ --- emacs-22.1/src/puresize.h~ 2007-01-14 03:24:37 +0000 +++ emacs-22.1/src/puresize.h 2007-06-03 23:21:07 +0000 @@ -43,7 +43,7 @@ #endif #ifndef BASE_PURESIZE -#define BASE_PURESIZE (1120000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) +#define BASE_PURESIZE (1180000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) #endif /* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */ @@ -57,7 +57,7 @@ /* This is the actual size in bytes to allocate. */ #ifndef PURESIZE -#define PURESIZE (BASE_PURESIZE * PURESIZE_RATIO) +#define PURESIZE ((BASE_PURESIZE + WNN_PURESIZE + SJ3_PURESIZE + EGG_PURESIZE + CANNA_PURESIZE) * PURESIZE_RATIO) #endif /* Signal an error if OBJ is pure. */ --- emacs-22.1/src/s/netbsd.h~ 2007-02-16 08:30:08 +0000 +++ emacs-22.1/src/s/netbsd.h 2007-06-03 23:21:07 +0000 @@ -54,6 +54,8 @@ #define LIBS_DEBUG /* -lutil is not needed for NetBSD >0.9. */ /* #define LIBS_SYSTEM -lutil */ +/* for Wnn */ +#define LIBS_SYSTEM -lcrypt #define LIBS_TERMCAP -ltermcap #define NEED_ERRNO --- /dev/null 1970-01-01 00:00:00 +0000 +++ emacs-22.1/src/wnnfns.c 2007-06-03 23:21:07 +0000 @@ -0,0 +1,2199 @@ +/* Jserver Interface for Mule + Coded by Yutaka Ishikawa at ETL (yisikawa@etl.go.jp) + Satoru Tomura at ETL (tomura@etl.go.jp) + Modified for Wnn4 library by + Toshiaki Shingu (shingu@cpr.canon.co.jp) + Hiroshi Kuribayashi (kuri@nff.ncl.omron.co.jp) + + This file is part of Egg on Nemacs (Japanese environment) + + Egg is distributed in the forms of patches to GNU + Emacs under the terms of the GNU EMACS GENERAL PUBLIC + LICENSE which is distributed along with GNU Emacs by the + Free Software Foundation. + + 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 EMACS GENERAL PUBLIC LICENSE for + more details. + + You should have received a copy of the GNU EMACS GENERAL + PUBLIC LICENSE along with Nemacs; see the file COPYING. + If not, write to the Free Software Foundation, 675 Mass + Ave, Cambridge, MA 02139, USA. */ + +/* + * CHANGE LOG + * + * 1995.5.30 wnn-server-version + * 1995. functions for Wnn6 + * 1994.2.24 check_wnn_server_type() should not be static. + * 1994.2.3 kWnn support by H.Kuribayashi. + * 1993.6.29 wnn-server-set-rev updated. + * 1993.4.23 serious bug in wnn-server-open fixed. + * 1993.4.2 wnn-server-fuzokugo-set, + * wnn-server-dict-add, wnn-server-dict-delete, + * wnn-server-dict-comment, wnn-server-dict-save, + * wnn-server-word-search, wnn-server-word-hindo-set, + * wnn-server-word-info, wnn-server-word-use, + * wnn-server-word-delete, wnn-server-word-add + * changed to support fixed type dictionary. + * 1993.3.3 w2y: bug fixed. + * 1992.12.7 wnn-server-set-param was modified to set parameters on + * normal/reverse environment individually. + * 1992.11.27 wnn-server-get-msg fixed by kuri. + * 1992.10.29 m2w() and w2m() handle PY_EOF for cserver. + * 1992.10.19 Slight change in Fwnn_word_info() by T.Atsushiba + * 1992.09.29 completely modified for chinese translation. + * 1992.09.03 code related to wnn_error changed. + * 1992.08.20 yes_or_no + * 1992.07.02 wnn-server-dict-list modified + * 1992.07.02 wnn-server-word-info + * 1992.05.18 modified for mule + * 1992.05.15 wnn-server-dict-add/query + * 1992.05.09 SERIOUS BUG FIX with jl_close + * 1992.05.09 wnn-server-open with lang + * 1992.05.09 wnn-server-inspect inproved + * 1992.05.09 zenkouho with dai/sho bunsetu + * 1992.04.23 rewrite for jl library by T.Shingu(shingu@cpr.canon.co.jp) + * ----------------------------------------------------------------------- + * + * Functions defined in this file are + * (wnn-server-open wnn-host-name login-name) + * wnn-host-name: STRING or NIL + * login-name: STRING + * RETURNS: BOOLEAN + * DESCRIPTION: + * jserver と接続し、サーバー内部に正変換/逆変換2つの環境を + * 作る。エラーの時は nil を返す。 + * + * (wnn-server-close) + * RETURNS: BOOLEAN + * DESCRIPTION: + * jserver との接続を切る。辞書、頻度はセーブされない。 + * + * (wnn-server-dict-add dict-file-name hindo-file-name priority + * dict-file-mode hindo-file-mode pw1 pw2) + * dict-file-name: STRING + * hindo-file-name: STRING or NULL-STRING + * priority: INTEGER + * dict-file-mode: BOOLEAN + * hindo-file-mode: BOOLEAN + * pw1: STRING or NIL + * pw2: STRING or NIL + * DESCRIPTION: + * 辞書ファイル名、頻度ファイル名、優先度、辞書ファイルモード + * 頻度ファイルモードで指定した辞書をバッファに追加する。 + * pw1, pw2 は辞書ファイル、頻度ファイルのパスワード。 + * + * (wnn-server-dict-delete dic-no) + * dic-no: INTEGER + * RETURNS: エラーの時 nil + * DESCRIPTION: dic-no の辞書番号の辞書を、バッファから + * 削除する。 + * + * (wnn-server-dict-list) + * RETURNS: ((dic-no1 file-name1 comment1 word-no1 nice1) + * (dic-no2 file-name2 comment2 word-no2 nice2)...) + * DESCRIPTION: バッファ上の辞書のリストを得る。 + * + * (wnn-server-dict-comment dic-no comment) + * RETURNS: エラーの時 nil + * DESCRIPTION: dic-no の辞書にコメントをつける。 + * + * (wnn-server-set-rev rev) + * rev: BOOLEAN + * rev が nil の時は正変換、それ以外の時は逆変換 + * + * (wnn-server-henkan-begin henkan-string) + * henkan-string: STRING + * RETURNS: bunsetu-suu + * DESCRIPTION: + * 仮名漢字変換をし、第一候補の文節数を返す。 + * + * (wnn-server-zenkouho bunsetu-no dai) + * bunsetu-no: INTEGER + * dai: BOOLEAN + * RETURNS: offset + * DESCRIPTION: + * 文節番号で指定された文節の全候補をとりだし + * 、現在のオフセットを返す。 + * + * (wnn-server-get-zenkouho offset) + * bunsetu-no: INTEGER + * dai: BOOLEAN + * RETURNS: list of zenkouho + * DESCRIPTION: + * オフセットで指定された候補を得る。 + * + * (wnn-server-zenkouho-bun) + * RETURNS: INTEGER + * DESCRIPTION: + * 全候補を表示している文節番号を得る。 + * + * (wnn-server-zenkouho-suu) + * RETURNS: INTEGER + * DESCRIPTION: + * 全候補を表示している文節の全候補数を得る。 + * + * (wnn-server-dai-top bun-no) + * bun-no: INTEGER + * RETURNS: BOOLEAN + * DESCRIPTION: + * 文節が大文節の先頭なら t + * + * (wnn-server-dai-end bun-no) + * bun-no: INTEGER + * RETURNS: INTEGER + * DESCRIPTION: + * 次の大文節の文節番号を得る。 + * + * (wnn-server-henkan-kakutei kouho-no dai) + * kouho-no: INTEGER + * dai: BOOLEAN + * RETURNS: BOOLEAN + * DESCRIPTION: + * 候補番号で示された候補を選択する。 + * (wnn-server-zenkouho) を呼んてからでないといけない。 + * + * (wnn-server-bunsetu-henkou bunsetu-no bunsetu-length dai) + * bunsetu-no: INTEGER + * bunsetu-length: INTEGER + * dai: BOOLEAN + * RETURNS: + * DESCRIPTION: + * 文節の長さを変更する。 + * + * (wnn-bunsetu-kouho-inspect bunsetu-no) + * bunsetu-no: INTEGER + * RETURNS: (kanji yomi jisho-no serial-no hinsi hindo + * ima hyoka daihyoka kangovect) + * DESCRIPTION: + * 文節の色々な情報を変換バッファからとり出す。 + * + * (wnn-server-henkan-quit) + * RETURNS: BOOLEAN + * DESCRIPTION: + * 何もしない。 + * + * (wnn-server-bunsetu-kanji bun-no) + * RETURNS: (bunsetu-kanji length) + * DESCRIPTION: + * + * (wnn-server-bunsetu-yomi bun-no) + * RETURNS: (bunsetu-yomi length) + * DESCRIPTION: + * + * (wnn-server-bunsetu-suu) + * RETURNS: bunsetu-suu + * DESCRIPTION: + * + * (wnn-server-hindo-update &optional bunsetu-no) + * bunsetu-no: INTEGER + * RETURNS: BOOLEAN + * DESCRIPTION: + * 頻度情報を更新する。 + * + * (wnn-server-word-add dic-no tango yomi comment hinsi) + * dic-no: INTEGER + * tango: STRING + * yoni: STRING + * comment: STRING + * hinsi: INTEGER + * RETURNS: BOOLEAN + * DESCRIPTION: + * 辞書に単語を登録する。 + * + * (wnn-server-word-delete dic-no entry) + * dic-no: INTEGER + * entry: INTEGER + * RETURNS: BOOLEAN + * DESCRIPTION: + * 辞書からエントリ番号で示される単語を削除する。 + * + * (wnn-server-word-use dic-no entry) + * dic-no: INTEGER + * entry: INTEGER + * RETURNS: BOOLEAN + * DESCRIPTION: + * 辞書からエントリ番号で示される単語の有効/無効をトグルする。 + * + * (wnn-server-word-info dic-no entry) + * dic-no: INTEGER + * entry: INTEGER + * RETURNS: (yomi kanji comment hindo hinsi) + * DESCRIPTION: + * 辞書からエントリ番号で示される単語の情報を得る。 + * + * (wnn-server-word-hindo-set dic-no entry hindo) + * dic-no: INTEGER + * entry: INTEGER + * hindo: INTEGER + * RETURNS: BOOLEAN + * DESCRIPTION: + * 辞書からエントリ番号で示される単語の頻度を設定する。 + * + * (wnn-server-word-search yomi) + * yomi: STRING + * RETURNS: a LIST of dict-joho + * DESCRIPTION: + * 全ての辞書から単語検索を行なう。 + * + * (wnn-server-dict-save) + * RETURNS: BOOLEAN + * DESCRIPTION: + * 全ての辞書と頻度ファイルをセーブする。 + * + * (wnn-server-get-param) + * RETURNS: (n nsho p1 p2 p3 ... p15) + * DESCRIPTION: 変換パラメータを得る。 + * + * (wnn-server-set-param n sho p1 ... p15) + * RETURNS: エラーの時 nil + * DESCRIPTION: 変換パラメータを設定する。 + * + * (wnn-server-get-msg error-no) + * RETURNS: エラーメッセージ + * DESCRIPTION: エラー番号からメッセージを得る。 + * + * (wnn-server-fuzokugo-set fname) + * RETURNS: エラーの時 nil + * DESCRIPTION: バッファに附属語ファイルを読み込む。 + * + * (wnn-server-fuzokugo-get) + * RETURNS: ファイル名 + * DESCRIPTION: バッファの附属語ファイル名を得る。 + * + * (wnn-server-isconnect) + * RETURNS: コネクトしてれば t, してなければ nil + * DESCRIPTION: サーバと継っているか調べる。 + * + * (wnn-server-hinsi-dicts hinsi-no) + * RETURNS: (dic-no1 dic-no2 ...) + * DESCRIPTION: hinsi-no の品詞が登録できる辞書のリストを得る。 + * hinsi-no = -1 のときには、登録可能な全辞書を得る。 + * + * (wnn-server-hinsi-list dic-no name) + * RETURNS: (name1 name2 ... ) + * DESCRIPTION: dic-no の辞書で、品詞ノードに属する + * 品詞ノード(名)のリストを得る。 + * 品詞名を与えた時は、0を返す。 + * + * (wnn-server-hinsi-name hinsi-no) + * RETURNS: hinsi-name + * DESCRIPTION: 品詞番号から名前を取る。 + * + * (wnn-server-hinsi-number hinsi-name) + * RETURNS: hinsi-no + * DESCRIPTION: 品詞名を品詞番号に変換する。 + * + * (wnn-server-version) + * RETURNS: version ID(int) + * + */ + +#include <ctype.h> + +#include "config.h" + +#include "commonhd.h" +#include "jllib.h" +/* + * FI-Wnn -- JSERVER_VERSION >= 0xF101 + * Wnn6 -- JSERVER_VERSION == 0xF101 + * Wnn7 -- JSERVER_VERSION == 0xF102 + */ +#if JSERVER_VERSION < 0xF102 +#include "cplib.h" +#endif + +/* UCHAR が二重定義されるので */ +#define _UCHAR_T + +#define EGG_TIMEOUT 0 +#define NSERVER 4 +#define WNNSERVER_J 0 +#define WNNSERVER_C 1 +#define WNNSERVER_T 2 +#define WNNSERVER_K 3 + +#include "lisp.h" +#include "buffer.h" +#include "window.h" +#include "charset.h" + +#define LCKANA 0x89 /* Right half of JIS X0201-1976 */ +#define LCROMAN 0x8A /* Left half of JIS X0201-1976 */ +#define LCJPOLD 0x90 /* For Japanese JIS X0208-1978 */ +#define LCCN 0x91 /* For Chinese Hanzi GB2312-1980 */ +#define LCJP 0x92 /* For Japanese JIS X0208-1983 */ +#define LCKR 0x93 /* For Hangul KS C5601-1987 */ +#define LCJP2 0x94 /* For Japanese JIS X0212-1990 */ +#define LCBIG5_1 0x98 /* For Big5 Level 1 */ +#define LCBIG5_2 0x99 /* For Big5 Level 2 */ +#define LCPRV11 0x9A /* 1-byte/1-clm character-set of private use */ +#define LCINV 0x9F /* Never used */ + +static struct wnn_buf *wnnfns_buf[NSERVER]; +static struct wnn_env *wnnfns_env_norm[NSERVER]; +static struct wnn_env *wnnfns_env_rev[NSERVER]; +static int wnnfns_norm; +static unsigned char lc_wnn_server_type[NSERVER] = {LCJP, LCCN, LCINV, LCKR}; + +/* Lisp Variables and Constants Definition */ +Lisp_Object Qjserver; +Lisp_Object Qcserver; +/*Lisp_Object Qtserver;*/ +Lisp_Object Qkserver; +Lisp_Object Qwnn_no_uniq; +Lisp_Object Qwnn_uniq; +Lisp_Object Qwnn_uniq_kanji; +Lisp_Object Vwnn_server_type; +Lisp_Object Vcwnn_zhuyin; +Lisp_Object Vwnnenv_sticky; +Lisp_Object Vwnn_uniq_level; +int lc_sisheng; + +/* Lisp functions definition */ + + + +DEFUN ("wnn-server-open", Fwnn_open, Swnn_open, + 2, 2, 0, + "Connect to jserver of host HNAME, make an environment with\n\ +login name LNAME in the server.\n\ +Return nil if error occurs") + (hname, lname) + register Lisp_Object hname, lname; +{ + char envname[32]; + char langname[32]; + char hostname[32]; + int snum; + CHECK_STRING (lname); + +#ifdef WINDOWSNT + init_winsock(TRUE); +#endif /* WINDOWSNT */ + snum = check_wnn_server_type(); + switch (snum) { + case WNNSERVER_J: + strcpy(langname, "ja_JP"); + break; + case WNNSERVER_C: + strcpy(langname, "zh_CN"); + break; +/* + case WNNSERVER_T: + strcpy(langname, "zh_TW"); + break; +*/ + case WNNSERVER_K: + strcpy(langname, "ko_KR"); + break; + } + strncpy(envname, XSTRING(lname)->data, 32); + if (hname == Qnil) strcpy(hostname, ""); + else { + CHECK_STRING (hname); + strncpy(hostname, XSTRING(hname)->data, 32); + } + CHECK_STRING (lname); + if(!(wnnfns_buf[snum] = jl_open_lang(envname, hostname, langname, + 0, 0, 0, EGG_TIMEOUT))) { + return Qnil; + } + if (!jl_isconnect(wnnfns_buf[snum])) return Qnil; + wnnfns_env_norm[snum] = jl_env_get(wnnfns_buf[snum]); +/* if (Vwnnenv_sticky == Qt) jl_env_sticky_e(wnnfns_env_norm[snum]); + else jl_env_un_sticky_e(wnnfns_env_norm[snum]);*/ + strcat(envname, "R"); + if(!(wnnfns_env_rev[snum] = jl_connect_lang(envname, hostname, langname, + 0, 0, 0, EGG_TIMEOUT))) { + return Qnil; + } +/* if (Vwnnenv_sticky == Qt) jl_env_sticky_e(wnnfns_env_rev[snum]); + else jl_env_un_sticky_e(wnnfns_env_rev[snum]);*/ + return Qt; +} + + +DEFUN ("wnn-server-close", Fwnn_close, Swnn_close, 0, 0, 0, + "Close the connection to jserver, Dictionary and friquency files\n\ +are not saved.") + () +{ + int snum; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + if(wnnfns_env_norm[snum]) { + if (Vwnnenv_sticky == Qnil) jl_env_un_sticky_e(wnnfns_env_norm[snum]); + else jl_env_sticky_e(wnnfns_env_norm[snum]); + jl_disconnect(wnnfns_env_norm[snum]); + } + if(wnnfns_env_rev[snum]) { + if (Vwnnenv_sticky == Qnil) jl_env_un_sticky_e(wnnfns_env_rev[snum]); + else jl_env_sticky_e(wnnfns_env_rev[snum]); + jl_disconnect(wnnfns_env_rev[snum]); + } + jl_env_set(wnnfns_buf[snum], 0); + jl_close(wnnfns_buf[snum]); + wnnfns_buf[snum] = (struct wnn_buf *)0; + wnnfns_env_norm[snum] = wnnfns_env_rev[snum] = (struct wnn_env *)0; + return Qt; +} + +DEFUN ("wnn-server-dict-add", Fwnn_dict_add, Swnn_dict_add, 5, MANY, 0, + "Add dictionary specified by DIICT-FILE-NAME, FREQ-FILE-NAME,\n\ +PRIORITY, DICT-FILE-MODE, FREQ-FILE-MODE.\n\ +Specify password files of dictionary and frequency, PW1 and PW2, if needed.") + (nargs, args) + int nargs; + register Lisp_Object *args; +{ + static int yes_or_no(); + static void puts2(); + struct gcpro gcpro1; + int snum; + CHECK_STRING (args[0]); + CHECK_STRING (args[1]); + CHECK_NUMBER (args[2]); + if (args[5] != Qnil) CHECK_STRING (args[5]); + if (args[6] != Qnil) CHECK_STRING (args[6]); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + GCPRO1 (*args); + gcpro1.nvars = nargs; + if(jl_dic_add(wnnfns_buf[snum], + XSTRING(args[0])->data, + XSTRING(args[1])->data, + wnnfns_norm ? WNN_DIC_ADD_NOR : WNN_DIC_ADD_REV, + XINT(args[2]), + (args[3] == Qnil) ? WNN_DIC_RDONLY : WNN_DIC_RW, + (args[4] == Qnil) ? WNN_DIC_RDONLY : WNN_DIC_RW, + (args[5] == Qnil) ? 0 : XSTRING(args[5])->data, + (args[6] == Qnil) ? 0 : XSTRING(args[6])->data, + yes_or_no, + puts2 ) < 0) { + UNGCPRO; + return Qnil; + } + UNGCPRO; + return Qt; +} + +DEFUN ("wnn-server-dict-delete", Fwnn_dict_delete, Swnn_dict_delete, + 1, 1, 0, + "Remove dictionary specified by DIC-NUMBER from buffer.") + (dicno) + register Lisp_Object dicno; +{ + int no; + int snum; + CHECK_NUMBER(dicno); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + no = XINT(dicno); + if(!wnnfns_buf[snum]) return Qnil; + if(jl_dic_delete(wnnfns_buf[snum], no) < 0) return Qnil; + return Qt; +} + +DEFUN ("wnn-server-dict-list", Fwnn_dict_list, Swnn_dict_list, + 0, 0, 0, + "Return information of dictionaries.") + () +{ + WNN_DIC_INFO *dicinfo; + int cnt, i; + unsigned char comment[1024]; + Lisp_Object val; + int snum; + unsigned char lc; + + if ((snum = check_wnn_server_type()) == -1) return Qnil; + lc = lc_wnn_server_type[snum]; + if(!wnnfns_buf[snum]) return Qnil; +#if JSERVER_VERSION >= 0xF101 + if((cnt = jl_fi_dic_list(wnnfns_buf[snum], 0x3f, &dicinfo)) < 0) return Qnil; +#else + if((cnt = jl_dic_list(wnnfns_buf[snum], &dicinfo)) < 0) return Qnil; +#endif + val = Qnil; + for(i = 0, dicinfo += cnt; i < cnt; i++) { + dicinfo--; + w2m(dicinfo->comment, comment, lc); + val = Fcons(Fcons(make_number(dicinfo->dic_no), + Fcons(make_string(dicinfo->fname, strlen(dicinfo->fname)), + Fcons(make_string(comment, strlen(comment)), + Fcons(make_number(dicinfo->gosuu), + Fcons(make_number(dicinfo->nice), Qnil))))), val); + } + return val; +} + +DEFUN ("wnn-server-dict-comment", Fwnn_dict_comment, Swnn_dict_comment, + 2, 2, 0, + "Set comment to dictionary specified by DIC-NUMBER.\n\ +Comment string COMMENT") + (dicno, comment) + register Lisp_Object dicno, comment; +{ + w_char wbuf[512]; + int snum; + CHECK_NUMBER(dicno); + CHECK_STRING(comment); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + m2w(XSTRING(comment)->data, wbuf); + if(jl_dic_comment_set(wnnfns_buf[snum], XINT(dicno), wbuf) < 0) + return Qnil; + return Qt; +} + + +DEFUN ("wnn-server-set-rev", Fwnn_set_rev, Swnn_set_rev, + 1, 1, 0, + "Switch the translation mode to normal if T, or reverse if NIL.") + (rev) + register Lisp_Object rev; +{ + int snum; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(rev == Qnil){ + if((!wnnfns_buf[snum]) || (!wnnfns_env_norm[snum])) return; + jl_env_set(wnnfns_buf[snum], wnnfns_env_norm[snum]); + wnnfns_norm = 1; + } + else{ + if((!wnnfns_buf[snum]) || (!wnnfns_env_rev[snum])) return; + jl_env_set(wnnfns_buf[snum], wnnfns_env_rev[snum]); + wnnfns_norm = 0; + } +} + +DEFUN ("wnn-server-henkan-begin", Fwnn_begin_henkan, Swnn_begin_henkan, + 1, 1, 0, + "Translate YOMI string to kanji. Retuen the number of bunsetsu.") + (hstring) + register Lisp_Object hstring; +{ + int cnt; + w_char wbuf[5000]; + int snum; + CHECK_STRING(hstring); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + m2w(XSTRING(hstring)->data, wbuf); +#if JSERVER_VERSION <= 0xF101 + if (snum == WNNSERVER_C) /* 92.10.30 by T.Saneto */ + w2y(wbuf); +#endif + +#if JSERVER_VERSION >= 0xF101 + if((cnt = jl_fi_ren_conv(wnnfns_buf[snum], wbuf, 0, -1, WNN_USE_MAE)) < 0) + return Qnil; +#else + if((cnt = jl_ren_conv(wnnfns_buf[snum], wbuf, 0, -1, WNN_USE_MAE)) < 0) + return Qnil; +#endif + return make_number(cnt); +} + +DEFUN ("wnn-server-zenkouho", Fwnn_zenkouho, Swnn_zenkouho, 2, 2, 0, + "Get zenkouho at BUNSETSU-NUMBER. Second argument DAI is T\n\ +if dai-bunsetsu, NIL if sho-bunsetsu. Return the current offset of zenkouho.") + (bunNo, dai) + register Lisp_Object bunNo, dai; +{ + int no, offset; + int snum; + int uniq_level; + CHECK_NUMBER(bunNo); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + no = XINT(bunNo); + if (Vwnn_uniq_level == Qwnn_no_uniq) uniq_level = WNN_NO_UNIQ; + else if (Vwnn_uniq_level == Qwnn_uniq) uniq_level = WNN_UNIQ; + else uniq_level = WNN_UNIQ_KNJ; + if(dai == Qnil) { + if (offset = jl_zenkouho(wnnfns_buf[snum],no,WNN_USE_MAE, uniq_level) < 0) + return Qnil; + } + else { + if (offset = jl_zenkouho_dai(wnnfns_buf[snum], no, dai_end(no, snum), + WNN_USE_MAE, uniq_level) < 0) + return Qnil; + } + return make_number(offset); +} + + +DEFUN ("wnn-server-get-zenkouho", Fwnn_get_zenkouho, Swnn_get_zenkouho, + 1, 1, 0, "Get kanji string of KOUHO-NUMBER") + (kouhoNo) + register Lisp_Object kouhoNo; +{ + unsigned char kanji_buf[256]; + w_char wbuf[256]; + int snum; + unsigned char lc; + CHECK_NUMBER(kouhoNo); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + lc = lc_wnn_server_type[snum]; + if(!wnnfns_buf[snum]) return Qnil; + jl_get_zenkouho_kanji(wnnfns_buf[snum], XINT(kouhoNo), wbuf); + w2m(wbuf, kanji_buf, lc); + return make_string(kanji_buf, strlen(kanji_buf)); +} + +DEFUN ("wnn-server-zenkouho-bun", Fwnn_zenkouho_bun, Swnn_zenkouho_bun, + 0, 0, 0, + "For Wnn.") + () +{ + int snum; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + return make_number(jl_zenkouho_bun(wnnfns_buf[snum])); +} + +DEFUN ("wnn-server-zenkouho-suu", Fwnn_zenkouho_suu, Swnn_zenkouho_suu, + 0, 0, 0, + "Return the number of zen kouho") + () +{ + int snum; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + return make_number(jl_zenkouho_suu(wnnfns_buf[snum])); +} + +DEFUN ("wnn-server-dai-top", Fwnn_dai_top, Swnn_dai_top, 1, 1, 0, + "Return T if bunsetsu BUN-NUMBER is dai-bunsetsu.") + (bunNo) + register Lisp_Object bunNo; +{ + int snum; + CHECK_NUMBER(bunNo); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + if (jl_dai_top(wnnfns_buf[snum], XINT(bunNo)) == 1) return Qt; + else return Qnil; +} + +DEFUN ("wnn-server-dai-end", Fwnn_dai_end, Swnn_dai_end, 1, 1, 0, + "Return the bunsetu number of the next dai-bunsetsu after BUN-NUMBER.") + (bunNo) + register Lisp_Object bunNo; +{ + int snum; + CHECK_NUMBER(bunNo); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + return make_number(dai_end(XINT(bunNo), snum)); +} + +DEFUN ("wnn-server-henkan-kakutei", Fwnn_kakutei, Swnn_kakutei, 2, 2, 0, + "Set candidate with OFFSET, DAI. DAI is T if dai-bunsetsu.") + (offset, dai) + register Lisp_Object offset, dai; +{ + int snum; + CHECK_NUMBER(offset); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + if(dai == Qnil) { + if(jl_set_jikouho(wnnfns_buf[snum], XINT(offset)) < 0) return Qnil; + } + else { + if(jl_set_jikouho_dai(wnnfns_buf[snum], XINT(offset)) < 0) return Qnil; + } + return Qt; +} + +DEFUN ("wnn-server-bunsetu-henkou", Fwnn_bunsetu_henkou, Swnn_bunsetu_henkou, + 3, 3, 0, + "Change length of BUN-NUMBER bunsetu to LEN. DAI is T if dai-bunsetsu.") + (bunNo, len, dai) + register Lisp_Object bunNo, len, dai; +{ + Lisp_Object val; + int cnt, no; + int snum; + CHECK_NUMBER(bunNo); + CHECK_NUMBER(len); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + no = XINT(bunNo); +#if JSERVER_VERSION >= 0xF101 + if((cnt = jl_fi_nobi_conv(wnnfns_buf[snum], no, XINT(len), -1, WNN_USE_MAE, + (dai == Qnil) ? WNN_SHO : WNN_DAI)) < 0) + return Qnil; +#else + if((cnt = jl_nobi_conv(wnnfns_buf[snum], no, XINT(len), -1, WNN_USE_MAE, + (dai == Qnil) ? WNN_SHO : WNN_DAI)) < 0) + return Qnil; +#endif + return make_number(cnt); +} + +DEFUN ("wnn-server-inspect", Fwnn_inspect, Swnn_inspect, 1, 1, 0, + "Get bunsetsu information specified by BUN-NUMBER.") + (bunNo) + Lisp_Object bunNo; +{ + Lisp_Object val; + struct wnn_jdata *info_buf; + unsigned char cbuf[512]; + w_char wbuf[256]; + int bun_no, yomilen, jirilen, i; + int snum; + unsigned char lc; + CHECK_NUMBER(bunNo); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + lc = lc_wnn_server_type[snum]; + if(!wnnfns_buf[snum]) return Qnil; + bun_no = XINT(bunNo); + val = Qnil; + val = Fcons(make_number(wnnfns_buf[snum]->bun[bun_no]->kangovect), val); + val = Fcons(make_number(wnnfns_buf[snum]->bun[bun_no]->daihyoka), val); + val = Fcons(make_number(wnnfns_buf[snum]->bun[bun_no]->hyoka), val); + val = Fcons(make_number(wnnfns_buf[snum]->bun[bun_no]->ima), val); + val = Fcons(make_number(wnnfns_buf[snum]->bun[bun_no]->hindo), val); + val = Fcons(make_number(wnnfns_buf[snum]->bun[bun_no]->hinsi), val); + val = Fcons(make_number(wnnfns_buf[snum]->bun[bun_no]->entry), val); + val = Fcons(make_number(wnnfns_buf[snum]->bun[bun_no]->dic_no), val); +#if JSERVER_VERSION >= 0xF102 + yomilen = jl_get_yomi(wnnfns_buf[snum], bun_no, bun_no + 1, wbuf, + sizeof(wbuf)); +#else + yomilen = jl_get_yomi(wnnfns_buf[snum], bun_no, bun_no + 1, wbuf); +#endif + jirilen = wnnfns_buf[snum]->bun[bun_no]->jirilen; + for(i = yomilen; i >= jirilen; i--) wbuf[i+1] = wbuf[i]; + wbuf[jirilen] = '+'; + w2m(wbuf, cbuf, lc); + val = Fcons(make_string(cbuf, strlen(cbuf)), val); +#if JSERVER_VERSION >= 0xF102 + jl_get_kanji(wnnfns_buf[snum], bun_no, bun_no + 1, wbuf, sizeof(wbuf)); +#else + jl_get_kanji(wnnfns_buf[snum], bun_no, bun_no + 1, wbuf); +#endif + w2m(wbuf, cbuf, lc); + val = Fcons(make_string(cbuf, strlen(cbuf)), val); + return val; +} + + +DEFUN ("wnn-server-henkan-quit", Fwnn_quit_henkan, Swnn_quit_henkan, 0, 0, 0, + "do nothing") + () +{ + int snum; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + return Qt; +} + +DEFUN ("wnn-server-bunsetu-kanji", Fwnn_bunsetu_kanji, Swnn_bunsetu_kanji, + 1, 1, 0, + "Get the pair of kanji and length of bunsetsu specified by BUN-NUMBER.") + (bunNo) + register Lisp_Object bunNo; +{ + register int no; + unsigned char kanji_buf[256]; + w_char wbuf[256]; + int kanji_len; + int snum; + unsigned char lc; + CHECK_NUMBER(bunNo); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + lc = lc_wnn_server_type[snum]; + if(!wnnfns_buf[snum]) return Qnil; + no = XINT(bunNo); +#if JSERVER_VERSION >= 0xF102 + kanji_len = jl_get_kanji(wnnfns_buf[snum], no, no + 1, wbuf, sizeof(wbuf)); +#else + kanji_len = jl_get_kanji(wnnfns_buf[snum], no, no + 1, wbuf); +#endif + w2m(wbuf, kanji_buf, lc); + return Fcons(make_string(kanji_buf, strlen(kanji_buf)), + make_number(kanji_len)); +} + +DEFUN ("wnn-server-bunsetu-yomi", Fwnn_bunsetu_yomi, Swnn_bunsetu_yomi, + 1, 1, 0, + "Get the pair of yomi and length of bunsetsu specified by BUN-NUMBER.") + (bunNo) + register Lisp_Object bunNo; +{ + register int no; + unsigned char yomi_buf[256]; + w_char wbuf[256]; + int yomi_len; + int snum; + unsigned char lc; + CHECK_NUMBER(bunNo); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + lc = lc_wnn_server_type[snum]; + if(!wnnfns_buf[snum]) return Qnil; + no = XINT(bunNo); +#if JSERVER_VERSION >= 0xF102 + yomi_len = jl_get_yomi(wnnfns_buf[snum], no, no + 1, wbuf, sizeof(wbuf)); +#else + yomi_len = jl_get_yomi(wnnfns_buf[snum], no, no + 1, wbuf); +#endif + w2m(wbuf, yomi_buf, lc); + return Fcons(make_string(yomi_buf, strlen(yomi_buf)), + make_number(yomi_len)); +} + +DEFUN ("wnn-server-bunsetu-suu", Fwnn_bunsetu_suu, Swnn_bunsetu_suu, + 0, 0, 0, + "Get the number of bunsetsu.") + () +{ + int snum; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + return make_number(jl_bun_suu(wnnfns_buf[snum])); +} + +DEFUN ("wnn-server-hindo-update", Fwnn_hindo_update, Swnn_hindo_update, + 0, 1, 0, + "Update frequency of bunsetsu specified by NUM-NUMBER.") + (bunNo) + Lisp_Object bunNo; +{ + int no; + Lisp_Object val; + int snum; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if (bunNo == Qnil) no = -1; + else { + CHECK_NUMBER(bunNo); + no = XINT(bunNo); + } + if(!wnnfns_buf[snum]) return Qnil; +#if JSERVER_VERSION >= 0xF101 + if(jl_optimize_fi(wnnfns_buf[snum], 0, no) < 0) return Qnil; +#else + if(jl_update_hindo(wnnfns_buf[snum], 0, no) < 0) return Qnil; +#endif + return Qt; +} + + +DEFUN ("wnn-server-word-add", Fwnn_word_toroku, Swnn_word_toroku, 5, 5, 0, + "Add a word to dictionary. Arguments are\n\ +DIC-NUMBER, KANJI, YOMI, COMMENT, HINSI-NUMBER") + (dicno, kanji, yomi, comment, hinsi) + register Lisp_Object dicno, kanji, yomi, comment, hinsi; +{ + w_char yomi_buf[256], kanji_buf[256], comment_buf[256]; + int snum; + CHECK_NUMBER(dicno); + CHECK_STRING(kanji); + CHECK_STRING(yomi); + CHECK_STRING(comment); + CHECK_NUMBER(hinsi); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + m2w(XSTRING(yomi)->data, yomi_buf); +#if JSERVER_VERSION <= 0xF101 + if (snum == WNNSERVER_C) + w2y(yomi_buf); +#endif + m2w(XSTRING(kanji)->data, kanji_buf); + m2w(XSTRING(comment)->data, comment_buf); + if(jl_word_add(wnnfns_buf[snum], XINT(dicno), yomi_buf, kanji_buf, + comment_buf, XINT(hinsi), 0) < 0) + return Qnil; + else return Qt; +} + + +DEFUN ("wnn-server-word-delete", Fwnn_word_sakujo, Swnn_word_sakujo, 2, 2, 0, + "Delete a word from dictionary, specified by DIC-NUMBER, SERIAL-NUMBER") + (no, serial) + register Lisp_Object no, serial; +{ + int snum; + CHECK_NUMBER(no); + CHECK_NUMBER(serial); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + if(jl_word_delete(wnnfns_buf[snum], XINT(no), XINT(serial)) < 0) + return Qnil; + else return Qt; +} + + +DEFUN ("wnn-server-word-use", Fwnn_word_use, Swnn_word_use, 2, 2, 0, + "Toggle on/off word, specified by DIC-NUMBER and SERIAL-NUMBER") + (no, serial) + register Lisp_Object no, serial; +{ + int snum; + CHECK_NUMBER(no); + CHECK_NUMBER(serial); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + if(jl_word_use(wnnfns_buf[snum], XINT(no), XINT(serial)) < 0) + return Qnil; + else return Qt; +} + +DEFUN ("wnn-server-word-info", Fwnn_word_info, Swnn_word_info, 2, 2, 0, + "Return list of yomi, kanji, comment, hindo, hinshi.") + (no, serial) + register Lisp_Object no, serial; +{ + Lisp_Object val; + struct wnn_jdata *info_buf; + unsigned char cbuf[512]; + int snum; + unsigned char lc; + CHECK_NUMBER(no); + CHECK_NUMBER(serial); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + lc = lc_wnn_server_type[snum]; + if(!wnnfns_buf[snum]) return Qnil; + /* 92.10.19 patch by T.Atsushiba <atsushiba@ailove.ENET.dec.com> + -- coerced to (int) */ + if((int)(info_buf = jl_word_info(wnnfns_buf[snum], + XINT(no), XINT(serial))) <= 0) { + return Qnil; + } else { + val = Qnil; + val = Fcons(make_number(info_buf->hinshi), val); + val = Fcons(make_number(info_buf->hindo), val); + w2m(info_buf->com, cbuf, lc); + val = Fcons(make_string(cbuf, strlen(cbuf)), val); + w2m(info_buf->kanji, cbuf, lc); + val = Fcons(make_string(cbuf, strlen(cbuf)), val); + w2m(info_buf->yomi, cbuf, lc); + val = Fcons(make_string(cbuf, strlen(cbuf)), val); + return val; + } +} + +DEFUN ("wnn-server-word-hindo-set", Fwnn_hindo_set, Swnn_hindo_set, 3, 3, 0, + "Set frequency to arbitrary value. Specified by DIC-NUMBER,\n\ +SERIAL-NUMBER, FREQUENCY") + (no, serial, hindo) + register Lisp_Object no, serial, hindo; +{ + int snum; + CHECK_NUMBER(no); + CHECK_NUMBER(serial); + CHECK_NUMBER(hindo); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + if(js_hindo_set(jl_env_get(wnnfns_buf[snum]), + XINT(no), + XINT(serial), + WNN_HINDO_NOP, + XINT(hindo)) < 0) + return Qnil; + else return Qt; +} + + +DEFUN ("wnn-server-word-search", Fwnn_dict_search, Swnn_dict_search, 1, 1, 0, + "Search a word YOMI from buffer.\n\ +Return list of (kanji hinshi freq dic_no serial).") + (yomi) + register Lisp_Object yomi; +{ + Lisp_Object val; + struct wnn_jdata *wordinfo; + int i, count; + w_char wbuf[256]; + unsigned char kanji_buf[256]; + int kanji_len; + int snum; + unsigned char lc; + CHECK_STRING(yomi); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + lc = lc_wnn_server_type[snum]; + if(!wnnfns_buf[snum]) return Qnil; + m2w(XSTRING(yomi)->data, wbuf); +#if JSERVER_VERSION <= 0xF101 + if (snum == WNNSERVER_C) + w2y(wbuf); +#endif + if((count = jl_word_search_by_env(wnnfns_buf[snum], + wbuf, &wordinfo)) < 0) + return Qnil; + val = Qnil; + for(i = 0, wordinfo += count; i < count; i++) { + wordinfo--; + w2m(wordinfo->kanji, kanji_buf, lc); + val = Fcons(Fcons(make_string(kanji_buf, strlen(kanji_buf)), + Fcons(make_number(wordinfo->hinshi), + Fcons(make_number(wordinfo->hindo), + Fcons(make_number(wordinfo->dic_no), + Fcons(make_number(wordinfo->serial), Qnil))))), + val); + } + return val; +} + +DEFUN ("wnn-server-dict-save", Fwnn_dict_save, Swnn_dict_save, 0, 0, 0, + "Save all dictianaries and grequency files.") + () +{ + int snum; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + if(jl_dic_save_all(wnnfns_buf[snum]) < 0) return Qnil; + else return Qt; +} + +DEFUN ("wnn-server-get-param", Fwnn_get_param, Swnn_get_param, + 0, 0, 0, + "Returns (n nsho hindo len jiri flag jisho sbn dbn_len sbn_cnt\n\ +suuji kana eisuu kigou toji_kakko fuzokogo kaikakko)") + () +{ + struct wnn_param param; + int snum; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + if(jl_param_get(wnnfns_buf[snum], ¶m) < 0) return Qnil; + return Fcons(make_number(param.n), + Fcons(make_number(param.nsho), + Fcons(make_number(param.p1), + Fcons(make_number(param.p2), + Fcons(make_number(param.p3), + Fcons(make_number(param.p4), + Fcons(make_number(param.p5), + Fcons(make_number(param.p6), + Fcons(make_number(param.p7), + Fcons(make_number(param.p8), + Fcons(make_number(param.p9), + Fcons(make_number(param.p10), + Fcons(make_number(param.p11), + Fcons(make_number(param.p12), + Fcons(make_number(param.p13), + Fcons(make_number(param.p14), + Fcons(make_number(param.p15),Qnil))))))))))))))))); +} + +DEFUN ("wnn-server-set-param", Fwnn_set_param, Swnn_set_param, + 17, MANY, 0, + "Set parameters, n nsho hindo len jiri flag jisho sbn dbn_len sbn_cnt\n\ +suuji kana eisuu kigou toji_kakko fuzokogo kaikakko") + (nargs, args) + int nargs; + register Lisp_Object *args; +{ + int rc; + struct wnn_param param; + int snum; + for (rc = 0; rc < 17; rc++) CHECK_NUMBER(args[rc]); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + param.n = XINT(args[0]); + param.nsho = XINT(args[1]); + param.p1 = XINT(args[2]); + param.p2 = XINT(args[3]); + param.p3 = XINT(args[4]); + param.p4 = XINT(args[5]); + param.p5 = XINT(args[6]); + param.p6 = XINT(args[7]); + param.p7 = XINT(args[8]); + param.p8 = XINT(args[9]); + param.p9 = XINT(args[10]); + param.p10 = XINT(args[11]); + param.p11 = XINT(args[12]); + param.p12 = XINT(args[13]); + param.p13 = XINT(args[14]); + param.p14 = XINT(args[15]); + param.p15 = XINT(args[16]); + + rc = jl_param_set(wnnfns_buf[snum], ¶m); + if(rc < 0) return Qnil; + return Qt; +} + +DEFUN ("wnn-server-get-msg", Fwnn_get_msg, Swnn_get_msg, 0, 0, 0, + "Get message string from wnn_perror.") + () +{ + char mbuf[256]; + char *msgp; + int snum; + unsigned char lc; +/* CHECK_NUMBER(errno);*/ + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + lc = lc_wnn_server_type[snum]; +#if JSERVER_VERSION < 0xF102 + { + char langname[32]; + switch (snum) { + case WNNSERVER_J: + strcpy(langname, "ja_JP"); + break; + case WNNSERVER_C: + strcpy(langname, "zh_CN"); + break; + /* + case WNNSERVER_T: + strcpy(langname, "zh_TW"); + break; + */ + case WNNSERVER_K: + strcpy(langname, "ko_KR"); + break; + } + msgp = wnn_perror_lang(langname); + } +#else + msgp = wnn_perror(); +#endif +/* msgp = msg_get(wnn_msg_cat, XINT(errno), 0, 0);*/ + c2m(msgp, mbuf, lc); + return make_string(mbuf, strlen(mbuf)); +} + + +DEFUN ("wnn-server-fuzokugo-set", Fwnn_fuzokugo_set, Swnn_fuzokugo_set, + 1, 1, 0, "For Wnn.") + (file) + register Lisp_Object file; +{ + int snum; + CHECK_STRING(file); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + if(jl_fuzokugo_set(wnnfns_buf[snum], XSTRING(file)->data) < 0) + return Qnil; + return Qt; +} + +DEFUN ("wnn-server-fuzokugo-get", Fwnn_fuzokugo_get, Swnn_fuzokugo_get, + 0, 0, 0, "For Wnn.") + () +{ + char fname[256]; + int snum; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + if(jl_fuzokugo_get(wnnfns_buf[snum], fname) < 0) return Qnil; + return make_string(fname, strlen(fname)); +} + + +DEFUN ("wnn-server-isconnect", Fwnn_isconnect, Swnn_isconnect, 0, 0, 0, + "For Wnn.") + () +{ + int snum; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + if(jl_isconnect(wnnfns_buf[snum])) return Qt; + else return Qnil; +} + +DEFUN ("wnn-server-hinsi-dicts", Fwnn_hinsi_dicts, Swnn_hinsi_dicts, 1, 1, 0, + "For Wnn.") + (hinsi) + register Lisp_Object hinsi; +{ + int *area; + int cnt; + Lisp_Object val; + int snum; + CHECK_NUMBER(hinsi); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + if((cnt = jl_hinsi_dicts(wnnfns_buf[snum], XINT(hinsi), &area)) < 0) + return Qnil; + val = Qnil; + for (area += cnt; cnt > 0; cnt--) { + area--; + val = Fcons(make_number(*area), val); + } + return val; +} + +DEFUN ("wnn-server-hinsi-list", Fwnn_hinsi_list, Swnn_hinsi_list, 2, 2, 0, + "For Wnn.") + (dicno, name) + register Lisp_Object dicno, name; +{ + int cnt; + Lisp_Object val; + w_char wbuf[256]; + w_char **area; + unsigned char cbuf[512]; + int snum; + unsigned char lc; + CHECK_NUMBER(dicno); + CHECK_STRING(name); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + lc = lc_wnn_server_type[snum]; + if(!wnnfns_buf[snum]) return Qnil; + m2w(XSTRING(name)->data, wbuf); + if((cnt = jl_hinsi_list(wnnfns_buf[snum], XINT(dicno), wbuf, &area)) < 0) + return Qnil; + if (cnt == 0) return make_number(0); + val = Qnil; + for (area += cnt; cnt > 0; cnt--) { + area--; + w2m(*area, cbuf, lc); + val = Fcons(make_string(cbuf, strlen(cbuf)), val); + } + return val; +} + +DEFUN ("wnn-server-hinsi-name", Fwnn_hinsi_name, Swnn_hinsi_name, 1, 1, 0, + "For Wnn.") + (no) + register Lisp_Object no; +{ + unsigned char name[256]; + w_char *wname; + int snum; + unsigned char lc; + CHECK_NUMBER(no); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + lc = lc_wnn_server_type[snum]; + if(!wnnfns_buf[snum]) return Qnil; + if((wname = jl_hinsi_name(wnnfns_buf[snum], XINT(no))) == 0) return Qnil; + w2m(wname, name, lc); + return make_string(name, strlen(name)); +} + +DEFUN ("wnn-server-hinsi-number", Fwnn_hinsi_number, Swnn_hinsi_number, + 1, 1, 0, + "For Wnn.") + (name) + register Lisp_Object name; +{ + w_char w_buf[256]; + int no; + int snum; + CHECK_STRING(name); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + m2w(XSTRING(name)->data, w_buf); + if((no = jl_hinsi_number(wnnfns_buf[snum], w_buf)) < 0) return Qnil; + return make_number(no); +} +#if JSERVER_VERSION >= 0xF101 +DEFUN ("wnn-server-fisys-dict-add", Fwnn_fisys_dict_add, Swnn_fisys_dict_add, 3, MANY, 0, + "Add dictionary specified by FISYS-DICT-FILE-NAME, FISYS-FREQ-FILE-NAME,\n\ +FISYS-FREQ-FILE-MODE.\n\ +Specify password files of dictionary and frequency, PW1 and PW2, if needed.") + (nargs, args) + int nargs; + register Lisp_Object *args; +{ + static int yes_or_no(); + static void puts2(); + struct gcpro gcpro1; + int snum; + CHECK_STRING (args[0]); + CHECK_STRING (args[1]); + if (args[3] != Qnil) CHECK_STRING (args[3]); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + GCPRO1 (*args); + gcpro1.nvars = nargs; + if(jl_fi_dic_add(wnnfns_buf[snum], + XSTRING(args[0])->data, + XSTRING(args[1])->data, + WNN_FI_SYSTEM_DICT, + WNN_DIC_RDONLY, + (args[2] == Qnil) ? WNN_DIC_RDONLY : WNN_DIC_RW, + 0, + (args[3] == Qnil) ? 0 : XSTRING(args[3])->data, + yes_or_no, + puts2 ) < 0) { + UNGCPRO; + return Qnil; + } + UNGCPRO; + return Qt; +} + +DEFUN ("wnn-server-fiusr-dict-add", Fwnn_fiusr_dict_add, Swnn_fiusr_dict_add, 4, MANY, 0, + "Add dictionary specified by FIUSR-DICT-FILE-NAME, FIUSR-FREQ-FILE-NAME,\n\ +FIUSR-DICT-FILE-MODE, FIUSR-FREQ-FILE-MODE.\n\ +Specify password files of dictionary and frequency, PW1 and PW2, if needed.") + (nargs, args) + int nargs; + register Lisp_Object *args; +{ + static int yes_or_no(); + static void puts2(); + struct gcpro gcpro1; + int snum; + CHECK_STRING (args[0]); + CHECK_STRING (args[1]); + if (args[4] != Qnil) CHECK_STRING (args[4]); + if (args[5] != Qnil) CHECK_STRING (args[5]); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + GCPRO1 (*args); + gcpro1.nvars = nargs; + if(jl_fi_dic_add(wnnfns_buf[snum], + XSTRING(args[0])->data, + XSTRING(args[1])->data, + WNN_FI_USER_DICT, + (args[2] == Qnil) ? WNN_DIC_RDONLY : WNN_DIC_RW, + (args[3] == Qnil) ? WNN_DIC_RDONLY : WNN_DIC_RW, + (args[4] == Qnil) ? 0 : XSTRING(args[4])->data, + (args[5] == Qnil) ? 0 : XSTRING(args[5])->data, + yes_or_no, + puts2 ) < 0) { + UNGCPRO; + return Qnil; + } + UNGCPRO; + return Qt; +} + +DEFUN ("wnn-server-notrans-dict-add", Fwnn_notrans_dict_add, Swnn_notrans_dict_add, 3, MANY, 0, + "Add dictionary specified by NOTRANS-DICT-FILE-NAME, PRIORITY, DICT-FILE-MODE.\n\ +Specify password files of dictionary and frequency PW1 if needed.") + (nargs, args) + int nargs; + register Lisp_Object *args; +{ + static int yes_or_no(); + static void puts2(); + struct gcpro gcpro1; + int snum; + int dic_no; + struct wnn_env *cur_env; + unsigned long vmask = 0; + struct wnn_henkan_env henv; + CHECK_STRING (args[0]); + CHECK_NUMBER (args[1]); + if (args[3] != Qnil) CHECK_STRING (args[3]); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + GCPRO1 (*args); + gcpro1.nvars = nargs; + if(wnnfns_norm) + cur_env = wnnfns_env_norm[snum]; + else + cur_env = wnnfns_env_rev[snum]; + dic_no = js_get_autolearning_dic(cur_env, WNN_MUHENKAN_LEARNING); + if (dic_no == WNN_NO_LEARNING) { + if((dic_no = jl_dic_add(wnnfns_buf[snum], + XSTRING(args[0])->data, + 0, + wnnfns_norm ? WNN_DIC_ADD_NOR : WNN_DIC_ADD_REV, + XINT(args[1]), + WNN_DIC_RW, WNN_DIC_RW, + (args[3] == Qnil) ? 0 : XSTRING(args[3])->data, + 0, + yes_or_no, + puts2)) < 0) { + UNGCPRO; + return Qnil; + } + js_set_autolearning_dic(cur_env, WNN_MUHENKAN_LEARNING, dic_no); + } + if(!js_is_loaded_temporary_dic(cur_env)) { + if(js_temporary_dic_add(cur_env, + wnnfns_norm ? WNN_DIC_ADD_NOR : WNN_DIC_ADD_REV) < 0) { + UNGCPRO; + return Qnil; + } + } + vmask |= WNN_ENV_MUHENKAN_LEARN_MASK; + henv.muhenkan_flag = (args[2] == Qnil) ? WNN_DIC_RDONLY : WNN_DIC_RW; + if(jl_set_henkan_env(wnnfns_buf[snum], + vmask, + &henv) < 0) { + UNGCPRO; + return Qnil; + } + UNGCPRO; + return Qt; +} + +DEFUN ("wnn-server-bmodify-dict-add", Fwnn_bmodify_dict_add, Swnn_bmodify_dict_add, 3, MANY, 0, + "Add dictionary specified by BMODIFY-DICT-FILE-NAME, PRIORITY, DICT-FILE-MODE.\n\ +Specify password files of dictionary and frequency PW1 if needed.") + (nargs, args) + int nargs; + register Lisp_Object *args; +{ + static int yes_or_no(); + static void puts2(); + struct gcpro gcpro1; + int snum; + int dic_no; + struct wnn_env *cur_env; + unsigned long vmask = 0; + struct wnn_henkan_env henv; + CHECK_STRING (args[0]); + CHECK_NUMBER (args[1]); + if (args[3] != Qnil) CHECK_STRING (args[3]); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + GCPRO1 (*args); + gcpro1.nvars = nargs; + if(wnnfns_norm) + cur_env = wnnfns_env_norm[snum]; + else + cur_env = wnnfns_env_rev[snum]; + dic_no = js_get_autolearning_dic(cur_env, WNN_BUNSETSUGIRI_LEARNING); + if (dic_no == WNN_NO_LEARNING) { + if((dic_no = jl_dic_add(wnnfns_buf[snum], + XSTRING(args[0])->data, + 0, + wnnfns_norm ? WNN_DIC_ADD_NOR : WNN_DIC_ADD_REV, + XINT(args[1]), + WNN_DIC_RW, WNN_DIC_RW, + (args[3] == Qnil) ? 0 : XSTRING(args[3])->data, + 0, + yes_or_no, + puts2)) < 0) { + UNGCPRO; + return Qnil; + } + js_set_autolearning_dic(cur_env, WNN_BUNSETSUGIRI_LEARNING, dic_no); + } + if(!js_is_loaded_temporary_dic(cur_env)) { + if(js_temporary_dic_add(cur_env, + wnnfns_norm ? WNN_DIC_ADD_NOR : WNN_DIC_ADD_REV) < 0) { + UNGCPRO; + return Qnil; + } + } + vmask |= WNN_ENV_BUNSETSUGIRI_LEARN_MASK; + henv.bunsetsugiri_flag = (args[2] == Qnil) ? WNN_DIC_RDONLY : WNN_DIC_RW; + if(jl_set_henkan_env(wnnfns_buf[snum], + vmask, + &henv) < 0) { + UNGCPRO; + return Qnil; + } + UNGCPRO; + return Qt; +} + +DEFUN ("wnn-server-set-last-is-first", Fwnn_last_is_first, Swnn_last_is_first, 1, 1, 0, + "For FI-Wnn.") + (mode) + register Lisp_Object mode; +{ + int snum; + unsigned long vmask = 0; + struct wnn_henkan_env henv; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + vmask |= WNN_ENV_LAST_IS_FIRST_MASK; + henv.last_is_first_flag = (mode == Qnil) ? False : True; + if(jl_set_henkan_env(wnnfns_buf[snum], + vmask, + &henv) < 0) return Qnil; + return Qt; +} + +DEFUN ("wnn-server-set-complex-conv-mode", Fwnn_complex_conv, Swnn_complex_conv, 1, 1, 0, + "For FI-Wnn.") + (mode) + register Lisp_Object mode; +{ + int snum; + unsigned long vmask = 0; + struct wnn_henkan_env henv; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + vmask |= WNN_ENV_COMPLEX_CONV_MASK; + henv.complex_flag = (mode == Qnil) ? False : True; + if(jl_set_henkan_env(wnnfns_buf[snum], + vmask, + &henv) < 0) return Qnil; + return Qt; +} + +DEFUN ("wnn-server-set-okuri-learn-mode", Fwnn_okuri_learn, Swnn_okuri_learn, 1, 1, 0, + "For FI-Wnn.") + (mode) + register Lisp_Object mode; +{ + int snum; + unsigned long vmask = 0; + struct wnn_henkan_env henv; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + vmask |= WNN_ENV_OKURI_LEARN_MASK; + henv.okuri_learn_flag = (mode == Qnil) ? False : True; + if(jl_set_henkan_env(wnnfns_buf[snum], + vmask, + &henv) < 0) return Qnil; + return Qt; +} + +DEFUN ("wnn-server-set-okuri-flag", Fwnn_okuri_flag, Swnn_okuri_flag, 1, 1, 0, + "For FI-Wnn.") + (mode) + register Lisp_Object mode; +{ + int snum, int_mode; + unsigned long vmask = 0; + struct wnn_henkan_env henv; + CHECK_NUMBER(mode); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + int_mode = XINT(mode); + if(int_mode != WNN_OKURI_REGULATION && + int_mode != WNN_OKURI_NO && + int_mode != WNN_OKURI_YES) + return Qnil; + henv.okuri_flag = int_mode; + vmask |= WNN_ENV_OKURI_MASK; + if(jl_set_henkan_env(wnnfns_buf[snum], + vmask, + &henv) < 0) return Qnil; + return Qt; +} + +DEFUN ("wnn-server-set-prefix-learn-mode", Fwnn_prefix_learn, Swnn_prefix_learn, 1, 1, 0, + "For FI-Wnn.") + (mode) + register Lisp_Object mode; +{ + int snum; + unsigned long vmask = 0; + struct wnn_henkan_env henv; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + vmask |= WNN_ENV_PREFIX_LEARN_MASK; + henv.prefix_learn_flag = (mode == Qnil) ? False : True; + if(jl_set_henkan_env(wnnfns_buf[snum], + vmask, + &henv) < 0) return Qnil; + return Qt; +} + +DEFUN ("wnn-server-set-prefix-flag", Fwnn_prefix_flag, Swnn_prefix_flag, 1, 1, 0, + "For FI-Wnn.") + (mode) + register Lisp_Object mode; +{ + int snum; + unsigned long vmask = 0; + struct wnn_henkan_env henv; + CHECK_NUMBER(mode); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + if(mode != WNN_KANA_KOUHO && mode != WNN_KANJI_KOUHO) + return Qnil; + else + henv.prefix_flag = mode; + vmask |= WNN_ENV_PREFIX_MASK; + if(jl_set_henkan_env(wnnfns_buf[snum], + vmask, + &henv) < 0) return Qnil; + return Qt; +} + +DEFUN ("wnn-server-set-suffix-learn-mode", Fwnn_suffix_learn, Swnn_suffix_learn, 1, 1, 0, + "For FI-Wnn.") + (mode) + register Lisp_Object mode; +{ + int snum; + unsigned long vmask = 0; + struct wnn_henkan_env henv; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + vmask |= WNN_ENV_SUFFIX_LEARN_MASK; + henv.suffix_learn_flag = (mode == Qnil) ? False : True; + if(jl_set_henkan_env(wnnfns_buf[snum], + vmask, + &henv) < 0) return Qnil; + return Qt; +} + +DEFUN ("wnn-server-set-common-learn-mode", Fwnn_common_learn, Swnn_common_learn, 1, 1, 0, + "For FI-Wnn.") + (mode) + register Lisp_Object mode; +{ + int snum; + unsigned long vmask = 0; + struct wnn_henkan_env henv; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + vmask |= WNN_ENV_COMMON_LAERN_MASK; + henv.common_learn_flag = (mode == Qnil) ? False : True; + if(jl_set_henkan_env(wnnfns_buf[snum], + vmask, + &henv) < 0) return Qnil; + return Qt; +} + +DEFUN ("wnn-server-set-freq-func-mode", Fwnn_freq_func, Swnn_freq_func, 1, 1, 0, + "For FI-Wnn.") + (mode) + register Lisp_Object mode; +{ + int snum; + unsigned long vmask = 0; + struct wnn_henkan_env henv; + CHECK_NUMBER(mode); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + if(mode != 0 && mode != 1 && mode != 2 && mode != 3 && mode != 4) + return Qnil; + else + henv.freq_func_flag = mode; + vmask |= WNN_ENV_FREQ_FUNC_MASK; + if(jl_set_henkan_env(wnnfns_buf[snum], + vmask, + &henv) < 0) return Qnil; + return Qt; +} + +DEFUN ("wnn-server-set-numeric-mode", Fwnn_numeric, Swnn_numeric, 1, 1, 0, + "For FI-Wnn.") + (mode) + register Lisp_Object mode; +{ + int snum, int_mode; + unsigned long vmask = 0; + struct wnn_henkan_env henv; + CHECK_NUMBER(mode); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + int_mode = XINT(mode); + if(int_mode != WNN_NUM_KANSUUJI && + int_mode != WNN_NUM_KANOLD && + int_mode != WNN_NUM_HANCAN && + int_mode != WNN_NUM_ZENCAN && + int_mode != WNN_NUM_HAN && + int_mode != WNN_NUM_ZEN && + int_mode != WNN_NUM_KAN) + return Qnil; + henv.numeric_flag = int_mode; + vmask |= WNN_ENV_NUMERIC_MASK; + if(jl_set_henkan_env(wnnfns_buf[snum], + vmask, + &henv) < 0) return Qnil; + return Qt; +} + +DEFUN ("wnn-server-set-alphabet-mode", Fwnn_alphabet, Swnn_alphabet, 1, 1, 0, + "For FI-Wnn.") + (mode) + register Lisp_Object mode; +{ + int snum, int_mode; + unsigned long vmask = 0; + struct wnn_henkan_env henv; + CHECK_NUMBER(mode); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + int_mode = XINT(mode); + if(int_mode != WNN_ALP_HAN && int_mode != WNN_ALP_ZEN) + return Qnil; + henv.alphabet_flag = int_mode; + vmask |= WNN_ENV_ALPHABET_MASK; + if(jl_set_henkan_env(wnnfns_buf[snum], + vmask, + &henv) < 0) return Qnil; + return Qt; +} + +DEFUN ("wnn-server-set-symbol-mode", Fwnn_symbol, Swnn_symbol, 1, 1, 0, + "For FI-Wnn.") + (mode) + register Lisp_Object mode; +{ + int snum, int_mode; + unsigned long vmask = 0; + struct wnn_henkan_env henv; + CHECK_NUMBER(mode); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + int_mode = XINT(mode); + if(int_mode != WNN_KIG_HAN && + int_mode != WNN_KIG_JIS && + int_mode != WNN_KIG_ASC) + return Qnil; + henv.symbol_flag = int_mode; + vmask |= WNN_ENV_SYMBOL_MASK; + if(jl_set_henkan_env(wnnfns_buf[snum], + vmask, + &henv) < 0) return Qnil; + return Qt; +} + +DEFUN ("wnn-server-set-yuragi-mode", Fwnn_yuragi, Swnn_yuragi, 1, 1, 0, + "For FI-Wnn.") + (mode) + register Lisp_Object mode; +{ + int snum; + unsigned long vmask = 0; + struct wnn_henkan_env henv; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + vmask |= WNN_ENV_YURAGI_MASK; + henv.yuragi_flag = (mode == Qnil) ? False : True; + if(jl_set_henkan_env(wnnfns_buf[snum], + vmask, + &henv) < 0) return Qnil; + return Qt; +} + +DEFUN ("wnn-reset-previous-info", Fwnn_reset_prev, Swnn_reset_prev, 0, 0, 0, + "For FI-Wnn.") + () +{ + int snum; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + if(jl_reset_prev_bun(wnnfns_buf[snum]) < 0) return Qnil; + return Qt; +} + +# if JSERVER_VERSION >= 0xF102 +DEFUN ("wnn-boin-kabusoku", Fwnn_boin_kabusoku, Swnn_boin_kabusoku, 1, 1, 0, + "For Wnn7.") + (mode) + register Lisp_Object mode; +{ + int snum; + unsigned long vmask = 0; + struct wnn_henkan_env henv; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + vmask |= WNN_ENV_BOIN_KABUSOKU_MASK; + henv.boin_kabusoku_flag = (mode == Qnil) ? False : True; + if(jl_set_henkan_env(wnnfns_buf[snum], + vmask, + &henv) < 0) return Qnil; + return Qt; +} + +DEFUN ("wnn-shiin-choka", Fwnn_shiin_choka, Swnn_shiin_choka, 1, 1, 0, + "For Wnn7.") + (mode) + register Lisp_Object mode; +{ + int snum; + unsigned long vmask = 0; + struct wnn_henkan_env henv; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + vmask |= WNN_ENV_SHIIN_CHOKA_MASK; + henv.shiin_choka_flag = (mode == Qnil) ? False : True; + if(jl_set_henkan_env(wnnfns_buf[snum], + vmask, + &henv) < 0) return Qnil; + return Qt; +} + +DEFUN ("wnn-n-choka", Fwnn_n_choka, Swnn_n_choka, 1, 1, 0, + "For Wnn7.") + (mode) + register Lisp_Object mode; +{ + int snum; + unsigned long vmask = 0; + struct wnn_henkan_env henv; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + vmask |= WNN_ENV_N_CHOKA_MASK; + henv.n_choka_flag = (mode == Qnil) ? False : True; + if(jl_set_henkan_env(wnnfns_buf[snum], + vmask, + &henv) < 0) return Qnil; + return Qt; +} + +#include "mt_jlib.h" /* for WNN_ENV_INT */ +DEFUN ("wnn-nihongo-kosei", Fwnn_nihongo_kosei, Swnn_nihongo_kosei, 1, 1, 0, + "For Wnn7.") + (mode) + register Lisp_Object mode; +{ + int snum; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + /* このtype castは非常に危険。jl.cが使っているのでマネしているだけ。 + 更に js_*()系を呼び出してる… */ + if(js_set_henkan_hinsi_group( (WNN_ENV_INT*)wnnfns_buf[snum]->env, + HINSI_NO_GOYOU, + HINSI_NO_GOYOU_START, + HINSI_NO_GOYOU_END, + (mode == Qnil) ? False : True ) < 0) + return Qnil; + if(js_set_henkan_hinsi_group( (WNN_ENV_INT*)wnnfns_buf[snum]->env, + HINSI_NO_ATEJI, + HINSI_NO_ATEJI_START, + HINSI_NO_ATEJI_END, + (mode == Qnil) ? False : True ) < 0) + return Qnil; + return Qt; +} + +DEFUN ("wnn-server-synonym", Fwnn_server_synonym, Swnn_server_synonym, 2, 2, 0, + "For Wnn7.") + (bunNo, dai) + Lisp_Object bunNo, dai; +{ + int no, offset; + int snum; + int uniq_level; + CHECK_NUMBER(bunNo); + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + no = XINT(bunNo); + if (Vwnn_uniq_level == Qwnn_no_uniq) uniq_level = WNN_NO_UNIQ; + else if (Vwnn_uniq_level == Qwnn_uniq) uniq_level = WNN_UNIQ; + else uniq_level = WNN_UNIQ_KNJ; + if(offset = jl_zenassoc_dai( wnnfns_buf[snum], no, dai_end(no, snum), + WNN_USE_MAE, uniq_level ) < 0) + return Qnil; + return make_number(offset); +} +# endif /* Wnn7 */ +#endif /* FI-Wnn */ + +DEFUN ("wnn-server-version", Fwnn_version, Swnn_version, 0, 0, 0, + "Returns Wnn server version ID.") + () +{ + int snum; + int serv; + int libv; + struct wnn_env *cur_env; + if ((snum = check_wnn_server_type()) == -1) return Qnil; + if(!wnnfns_buf[snum]) return Qnil; + if(wnnfns_norm) + cur_env = wnnfns_env_norm[snum]; + else + cur_env = wnnfns_env_rev[snum]; + if(js_version(cur_env->js_id,&serv,&libv) < 0) return Qnil; + return make_number(serv); +} + +syms_of_wnn() +{ + int i; + + defsubr(&Swnn_open); + defsubr(&Swnn_close); + defsubr(&Swnn_dict_add); + defsubr(&Swnn_dict_delete); + defsubr(&Swnn_dict_list); + defsubr(&Swnn_dict_comment); + defsubr(&Swnn_set_rev); + defsubr(&Swnn_begin_henkan); + defsubr(&Swnn_zenkouho); + defsubr(&Swnn_get_zenkouho); + defsubr(&Swnn_zenkouho_bun); + defsubr(&Swnn_zenkouho_suu); + defsubr(&Swnn_dai_top); + defsubr(&Swnn_dai_end); + defsubr(&Swnn_kakutei); + defsubr(&Swnn_bunsetu_henkou); + defsubr(&Swnn_inspect); + defsubr(&Swnn_quit_henkan); + defsubr(&Swnn_bunsetu_kanji); + defsubr(&Swnn_bunsetu_yomi); + defsubr(&Swnn_bunsetu_suu); + defsubr(&Swnn_hindo_update); + defsubr(&Swnn_word_toroku); + defsubr(&Swnn_word_sakujo); + defsubr(&Swnn_word_use); + defsubr(&Swnn_word_info); + defsubr(&Swnn_hindo_set); + defsubr(&Swnn_dict_search); + defsubr(&Swnn_dict_save); + defsubr(&Swnn_get_param); + defsubr(&Swnn_set_param); + defsubr(&Swnn_get_msg); + defsubr(&Swnn_fuzokugo_set); + defsubr(&Swnn_fuzokugo_get); + defsubr(&Swnn_isconnect); + defsubr(&Swnn_hinsi_dicts); + defsubr(&Swnn_hinsi_list); + defsubr(&Swnn_hinsi_name); + defsubr(&Swnn_hinsi_number); +#if JSERVER_VERSION >= 0xF101 + defsubr(&Swnn_fisys_dict_add); + defsubr(&Swnn_fiusr_dict_add); + defsubr(&Swnn_notrans_dict_add); + defsubr(&Swnn_bmodify_dict_add); + defsubr(&Swnn_last_is_first); + defsubr(&Swnn_complex_conv); + defsubr(&Swnn_okuri_learn); + defsubr(&Swnn_okuri_flag); + defsubr(&Swnn_prefix_learn); + defsubr(&Swnn_prefix_flag); + defsubr(&Swnn_suffix_learn); + defsubr(&Swnn_common_learn); + defsubr(&Swnn_freq_func); + defsubr(&Swnn_numeric); + defsubr(&Swnn_alphabet); + defsubr(&Swnn_symbol); + defsubr(&Swnn_yuragi); + defsubr(&Swnn_reset_prev); +# if JSERVER_VERSION >= 0xF102 + defsubr(&Swnn_boin_kabusoku); + defsubr(&Swnn_shiin_choka); + defsubr(&Swnn_n_choka); + defsubr(&Swnn_nihongo_kosei); + defsubr(&Swnn_server_synonym); +# endif /* Wnn7 */ +#endif /* FI-Wnn */ + defsubr(&Swnn_version); + + DEFVAR_INT ("lc-sisheng", &lc_sisheng, "Leading character for Sisheng."); + DEFVAR_LISP ("wnn-server-type", &Vwnn_server_type, "*jserver, cserver .."); + DEFVAR_LISP ("cwnn-zhuyin", &Vcwnn_zhuyin, "*pinyin or zhuyin"); + DEFVAR_LISP ("wnnenv-sticky", &Vwnnenv_sticky, + "*If non-nil, make environment sticky"); + DEFVAR_LISP ("wnn-uniq-level", &Vwnn_uniq_level, "*Uniq level"); + + Qjserver = intern("jserver"); + Qcserver = intern("cserver"); + /* Qtserver = intern("tserver"); */ + Qkserver = intern("kserver"); + + Qwnn_no_uniq = intern("wnn-no-uniq"); + Qwnn_uniq = intern("wnn-uniq"); + Qwnn_uniq_kanji = intern("wnn-uniq-kanji"); + + Vwnn_server_type = Qjserver; + Vcwnn_zhuyin = Qnil; + Vwnnenv_sticky = Qnil; + + Vwnn_uniq_level = Qwnn_uniq; + + for (i = 0; i < NSERVER; i++) { + wnnfns_buf[i] = (struct wnn_buf *)0; + wnnfns_env_norm[i] = (struct wnn_env *)0; + wnnfns_env_rev[i] = (struct wnn_env *)0; + } +} + +w2m(wp, mp, lc) + w_char *wp; + unsigned char *mp; + unsigned char lc; +{ + w_char wc; + w_char pzy[10]; + int i, len; + + while(wc = *wp++) { + switch (wc & 0x8080) { + case 0x80: +#if JSERVER_VERSION <= 0xF101 + if (Vwnn_server_type == Qcserver) { + len = cwnn_yincod_pzy(pzy, wc, + (Vcwnn_zhuyin == Qnil) + ? CWNN_PINYIN + : CWNN_ZHUYIN); + for(i = 0; i < len; i++) { + if (pzy[i] & 0x80) { + *mp++ = LCPRV11; + *mp++ = lc_sisheng; + } + *mp++ = pzy[i]; + } + }else +#endif + { + *mp++ = LCKANA; + *mp++ = (wc & 0xff); + } + break; + case 0x8080: + *mp++ = lc; + *mp++ = (wc & 0xff00) >> 8; + *mp++ = wc & 0x00ff; + break; + case 0x8000: + if (lc == LCJP) + *mp++ = LCJP2; + else if (lc == LCBIG5_1) + *mp++ = LCBIG5_2; + else + *mp++ = lc; + *mp++ = (wc & 0xff00) >> 8; + *mp++ = wc & 0x00ff | 0x80; + break; + default: + *mp++ = wc & 0x00ff; + break; + } + } + *mp = 0; +} + +m2w(mp, wp) + unsigned char *mp; + w_char *wp; +{ + unsigned int ch; + +#define ASCII_P(c) ((c) < 0x80) +#define LC_P(c) (0x80 <= (c) && (c) < LCINV) + while (ch = *mp++) { + if (ASCII_P (ch)) { + *wp++ = ch; + } else if (LC_P (ch)) { + switch (ch) { + case LCKANA: *wp++ = *mp++; break; + case LCROMAN: *wp++ = *mp++ & 0x7F; break; + case LCJPOLD: case LCCN: case LCJP: case LCKR: + /* case LCTW: */ + ch = *mp++; + *wp++ = (ch << 8) | *mp++; + break; + case LCJP2: + ch = *mp++; + *wp++ = (ch << 8) | (*mp++ & 0x7f); + break; + case LCPRV11: + ch = *mp++; + if (ch == lc_sisheng) + *wp++ = 0x8e80 | *mp++; + else + mp++; + break; + default: /* ignore this character */ + mp += bytes_by_char_head[ch] - 1; + } + } + } + *wp = 0; +} + +_xp(x) +int x; +{ + printf("%x\n", x); fflush(stdout); +} + +#if JSERVER_VERSION <= 0xF101 +/* static void */ +w2y(w) +w_char *w; +{ + unsigned long pbuf[5000], ybuf[5000]; + unsigned long *pin; + w_char *y; + int len; + + pin = pbuf; + y = w; + while (1) { + if (*w == 0) {*pin =0; break;} + else *pin = *w; + w++; pin++; + } + len = cwnn_pzy_yincod(ybuf, pbuf, + (Vcwnn_zhuyin == Qnil) ? CWNN_PINYIN : CWNN_ZHUYIN); + if (len <= 0) + return; + + pin = ybuf; + while (1) { + if (*pin == 0 || len == 0) {*y = 0;break;} + *y = *pin; + y++; pin++; len--; + } +} +#endif + +c2m(cp, mp, lc) + unsigned char *cp; + unsigned char *mp; + unsigned char lc; +{ + unsigned char ch; + while(ch = *cp) { + if(ch & 0x80) { + *mp++ = lc; + *mp++ = *cp++; + } + *mp++ = *cp++; + } + *mp = 0; +} + +int +dai_end(no, server) + int no; + int server; +{ + for(no++; no < jl_bun_suu(wnnfns_buf[server]) + && !jl_dai_top(wnnfns_buf[server], no); no++); + return (no); +} + +static int +yes_or_no(s) +unsigned char *s; +{ + extern Lisp_Object Fy_or_n_p(); + unsigned char mbuf[512]; + unsigned char lc; + int len; + int snum; + if ((snum = check_wnn_server_type()) == -1) return 0; + lc = lc_wnn_server_type[snum]; + /* if no message found, create file without query */ +/* if (wnn_msg_cat->msg_bd == 0) return 1;*/ + if (*s == 0) return 1; + c2m(s, mbuf, lc); + /* truncate "(Y/N)" */ + for (len = 0; (mbuf[len]) && (len < 512); len++); + if(index(mbuf,'(')) + for (; (mbuf[len] != '(') && (len > 0); len--); + if (Fy_or_n_p(make_string(mbuf, len)) == Qnil) return 0; + else return (1); +} + +static void +puts2(s) +char *s; +{ + Lisp_Object args[1]; + char mbuf[512]; + unsigned char lc; + extern Lisp_Object Fmessage(); + int snum; + if ((snum = check_wnn_server_type()) == -1) return; + lc = lc_wnn_server_type[snum]; + c2m(s, mbuf, lc); + args[0] = make_string(mbuf, strlen(mbuf)); + Fmessage(1, args); +} + +int +check_wnn_server_type() +{ + if (Vwnn_server_type == Qjserver) { + return WNNSERVER_J; + } + else if (Vwnn_server_type == Qcserver) { + return WNNSERVER_C; + } + /* else if (Vwnn_server_type == Qtserver) { + return WNNSERVER_T; + } */ + else if (Vwnn_server_type == Qkserver) { + return WNNSERVER_K; + } + else return -1; +}