annotate lisp/international/ja-dic-cnv.el @ 90106:bf0d492ea2d5

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-16 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-106 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-110 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-111 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-112 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-113 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-114 <no summary provided> * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-115 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-123 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-124 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-17 - miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-19 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-20 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-21 More work on moving images to etc/images * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-22 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-23 Fix errors with image-file installation * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-24 etc/Makefile.in (install): Put gnus-tut.txt in the right place. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-25 etc/Makefile.in (install, uninstall): Fix installed image dirs. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-26 etc/Makefile.in (install): Create $(etcdir)/images/gnus dir. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-27 Update from CVS
author Miles Bader <miles@gnu.org>
date Wed, 23 Feb 2005 09:18:23 +0000
parents 68c22ea6027c
children f042e7c0fe20
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38414
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 36681
diff changeset
1 ;;; ja-dic-cnv.el --- convert a Japanese dictionary (SKK-JISYO.L) to Emacs Lisp
31164
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
2
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
3 ;; Copyright (C) 1995, 2000 Electrotechnical Laboratory, JAPAN.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
4 ;; Licensed to the Free Software Foundation.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
5
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
6 ;; Keywords: mule, multilingual, Japanese
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
7
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
9
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
13 ;; any later version.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
14
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
19
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
23 ;; Boston, MA 02111-1307, USA.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
24
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
25 ;;; Commentary:
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
26
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
27 ;; SKK is a Japanese input method running on Mule created by Masahiko
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
28 ;; Sato <masahiko@sato.riec.tohoku.ac.jp>. Here we provide utilities
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
29 ;; to handle a dictionary distributed with SKK so that a different
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
30 ;; input method (e.g. quail-japanese) can utilize the dictionary.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
31
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
32 ;; The format of SKK dictionary is quite simple. Each line has the
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
33 ;; form "KANASTRING /CONV1/CONV2/.../" which means KANASTRING ($B2>L>J8(B
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
34 ;; $B;zNs(B) can be converted to one of CONVi. CONVi is a Kanji ($B4A;z(B)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
35 ;; and Kana ($B2>L>(B) mixed string.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
36 ;;
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
37 ;; KANASTRING may have a trailing ASCII letter for Okurigana ($BAw$j2>L>(B)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
38 ;; information. For instance, the trailing letter `k' means that one
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
39 ;; of the following Okurigana is allowed: $B$+$-$/$1$3(B. So, in that
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
40 ;; case, the string "KANASTRING$B$/(B" can be converted to one of "CONV1$B$/(B",
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
41 ;; CONV2$B$/(B, ...
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
42
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
43 ;;; Code:
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
44
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
45 ;; Name of a file to generate from SKK dictionary.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
46 (defvar ja-dic-filename "ja-dic.el")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
47
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
48 ;; To make a generated ja-dic.el smaller.
88406
934ee50a6eb3 (skkdic-get-kana-compact-codes): Call encode-char instead of
Kenichi Handa <handa@m17n.org>
parents: 38479
diff changeset
49 (define-coding-system 'iso-2022-7bit-short
31164
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
50 "Like `iso-2022-7bit' but no ASCII designation before SPC."
88406
934ee50a6eb3 (skkdic-get-kana-compact-codes): Call encode-char instead of
Kenichi Handa <handa@m17n.org>
parents: 38479
diff changeset
51 :coding-type 'iso-2022
934ee50a6eb3 (skkdic-get-kana-compact-codes): Call encode-char instead of
Kenichi Handa <handa@m17n.org>
parents: 38479
diff changeset
52 :mnemonic ?J
934ee50a6eb3 (skkdic-get-kana-compact-codes): Call encode-char instead of
Kenichi Handa <handa@m17n.org>
parents: 38479
diff changeset
53 :charset-list 'iso-2022
934ee50a6eb3 (skkdic-get-kana-compact-codes): Call encode-char instead of
Kenichi Handa <handa@m17n.org>
parents: 38479
diff changeset
54 :designation [(ascii t) nil nil nil]
934ee50a6eb3 (skkdic-get-kana-compact-codes): Call encode-char instead of
Kenichi Handa <handa@m17n.org>
parents: 38479
diff changeset
55 :flags '(short 7-bit designation))
31164
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
56
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
57 (defun skkdic-convert-okuri-ari (skkbuf buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
58 (message "Processing OKURI-ARI entries ...")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
59 (goto-char (point-min))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
60 (save-excursion
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
61 (set-buffer buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
62 (insert ";; Setting okuri-ari entries.\n"
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
63 "(skkdic-set-okuri-ari\n"))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
64 (while (not (eobp))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
65 (let ((from (point))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
66 to)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
67 (end-of-line)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
68 (setq to (point))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
69
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
70 (save-excursion
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
71 (set-buffer buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
72 (insert-buffer-substring skkbuf from to)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
73 (beginning-of-line)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
74 (insert "\"")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
75 (search-forward " ")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
76 (delete-char 1) ; delete the first '/'
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
77 (let ((p (point)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
78 (end-of-line)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
79 (delete-char -1) ; delete the last '/'
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
80 (subst-char-in-region p (point) ?/ ? 'noundo))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
81 (insert "\"\n"))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
82
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
83 (forward-line 1)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
84 (save-excursion
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
85 (set-buffer buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
86 (insert ")\n\n")))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
87
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
88 (defconst skkdic-postfix-list '(skkdic-postfix-list))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
89
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
90 (defconst skkdic-postfix-data
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
91 '(("$B$$$-(B" "$B9T(B")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
92 ("$B$,$+$j(B" "$B78(B")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
93 ("$B$,$/(B" "$B3X(B")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
94 ("$B$,$o(B" "$B@n(B")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
95 ("$B$7$c(B" "$B<R(B")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
96 ("$B$7$e$&(B" "$B=8(B")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
97 ("$B$7$g$&(B" "$B>^(B" "$B>k(B")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
98 ("$B$8$g$&(B" "$B>k(B")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
99 ("$B$;$s(B" "$B@~(B")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
100 ("$B$@$1(B" "$B3Y(B")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
101 ("$B$A$c$/(B" "$BCe(B")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
102 ("$B$F$s(B" "$BE9(B")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
103 ("$B$H$&$2(B" "$BF=(B")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
104 ("$B$I$*$j(B" "$BDL$j(B")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
105 ("$B$d$^(B" "$B;3(B")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
106 ("$B$P$7(B" "$B66(B")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
107 ("$B$O$D(B" "$BH/(B")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
108 ("$B$b$/(B" "$BL\(B")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
109 ("$B$f$-(B" "$B9T(B")))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
110
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
111 (defun skkdic-convert-postfix (skkbuf buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
112 (message "Processing POSTFIX entries ...")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
113 (goto-char (point-min))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
114 (save-excursion
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
115 (set-buffer buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
116 (insert ";; Setting postfix entries.\n"
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
117 "(skkdic-set-postfix\n"))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
118
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
119 ;; Initialize SKKDIC-POSTFIX-LIST by predefined data
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
120 ;; SKKDIC-POSTFIX-DATA.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
121 (save-excursion
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
122 (set-buffer buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
123 (let ((l skkdic-postfix-data)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
124 kana candidates entry)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
125 (while l
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
126 (setq kana (car (car l)) candidates (cdr (car l)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
127 (insert "\"" kana)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
128 (while candidates
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
129 (insert " " (car candidates))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
130 (setq entry (lookup-nested-alist (car candidates)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
131 skkdic-postfix-list nil nil t))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
132 (if (consp (car entry))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
133 (setcar entry (cons kana (car entry)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
134 (set-nested-alist (car candidates) (list kana)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
135 skkdic-postfix-list))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
136 (setq candidates (cdr candidates)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
137 (insert "\"\n")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
138 (setq l (cdr l)))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
139
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
140 ;; Search postfix entries.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
141 (while (re-search-forward "^[#<>?]\\(\\(\\cH\\|$B!<(B\\)+\\) " nil t)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
142 (let ((kana (match-string 1))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
143 str candidates)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
144 (while (looking-at "/[#0-9 ]*\\([^/\n]*\\)/")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
145 (setq str (match-string 1))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
146 (if (not (member str candidates))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
147 (setq candidates (cons str candidates)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
148 (goto-char (match-end 1)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
149 (save-excursion
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
150 (set-buffer buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
151 (insert "\"" kana)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
152 (while candidates
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
153 (insert " " (car candidates))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
154 (let ((entry (lookup-nested-alist (car candidates)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
155 skkdic-postfix-list nil nil t)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
156 (if (consp (car entry))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
157 (if (not (member kana (car entry)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
158 (setcar entry (cons kana (car entry))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
159 (set-nested-alist (car candidates) (list kana)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
160 skkdic-postfix-list)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
161 (setq candidates (cdr candidates)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
162 (insert "\"\n"))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
163 (save-excursion
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
164 (set-buffer buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
165 (insert ")\n\n")))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46671
diff changeset
166
31164
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
167 (defconst skkdic-prefix-list '(skkdic-prefix-list))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
168
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
169 (defun skkdic-convert-prefix (skkbuf buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
170 (message "Processing PREFIX entries ...")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
171 (goto-char (point-min))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
172 (save-excursion
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
173 (set-buffer buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
174 (insert ";; Setting prefix entries.\n"
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
175 "(skkdic-set-prefix\n"))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
176 (save-excursion
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
177 (while (re-search-forward "^\\(\\(\\cH\\|$B!<(B\\)+\\)[<>?] " nil t)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
178 (let ((kana (match-string 1))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
179 str candidates)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
180 (while (looking-at "/\\([^/\n]+\\)/")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
181 (setq str (match-string 1))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
182 (if (not (member str candidates))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
183 (setq candidates (cons str candidates)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
184 (goto-char (match-end 1)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
185 (save-excursion
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
186 (set-buffer buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
187 (insert "\"" kana)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
188 (while candidates
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
189 (insert " " (car candidates))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
190 (set-nested-alist (car candidates) kana skkdic-prefix-list)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
191 (setq candidates (cdr candidates)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
192 (insert "\"\n")))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
193 (save-excursion
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
194 (set-buffer buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
195 (insert ")\n\n")))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46671
diff changeset
196
31164
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
197 ;; FROM and TO point the head and tail of "/J../J../.../".
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
198 (defun skkdic-get-candidate-list (from to)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
199 (let (candidates)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
200 (goto-char from)
34626
6e98a6e86b7f (skkdic-get-candidate-list): Fix the regexp to search for candidates.
Kenichi Handa <handa@m17n.org>
parents: 34532
diff changeset
201 (while (re-search-forward "/[^/ \n]+" to t)
31164
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
202 (setq candidates (cons (buffer-substring (1+ (match-beginning 0))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
203 (match-end 0))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
204 candidates)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
205 candidates))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
206
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
207 ;; Return entry for STR from nested alist ALIST.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
208 (defsubst skkdic-get-entry (str alist)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
209 (car (lookup-nested-alist str alist nil nil t)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
210
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
211
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
212 (defconst skkdic-word-list '(skkdic-word-list))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
213
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
214 ;; Return t if substring of STR (between FROM and TO) can be broken up
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
215 ;; to chunks all of which can be derived from another entry in SKK
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
216 ;; dictionary. SKKBUF is the buffer where the original SKK dictionary
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
217 ;; is visited, KANA is the current entry for STR. FIRST is t iff this
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
218 ;; is called at top level.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
219
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
220 (defun skkdic-breakup-string (skkbuf kana str from to &optional first)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
221 (let ((len (- to from)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
222 (or (and (>= len 2)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
223 (let ((min-idx (+ from 2))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
224 (idx (if first (1- to ) to))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
225 (found nil))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
226 (while (and (not found) (>= idx min-idx))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
227 (let ((kana2-list (skkdic-get-entry
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
228 (substring str from idx)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
229 skkdic-word-list)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
230 (if (or (and (consp kana2-list)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
231 (let ((kana-len (length kana))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
232 kana2)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
233 (catch 'skkdic-tag
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
234 (while kana2-list
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
235 (setq kana2 (car kana2-list))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
236 (if (string-match kana2 kana)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
237 (throw 'skkdic-tag t))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
238 (setq kana2-list (cdr kana2-list)))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
239 (or (= idx to)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
240 (skkdic-breakup-string skkbuf kana str
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
241 idx to)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
242 (and (stringp kana2-list)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
243 (string-match kana2-list kana)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
244 (setq found t)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
245 (setq idx (1- idx)))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
246 found))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
247 (and first
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
248 (> len 2)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
249 (let ((kana2 (skkdic-get-entry
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
250 (substring str from (1+ from))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
251 skkdic-prefix-list)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
252 (and (stringp kana2)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
253 (eq (string-match kana2 kana) 0)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
254 (skkdic-breakup-string skkbuf kana str (1+ from) to))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
255 (and (not first)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
256 (>= len 1)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
257 (let ((kana2-list (skkdic-get-entry
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
258 (substring str from to)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
259 skkdic-postfix-list)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
260 (and (consp kana2-list)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
261 (let (kana2)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
262 (catch 'skkdic-tag
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
263 (while kana2-list
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
264 (setq kana2 (car kana2-list))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
265 (if (string= kana2
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
266 (substring kana (- (length kana2))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
267 (throw 'skkdic-tag t))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
268 (setq kana2-list (cdr kana2-list)))))))))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
269
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
270 ;; Return list of candidates which excludes some from CANDIDATES.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
271 ;; Excluded candidates can be derived from another entry.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
272
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
273 (defun skkdic-reduced-candidates (skkbuf kana candidates)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
274 (let (elt l)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
275 (while candidates
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
276 (setq elt (car candidates))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
277 (if (or (= (length elt) 1)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
278 (and (string-match "^\\cj" elt)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
279 (not (skkdic-breakup-string skkbuf kana elt 0 (length elt)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
280 'first))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
281 (setq l (cons elt l)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
282 (setq candidates (cdr candidates)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
283 (nreverse l)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
284
51055
b3d9bd5b31b8 (skkdic-okuri-nasi-entries, skkdic-okuri-nasi-entries-count):
John Paul Wallington <jpw@pobox.com>
parents: 49598
diff changeset
285 (defvar skkdic-okuri-nasi-entries (list nil))
b3d9bd5b31b8 (skkdic-okuri-nasi-entries, skkdic-okuri-nasi-entries-count):
John Paul Wallington <jpw@pobox.com>
parents: 49598
diff changeset
286 (defvar skkdic-okuri-nasi-entries-count 0)
31164
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
287
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
288 (defun skkdic-collect-okuri-nasi ()
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
289 (message "Collecting OKURI-NASI entries ...")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
290 (save-excursion
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
291 (let ((prev-ratio 0)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
292 ratio)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
293 (while (re-search-forward "^\\(\\(\\cH\\|$B!<(B\\)+\\) \\(/\\cj.*\\)/$"
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
294 nil t)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
295 (let ((kana (match-string 1))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
296 (candidates (skkdic-get-candidate-list (match-beginning 3)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
297 (match-end 3))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
298 (setq skkdic-okuri-nasi-entries
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
299 (cons (cons kana candidates) skkdic-okuri-nasi-entries)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
300 skkdic-okuri-nasi-entries-count
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
301 (1+ skkdic-okuri-nasi-entries-count))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
302 (setq ratio (floor (/ (* (point) 100.0) (point-max))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
303 (if (/= ratio prev-ratio)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
304 (progn
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
305 (message "collected %2d%% %s ..." ratio kana)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
306 (setq prev-ratio ratio)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
307 (while candidates
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
308 (let ((entry (lookup-nested-alist (car candidates)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
309 skkdic-word-list nil nil t)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
310 (if (consp (car entry))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
311 (setcar entry (cons kana (car entry)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
312 (set-nested-alist (car candidates) (list kana)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
313 skkdic-word-list)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
314 (setq candidates (cdr candidates))))))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
315
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
316 (defun skkdic-convert-okuri-nasi (skkbuf buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
317 (message "Processing OKURI-NASI entries ...")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
318 (save-excursion
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
319 (set-buffer buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
320 (insert ";; Setting okuri-nasi entries.\n"
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
321 "(skkdic-set-okuri-nasi\n")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
322 (let ((l (nreverse skkdic-okuri-nasi-entries))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
323 (count 0)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
324 (prev-ratio 0)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
325 ratio)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
326 (while l
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
327 (let ((kana (car (car l)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
328 (candidates (cdr (car l))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
329 (setq ratio (/ (* count 1000) skkdic-okuri-nasi-entries-count)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
330 count (1+ count))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
331 (if (/= prev-ratio (/ ratio 10))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
332 (progn
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
333 (message "processed %2d%% %s ..." (/ ratio 10) kana)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
334 (setq prev-ratio (/ ratio 10))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
335 (if (setq candidates
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
336 (skkdic-reduced-candidates skkbuf kana candidates))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
337 (progn
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
338 (insert "\"" kana)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
339 (while candidates
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
340 (insert " " (car candidates))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
341 (setq candidates (cdr candidates)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
342 (insert "\"\n"))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
343 (setq l (cdr l))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
344 (insert ")\n\n")))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
345
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
346 (defun skkdic-convert (filename &optional dirname)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
347 "Generate Emacs lisp file form Japanese dictionary file FILENAME.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
348 The format of the dictionary file should be the same as SKK dictionaries.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
349 Optional argument DIRNAME if specified is the directory name under which
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
350 the generated Emacs Lisp is saved.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
351 The name of generated file is specified by the variable `ja-dic-filename'."
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
352 (interactive "FSKK dictionary file: ")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
353 (message "Reading file \"%s\" ..." filename)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
354 (let* ((coding-system-for-read 'euc-japan)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
355 (skkbuf(find-file-noselect (expand-file-name filename)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
356 (buf (get-buffer-create "*skkdic-work*")))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
357 (save-excursion
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
358 ;; Setup and generate the header part of working buffer.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
359 (set-buffer buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
360 (erase-buffer)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
361 (buffer-disable-undo)
88812
d0d26a8cd2f8 (skkdic-convert): Add coding tag.
Dave Love <fx@gnu.org>
parents: 88406
diff changeset
362 (insert ";;; ja-dic.el --- dictionary for Japanese input method"
d0d26a8cd2f8 (skkdic-convert): Add coding tag.
Dave Love <fx@gnu.org>
parents: 88406
diff changeset
363 " -*-coding: iso-2022-jp;-*-\n"
31164
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
364 ";;\tGenerated by the command `skkdic-convert'\n"
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
365 ";;\tDate: " (current-time-string) "\n"
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
366 ";;\tOriginal SKK dictionary file: "
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
367 (file-name-nondirectory filename)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
368 "\n\n"
38479
758a6e658e72 Doc and coding conventions fixes.
Pavel Janík <Pavel@Janik.cz>
parents: 38414
diff changeset
369 ";; This file is part of GNU Emacs.\n\n"
758a6e658e72 Doc and coding conventions fixes.
Pavel Janík <Pavel@Janik.cz>
parents: 38414
diff changeset
370 ";;; Commentary:\n\n"
31164
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
371 ";; Do byte-compile this file again after any modification.\n\n"
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
372 ";;; Start of the header of the original SKK dictionary.\n\n")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
373 (set-buffer skkbuf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
374 (widen)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
375 (goto-char 1)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
376 (let (pos)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
377 (search-forward ";; okuri-ari")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
378 (forward-line 1)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
379 (setq pos (point))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
380 (set-buffer buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
381 (insert-buffer-substring skkbuf 1 pos))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
382 (insert "\n"
31196
28b5eff78c33 (skkdic-convert): Insert (require 'ja-dic-cnv), not (require
Kenichi Handa <handa@m17n.org>
parents: 31164
diff changeset
383 ";;; Code:\n\n(eval-when-compile (require 'ja-dic-cnv))\n\n")
31164
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
384
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
385 ;; Generate the body part of working buffer.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
386 (set-buffer skkbuf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
387 (let ((from (point))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
388 to)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
389 ;; Convert okuri-ari entries.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
390 (search-forward ";; okuri-nasi")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
391 (beginning-of-line)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
392 (setq to (point))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
393 (narrow-to-region from to)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
394 (skkdic-convert-okuri-ari skkbuf buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
395 (widen)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
396
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
397 ;; Convert okuri-nasi postfix entries.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
398 (goto-char to)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
399 (forward-line 1)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
400 (setq from (point))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
401 (re-search-forward "^\\cH")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
402 (setq to (match-beginning 0))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
403 (narrow-to-region from to)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
404 (skkdic-convert-postfix skkbuf buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
405 (widen)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
406
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
407 ;; Convert okuri-nasi prefix entries.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
408 (goto-char to)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
409 (skkdic-convert-prefix skkbuf buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
410
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46671
diff changeset
411 ;;
31164
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
412 (skkdic-collect-okuri-nasi)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
413
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
414 ;; Convert okuri-nasi general entries.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
415 (skkdic-convert-okuri-nasi skkbuf buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
416
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
417 ;; Postfix
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
418 (save-excursion
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
419 (set-buffer buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
420 (goto-char (point-max))
38479
758a6e658e72 Doc and coding conventions fixes.
Pavel Janík <Pavel@Janik.cz>
parents: 38414
diff changeset
421 (insert ";;\n(provide 'ja-dic)\n\n;;; ja-dic.el ends here\n")))
31164
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
422
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
423 ;; Save the working buffer.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
424 (set-buffer buf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
425 (set-visited-file-name (expand-file-name ja-dic-filename dirname) t)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
426 (set-buffer-file-coding-system 'iso-2022-7bit-short)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
427 (save-buffer 0))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
428 (kill-buffer skkbuf)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
429 (switch-to-buffer buf)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
430
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
431 (defun batch-skkdic-convert ()
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
432 "Run `skkdic-convert' on the files remaining on the command line.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
433 Use this from the command line, with `-batch';
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
434 it won't work in an interactive Emacs.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
435 For example, invoke:
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
436 % emacs -batch -l ja-dic-cnv -f batch-skkdic-convert SKK-JISYO.L
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
437 to generate \"ja-dic.el\" from SKK dictionary file \"SKK-JISYO.L\".
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
438 To get complete usage, invoke:
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
439 % emacs -batch -l ja-dic-cnv -f batch-skkdic-convert -h"
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
440 (defvar command-line-args-left) ; Avoid compiler warning.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
441 (if (not noninteractive)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
442 (error "`batch-skkdic-convert' should be used only with -batch"))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
443 (if (string= (car command-line-args-left) "-h")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
444 (progn
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
445 (message "To convert SKK-JISYO.L into skkdic.el:")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
446 (message " %% emacs -batch -l ja-dic-cnv -f batch-skkdic-convert SKK-JISYO.L")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
447 (message "To convert SKK-JISYO.L into DIR/ja-dic.el:")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
448 (message " %% emacs -batch -l ja-dic-cnv -f batch-skkdic-convert -dir DIR SKK-JISYO.L"))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
449 (let (targetdir filename)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
450 (if (string= (car command-line-args-left) "-dir")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
451 (progn
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
452 (setq command-line-args-left (cdr command-line-args-left))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
453 (setq targetdir (expand-file-name (car command-line-args-left)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
454 (setq command-line-args-left (cdr command-line-args-left))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
455 (setq filename (expand-file-name (car command-line-args-left)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
456 (message "Converting %s to %s ..." filename ja-dic-filename)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
457 (message "It takes around 10 minutes even on Sun SS20.")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
458 (skkdic-convert filename targetdir)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
459 (message "Do byte-compile the created file by:")
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
460 (message " %% emacs -batch -f batch-byte-compile %s" ja-dic-filename)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
461 ))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
462 (kill-emacs 0))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
463
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
464
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
465 ;; The following macros are expanded at byte-compiling time so that
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
466 ;; compiled code can be loaded quickly.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
467
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
468 (defun skkdic-get-kana-compact-codes (kana)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
469 (let* ((len (length kana))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
470 (vec (make-vector len 0))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
471 (i 0)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
472 ch)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
473 (while (< i len)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
474 (setq ch (aref kana i))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
475 (aset vec i
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
476 (if (< ch 128) ; CH is an ASCII letter for OKURIGANA,
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
477 (- ch) ; represented by a negative code.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
478 (if (= ch ?$B!<(B) ; `$B!<(B' is represented by 0.
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
479 0
88406
934ee50a6eb3 (skkdic-get-kana-compact-codes): Call encode-char instead of
Kenichi Handa <handa@m17n.org>
parents: 38479
diff changeset
480 (- (logand (encode-char ch 'japanese-jisx0208) #xFF) 32))))
31164
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
481 (setq i (1+ i)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
482 vec))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
483
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
484 (defun skkdic-extract-conversion-data (entry)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
485 (string-match "^\\cj+[a-z]* " entry)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
486 (let ((kana (substring entry (match-beginning 0) (1- (match-end 0))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
487 (i (match-end 0))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
488 candidates)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
489 (while (string-match "[^ ]+" entry i)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
490 (setq candidates (cons (match-string 0 entry) candidates))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
491 (setq i (match-end 0)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
492 (cons (skkdic-get-kana-compact-codes kana) candidates)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
493
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
494 (defmacro skkdic-set-okuri-ari (&rest entries)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
495 `(defconst skkdic-okuri-ari
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
496 ',(let ((l entries)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
497 (map '(skkdic-okuri-ari))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
498 entry)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
499 (while l
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
500 (setq entry (skkdic-extract-conversion-data (car l)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
501 (set-nested-alist (car entry) (cdr entry) map)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
502 (setq l (cdr l)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
503 map)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
504
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
505 (defmacro skkdic-set-postfix (&rest entries)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
506 `(defconst skkdic-postfix
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
507 ',(let ((l entries)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
508 (map '(nil))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
509 (longest 1)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
510 len entry)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
511 (while l
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
512 (setq entry (skkdic-extract-conversion-data (car l)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
513 (setq len (length (car entry)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
514 (if (> len longest)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
515 (setq longest len))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
516 (let ((entry2 (lookup-nested-alist (car entry) map nil nil t)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
517 (if (consp (car entry2))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
518 (let ((conversions (cdr entry)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
519 (while conversions
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
520 (if (not (member (car conversions) (car entry2)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
521 (setcar entry2 (cons (car conversions) (car entry2))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
522 (setq conversions (cdr conversions))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
523 (set-nested-alist (car entry) (cdr entry) map)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
524 (setq l (cdr l)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
525 (setcar map longest)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
526 map)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
527
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
528 (defmacro skkdic-set-prefix (&rest entries)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
529 `(defconst skkdic-prefix
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
530 ',(let ((l entries)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
531 (map '(nil))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
532 (longest 1)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
533 len entry)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
534 (while l
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
535 (setq entry (skkdic-extract-conversion-data (car l)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
536 (setq len (length (car entry)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
537 (if (> len longest)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
538 (setq longest len))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
539 (let ((entry2 (lookup-nested-alist (car entry) map len nil t)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
540 (if (consp (car entry2))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
541 (let ((conversions (cdr entry)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
542 (while conversions
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
543 (if (not (member (car conversions) (car entry2)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
544 (setcar entry2 (cons (car conversions) (car entry2))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
545 (setq conversions (cdr conversions))))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
546 (set-nested-alist (car entry) (cdr entry) map len)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
547 (setq l (cdr l)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
548 (setcar map longest)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
549 map)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
550
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
551 (defmacro skkdic-set-okuri-nasi (&rest entries)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
552 `(defconst skkdic-okuri-nasi
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
553 ',(let ((l entries)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
554 (map '(skdic-okuri-nasi))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
555 (count 0)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
556 entry)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
557 (while l
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
558 (setq count (1+ count))
34532
dad96251e889 (skkdic-set-okuri-nasi): Show
Kenichi Handa <handa@m17n.org>
parents: 31196
diff changeset
559 (if (= (% count 10000) 0)
31164
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
560 (message (format "%d entries" count)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
561 (setq entry (skkdic-extract-conversion-data (car l)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
562 (set-nested-alist (car entry) (cdr entry) map)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
563 (setq l (cdr l)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
564 map)))
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
565
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
566 (provide 'ja-dic-cnv)
bb7de354d69f Renamed from skkdic-cnv.el.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
567
36681
8f93fc285ff3 Add coding: tag in Loval Vairables: section.
Kenichi Handa <handa@m17n.org>
parents: 34626
diff changeset
568 ;; Local Variables:
8f93fc285ff3 Add coding: tag in Loval Vairables: section.
Kenichi Handa <handa@m17n.org>
parents: 34626
diff changeset
569 ;; coding: iso-2022-7bit
8f93fc285ff3 Add coding: tag in Loval Vairables: section.
Kenichi Handa <handa@m17n.org>
parents: 34626
diff changeset
570 ;; End:
38414
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 36681
diff changeset
571
89909
68c22ea6027c Sync to HEAD
Kenichi Handa <handa@m17n.org>
parents: 89483
diff changeset
572 ;;; arch-tag: dec06fb0-8118-45b1-80d7-dc360b6fd3b2
38414
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 36681
diff changeset
573 ;;; ja-dic-cnv.el ends here