annotate lisp/international/titdic-cnv.el @ 37723:419538da0f94

*** empty log message ***
author Gerd Moellmann <gerd@gnu.org>
date Mon, 14 May 2001 13:18:04 +0000
parents 3e478bb3f389
children 91cf555a6d8d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18555
39589a3b1b20 Add license note.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1 ;;; titdic-cnv.el --- convert cxterm dictionary (TIT format) to Quail package
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
18377
8b4a66c66dd6 Change copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 18202
diff changeset
4 ;; Licensed to the Free Software Foundation.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
5
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
6 ;; Keywords: Quail, TIT, cxterm
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
7
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
9
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
13 ;; any later version.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
14
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
19
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
23 ;; Boston, MA 02111-1307, USA.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
24
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
25 ;;; Comments:
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
26
18555
39589a3b1b20 Add license note.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
27 ;; Convert cxterm dictionary (of TIT format) to quail-package.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
28 ;;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
29 ;; Usage (within Emacs):
18555
39589a3b1b20 Add license note.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
30 ;; M-x titdic-convert<CR>CXTERM-DICTIONARY-NAME<CR>
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
31 ;; Usage (from shell):
18555
39589a3b1b20 Add license note.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
32 ;; % emacs -batch -l titdic-cnv -f batch-titdic-convert\
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
33 ;; [-dir DIR] [DIR | FILE] ...
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
34 ;;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
35 ;; When you run titdic-convert within Emacs, you have a chance to
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
36 ;; modify arguments of `quail-define-package' before saving the
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
37 ;; converted file. For instance, you are likely to modify TITLE,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
38 ;; DOCSTRING, and KEY-BINDINGS.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
39
18555
39589a3b1b20 Add license note.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
40 ;; Cxterm dictionary file (*.tit) is a line-oriented text (English,
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
41 ;; Chinese, Japanese, and Korean) file. The whole file contains of
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
42 ;; two parts, the definition part (`header' here after) followed by
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
43 ;; the dictionary part (`body' here after). All lines begin with
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
44 ;; leading '#' are ignored.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
45 ;;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
46 ;; Each line in the header part has two fields, KEY and VALUE. These
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
47 ;; fields are separated by one or more white characters.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
48 ;;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
49 ;; Each line in the body part has two fields, KEYSEQ and TRANSLATIONS.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
50 ;; These fields are separated by one or more white characters.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
51 ;;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
52 ;; See the manual page of `tit2cit' of cxterm distribution for more
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
53 ;; detail.
37116
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
54 ;;
37261
4ffaf150ddfc Fix a typo in a comment.
Eli Zaretskii <eliz@gnu.org>
parents: 37258
diff changeset
55 ;; Near the end of this file, we also have a few other tools to convert
37116
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
56 ;; miscellaneous dictionaries.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
57
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
58 ;;; Code:
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
59
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
60 (require 'quail)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
61
18555
39589a3b1b20 Add license note.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
62 ;; List of values of key "ENCODE:" and the corresponding Emacs
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
63 ;; coding-system and language environment name.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
64 (defvar tit-encode-list
17098
8917133b7e82 Remove prefix "coding-system-" from coding system symbol names.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
65 '(("GB" euc-china "Chinese-GB")
8917133b7e82 Remove prefix "coding-system-" from coding system symbol names.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
66 ("BIG5" cn-big5 "Chinese-BIG5")
8917133b7e82 Remove prefix "coding-system-" from coding system symbol names.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
67 ("JIS" euc-japan "Japanese")
18555
39589a3b1b20 Add license note.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
68 ("KS" euc-kr "Korean")))
39589a3b1b20 Add license note.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
69
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
70 ;; Alist of input method names and the corresponding title and extra
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
71 ;; docstring. For each of input method generated from TIT dictionary,
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
72 ;; a docstring is automatically generated from the comments in the
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
73 ;; dictionary. The extra docstring in this alist is to add more
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
74 ;; information.
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
75 ;; The command describe-input-method shows the automatically generated
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
76 ;; docstring, then an extra docstrings while replacing the form \<VAR>
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
77 ;; by the value of variable VAR. For instance, the form
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
78 ;; \<quail-translation-docstring> is replaced by a description about
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
79 ;; how to select a translation from a list of candidates.
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
80
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
81 (defvar quail-cxterm-package-ext-info
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
82 '(("chinese-4corner" "$(0(?-F(B")
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
83 ("chinese-array30" "$(0#R#O(B")
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
84 ("chinese-ccdospy" "$AKuF4(B"
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
85 "Pinyin base input method for Chinese charset GB2312 \(`chinese-gb2312').
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
86
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
87 Pinyin is the standared roman transliteration method for Chinese.
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
88 For the detail of Pinyin system, see the documentation of the input
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
89 method `chinese-py'.
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
90
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
91 This input method works almost the same way as `chinese-py'. The
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
92 difference is that you type a single key for these Pinyin spelling.
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
93 Pinyin: zh en eng ang ch an ao ai ong sh ing yu($A(9(B)
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
94 keyseq: a f g h i j k l s u y v
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
95 For expample:
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
96 Chinese: $A0!(B $A9{(B $AVP(B $AND(B $A9b(B $ASq(B $AH+(B
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
97 Pinyin: a guo zhong wen guang yu quan
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
98 Keyseq: a1 guo4 as1 wf4 guh1 yu..6 qvj6
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
99
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
100 \\<quail-translation-docstring>
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
101
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
102 For double-width GB2312 characters correponding to ASCII, use the
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
103 input method `chinese-qj'.")
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
104
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
105 ("chinese-ctlau" "$AAuTA(B")
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
106
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
107 ("chinese-ctlaub" "$(0N,Gn(B")
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
108
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
109 ("chinese-ecdict" "$(05CKH(B"
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
110 "In this input method, you enter a Chinese (Big5) charactere or word
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
111 by typing the corresponding English word. For example, if you type
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
112 \"computer\", \"$(0IZH+(B\" is input.
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
113
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
114 \\<quail-translation-docstring>")
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
115
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
116 ("chinese-etzy" "$(06/0D(B"
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
117 "Zhuyin base input method for Chinese Big5 characters (`chinese-big5-1',
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
118 `chinese-big5-2').
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
119
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
120 Zhuyin is a kind of phonetic symbol. One to three Zhuyin symbols
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
121 compose one Chinese character.
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
122
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
123 In this input method, you enter a Chinese character by first typing
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
124 keys corresponding to Zhuyin symbols (see the above table) followed by
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
125 SPC, 1, 2, 3, or 4 specifing a tone (SPC:$(0?v(N(B, 1:$(0M=Vy(B, 2:$(0Dm(N(B, 3: $(0&9Vy(B,
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
126 4:$(0(+Vy(B).
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
127
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
128 \\<quail-translation-docstring>")
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
129
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
130 ("chinese-punct-b5" "$(0O:(BB"
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
131 "Input method for Chinese punctuations and symbols of Big5
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
132 \(`chinese-big5-1' and `chinese-big5-2').")
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
133
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
134 ("chinese-punct" "$A1j(BG"
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
135 "Input method for Chinese punctuations and symbols of GB2312
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
136 \(`chinese-gb2312').")
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
137
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
138 ("chinese-py-b5" "$(03<(BB"
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
139 "Pinyin base input method for Chinese Big5 characters
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
140 \(`chinese-big5-1', `chinese-big5-2').
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
141
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
142 This input method works almost the same way as `chinese-py' (which
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
143 see).
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
144
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
145 This input method supports only Han characters. The more convenient
31481
e9e907d10d80 (quail-cxterm-package-ext-info): Fix doc strings of chinese-py-b5,
Eli Zaretskii <eliz@gnu.org>
parents: 31425
diff changeset
146 method is `chinese-py-punct-b5', which is the combination of this
e9e907d10d80 (quail-cxterm-package-ext-info): Fix doc strings of chinese-py-b5,
Eli Zaretskii <eliz@gnu.org>
parents: 31425
diff changeset
147 method and `chinese-punct-b5' and which supports both Han characters
e9e907d10d80 (quail-cxterm-package-ext-info): Fix doc strings of chinese-py-b5,
Eli Zaretskii <eliz@gnu.org>
parents: 31425
diff changeset
148 and punctuation/symbols.
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
149
31481
e9e907d10d80 (quail-cxterm-package-ext-info): Fix doc strings of chinese-py-b5,
Eli Zaretskii <eliz@gnu.org>
parents: 31425
diff changeset
150 For double-width Big5 characters corresponding to ASCII, use the input
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
151 method `chinese-qj-b5'.
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
152
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
153 The input method `chinese-py' and `chinese-tonepy' are also Pinyin
31481
e9e907d10d80 (quail-cxterm-package-ext-info): Fix doc strings of chinese-py-b5,
Eli Zaretskii <eliz@gnu.org>
parents: 31425
diff changeset
154 based, but for the character set GB2312 (`chinese-gb2312').")
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
155
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
156 ("chinese-qj-b5" "$(0)A(BB")
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
157
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
158 ("chinese-qj" "$AH+(BG")
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
159
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
160 ("chinese-sw" "$AJWN2(B"
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
161 "Radical base input method for Chinese charset GB2312 (`chinese-gb2312').
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
162
32277
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
163 In this input method, you enter a Chinese character by typing two
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
164 keys. The first key corresponds to the first ($AJW(B) radical, the second
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
165 key corresponds to the last ($AN2(B) radical. The correspondence of keys
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
166 and radicals is as below:
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
167
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
168 first radical:
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
169 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
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
170 $APD(B $AZ"(B $AJ,(B $AX<(B $A;p(B $A?Z(B $A^P(B $Ac_(B $AZ%(B $A\3(B $AXi(B $AD>(B $Alj(B $Ab;(B $ATB(B $Afy(B $AJ/(B $AMu(B $A0K(B $AX/(B $AHU(B $AeA(B $Aak(B $AVq(B $AR;(B $AHK(B
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
171 last radical:
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
172 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
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
173 $ASV(B $AI=(B $AMA(B $A56(B $AZb(B $A?Z(B $ARB(B $Aqb(B $A4s(B $A6!(B $A[L(B $Ala(B $AJ.(B $A4u(B $AXg(B $ACE(B $A=q(B $AX-(B $AE.(B $ARR(B $A`m(B $AP!(B $A3'(B $A3f(B $A_.(B $A27(B
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
174
36995
eba40b9dc09b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36684
diff changeset
175 \\<quail-translation-docstring>")
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
176
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
177 ("chinese-tonepy" "$A5wF4(B"
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
178 "Pinyin base input method for Chinese charset GB2312 (`chinese-gb2312').
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
179
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
180 Pinyin is the standared roman transliteration method for Chinese.
32277
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
181 For the details of Pinyin system, see the documentation of the input
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
182 method `chinese-py'.
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
183
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
184 This input method works almost the same way as `chinese-py'. The
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
185 difference is that you must type 1..5 after each Pinyin spelling to
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
186 specify a tone (1:$ARuF=(B, 2:$AQtF=(B, 3:$AIOIy(B, 4$AOBIy(B, 5:$AGaIy(B).
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
187
36995
eba40b9dc09b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36684
diff changeset
188 \\<quail-translation-docstring>
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
189
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
190 For instance, to input $ADc(B, you type \"n i 3 3\", the first \"n i\" is
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
191 a Pinyin, the next \"3\" specifies tone, and the last \"3\" selects
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
192 the third character from the candidate list.
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
193
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
194 For double-width GB2312 characters correponding to ASCII, use the
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
195 input method `chinese-qj'.")
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
196
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
197 ("chinese-zozy" "$(0I\0D(B"
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
198 "Zhuyin base input method for Chinese Big5 characters (`chinese-big5-1',
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
199 `chinese-big5-2').
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
200
32277
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
201 Zhuyin is a kind of a phonetic symbol. One to three Zhuyin symbols
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
202 compose a Chinese character.
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
203
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
204 In this input method, you enter a Chinese character by first typing
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
205 keys corresponding to Zhuyin symbols (see the above table) followed by
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
206 SPC, 6, 3, 4, or 7 specifing a tone (SPC:$(0?v(N(B, 6:$(0Dm(N(B, 3:$(0&9Vy(B, 4:$(0(+Vy(B,
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
207 7:$(0M=Vy(B).
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
208
36995
eba40b9dc09b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36684
diff changeset
209 \\<quail-translation-docstring>")))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
210
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
211 ;; Return a value of the key in the current line.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
212 (defsubst tit-read-key-value ()
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
213 (if (looking-at "[^ \t\n]+")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
214 (car (read-from-string (concat "\"" (match-string 0) "\"")))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
215
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
216 ;; Return an appropriate quail-package filename from FILENAME (TIT
18555
39589a3b1b20 Add license note.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
217 ;; dictionary filename). For instance, ".../ZOZY.tit" -> "ZOZY.el".
39589a3b1b20 Add license note.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
218 (defun tit-make-quail-package-file-name (filename &optional dirname)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
219 (expand-file-name
18555
39589a3b1b20 Add license note.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
220 (concat (file-name-nondirectory (substring filename 0 -4)) ".el")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
221 dirname))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
222
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
223 ;; This value is nil if we are processing phrase dictionary.
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
224 (defconst tit-dictionary t)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
225 (defvar tit-encode nil)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
226 (defvar tit-default-encode "GB")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
227
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
228 ;; Generate elements of KEY-BINDINGS arg for `quail-define-package' so
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
229 ;; that each characters in KEYS invokes FUNCTION-SYMBOL.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
230 (defun tit-generate-key-bindings (keys function-symbol)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
231 (let ((len (length keys))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
232 (i 0)
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
233 (first t)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
234 key)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
235 (while (< i len)
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
236 (or first (princ "\n "))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
237 (setq key (aref keys i))
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
238 (if (if (< key ?\ )
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
239 (eq (lookup-key quail-translation-keymap
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
240 (char-to-string key))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
241 'quail-execute-non-quail-command)
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
242 (<= key 127))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
243 (progn
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
244 (princ (cons (cond ((< key ?\ ) (format "\"\\C-%c\"" (+ key ?@)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
245 ((< key 127) (format "\"%c\"" key))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
246 (t "\"\\C-?\""))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
247 function-symbol))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
248 (setq first nil)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
249 (setq i (1+ i)))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
250
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
251 ;; Analyze header part of TIT dictionary and generate an appropriate
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
252 ;; `quail-define-package' function call.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
253 (defun tit-process-header (filename)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
254 (message "Processing header part...")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
255 (goto-char (point-min))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
256
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
257 ;; At first, generate header part of the Quail package while
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
258 ;; collecting information from the original header.
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
259 (let ((package (concat
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
260 "chinese-"
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
261 (substring (downcase (file-name-nondirectory filename))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
262 0 -4)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
263 ;; TIT keywords and the corresponding default values.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
264 (tit-multichoice t)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
265 (tit-prompt "")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
266 (tit-comments nil)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
267 (tit-backspace "\010\177")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
268 (tit-deleteall "\015\025")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
269 (tit-moveright ".>")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
270 (tit-moveleft ",<")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
271 (tit-keyprompt nil))
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
272
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
273 (princ ";; Quail package `")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
274 (princ package)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
275 (princ "' generated by the command `titdic-convert'\n;;\tDate: ")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
276 (princ (current-time-string))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
277 (princ "\n;;\tOriginal TIT dictionary file: ")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
278 (princ (file-name-nondirectory filename))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
279 (princ "\n\n;;; Comment:\n\n")
21503
d08387c742bb (titdic-convert): Message improved.
Kenichi Handa <handa@m17n.org>
parents: 21081
diff changeset
280 (princ ";; Byte-compile this file again after any modification.\n\n")
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
281 (princ ";;; Start of the header of original TIT dictionary.\n\n")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
282
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
283 (while (not (eobp))
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
284 (let ((ch (following-char))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
285 (pos (point)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
286 (cond ((= ch ?C) ; COMMENT
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
287 (cond ((looking-at "COMMENT")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
288 (let ((pos (match-end 0)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
289 (end-of-line)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
290 (setq tit-comments (cons (buffer-substring pos (point))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
291 tit-comments))))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
292 ((= ch ?M) ; MULTICHOICE, MOVERIGHT, MOVELEFT
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
293 (cond ((looking-at "MULTICHOICE:[ \t]*")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
294 (goto-char (match-end 0))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
295 (setq tit-multichoice (looking-at "YES")))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
296 ((looking-at "MOVERIGHT:[ \t]*")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
297 (goto-char (match-end 0))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
298 (setq tit-moveright (tit-read-key-value)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
299 ((looking-at "MOVELEFT:[ \t]*")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
300 (goto-char (match-end 0))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
301 (setq tit-moveleft (tit-read-key-value)))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
302 ((= ch ?P) ; PROMPT
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
303 (cond ((looking-at "PROMPT:[ \t]*")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
304 (goto-char (match-end 0))
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
305 (setq tit-prompt (tit-read-key-value))
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
306 ;; Some TIT dictionaies that are encoded by
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
307 ;; euc-china contains invalid character at the tail.
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
308 (let* ((last (aref tit-prompt (1- (length tit-prompt))))
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
309 (split (split-char last)))
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
310 (if (or (eq (nth 1 split) 32)
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
311 (eq (nth 2 split) 32))
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
312 (setq tit-prompt (substring tit-prompt 0 -1)))))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
313 ((= ch ?B) ; BACKSPACE, BEGINDICTIONARY,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
314 ; BEGINPHRASE
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
315 (cond ((looking-at "BACKSPACE:[ \t]*")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
316 (goto-char (match-end 0))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
317 (setq tit-backspace (tit-read-key-value)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
318 ((looking-at "BEGINDICTIONARY")
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
319 (setq tit-dictionary t))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
320 ((looking-at "BEGINPHRASE")
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
321 (setq tit-dictionary nil))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
322 ((= ch ?K) ; KEYPROMPT
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
323 (cond ((looking-at "KEYPROMPT(\\(.*\\)):[ \t]*")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
324 (let ((key-char (match-string 1)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
325 (goto-char (match-end 0))
19943
23ada3fdbc8b (tit-process-header): Convert argument of KEYPROMPT if it contains an escape.
Richard M. Stallman <rms@gnu.org>
parents: 19431
diff changeset
326 (if (string-match "\\\\[0-9]+" key-char)
23ada3fdbc8b (tit-process-header): Convert argument of KEYPROMPT if it contains an escape.
Richard M. Stallman <rms@gnu.org>
parents: 19431
diff changeset
327 (setq key-char
23ada3fdbc8b (tit-process-header): Convert argument of KEYPROMPT if it contains an escape.
Richard M. Stallman <rms@gnu.org>
parents: 19431
diff changeset
328 (car (read-from-string (format "\"%s\""
23ada3fdbc8b (tit-process-header): Convert argument of KEYPROMPT if it contains an escape.
Richard M. Stallman <rms@gnu.org>
parents: 19431
diff changeset
329 key-char)))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
330 (setq tit-keyprompt
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
331 (cons (cons key-char (tit-read-key-value))
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
332 tit-keyprompt)))))))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
333 (end-of-line)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
334 (princ ";; ")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
335 (princ (buffer-substring pos (point)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
336 (princ "\n")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
337 (forward-line 1)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
338
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
339 (princ "\n;;; End of the header of original TIT dictionary.\n\n")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
340 (princ ";;; Code:\n\n(require 'quail)\n\n")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
341
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
342 (princ "(quail-define-package ")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
343 ;; Args NAME, LANGUAGE, TITLE
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
344 (let ((title (nth 1 (assoc package quail-cxterm-package-ext-info))))
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
345 (princ "\"")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
346 (princ package)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
347 (princ "\" \"")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
348 (princ (nth 2 (assoc tit-encode tit-encode-list)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
349 (princ "\" \"")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
350 (princ (or title
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
351 (if (string-match "[:$A!K$(0!(!J(B]+\\([^:$A!K$(0!(!K(B]+\\)" tit-prompt)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
352 (substring tit-prompt (match-beginning 1) (match-end 1))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
353 tit-prompt)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
354 (princ "\"\n"))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
355
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
356 ;; Arg GUIDANCE
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
357 (if tit-keyprompt
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
358 (progn
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
359 (princ " '(")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
360 (while tit-keyprompt
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
361 (princ " ")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
362 (princ (format "(%d . \"%s\")\n"
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
363 (string-to-char (car (car tit-keyprompt)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
364 (cdr (car tit-keyprompt))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
365 (setq tit-keyprompt (cdr tit-keyprompt)))
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
366 (princ ")"))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
367 (princ " t\n"))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
368
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
369 ;; Arg DOCSTRING
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
370 (let ((doc (concat tit-prompt "\n"))
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
371 (comments (if tit-comments
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
372 (mapconcat 'identity (nreverse tit-comments) "\n")))
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
373 (doc-ext (nth 2 (assoc package quail-cxterm-package-ext-info))))
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
374 (if comments
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
375 (setq doc (concat doc "\n" comments "\n")))
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
376 (if doc-ext
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
377 (setq doc (concat doc "\n" doc-ext "\n")))
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
378 (prin1 doc)
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
379 (terpri))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
380
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
381 ;; Arg KEY-BINDINGS
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
382 (princ " '(")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
383 (tit-generate-key-bindings tit-backspace 'quail-delete-last-char)
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
384 (princ "\n ")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
385 (tit-generate-key-bindings tit-deleteall 'quail-abort-translation)
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
386 (princ "\n ")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
387 (tit-generate-key-bindings tit-moveright 'quail-next-translation)
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
388 (princ "\n ")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
389 (tit-generate-key-bindings tit-moveleft 'quail-prev-translation)
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
390 (princ ")\n")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
391
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
392 ;; Args FORGET-TRANSLATION, DETERMINISTIC, KBD-TRANSLATE, SHOW-LAYOUT.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
393 ;; The remaining args are all nil.
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
394 (princ " nil")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
395 (princ (if tit-multichoice " nil" " t"))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
396 (princ (if tit-keyprompt " t t)\n\n" " nil nil)\n\n"))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
397
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
398 (defsubst tit-flush-translations (key translations)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
399 (if (string-match "\\\\[0-9][0-9][0-9]" key)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
400 (let ((newkey (concat (substring key 0 (match-beginning 0))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
401 (car (read-from-string
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
402 (concat "\"" (match-string 0 key) "\"")))))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
403 (idx (match-end 0)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
404 (while (string-match "\\\\[0-9][0-9][0-9]" key idx)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
405 (setq newkey (concat
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
406 newkey
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
407 (substring key idx (match-beginning 0))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
408 (car (read-from-string
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
409 (concat "\"" (match-string 0 key) "\"")))))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
410 (setq idx (match-end 0)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
411 (setq key (concat newkey (substring key idx)))))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
412 (prin1 (list key (if tit-dictionary translations
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
413 (vconcat (nreverse translations)))))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
414 (princ "\n"))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
415
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
416 ;; Convert body part of TIT dictionary into `quail-define-rules'
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
417 ;; function call.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
418 (defun tit-process-body ()
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
419 (message "Formatting translation rules...")
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
420 (let* ((template (list nil nil))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
421 (second (cdr template))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
422 (prev-key "")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
423 ch key translations pos)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
424 (princ "(quail-define-rules\n")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
425 (while (null (eobp))
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
426 (setq ch (following-char))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
427 (if (or (= ch ?#) (= ch ?\n))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
428 (forward-line 1)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
429 (setq pos (point))
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
430 (skip-chars-forward "^ \t\n")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
431 (setq key (buffer-substring pos (point)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
432 (skip-chars-forward " \t")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
433 (setq ch (following-char))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
434 (if (or (= ch ?#) (= ch ?\n))
18796
ab40b57484c1 (tit-process-body): Ignore vacant entries.
Kenichi Handa <handa@m17n.org>
parents: 18555
diff changeset
435 ;; This entry contains no translations. Let's ignore it.
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
436 (forward-line 1)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
437 (or (string= key prev-key)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
438 (progn
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
439 (if translations
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
440 (tit-flush-translations prev-key translations))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
441 (setq translations nil
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
442 prev-key key)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
443 (if tit-dictionary
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
444 (progn
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
445 (setq pos (point))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
446 (skip-chars-forward "^ \t#\n")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
447 (setq translations
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
448 (if translations
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
449 (concat translations
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
450 (buffer-substring pos (point)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
451 (buffer-substring pos (point)))))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
452 (while (not (eolp))
18796
ab40b57484c1 (tit-process-body): Ignore vacant entries.
Kenichi Handa <handa@m17n.org>
parents: 18555
diff changeset
453 (setq pos (point))
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
454 (skip-chars-forward "^ \t\n")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
455 (setq translations (cons (buffer-substring pos (point))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
456 translations))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
457 (skip-chars-forward " \t")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
458 (setq ch (following-char))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
459 (if (= ch ?#) (end-of-line))))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
460 (forward-line 1))))
18796
ab40b57484c1 (tit-process-body): Ignore vacant entries.
Kenichi Handa <handa@m17n.org>
parents: 18555
diff changeset
461
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
462 (if translations
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
463 (tit-flush-translations prev-key translations))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
464 (princ ")\n")))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
465
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
466 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
467 (defun titdic-convert (filename &optional dirname)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
468 "Convert a TIT dictionary of FILENAME into a Quail package.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
469 Optional argument DIRNAME if specified is the directory name under which
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
470 the generated Quail package is saved."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
471 (interactive "FTIT dictionary file: ")
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
472 (with-temp-file (tit-make-quail-package-file-name filename dirname)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
473 (set-buffer-file-coding-system 'iso-2022-7bit)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
474 (let ((standard-output (current-buffer)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
475 (with-temp-buffer
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
476 (let ((coding-system-for-read 'no-conversion))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
477 (insert-file-contents (expand-file-name filename)))
21081
f7d33c30712e (titdic-convert): Use set-buffer-multibyte.
Richard M. Stallman <rms@gnu.org>
parents: 20840
diff changeset
478 (set-buffer-multibyte t)
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
479
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
480 ;; Decode the buffer contents from the encoding specified by a
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
481 ;; value of the key "ENCODE:".
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
482 (if (not (search-forward "\nBEGIN" nil t))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
483 (error "TIT dictionary doesn't have body part"))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
484 (let ((limit (point))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
485 coding-system slot)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
486 (goto-char (point-min))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
487 (if (re-search-forward "^ENCODE:[ \t]*" limit t)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
488 (progn
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
489 (goto-char (match-end 0))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
490 (setq tit-encode (tit-read-key-value)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
491 (setq tit-encode tit-default-encode))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
492 (setq slot (assoc tit-encode tit-encode-list))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
493 (if (not slot)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
494 (error "Invalid ENCODE: value in TIT dictionary"))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
495 (setq coding-system (nth 1 slot))
21503
d08387c742bb (titdic-convert): Message improved.
Kenichi Handa <handa@m17n.org>
parents: 21081
diff changeset
496 (message "Decoding with coding system %s..." coding-system)
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
497 (goto-char (point-min))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
498 (decode-coding-region (point-min) (point-max) coding-system))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
499
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
500 ;; Set point the starting position of the body part.
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
501 (goto-char (point-min))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
502 (if (not (search-forward "\nBEGIN" nil t))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
503 (error "TIT dictionary can't be decoded correctly"))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
504
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
505 ;; Process the header part.
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
506 (forward-line 1)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
507 (narrow-to-region (point-min) (point))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
508 (tit-process-header filename)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
509 (widen)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
510
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
511 ;; Process the body part. For speed, we turn off multibyte facility.
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
512 (with-current-buffer standard-output
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
513 (set-buffer-multibyte nil))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
514 (set-buffer-multibyte nil)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
515 (tit-process-body)))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
516
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
517 ;;;###autoload
18831
e6f6c2712a5f (batch-titdic-convert): Add optional arg FORCE.
Kenichi Handa <handa@m17n.org>
parents: 18796
diff changeset
518 (defun batch-titdic-convert (&optional force)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
519 "Run `titdic-convert' on the files remaining on the command line.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
520 Use this from the command line, with `-batch';
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
521 it won't work in an interactive Emacs.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
522 For example, invoke \"emacs -batch -f batch-titdic-convert XXX.tit\" to
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
523 generate Quail package file \"xxx.el\" from TIT dictionary file \"XXX.tit\".
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
524 To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
525 (defvar command-line-args-left) ; Avoid compiler warning.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
526 (if (not noninteractive)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
527 (error "`batch-titdic-convert' should be used only with -batch"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
528 (if (string= (car command-line-args-left) "-h")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
529 (progn
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
530 (message "To convert XXX.tit and YYY.tit into xxx.el and yyy.el:")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
531 (message " %% emacs -batch -l titdic-cnv -f batch-titdic-convert XXX.tit YYY.tit")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
532 (message "To convert XXX.tit into DIR/xxx.el:")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
533 (message " %% emacs -batch -l titdic-cnv -f batch-titdic-convert -dir DIR XXX.tit"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
534 (let (targetdir filename files file)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
535 (if (string= (car command-line-args-left) "-dir")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
536 (progn
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
537 (setq command-line-args-left (cdr command-line-args-left))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
538 (setq targetdir (car command-line-args-left))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
539 (setq command-line-args-left (cdr command-line-args-left))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
540 (while command-line-args-left
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
541 (setq filename (expand-file-name (car command-line-args-left)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
542 (if (file-directory-p filename)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
543 (progn
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
544 (message "Converting all tit files in the directory %s" filename)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
545 (setq files (directory-files filename t "\\.tit$")))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
546 (setq files (list filename)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
547 (while files
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
548 (setq file (expand-file-name (car files)))
18831
e6f6c2712a5f (batch-titdic-convert): Add optional arg FORCE.
Kenichi Handa <handa@m17n.org>
parents: 18796
diff changeset
549 (when (or force
e6f6c2712a5f (batch-titdic-convert): Add optional arg FORCE.
Kenichi Handa <handa@m17n.org>
parents: 18796
diff changeset
550 (file-newer-than-file-p
e6f6c2712a5f (batch-titdic-convert): Add optional arg FORCE.
Kenichi Handa <handa@m17n.org>
parents: 18796
diff changeset
551 file (tit-make-quail-package-file-name file targetdir)))
e6f6c2712a5f (batch-titdic-convert): Add optional arg FORCE.
Kenichi Handa <handa@m17n.org>
parents: 18796
diff changeset
552 (message "Converting %s to quail-package..." file)
e6f6c2712a5f (batch-titdic-convert): Add optional arg FORCE.
Kenichi Handa <handa@m17n.org>
parents: 18796
diff changeset
553 (titdic-convert file targetdir))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
554 (setq files (cdr files)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
555 (setq command-line-args-left (cdr command-line-args-left)))
21503
d08387c742bb (titdic-convert): Message improved.
Kenichi Handa <handa@m17n.org>
parents: 21081
diff changeset
556 (message "Byte-compile the created files by:")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
557 (message " %% emacs -batch -f batch-byte-compile XXX.el")))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
558 (kill-emacs 0))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
559
37116
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
560
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
561 ;;; Converter of miscellaneous dictionaries other than TIT format.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
562
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
563 ;; Alist of input method names and the corresponding information.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
564 ;; Each element has this form:
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
565 ;; (INPUT-METHOD-NAME ;; Name of the input method.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
566 ;; INPUT-METHOD-TITLE ;; Title string of the input method
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
567 ;; DICFILE ;; Name of the source dictionary file.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
568 ;; CODING ;; Coding system of the dictionary file.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
569 ;; QUAILFILE ;; Name of the Quail package file.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
570 ;; CONVERTER ;; Function to generate the Quail package.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
571 ;; COPYRIGHT-NOTICE ;; Copyright notice of the source dictionary.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
572 ;; )
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
573
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
574 (defvar quail-misc-package-ext-info
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
575 '(("chinese-b5-tsangchi" "$(06A(BB"
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
576 "cangjie-table.b5" big5 "tsang-b5.el"
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
577 tsang-b5-converter
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
578 "\
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
579 ;; # Copyright 2001 Christian Wittern <wittern@iis.sinica.edu.tw>
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
580 ;; #
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
581 ;; # Permission to copy and distribute both modified and
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
582 ;; # unmodified versions is granted without royalty provided
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
583 ;; # this notice is preserved.")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
584
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
585 ("chinese-b5-quick" "$(0X|(BB"
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
586 "cangjie-table.b5" big5 "quick-b5.el"
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
587 quick-b5-converter
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
588 "\
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
589 ;; # Copyright 2001 Christian Wittern <wittern@iis.sinica.edu.tw>
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
590 ;; #
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
591 ;; # Permission to copy and distribute both modified and
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
592 ;; # unmodified versions is granted without royalty provided
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
593 ;; # this notice is preserved.")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
594
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
595 ("chinese-cns-tsangchi" "$(GT?(BC"
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
596 "cangjie-table.cns" iso-2022-cn-ext "tsang-cns.el"
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
597 tsang-cns-converter
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
598 "\
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
599 ;; # Copyright 2001 Christian Wittern <wittern@iis.sinica.edu.tw>
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
600 ;; #
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
601 ;; # Permission to copy and distribute both modified and
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
602 ;; # unmodified versions is granted without royalty provided
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
603 ;; # this notice is preserved.")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
604
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
605 ("chinese-cns-quick" "$(Gv|(BC"
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
606 "cangjie-table.cns" iso-2022-cn-ext "quick-cns.el"
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
607 quick-cns-converter
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
608 "\
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
609 ;; # Copyright 2001 Christian Wittern <wittern@iis.sinica.edu.tw>
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
610 ;; #
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
611 ;; # Permission to copy and distribute both modified and
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
612 ;; # unmodified versions is granted without royalty provided
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
613 ;; # this notice is preserved.")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
614
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
615 ("chinese-py" "$AF4(BG"
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
616 "pinyin.map" cn-gb-2312 "PY.el"
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
617 py-converter
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
618 "\
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
619 ;; \"pinyin.map\" is included in a free package called CCE. It is
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
620 ;; available at:
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
621 ;; http://ftp.debian.org/debian/dists/potato/main
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
622 ;; /source/utils/cce_0.36.orig.tar.gz
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
623 ;; This package contains the following copyright notice.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
624 ;;
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
625 ;;
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
626 ;; Copyright (C) 1999, Rui He, herui@cs.duke.edu
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
627 ;;
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
628 ;;
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
629 ;; CCE(Console Chinese Environment) 0.32
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
630 ;;
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
631 ;; CCE is free software; you can redistribute it and/or modify it under the
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
632 ;; terms of the GNU General Public License as published by the Free Software
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
633 ;; Foundation; either version 1, or (at your option) any later version.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
634 ;;
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
635 ;; CCE is distributed in the hope that it will be useful, but WITHOUT ANY
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
636 ;; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
637 ;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
638 ;; details.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
639 ;;
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
640 ;; You should have received a copy of the GNU General Public License along with
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
641 ;; CCE; see the file COPYING. If not, write to the Free Software Foundation,
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
642 ;; 675 Mass Ave, Cambridge, MA 02139, USA.")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
643
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
644 ("chinese-ziranma" "$AWTH;(B"
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
645 "ziranma.cin" cn-gb-2312 "ZIRANMA.el"
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
646 ziranma-converter
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
647 "\
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
648 ;; \"ziranma.cin\" is included in a free package called CCE. It is
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
649 ;; available at:
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
650 ;; http://ftp.debian.org/debian/dists/potato/main
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
651 ;; /source/utils/cce_0.36.orig.tar.gz
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
652 ;; This package contains the following copyright notice.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
653 ;;
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
654 ;;
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
655 ;; Copyright (C) 1999, Rui He, herui@cs.duke.edu
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
656 ;;
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
657 ;;
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
658 ;; CCE(Console Chinese Environment) 0.32
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
659 ;;
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
660 ;; CCE is free software; you can redistribute it and/or modify it under the
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
661 ;; terms of the GNU General Public License as published by the Free Software
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
662 ;; Foundation; either version 1, or (at your option) any later version.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
663 ;;
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
664 ;; CCE is distributed in the hope that it will be useful, but WITHOUT ANY
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
665 ;; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
666 ;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
667 ;; details.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
668 ;;
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
669 ;; You should have received a copy of the GNU General Public License along with
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
670 ;; CCE; see the file COPYING. If not, write to the Free Software Foundation,
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
671 ;; 675 Mass Ave, Cambridge, MA 02139, USA.")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
672 ))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
673
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
674 ;; Generate a code of a Quail package in the current buffer from Tsang
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
675 ;; dictionary in the buffer DICBUF. The input method name of the
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
676 ;; Quail package is NAME, and the title string is TITLE.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
677
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
678 ;; TSANG-P is non-nil, genereate $(06AQo(B input method. Otherwise
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
679 ;; generate $(0X|/y(B (simple version of $(06AQo(B). If BIG5-P is non-nil, the
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
680 ;; input method is for inputting Big5 characters. Otherwise the input
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
681 ;; method is for inputting CNS characters.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
682
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
683 (defun tsang-quick-converter (dicbuf name title tsang-p big5-p)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
684 (let ((fulltitle (if tsang-p (if big5-p "$(06AQo(B" "$(GT?on(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
685 (if big5-p "$(0X|/y(B" "$(Gv|Mx(B")))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
686 dic)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
687 (goto-char (point-max))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
688 (if big5-p
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
689 (insert (format "\"$(0&d'GTT&,!J(B%s$(0!K(BBIG5
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
690
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
691 $(0KHM$(B%s$(0TT&,WoOu(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
692
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
693 [Q $(0'D(B] [W $(0(q(B] [E $(0'V(B] [R $(0&H(B] [T $(0'>(B] [Y $(0&4(B] [U $(0&U(B] [I $(0'B(B] [O $(0&*(B] [P $(0'A(B]
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
694
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
695 [A $(0'K(B] [S $(0&T(B] [D $(0'N(B] [F $(0'W(B] [G $(0&I(B] [H $(0*M(B] [J $(0&3(B] [L $(0&d(B]
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
696
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
697 [Z ] [X $(0[E(B] [C $(01[(B] [V $(0&M(B] [B $(0'M(B] [N $(0&_(B] [M $(0&"(B]
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
698
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
699 \\\\<quail-translation-docstring>\"\n"
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
700 fulltitle fulltitle))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
701 (insert (format "\"$(GDcEFrSD+!J(B%s$(G!K(BCNS
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
702
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
703 $(GiGk#(B%s$(GrSD+uomu(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
704
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
705 [Q $(GEC(B] [W $(GFp(B] [E $(GEU(B] [R $(GDG(B] [T $(GE=(B] [Y $(GD3(B] [U $(GDT(B] [I $(GEA(B] [O $(GD)(B] [P $(GE@(B]
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
706
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
707 [A $(GEJ(B] [S $(GDS(B] [D $(GEM(B] [F $(GEV(B] [G $(GDH(B] [H $(GHL(B] [J $(GD2(B] [L $(GDc(B]
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
708
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
709 [Z ] [X $(GyE(B] [C $(GOZ(B] [V $(GDL(B] [B $(GEL(B] [N $(GD^(B] [M $(GD!(B]
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
710
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
711 \\\\<quail-translation-docstring>\"\n"
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
712 fulltitle fulltitle)))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
713 (insert " '((\".\" . quail-next-translation-block)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
714 (\",\" . quail-prev-translation-block))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
715 nil nil)\n\n")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
716 (insert "(quail-define-rules\n")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
717 (save-excursion
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
718 (set-buffer dicbuf)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
719 (goto-char (point-min))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
720 (search-forward "A440")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
721 (beginning-of-line)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
722 (let ((table (make-hash-table :test 'equal))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
723 val)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
724 (while (not (eobp))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
725 (forward-char 5)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
726 (let ((trans (char-to-string (following-char)))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
727 key slot)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
728 (re-search-forward "[A-Z]+$" nil t)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
729 (setq key (downcase
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
730 (if (or tsang-p
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
731 (<= (- (match-end 0) (match-beginning 0)) 1))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
732 (match-string 0)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
733 (string (char-after (match-beginning 0))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
734 (char-after (1- (match-end 0)))))))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
735 (setq val (gethash key table))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
736 (if val (setq trans (concat val trans)))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
737 (puthash key trans table)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
738 (forward-line 1)))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
739 (maphash #'(lambda (key val) (setq dic (cons (cons key val) dic)))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
740 table)))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
741 (setq dic (sort dic (function (lambda (x y) (string< (car x ) (car y))))))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
742 (dolist (elt dic)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
743 (insert (format "(%S\t%S)\n" (car elt) (cdr elt))))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
744 (let ((punctuations '((";" "$(0!'!2!"!#!.!/(B" "$(G!'!2!"!#!.!/(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
745 (":" "$(0!(!+!3!%!$!&!0!1(B" "$(G!(!+!3!%!$!&!0!1(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
746 ("'" "$(0!e!d(B" "$(G!e!d(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
747 ("\"" "$(0!g!f!h!i!q(B" "$(G!g!f!h!i!q(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
748 ("\\" "$(0"`"b#M(B" "$(G"`"b#M(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
749 ("|" "$(0!6!8!:"^(B" "$(G!6!8!:"^(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
750 ("/" "$(0"_"a#L(B" "$(G"_"a#L(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
751 ("?" "$(0!)!4(B" "$(G!)!4(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
752 ("<" "$(0!R"6"A!T"H(B" "$(G!R"6"A!T"H(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
753 (">" "$(0!S"7"B!U(B" "$(G!S"7"B!U(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
754 ("[" "$(0!F!J!b!H!L!V!Z!X!\(B" "$(G!F!J!b!H!L!V!Z!X!\(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
755 ("]" "$(0!G!K!c!I!M!W![!Y!](B" "$(G!G!K!c!I!M!W![!Y!](B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
756 ("{" "$(0!B!`!D(B " "$(G!B!`!D(B ")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
757 ("}" "$(0!C!a!E(B" "$(G!C!a!E(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
758 ("`" "$(0!j!k(B" "$(G!j!k(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
759 ("~" "$(0"D"+",!<!=(B" "$(G"D"+",!<!=(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
760 ("!" "$(0!*!5(B" "$(G!*!5(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
761 ("@" "$(0"i"n(B" "$(G"i"n(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
762 ("#" "$(0!l"-(B" "$(G!l"-(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
763 ("$" "$(0"c"l(B" "$(G"c"l(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
764 ("%" "$(0"h"m(B" "$(G"h"m(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
765 ("&" "$(0!m".(B" "$(G!m".(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
766 ("*" "$(0!n"/!o!w!x(B" "$(G!n"/!o!w!x(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
767 ("(" "$(0!>!^!@(B" "$(G!>!^!@(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
768 (")" "$(0!?!_!A(B" "$(G!?!_!A(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
769 ("-" "$(0!7!9"#"$"1"@(B" "$(G!7!9"#"$"1"@(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
770 ("_" "$(0"%"&(B" "$(G"%"&(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
771 ("=" "$(0"8"C(B" "$(G"8"C(B")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
772 ("+" "$(0"0"?(B" "$(G"0"?(B"))))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
773 (dolist (elt punctuations)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
774 (insert (format "(%S %S)\n" (concat "z" (car elt))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
775 (if big5-p (nth 1 elt) (nth 2 elt))))))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
776 (insert ")\n")))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
777
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
778 (defun tsang-b5-converter (dicbuf name title)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
779 (tsang-quick-converter dicbuf name title t t))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
780
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
781 (defun quick-b5-converter (dicbuf name title)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
782 (tsang-quick-converter dicbuf name title nil t))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
783
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
784 (defun tsang-cns-converter (dicbuf name title)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
785 (tsang-quick-converter dicbuf name title t nil))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
786
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
787 (defun quick-cns-converter (dicbuf name title)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
788 (tsang-quick-converter dicbuf name title nil nil))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
789
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
790 ;; Generate a code of a Quail package in the current buffer from
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
791 ;; Pinyin dictionary in the buffer DICBUF. The input method name of
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
792 ;; the Quail package is NAME, and the title string is TITLE.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
793
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
794 (defun py-converter (dicbuf name title)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
795 (goto-char (point-max))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
796 (insert (format "%S\n" "$A::WVJdHk!KF4Rt!K(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
797
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
798 $AF4Rt7=08(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
799
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
800 $AP!P4S"NDWVD84z1m!8F4Rt!97{:E#,(B \"u(yu) $ATrSC(B u: $A1mJ>!C(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
801
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
802 Pinyin base input method for Chinese charset GB2312 (`chinese-gb2312').
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
803
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
804 Pinyin is the standared roman transliteration method for Chinese.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
805 Pinyin uses a sequence of Latin alphabetic characters for each Chinese
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
806 character. The sequence is made by the combination of the initials
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
807 \(the beginning sounds) and finals (the ending sounds).
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
808
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
809 initials: b p m f d t n l z c s zh ch sh r j q x g k h
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
810 finals: a o e i er ai ei oa ou an en ang eng ong i ia iao ie iu ian in
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
811 iang ing iong u ua uo uai ui uan un uan ueng yu yue yuan yun
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
812
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
813 (Note: In the correct Pinyin writing, the sequence \"yu\" in the last
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
814 four finals should be written by the character u-umlaut `$A(9(B'.)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
815
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
816 With this input method, you enter a Chinese character by first
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
817 entering its pinyin spelling.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
818
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
819 \\<quail-translation-docstring>
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
820
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
821 For instance, to input $ADc(B, you type \"n i C-n 3\". The first \"n i\"
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
822 is a Pinyin, \"C-n\" selects the next group of candidates (each group
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
823 contains at most 10 characters), \"3\" select the third character in
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
824 that group.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
825
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
826 This input method supports only Han characters. The related input
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
827 method `chinese-py-punct' is the combination of this method and
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
828 `chinese-punct'; it supports both Han characters and punctuation
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
829 characters.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
830
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
831 For double-width GB2312 characters corresponding to ASCII, use the
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
832 input method `chinese-qj'.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
833
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
834 The correct Pinyin system specifies tones by diacritical marks, but
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
835 this input method doesn't use them, which results in easy (you don't
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
836 have to know the exact tones), but verbose (many characters are assigned
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
837 to the same key sequence) input. You may also want to try the input
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
838 method `chinese-tonepy' with which you must specify tones by digits
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
839 \(1..5)."))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
840 (insert " '((\"\C-?\" . quail-delete-last-char)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
841 (\".\" . quail-next-translation)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
842 (\">\" . quail-next-translation)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
843 (\",\" . quail-prev-translation)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
844 (\"<\" . quail-prev-translation))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
845 nil nil nil nil)\n\n")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
846 (insert "(quail-define-rules\n")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
847 (let ((pos (point)))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
848 (insert-buffer-substring dicbuf)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
849 (goto-char pos)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
850 (while (not (eobp))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
851 (insert "(\"")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
852 (skip-chars-forward "a-z")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
853 (insert "\" \"")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
854 (delete-char 1)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
855 (end-of-line)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
856 (insert "\")")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
857 (forward-line 1)))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
858 (insert ")\n"))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
859
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
860 ;; Generate a code of a Quail package in the current buffer from
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
861 ;; Ziranma dictionary in the buffer DICBUF. The input method name of
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
862 ;; the Quail package is NAME, and the title string is TITLE.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
863
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
864 (defun ziranma-converter (dicbuf name title)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
865 (let (dic)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
866 (save-excursion
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
867 (set-buffer dicbuf)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
868 (goto-char (point-min))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
869 (search-forward "%keyname end\n")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
870 (let ((table (make-hash-table :test 'equal))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
871 elt pos key trans val)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
872 (while (not (eobp))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
873 (setq pos (point))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
874 (skip-chars-forward "^ \t")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
875 (setq key (buffer-substring pos (point)))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
876 (skip-chars-forward " \t")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
877 (setq trans (vector (buffer-substring (point) (line-end-position))))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
878 (setq val (gethash key table))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
879 (if val (setq trans (vconcat val trans)))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
880 (puthash key trans table)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
881 (forward-line 1))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
882 (maphash #'(lambda (key trans)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
883 (let ((len (length trans))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
884 i)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
885 (if (and (= len 1) (= (length (aref trans 0)) 1))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
886 (setq trans (aref trans 0))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
887 (setq i 0)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
888 (while (and (< i len)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
889 (= (length (aref trans i)) 1))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
890 (setq i (1+ i)))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
891 (if (= i len)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
892 (setq trans (mapconcat 'identity trans "")))))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
893 (setq dic (cons (cons key trans) dic)))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
894 table)))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
895 (setq dic (sort dic (function (lambda (x y) (string< (car x) (car y))))))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
896 (goto-char (point-max))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
897 (insert (format "%S\n" "$A::WVJdHk!K!>WTH;!?!K(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
898
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
899 $A<|EL6TUU1m(B:
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
900 $A)3)%)%)W)%)%)W)%)%)W)%)%)W)%)%)W)%)%)W)%)%)W)%)%)W)%)%)W)%)%)7(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
901 $A)'#Q(B $A)'#W(B $A)'#E(B $A)'#R(B $A)'#T(B $A)'#Y(B $A)'#U(Bsh$A)'#I(Bch$A)'#O(B $A)'#P(B $A)'(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
902 $A)'(B iu$A)'(B ua$A)'(B e$A)'(B uan$A)'(B ue$A)'(B uai$A)'(B u$A)'(B i$A)'(B o$A)'(B un$A)'(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
903 $A)'(B $A)'(B ia$A)'(B $A)'(B van$A)'(B ve$A)'(B ing$A)'(B $A)'(B $A)'(B uo$A)'(B vn$A)'(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
904 $A);)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)?(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
905 $A)'#A(B $A)'#S(B $A)'#D(B $A)'#F(B $A)'#G(B $A)'#H(B $A)'#J(B $A)'#K(B $A)'#L(B $A)'(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
906 $A)'(B a$A)'(Biong$A)'(Buang$A)'(B en$A)'(B eng$A)'(B ang$A)'(B an$A)'(B ao$A)'(B ai$A)'(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
907 $A)'(B $A)'(B ong$A)'(Biang$A)'(B $A)'(B ng$A)'(B $A)'(B $A)'(B $A)'(B $A)'(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
908 $A);)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)%)7(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
909 $A)'#Z(B $A)'#X(B $A)'#C(B $A)'#V(Bzh$A)'#B(B $A)'#N(B $A)'#M(B $A)'#,(B $A)'#.(B $A)'(B $A#/(B $A)'(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
910 $A)'(B ei$A)'(B ie$A)'(B iao$A)'(B ui$A)'(B ou$A)'(B in$A)'(B ian$A)'G0R3)':sR3)'7{:E)'(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
911 $A)'(B $A)'(B $A)'(B $A)'(B v$A)'(B $A)'(B $A)'(B $A)'(B $A)'(B $A)'(B $A)'(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
912 $A);)%)%)_)%)%)_)%)%)_)%)%)_)%)%)_)%)%)_)%)%)_)%)%)_)%)%)_)%)%)?(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
913
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
914
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
915 Pinyin base input method for Chinese GB2312 characters (`chinese-gb2312').
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
916
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
917 Pinyin is the standard roman transliteration method for Chinese.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
918 For the details of Pinyin system, see the documentation of the input
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
919 method `chinese-py'.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
920
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
921 Unlike the standard spelling of Pinyin, in this input method all
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
922 initials and finals are assigned to single keys (see the above table).
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
923 For instance, the initial \"ch\" is assigned to the key `i', the final
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
924 \"iu\" is assigned to the key `q', and tones 1, 2, 3, 4, and $AGaIy(B are
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
925 assigned to the keys `q', `w', `e', `r', `t' respectively.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
926
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
927 \\<quail-translation-docstring>
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
928
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
929 To input one-letter words, you type 4 keys, the first two for the
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
930 Pinyin of the letter, next one for tone, and the last one is always a
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
931 quote ('). For instance, \"vsq'\" input $AVP(B. Exceptions are these
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
932 letters. You can input them just by typing a single key.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
933
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
934 Character: $A04(B $A2;(B $A4N(B $A5D(B $A6~(B $A7"(B $A8v(B $A:M(B $A3v(B $A<0(B $A?I(B $AAK(B $AC;(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
935 Key: a b c d e f g h i j k l m
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
936 Character: $ADc(B $AE7(B $AF,(B $AF_(B $AHK(B $AH}(B $AK{(B $AJG(B $AWE(B $ANR(B $AP!(B $AR;(B $ATZ(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
937 Key: n o p q r s t u v w x y z
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
938
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
939 To input two-letter words, you have two ways. One way is to type 4
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
940 keys, two for the first Pinyin, two for the second Pinyin. For
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
941 instance, \"vsgo\" inputs $AVP9z(B. Another way is to type 3 keys: 2
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
942 initials of two letters, and quote ('). For instance, \"vg'\" also
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
943 inputs $AVP9z(B.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
944
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
945 To input three-letter words, you type 4 keys: initials of three
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
946 letters, and the last is quote ('). For instance, \"bjy'2\" inputs $A11(B
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
947 $A>)Q<(B (the last `2' is to select one of the candidates).
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
948
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
949 To input words of more than three letters, you type 4 keys, initials
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
950 of the first three letters and the last letter. For instance,
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
951 \"bjdt\" inputs $A11>)5gJSL((B.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
952
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
953 To input symbols and punctuations, type `/' followed by one of `a' to
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
954 `z', then select one of the candidates."))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
955 (insert " '((\"\C-?\" . quail-delete-last-char)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
956 (\".\" . quail-next-translation)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
957 (\"[\" . quail-next-translation)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
958 (\",\" . quail-prev-translation)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
959 (\"]\" . quail-prev-translation))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
960 nil nil nil nil)\n\n")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
961 (insert "(quail-define-rules\n")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
962 (dolist (elt dic)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
963 (insert (format "(%S %S)\n" (car elt) (cdr elt))))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
964 (insert ")\n")))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
965
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
966 (defun miscdic-convert (filename &optional dirname)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
967 "Convert a dictionary file FILENAME into a Quail package.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
968 Optional argument DIRNAME if specified is the directory name under which
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
969 the generated Quail package is saved."
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
970 (interactive "FInput method dictionary file: ")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
971 (or (file-readable-p filename)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
972 (error "%s does not exist" filename))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
973 (let ((tail quail-misc-package-ext-info)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
974 (default-buffer-file-coding-system 'iso-2022-7bit)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
975 slot
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
976 name title dicfile coding quailfile converter copyright
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
977 dicbuf)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
978 (while tail
37258
d74967dafcb7 (miscdic-convert): For MS-DOS, if
Eli Zaretskii <eliz@gnu.org>
parents: 37146
diff changeset
979 (when (or (string-match (nth 2 (car tail)) filename)
d74967dafcb7 (miscdic-convert): For MS-DOS, if
Eli Zaretskii <eliz@gnu.org>
parents: 37146
diff changeset
980 ;; MS-DOS filesystem truncates file names to 8+3
d74967dafcb7 (miscdic-convert): For MS-DOS, if
Eli Zaretskii <eliz@gnu.org>
parents: 37146
diff changeset
981 ;; limits, so "cangjie-table.cns" becomes
d74967dafcb7 (miscdic-convert): For MS-DOS, if
Eli Zaretskii <eliz@gnu.org>
parents: 37146
diff changeset
982 ;; "cangjie-.cns", and the above string-match fails.
d74967dafcb7 (miscdic-convert): For MS-DOS, if
Eli Zaretskii <eliz@gnu.org>
parents: 37146
diff changeset
983 ;; Give DOS users a chance...
d74967dafcb7 (miscdic-convert): For MS-DOS, if
Eli Zaretskii <eliz@gnu.org>
parents: 37146
diff changeset
984 (and (fboundp 'msdos-long-file-names)
d74967dafcb7 (miscdic-convert): For MS-DOS, if
Eli Zaretskii <eliz@gnu.org>
parents: 37146
diff changeset
985 (not (msdos-long-file-names))
37262
3e478bb3f389 (dos-8+3-filename): Rename from dos-truncate-to-8+3.
Eli Zaretskii <eliz@gnu.org>
parents: 37261
diff changeset
986 (string-match (dos-8+3-filename (nth 2 (car tail)))
37258
d74967dafcb7 (miscdic-convert): For MS-DOS, if
Eli Zaretskii <eliz@gnu.org>
parents: 37146
diff changeset
987 filename)))
37116
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
988 (setq slot (car tail)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
989 name (car slot)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
990 title (nth 1 slot)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
991 dicfile (nth 2 slot)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
992 coding (nth 3 slot)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
993 quailfile (nth 4 slot)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
994 converter (nth 5 slot)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
995 copyright (nth 6 slot))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
996 (message "Converting %s to %s..." dicfile quailfile)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
997 (with-temp-file (expand-file-name quailfile dirname)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
998 (set-buffer-file-coding-system 'iso-2022-7bit)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
999 (insert ";; Quail package `" name "' -*- coding:iso-2022-7bit; -*-\n")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1000 (insert ";; Generated by the command `miscdic-convert'\n")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1001 (insert ";; Date: " (current-time-string) "\n")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1002 (insert ";; Source dictionary file: " dicfile "\n")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1003 (insert ";; Copyright notice of the source file\n")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1004 (insert ";;------------------------------------------------------\n")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1005 (insert copyright "\n")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1006 (insert ";;------------------------------------------------------\n")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1007 (insert "\n")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1008 (insert ";;; Code:\n\n")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1009 (insert "(require 'quail)\n")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1010 (insert "(quail-define-package \"" name "\" \""
37146
f7906041b879 (miscdic-convert): Fix a typo in the last change.
Eli Zaretskii <eliz@gnu.org>
parents: 37116
diff changeset
1011 (if (eq coding 'big5) "Chinese-BIG5" "Chinese-CNS")
37116
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1012 "\" \"" title "\" t\n")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1013 (let* ((coding-system-for-read coding)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1014 (dicbuf (find-file-noselect filename)))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1015 (funcall converter dicbuf name title)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1016 (kill-buffer dicbuf)))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1017 (message "Converting %s to %s...done" dicfile quailfile))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1018 (setq tail (cdr tail)))))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1019
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1020 (defun batch-miscdic-convert ()
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1021 "Run `miscdic-convert' on the files remaing on the command line.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1022 Use this from the command line, with `-batch';
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1023 it won't work in an interactive Emacs.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1024 If there's an argument \"-dir\", the next argument specifies a directory
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1025 to store generated Quail packages."
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1026 (defvar command-line-args-left) ; Avoid compiler warning.
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1027 (if (not noninteractive)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1028 (error "`batch-miscdic-convert' should be used only with -batch"))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1029 (let ((dir default-directory)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1030 filename)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1031 (while command-line-args-left
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1032 (if (string= (car command-line-args-left) "-dir")
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1033 (progn
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1034 (setq command-line-args-left (cdr command-line-args-left))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1035 (setq dir (car command-line-args-left))))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1036 (setq filename (car command-line-args-left)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1037 command-line-args-left (cdr command-line-args-left))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1038 (if (file-directory-p filename)
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1039 (dolist (file (directory-files filename t nil t))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1040 (miscdic-convert file dir))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1041 (miscdic-convert filename dir))))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1042 (kill-emacs 0))
dafc644df705 (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 36995
diff changeset
1043
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1044 ;;; titdic-cnv.el ends here
36684
61687d474d90 Add coding: tag in Local Variables: section.
Kenichi Handa <handa@m17n.org>
parents: 32277
diff changeset
1045
61687d474d90 Add coding: tag in Local Variables: section.
Kenichi Handa <handa@m17n.org>
parents: 32277
diff changeset
1046 ;; Local Variables:
61687d474d90 Add coding: tag in Local Variables: section.
Kenichi Handa <handa@m17n.org>
parents: 32277
diff changeset
1047 ;; coding: iso-2022-7bit
61687d474d90 Add coding: tag in Local Variables: section.
Kenichi Handa <handa@m17n.org>
parents: 32277
diff changeset
1048 ;; End: