annotate lisp/international/titdic-cnv.el @ 34585:1e66e14d9695

(read-face-attribute): If there's no entry for the user's input in VALID, just use it as-is (this will often result in an error, but it may be OK for e.g. colors using hexadecimal notation, and at least will yield a better error message).
author Miles Bader <miles@gnu.org>
date Fri, 15 Dec 2000 03:10:44 +0000
parents d589b182b25a
children 61687d474d90
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.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
54
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
55 ;;; Code:
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
56
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
57 (require 'quail)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
58
18555
39589a3b1b20 Add license note.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
59 ;; List of values of key "ENCODE:" and the corresponding Emacs
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
60 ;; coding-system and language environment name.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
61 (defvar tit-encode-list
17098
8917133b7e82 Remove prefix "coding-system-" from coding system symbol names.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
62 '(("GB" euc-china "Chinese-GB")
8917133b7e82 Remove prefix "coding-system-" from coding system symbol names.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
63 ("BIG5" cn-big5 "Chinese-BIG5")
8917133b7e82 Remove prefix "coding-system-" from coding system symbol names.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
64 ("JIS" euc-japan "Japanese")
18555
39589a3b1b20 Add license note.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
65 ("KS" euc-kr "Korean")))
39589a3b1b20 Add license note.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
66
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
67 ;; 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
68 ;; 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
69 ;; 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
70 ;; 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
71 ;; information.
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
72 ;; 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
73 ;; 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
74 ;; 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
75 ;; \<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
76 ;; 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
77
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
78 (defvar quail-cxterm-package-ext-info
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
79 '(("chinese-4corner" "$(0(?-F(B")
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
80 ("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
81 ("chinese-ccdospy" "$AKuF4(B"
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
82 "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
83
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
84 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
85 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
86 method `chinese-py'.
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
87
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
88 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
89 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
90 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
91 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
92 For expample:
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
93 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
94 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
95 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
96
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
97 \\<quail-translation-docstring>
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
98
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
99 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
100 input method `chinese-qj'.")
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
101
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
102 ("chinese-ctlau" "$AAuTA(B")
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
103
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
104 ("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
105
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
106 ("chinese-ecdict" "$(05CKH(B"
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
107 "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
108 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
109 \"computer\", \"$(0IZH+(B\" is input.
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
110
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
111 \\<quail-translation-docstring>")
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
112
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
113 ("chinese-etzy" "$(06/0D(B"
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
114 "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
115 `chinese-big5-2').
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
116
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
117 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
118 compose one Chinese character.
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 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
121 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
122 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
123 4:$(0(+Vy(B).
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
124
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
125 \\<quail-translation-docstring>")
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
126
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
127 ("chinese-punct-b5" "$(0O:(BB"
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
128 "Input method for Chinese punctuations and symbols of Big5
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
129 \(`chinese-big5-1' and `chinese-big5-2').")
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
130
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
131 ("chinese-punct" "$A1j(BG"
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
132 "Input method for Chinese punctuations and symbols of GB2312
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
133 \(`chinese-gb2312').")
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
134
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
135 ("chinese-py-b5" "$(03<(BB"
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
136 "Pinyin base input method for Chinese Big5 characters
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
137 \(`chinese-big5-1', `chinese-big5-2').
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
138
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
139 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
140 see).
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 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
143 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
144 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
145 and punctuation/symbols.
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
146
31481
e9e907d10d80 (quail-cxterm-package-ext-info): Fix doc strings of chinese-py-b5,
Eli Zaretskii <eliz@gnu.org>
parents: 31425
diff changeset
147 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
148 method `chinese-qj-b5'.
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
149
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
150 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
151 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
152
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
153 ("chinese-py" "$AF4(BG"
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
154 "Pinyin base input method for Chinese charset GB2312
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
155 \(`chinese-gb2312').
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
156
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
157 Pinyin is the standared roman transliteration method for Chinese.
31481
e9e907d10d80 (quail-cxterm-package-ext-info): Fix doc strings of chinese-py-b5,
Eli Zaretskii <eliz@gnu.org>
parents: 31425
diff changeset
158 Pinyin uses a sequence of Latin alphabetic characters for each Chinese
e9e907d10d80 (quail-cxterm-package-ext-info): Fix doc strings of chinese-py-b5,
Eli Zaretskii <eliz@gnu.org>
parents: 31425
diff changeset
159 character. The sequence is made by the combination of the initials
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
160 \(the beginning sounds) and finals \(the ending sounds).
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
161
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
162 initials: b p m f d t n l z c s zh ch sh r j q x g k h
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
163 finals: a o e i er ai ei oa ou an en ang eng ong i ia iao ie iu ian in
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
164 iang ing iong u ua uo uai ui uan un uan ueng yu yue yuan yun
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
165
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
166 (Note: In the correct Pinyin writing, the sequence \"yu\" in the last
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
167 four finals should be written by the character u-umlaut `$A(9(B'.)
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
168
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
169 With this input method, you enter a Chinese character by first
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
170 entering its pinyin spelling.
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
171
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
172 \\<quail-translation-docstring>
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
173
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
174 For instance, to input $ADc(B, you type \"n i C-n 3\". The first \"n i\"
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
175 is a Pinyin, \"C-n\" selects the next group of candidates (each group
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
176 contains at most 10 characters), \"3\" select the third character in
31481
e9e907d10d80 (quail-cxterm-package-ext-info): Fix doc strings of chinese-py-b5,
Eli Zaretskii <eliz@gnu.org>
parents: 31425
diff changeset
177 that group.
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
178
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
179 This input method supports only Han characters. The related input
32277
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
180 method `chinese-py-punct' is the combination of this method and
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
181 `chinese-punct'; it supports both Han characters and punctuation
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
182 characters.
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
183
31481
e9e907d10d80 (quail-cxterm-package-ext-info): Fix doc strings of chinese-py-b5,
Eli Zaretskii <eliz@gnu.org>
parents: 31425
diff changeset
184 For double-width GB2312 characters corresponding to ASCII, use the
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
185 input method `chinese-qj'.
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
186
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
187 The correct Pinyin system specifies tones by diacritical marks, but
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
188 this input method doesn't use them, which results in easy (you don't
31481
e9e907d10d80 (quail-cxterm-package-ext-info): Fix doc strings of chinese-py-b5,
Eli Zaretskii <eliz@gnu.org>
parents: 31425
diff changeset
189 have to know the exact tones), but verbose (many characters are assigned
e9e907d10d80 (quail-cxterm-package-ext-info): Fix doc strings of chinese-py-b5,
Eli Zaretskii <eliz@gnu.org>
parents: 31425
diff changeset
190 to the same key sequence) input. You may also want to try the input
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
191 method `chinese-tonepy' with which you must specify tones by digits
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
192 \(1..5).")
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
193
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
194 ("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
195
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
196 ("chinese-qj" "$AH+(BG")
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
197
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
198 ("chinese-sw" "$AJWN2(B"
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
199 "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
200
32277
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
201 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
202 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
203 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
204 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
205
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
206 first radical:
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
207 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
208 $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
209 last radical:
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
210 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
211 $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
212
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
213 \<quail-translation-docstring>")
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
214
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
215 ("chinese-tonepy" "$A5wF4(B"
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
216 "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
217
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
218 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
219 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
220 method `chinese-py'.
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
221
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
222 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
223 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
224 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
225
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
226 \<quail-translation-docstring>
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
227
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
228 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
229 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
230 the third character from the candidate list.
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
231
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
232 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
233 input method `chinese-qj'.")
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
234
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
235 ("chinese-ziranma" "$AK+F4(B"
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
236 "Pinyin base input method for Chinese GB2312 characters (`chinese-gb2312').
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
237
32277
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
238 Pinyin is the standard roman transliteration method for Chinese.
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
239 For the details of Pinyin system, see the documentation of the input
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
240 method `chinese-py'.
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
241
32277
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
242 unlike the standard spelling of Pinyin, in this input method all
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
243 initials and finals are assigned to single keys (see the above table).
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
244 For instance, the initial \"ch\" is assigned to the key `i', the final
32277
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
245 \"iu\" is assigned to the key `q', and tones 1, 2, 3, 4, and $AGaIy(B are
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
246 assigned to the keys `q', `w', `e', `r', `t' respectively.
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
247
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
248 \<quail-translation-docstring>
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
249
32277
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
250 To input one-letter words, you type 4 keys, the first two for the
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
251 Pinyin of the letter, next one for tone, and the last one is always a
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
252 quote ('). For instance, \"vsq'1\" input $AVP(B. Exceptions are these
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
253 letters. You can input them just by typing a single key.
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
254
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
255 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
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
256 Key: a b c d e f g h i j k l m
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
257 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
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
258 Key: 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
259
32277
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
260 To input two-letter words, you have two ways. One way is to type 4
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
261 keys, two for the first Pinyin, two for the second Pinyin. For
32277
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
262 instance, \"vsgo\" inputs $AVP9z(B. Another way is to type 3 keys: 2
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
263 initials of two letters, and quote ('). For instance, \"vg'\" also
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
264 inputs $AVP9z(B.
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
265
32277
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
266 To input three-letter words, you type 4 keys: initials of three
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
267 letters, and the last is quote ('). For instance, \"bjy'2\" inputs $A11(B
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
268 $A>)Q<(B (the last `2' is to select one of the candidates).
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
269
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
270 To input words of more than three letters, you type 4 keys, initials
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
271 of the first three letters and the last letter. For instance,
32277
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
272 \"bjdt\" inputs $A11>)5gJSL((B.
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
273
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
274 To input symbols and punctuations, type `/' followed by one of `a' to
32277
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
275 `z', then select one of the candidates.
31548
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
276
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
277 ")
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
278
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
279 ("chinese-zozy" "$(0I\0D(B"
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
280 "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
281 `chinese-big5-2').
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
282
32277
d589b182b25a (quail-cxterm-package-ext-info): Fix typos in doc strings.
Eli Zaretskii <eliz@gnu.org>
parents: 31548
diff changeset
283 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
284 compose a Chinese character.
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
285
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
286 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
287 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
288 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
289 7:$(0M=Vy(B).
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
290
c8f1f4614a02 (quail-cxterm-package-ext-info): Add extra docstrings for
Kenichi Handa <handa@m17n.org>
parents: 31481
diff changeset
291 \<quail-translation-docstring>")))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
292
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
293 ;; Return a value of the key in the current line.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
294 (defsubst tit-read-key-value ()
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
295 (if (looking-at "[^ \t\n]+")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
296 (car (read-from-string (concat "\"" (match-string 0) "\"")))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
297
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
298 ;; Return an appropriate quail-package filename from FILENAME (TIT
18555
39589a3b1b20 Add license note.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
299 ;; dictionary filename). For instance, ".../ZOZY.tit" -> "ZOZY.el".
39589a3b1b20 Add license note.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
300 (defun tit-make-quail-package-file-name (filename &optional dirname)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
301 (expand-file-name
18555
39589a3b1b20 Add license note.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
302 (concat (file-name-nondirectory (substring filename 0 -4)) ".el")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
303 dirname))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
304
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
305 ;; 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
306 (defconst tit-dictionary t)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
307 (defvar tit-encode nil)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
308 (defvar tit-default-encode "GB")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
309
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
310 ;; Generate elements of KEY-BINDINGS arg for `quail-define-package' so
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
311 ;; that each characters in KEYS invokes FUNCTION-SYMBOL.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
312 (defun tit-generate-key-bindings (keys function-symbol)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
313 (let ((len (length keys))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
314 (i 0)
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
315 (first t)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
316 key)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
317 (while (< i len)
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
318 (or first (princ "\n "))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
319 (setq key (aref keys i))
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
320 (if (if (< key ?\ )
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
321 (eq (lookup-key quail-translation-keymap
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
322 (char-to-string key))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
323 'quail-execute-non-quail-command)
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
324 (<= key 127))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
325 (progn
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
326 (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
327 ((< key 127) (format "\"%c\"" key))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
328 (t "\"\\C-?\""))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
329 function-symbol))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
330 (setq first nil)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
331 (setq i (1+ i)))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
332
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
333 ;; Analyze header part of TIT dictionary and generate an appropriate
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
334 ;; `quail-define-package' function call.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
335 (defun tit-process-header (filename)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
336 (message "Processing header part...")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
337 (goto-char (point-min))
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 ;; 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
340 ;; collecting information from the original header.
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
341 (let ((package (concat
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
342 "chinese-"
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
343 (substring (downcase (file-name-nondirectory filename))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
344 0 -4)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
345 ;; TIT keywords and the corresponding default values.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
346 (tit-multichoice t)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
347 (tit-prompt "")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
348 (tit-comments nil)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
349 (tit-backspace "\010\177")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
350 (tit-deleteall "\015\025")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
351 (tit-moveright ".>")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
352 (tit-moveleft ",<")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
353 (tit-keyprompt nil))
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
354
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
355 (princ ";; Quail package `")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
356 (princ package)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
357 (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
358 (princ (current-time-string))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
359 (princ "\n;;\tOriginal TIT dictionary file: ")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
360 (princ (file-name-nondirectory filename))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
361 (princ "\n\n;;; Comment:\n\n")
21503
d08387c742bb (titdic-convert): Message improved.
Kenichi Handa <handa@m17n.org>
parents: 21081
diff changeset
362 (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
363 (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
364
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
365 (while (not (eobp))
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
366 (let ((ch (following-char))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
367 (pos (point)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
368 (cond ((= ch ?C) ; COMMENT
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
369 (cond ((looking-at "COMMENT")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
370 (let ((pos (match-end 0)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
371 (end-of-line)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
372 (setq tit-comments (cons (buffer-substring pos (point))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
373 tit-comments))))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
374 ((= ch ?M) ; MULTICHOICE, MOVERIGHT, MOVELEFT
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
375 (cond ((looking-at "MULTICHOICE:[ \t]*")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
376 (goto-char (match-end 0))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
377 (setq tit-multichoice (looking-at "YES")))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
378 ((looking-at "MOVERIGHT:[ \t]*")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
379 (goto-char (match-end 0))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
380 (setq tit-moveright (tit-read-key-value)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
381 ((looking-at "MOVELEFT:[ \t]*")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
382 (goto-char (match-end 0))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
383 (setq tit-moveleft (tit-read-key-value)))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
384 ((= ch ?P) ; PROMPT
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
385 (cond ((looking-at "PROMPT:[ \t]*")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
386 (goto-char (match-end 0))
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
387 (setq tit-prompt (tit-read-key-value))
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
388 ;; Some TIT dictionaies that are encoded by
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
389 ;; euc-china contains invalid character at the tail.
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
390 (let* ((last (aref tit-prompt (1- (length tit-prompt))))
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
391 (split (split-char last)))
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
392 (if (or (eq (nth 1 split) 32)
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
393 (eq (nth 2 split) 32))
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
394 (setq tit-prompt (substring tit-prompt 0 -1)))))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
395 ((= ch ?B) ; BACKSPACE, BEGINDICTIONARY,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
396 ; BEGINPHRASE
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
397 (cond ((looking-at "BACKSPACE:[ \t]*")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
398 (goto-char (match-end 0))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
399 (setq tit-backspace (tit-read-key-value)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
400 ((looking-at "BEGINDICTIONARY")
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
401 (setq tit-dictionary t))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
402 ((looking-at "BEGINPHRASE")
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
403 (setq tit-dictionary nil))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
404 ((= ch ?K) ; KEYPROMPT
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
405 (cond ((looking-at "KEYPROMPT(\\(.*\\)):[ \t]*")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
406 (let ((key-char (match-string 1)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
407 (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
408 (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
409 (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
410 (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
411 key-char)))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
412 (setq tit-keyprompt
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
413 (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
414 tit-keyprompt)))))))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
415 (end-of-line)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
416 (princ ";; ")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
417 (princ (buffer-substring pos (point)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
418 (princ "\n")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
419 (forward-line 1)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
420
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
421 (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
422 (princ ";;; Code:\n\n(require 'quail)\n\n")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
423
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
424 (princ "(quail-define-package ")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
425 ;; Args NAME, LANGUAGE, TITLE
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
426 (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
427 (princ "\"")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
428 (princ package)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
429 (princ "\" \"")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
430 (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
431 (princ "\" \"")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
432 (princ (or title
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
433 (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
434 (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
435 tit-prompt)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
436 (princ "\"\n"))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
437
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
438 ;; Arg GUIDANCE
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
439 (if tit-keyprompt
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
440 (progn
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
441 (princ " '(")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
442 (while tit-keyprompt
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
443 (princ " ")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
444 (princ (format "(%d . \"%s\")\n"
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
445 (string-to-char (car (car tit-keyprompt)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
446 (cdr (car tit-keyprompt))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
447 (setq tit-keyprompt (cdr tit-keyprompt)))
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
448 (princ ")"))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
449 (princ " t\n"))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
450
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
451 ;; Arg DOCSTRING
31425
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
452 (let ((doc (concat tit-prompt "\n"))
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
453 (comments (if tit-comments
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
454 (mapconcat 'identity (nreverse tit-comments) "\n")))
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
455 (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
456 (if comments
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
457 (setq doc (concat doc "\n" comments "\n")))
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
458 (if doc-ext
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
459 (setq doc (concat doc "\n" doc-ext "\n")))
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
460 (prin1 doc)
3ab020a4847b (quail-cxterm-package-ext-info):
Kenichi Handa <handa@m17n.org>
parents: 21503
diff changeset
461 (terpri))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
462
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
463 ;; Arg KEY-BINDINGS
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
464 (princ " '(")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
465 (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
466 (princ "\n ")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
467 (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
468 (princ "\n ")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
469 (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
470 (princ "\n ")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
471 (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
472 (princ ")\n")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
473
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
474 ;; Args FORGET-TRANSLATION, DETERMINISTIC, KBD-TRANSLATE, SHOW-LAYOUT.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
475 ;; The remaining args are all nil.
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
476 (princ " nil")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
477 (princ (if tit-multichoice " nil" " t"))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
478 (princ (if tit-keyprompt " t t)\n\n" " nil nil)\n\n"))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
479
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
480 (defsubst tit-flush-translations (key translations)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
481 (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
482 (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
483 (car (read-from-string
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
484 (concat "\"" (match-string 0 key) "\"")))))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
485 (idx (match-end 0)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
486 (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
487 (setq newkey (concat
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
488 newkey
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
489 (substring key idx (match-beginning 0))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
490 (car (read-from-string
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
491 (concat "\"" (match-string 0 key) "\"")))))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
492 (setq idx (match-end 0)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
493 (setq key (concat newkey (substring key idx)))))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
494 (prin1 (list key (if tit-dictionary translations
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
495 (vconcat (nreverse translations)))))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
496 (princ "\n"))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
497
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
498 ;; Convert body part of TIT dictionary into `quail-define-rules'
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
499 ;; function call.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
500 (defun tit-process-body ()
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
501 (message "Formatting translation rules...")
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
502 (let* ((template (list nil nil))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
503 (second (cdr template))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
504 (prev-key "")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
505 ch key translations pos)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
506 (princ "(quail-define-rules\n")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
507 (while (null (eobp))
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
508 (setq ch (following-char))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
509 (if (or (= ch ?#) (= ch ?\n))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
510 (forward-line 1)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
511 (setq pos (point))
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
512 (skip-chars-forward "^ \t\n")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
513 (setq key (buffer-substring pos (point)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
514 (skip-chars-forward " \t")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
515 (setq ch (following-char))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
516 (if (or (= ch ?#) (= ch ?\n))
18796
ab40b57484c1 (tit-process-body): Ignore vacant entries.
Kenichi Handa <handa@m17n.org>
parents: 18555
diff changeset
517 ;; 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
518 (forward-line 1)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
519 (or (string= key prev-key)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
520 (progn
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
521 (if translations
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
522 (tit-flush-translations prev-key translations))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
523 (setq translations nil
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
524 prev-key key)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
525 (if tit-dictionary
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
526 (progn
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
527 (setq pos (point))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
528 (skip-chars-forward "^ \t#\n")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
529 (setq translations
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
530 (if translations
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
531 (concat translations
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
532 (buffer-substring pos (point)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
533 (buffer-substring pos (point)))))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
534 (while (not (eolp))
18796
ab40b57484c1 (tit-process-body): Ignore vacant entries.
Kenichi Handa <handa@m17n.org>
parents: 18555
diff changeset
535 (setq pos (point))
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
536 (skip-chars-forward "^ \t\n")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
537 (setq translations (cons (buffer-substring pos (point))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
538 translations))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
539 (skip-chars-forward " \t")
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
540 (setq ch (following-char))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
541 (if (= ch ?#) (end-of-line))))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
542 (forward-line 1))))
18796
ab40b57484c1 (tit-process-body): Ignore vacant entries.
Kenichi Handa <handa@m17n.org>
parents: 18555
diff changeset
543
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
544 (if translations
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
545 (tit-flush-translations prev-key translations))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
546 (princ ")\n")))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
547
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
548 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
549 (defun titdic-convert (filename &optional dirname)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
550 "Convert a TIT dictionary of FILENAME into a Quail package.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
551 Optional argument DIRNAME if specified is the directory name under which
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
552 the generated Quail package is saved."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
553 (interactive "FTIT dictionary file: ")
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
554 (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
555 (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
556 (let ((standard-output (current-buffer)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
557 (with-temp-buffer
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
558 (let ((coding-system-for-read 'no-conversion))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
559 (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
560 (set-buffer-multibyte t)
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
561
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
562 ;; 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
563 ;; value of the key "ENCODE:".
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
564 (if (not (search-forward "\nBEGIN" nil t))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
565 (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
566 (let ((limit (point))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
567 coding-system slot)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
568 (goto-char (point-min))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
569 (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
570 (progn
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
571 (goto-char (match-end 0))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
572 (setq tit-encode (tit-read-key-value)))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
573 (setq tit-encode tit-default-encode))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
574 (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
575 (if (not slot)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
576 (error "Invalid ENCODE: value in TIT dictionary"))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
577 (setq coding-system (nth 1 slot))
21503
d08387c742bb (titdic-convert): Message improved.
Kenichi Handa <handa@m17n.org>
parents: 21081
diff changeset
578 (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
579 (goto-char (point-min))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
580 (decode-coding-region (point-min) (point-max) coding-system))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
581
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
582 ;; 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
583 (goto-char (point-min))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
584 (if (not (search-forward "\nBEGIN" nil t))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
585 (error "TIT dictionary can't be decoded correctly"))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
586
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
587 ;; Process the header part.
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
588 (forward-line 1)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
589 (narrow-to-region (point-min) (point))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
590 (tit-process-header filename)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
591 (widen)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
592
20840
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
593 ;; 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
594 (with-current-buffer standard-output
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
595 (set-buffer-multibyte nil))
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
596 (set-buffer-multibyte nil)
1842af0263da Many codes re-written to adjust for
Kenichi Handa <handa@m17n.org>
parents: 20795
diff changeset
597 (tit-process-body)))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
598
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
599 ;;;###autoload
18831
e6f6c2712a5f (batch-titdic-convert): Add optional arg FORCE.
Kenichi Handa <handa@m17n.org>
parents: 18796
diff changeset
600 (defun batch-titdic-convert (&optional force)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
601 "Run `titdic-convert' on the files remaining on the command line.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
602 Use this from the command line, with `-batch';
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
603 it won't work in an interactive Emacs.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
604 For example, invoke \"emacs -batch -f batch-titdic-convert XXX.tit\" to
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
605 generate Quail package file \"xxx.el\" from TIT dictionary file \"XXX.tit\".
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
606 To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
607 (defvar command-line-args-left) ; Avoid compiler warning.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
608 (if (not noninteractive)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
609 (error "`batch-titdic-convert' should be used only with -batch"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
610 (if (string= (car command-line-args-left) "-h")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
611 (progn
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
612 (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
613 (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
614 (message "To convert XXX.tit into DIR/xxx.el:")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
615 (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
616 (let (targetdir filename files file)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
617 (if (string= (car command-line-args-left) "-dir")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
618 (progn
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
619 (setq command-line-args-left (cdr command-line-args-left))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
620 (setq targetdir (car command-line-args-left))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
621 (setq command-line-args-left (cdr command-line-args-left))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
622 (while command-line-args-left
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
623 (setq filename (expand-file-name (car command-line-args-left)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
624 (if (file-directory-p filename)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
625 (progn
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
626 (message "Converting all tit files in the directory %s" filename)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
627 (setq files (directory-files filename t "\\.tit$")))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
628 (setq files (list filename)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
629 (while files
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
630 (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
631 (when (or force
e6f6c2712a5f (batch-titdic-convert): Add optional arg FORCE.
Kenichi Handa <handa@m17n.org>
parents: 18796
diff changeset
632 (file-newer-than-file-p
e6f6c2712a5f (batch-titdic-convert): Add optional arg FORCE.
Kenichi Handa <handa@m17n.org>
parents: 18796
diff changeset
633 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
634 (message "Converting %s to quail-package..." file)
e6f6c2712a5f (batch-titdic-convert): Add optional arg FORCE.
Kenichi Handa <handa@m17n.org>
parents: 18796
diff changeset
635 (titdic-convert file targetdir))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
636 (setq files (cdr files)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
637 (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
638 (message "Byte-compile the created files by:")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
639 (message " %% emacs -batch -f batch-byte-compile XXX.el")))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
640 (kill-emacs 0))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
641
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
642 ;;; titdic-cnv.el ends here