;;
;; See the manual page of `tit2cit' of cxterm distribution for more
;; detail.
+;;
+;; At the tail of this file, we also have another tools to convert
+;; miscellaneous dictionaries.
;;; Code:
The input method `chinese-py' and `chinese-tonepy' are also Pinyin
based, but for the character set GB2312 (`chinese-gb2312').")
- ("chinese-py" "\e$AF4\e(BG"
- "Pinyin base input method for Chinese charset GB2312
-\(`chinese-gb2312').
-
-Pinyin is the standared roman transliteration method for Chinese.
-Pinyin uses a sequence of Latin alphabetic characters for each Chinese
-character. The sequence is made by the combination of the initials
-\(the beginning sounds) and finals \(the ending sounds).
-
- initials: b p m f d t n l z c s zh ch sh r j q x g k h
- finals: a o e i er ai ei oa ou an en ang eng ong i ia iao ie iu ian in
- iang ing iong u ua uo uai ui uan un uan ueng yu yue yuan yun
-
- (Note: In the correct Pinyin writing, the sequence \"yu\" in the last
- four finals should be written by the character u-umlaut `\e$A(9\e(B'.)
-
-With this input method, you enter a Chinese character by first
-entering its pinyin spelling.
-
-\\<quail-translation-docstring>
-
-For instance, to input \e$ADc\e(B, you type \"n i C-n 3\". The first \"n i\"
-is a Pinyin, \"C-n\" selects the next group of candidates (each group
-contains at most 10 characters), \"3\" select the third character in
-that group.
-
-This input method supports only Han characters. The related input
-method `chinese-py-punct' is the combination of this method and
-`chinese-punct'; it supports both Han characters and punctuation
-characters.
-
-For double-width GB2312 characters corresponding to ASCII, use the
-input method `chinese-qj'.
-
-The correct Pinyin system specifies tones by diacritical marks, but
-this input method doesn't use them, which results in easy (you don't
-have to know the exact tones), but verbose (many characters are assigned
-to the same key sequence) input. You may also want to try the input
-method `chinese-tonepy' with which you must specify tones by digits
-\(1..5).")
-
("chinese-qj-b5" "\e$(0)A\e(BB")
("chinese-qj" "\e$AH+\e(BG")
For double-width GB2312 characters correponding to ASCII, use the
input method `chinese-qj'.")
- ("chinese-ziranma" "\e$AK+F4\e(B"
-"Pinyin base input method for Chinese GB2312 characters (`chinese-gb2312').
-
-Pinyin is the standard roman transliteration method for Chinese.
-For the details of Pinyin system, see the documentation of the input
-method `chinese-py'.
-
-unlike the standard spelling of Pinyin, in this input method all
-initials and finals are assigned to single keys (see the above table).
-For instance, the initial \"ch\" is assigned to the key `i', the final
-\"iu\" is assigned to the key `q', and tones 1, 2, 3, 4, and \e$AGaIy\e(B are
-assigned to the keys `q', `w', `e', `r', `t' respectively.
-
-\\<quail-translation-docstring>
-
-To input one-letter words, you type 4 keys, the first two for the
-Pinyin of the letter, next one for tone, and the last one is always a
-quote ('). For instance, \"vsq'1\" input \e$AVP\e(B. Exceptions are these
-letters. You can input them just by typing a single key.
-
- Character: \e$A04\e(B \e$A2;\e(B \e$A4N\e(B \e$A5D\e(B \e$A6~\e(B \e$A7"\e(B \e$A8v\e(B \e$A:M\e(B \e$A3v\e(B \e$A<0\e(B \e$A?I\e(B \e$AAK\e(B \e$AC;\e(B
- Key: a b c d e f g h i j k l m
- Character: \e$ADc\e(B \e$AE7\e(B \e$AF,\e(B \e$AF_\e(B \e$AHK\e(B \e$AH}\e(B \e$AK{\e(B \e$AJG\e(B \e$AWE\e(B \e$ANR\e(B \e$AP!\e(B \e$AR;\e(B \e$ATZ\e(B
- Key: n o p q r s t u v w x y z
-
-To input two-letter words, you have two ways. One way is to type 4
-keys, two for the first Pinyin, two for the second Pinyin. For
-instance, \"vsgo\" inputs \e$AVP9z\e(B. Another way is to type 3 keys: 2
-initials of two letters, and quote ('). For instance, \"vg'\" also
-inputs \e$AVP9z\e(B.
-
-To input three-letter words, you type 4 keys: initials of three
-letters, and the last is quote ('). For instance, \"bjy'2\" inputs \e$A11\e(B
-\e$A>)Q<\e(B (the last `2' is to select one of the candidates).
-
-To input words of more than three letters, you type 4 keys, initials
-of the first three letters and the last letter. For instance,
-\"bjdt\" inputs \e$A11>)5gJSL(\e(B.
-
-To input symbols and punctuations, type `/' followed by one of `a' to
-`z', then select one of the candidates.
-
-")
-
("chinese-zozy" "\e$(0I\0D\e(B"
"Zhuyin base input method for Chinese Big5 characters (`chinese-big5-1',
`chinese-big5-2').
(message " %% emacs -batch -f batch-byte-compile XXX.el")))
(kill-emacs 0))
+\f
+;;; Converter of miscellaneous dictionaries other than TIT format.
+
+;; Alist of input method names and the corresponding information.
+;; Each element has this form:
+;; (INPUT-METHOD-NAME ;; Name of the input method.
+;; INPUT-METHOD-TITLE ;; Title string of the input method
+;; DICFILE ;; Name of the source dictionary file.
+;; CODING ;; Coding system of the dictionary file.
+;; QUAILFILE ;; Name of the Quail package file.
+;; CONVERTER ;; Function to generate the Quail package.
+;; COPYRIGHT-NOTICE ;; Copyright notice of the source dictionary.
+;; )
+
+(defvar quail-misc-package-ext-info
+ '(("chinese-b5-tsangchi" "\e$(06A\e(BB"
+ "cangjie-table.b5" big5 "tsang-b5.el"
+ tsang-b5-converter
+ "\
+;; # Copyright 2001 Christian Wittern <wittern@iis.sinica.edu.tw>
+;; #
+;; # Permission to copy and distribute both modified and
+;; # unmodified versions is granted without royalty provided
+;; # this notice is preserved.")
+
+ ("chinese-b5-quick" "\e$(0X|\e(BB"
+ "cangjie-table.b5" big5 "quick-b5.el"
+ quick-b5-converter
+ "\
+;; # Copyright 2001 Christian Wittern <wittern@iis.sinica.edu.tw>
+;; #
+;; # Permission to copy and distribute both modified and
+;; # unmodified versions is granted without royalty provided
+;; # this notice is preserved.")
+
+ ("chinese-cns-tsangchi" "\e$(GT?\e(BC"
+ "cangjie-table.cns" iso-2022-cn-ext "tsang-cns.el"
+ tsang-cns-converter
+ "\
+;; # Copyright 2001 Christian Wittern <wittern@iis.sinica.edu.tw>
+;; #
+;; # Permission to copy and distribute both modified and
+;; # unmodified versions is granted without royalty provided
+;; # this notice is preserved.")
+
+ ("chinese-cns-quick" "\e$(Gv|\e(BC"
+ "cangjie-table.cns" iso-2022-cn-ext "quick-cns.el"
+ quick-cns-converter
+ "\
+;; # Copyright 2001 Christian Wittern <wittern@iis.sinica.edu.tw>
+;; #
+;; # Permission to copy and distribute both modified and
+;; # unmodified versions is granted without royalty provided
+;; # this notice is preserved.")
+
+ ("chinese-py" "\e$AF4\e(BG"
+ "pinyin.map" cn-gb-2312 "PY.el"
+ py-converter
+ "\
+;; \"pinyin.map\" is included in a free package called CCE. It is
+;; available at:
+;; http://ftp.debian.org/debian/dists/potato/main
+;; /source/utils/cce_0.36.orig.tar.gz
+;; This package contains the following copyright notice.
+;;
+;;
+;; Copyright (C) 1999, Rui He, herui@cs.duke.edu
+;;
+;;
+;; CCE(Console Chinese Environment) 0.32
+;;
+;; CCE is free software; you can redistribute it and/or modify it under the
+;; terms of the GNU General Public License as published by the Free Software
+;; Foundation; either version 1, or (at your option) any later version.
+;;
+;; CCE is distributed in the hope that it will be useful, but WITHOUT ANY
+;; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+;; details.
+;;
+;; You should have received a copy of the GNU General Public License along with
+;; CCE; see the file COPYING. If not, write to the Free Software Foundation,
+;; 675 Mass Ave, Cambridge, MA 02139, USA.")
+
+ ("chinese-ziranma" "\e$AWTH;\e(B"
+ "ziranma.cin" cn-gb-2312 "ZIRANMA.el"
+ ziranma-converter
+ "\
+;; \"ziranma.cin\" is included in a free package called CCE. It is
+;; available at:
+;; http://ftp.debian.org/debian/dists/potato/main
+;; /source/utils/cce_0.36.orig.tar.gz
+;; This package contains the following copyright notice.
+;;
+;;
+;; Copyright (C) 1999, Rui He, herui@cs.duke.edu
+;;
+;;
+;; CCE(Console Chinese Environment) 0.32
+;;
+;; CCE is free software; you can redistribute it and/or modify it under the
+;; terms of the GNU General Public License as published by the Free Software
+;; Foundation; either version 1, or (at your option) any later version.
+;;
+;; CCE is distributed in the hope that it will be useful, but WITHOUT ANY
+;; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+;; details.
+;;
+;; You should have received a copy of the GNU General Public License along with
+;; CCE; see the file COPYING. If not, write to the Free Software Foundation,
+;; 675 Mass Ave, Cambridge, MA 02139, USA.")
+ ))
+
+;; Generate a code of a Quail package in the current buffer from Tsang
+;; dictionary in the buffer DICBUF. The input method name of the
+;; Quail package is NAME, and the title string is TITLE.
+
+;; TSANG-P is non-nil, genereate \e$(06AQo\e(B input method. Otherwise
+;; generate \e$(0X|/y\e(B (simple version of \e$(06AQo\e(B). If BIG5-P is non-nil, the
+;; input method is for inputting Big5 characters. Otherwise the input
+;; method is for inputting CNS characters.
+
+(defun tsang-quick-converter (dicbuf name title tsang-p big5-p)
+ (let ((fulltitle (if tsang-p (if big5-p "\e$(06AQo\e(B" "\e$(GT?on\e(B")
+ (if big5-p "\e$(0X|/y\e(B" "\e$(Gv|Mx\e(B")))
+ dic)
+ (goto-char (point-max))
+ (if big5-p
+ (insert (format "\"\e$(0&d'GTT&,!J\e(B%s\e$(0!K\e(BBIG5
+
+ \e$(0KHM$\e(B%s\e$(0TT&,WoOu\e(B
+
+ [Q \e$(0'D\e(B] [W \e$(0(q\e(B] [E \e$(0'V\e(B] [R \e$(0&H\e(B] [T \e$(0'>\e(B] [Y \e$(0&4\e(B] [U \e$(0&U\e(B] [I \e$(0'B\e(B] [O \e$(0&*\e(B] [P \e$(0'A\e(B]
+
+ [A \e$(0'K\e(B] [S \e$(0&T\e(B] [D \e$(0'N\e(B] [F \e$(0'W\e(B] [G \e$(0&I\e(B] [H \e$(0*M\e(B] [J \e$(0&3\e(B] [L \e$(0&d\e(B]
+
+ [Z ] [X \e$(0[E\e(B] [C \e$(01[\e(B] [V \e$(0&M\e(B] [B \e$(0'M\e(B] [N \e$(0&_\e(B] [M \e$(0&"\e(B]
+
+\\\\<quail-translation-docstring>\"\n"
+ fulltitle fulltitle))
+ (insert (format "\"\e$(GDcEFrSD+!J\e(B%s\e$(G!K\e(BCNS
+
+ \e$(GiGk#\e(B%s\e$(GrSD+uomu\e(B
+
+ [Q \e$(GEC\e(B] [W \e$(GFp\e(B] [E \e$(GEU\e(B] [R \e$(GDG\e(B] [T \e$(GE=\e(B] [Y \e$(GD3\e(B] [U \e$(GDT\e(B] [I \e$(GEA\e(B] [O \e$(GD)\e(B] [P \e$(GE@\e(B]
+
+ [A \e$(GEJ\e(B] [S \e$(GDS\e(B] [D \e$(GEM\e(B] [F \e$(GEV\e(B] [G \e$(GDH\e(B] [H \e$(GHL\e(B] [J \e$(GD2\e(B] [L \e$(GDc\e(B]
+
+ [Z ] [X \e$(GyE\e(B] [C \e$(GOZ\e(B] [V \e$(GDL\e(B] [B \e$(GEL\e(B] [N \e$(GD^\e(B] [M \e$(GD!\e(B]
+
+\\\\<quail-translation-docstring>\"\n"
+ fulltitle fulltitle)))
+ (insert " '((\".\" . quail-next-translation-block)
+ (\",\" . quail-prev-translation-block))
+ nil nil)\n\n")
+ (insert "(quail-define-rules\n")
+ (save-excursion
+ (set-buffer dicbuf)
+ (goto-char (point-min))
+ (search-forward "A440")
+ (beginning-of-line)
+ (let ((table (make-hash-table :test 'equal))
+ val)
+ (while (not (eobp))
+ (forward-char 5)
+ (let ((trans (char-to-string (following-char)))
+ key slot)
+ (re-search-forward "[A-Z]+$" nil t)
+ (setq key (downcase
+ (if (or tsang-p
+ (<= (- (match-end 0) (match-beginning 0)) 1))
+ (match-string 0)
+ (string (char-after (match-beginning 0))
+ (char-after (1- (match-end 0)))))))
+ (setq val (gethash key table))
+ (if val (setq trans (concat val trans)))
+ (puthash key trans table)
+ (forward-line 1)))
+ (maphash #'(lambda (key val) (setq dic (cons (cons key val) dic)))
+ table)))
+ (setq dic (sort dic (function (lambda (x y) (string< (car x ) (car y))))))
+ (dolist (elt dic)
+ (insert (format "(%S\t%S)\n" (car elt) (cdr elt))))
+ (let ((punctuations '((";" "\e$(0!'!2!"!#!.!/\e(B" "\e$(G!'!2!"!#!.!/\e(B")
+ (":" "\e$(0!(!+!3!%!$!&!0!1\e(B" "\e$(G!(!+!3!%!$!&!0!1\e(B")
+ ("'" "\e$(0!e!d\e(B" "\e$(G!e!d\e(B")
+ ("\"" "\e$(0!g!f!h!i!q\e(B" "\e$(G!g!f!h!i!q\e(B")
+ ("\\" "\e$(0"`"b#M\e(B" "\e$(G"`"b#M\e(B")
+ ("|" "\e$(0!6!8!:"^\e(B" "\e$(G!6!8!:"^\e(B")
+ ("/" "\e$(0"_"a#L\e(B" "\e$(G"_"a#L\e(B")
+ ("?" "\e$(0!)!4\e(B" "\e$(G!)!4\e(B")
+ ("<" "\e$(0!R"6"A!T"H\e(B" "\e$(G!R"6"A!T"H\e(B")
+ (">" "\e$(0!S"7"B!U\e(B" "\e$(G!S"7"B!U\e(B")
+ ("[" "\e$(0!F!J!b!H!L!V!Z!X!\\e(B" "\e$(G!F!J!b!H!L!V!Z!X!\\e(B")
+ ("]" "\e$(0!G!K!c!I!M!W![!Y!]\e(B" "\e$(G!G!K!c!I!M!W![!Y!]\e(B")
+ ("{" "\e$(0!B!`!D\e(B " "\e$(G!B!`!D\e(B ")
+ ("}" "\e$(0!C!a!E\e(B" "\e$(G!C!a!E\e(B")
+ ("`" "\e$(0!j!k\e(B" "\e$(G!j!k\e(B")
+ ("~" "\e$(0"D"+",!<!=\e(B" "\e$(G"D"+",!<!=\e(B")
+ ("!" "\e$(0!*!5\e(B" "\e$(G!*!5\e(B")
+ ("@" "\e$(0"i"n\e(B" "\e$(G"i"n\e(B")
+ ("#" "\e$(0!l"-\e(B" "\e$(G!l"-\e(B")
+ ("$" "\e$(0"c"l\e(B" "\e$(G"c"l\e(B")
+ ("%" "\e$(0"h"m\e(B" "\e$(G"h"m\e(B")
+ ("&" "\e$(0!m".\e(B" "\e$(G!m".\e(B")
+ ("*" "\e$(0!n"/!o!w!x\e(B" "\e$(G!n"/!o!w!x\e(B")
+ ("(" "\e$(0!>!^!@\e(B" "\e$(G!>!^!@\e(B")
+ (")" "\e$(0!?!_!A\e(B" "\e$(G!?!_!A\e(B")
+ ("-" "\e$(0!7!9"#"$"1"@\e(B" "\e$(G!7!9"#"$"1"@\e(B")
+ ("_" "\e$(0"%"&\e(B" "\e$(G"%"&\e(B")
+ ("=" "\e$(0"8"C\e(B" "\e$(G"8"C\e(B")
+ ("+" "\e$(0"0"?\e(B" "\e$(G"0"?\e(B"))))
+ (dolist (elt punctuations)
+ (insert (format "(%S %S)\n" (concat "z" (car elt))
+ (if big5-p (nth 1 elt) (nth 2 elt))))))
+ (insert ")\n")))
+
+(defun tsang-b5-converter (dicbuf name title)
+ (tsang-quick-converter dicbuf name title t t))
+
+(defun quick-b5-converter (dicbuf name title)
+ (tsang-quick-converter dicbuf name title nil t))
+
+(defun tsang-cns-converter (dicbuf name title)
+ (tsang-quick-converter dicbuf name title t nil))
+
+(defun quick-cns-converter (dicbuf name title)
+ (tsang-quick-converter dicbuf name title nil nil))
+
+;; Generate a code of a Quail package in the current buffer from
+;; Pinyin dictionary in the buffer DICBUF. The input method name of
+;; the Quail package is NAME, and the title string is TITLE.
+
+(defun py-converter (dicbuf name title)
+ (goto-char (point-max))
+ (insert (format "%S\n" "\e$A::WVJdHk!KF4Rt!K\e(B
+
+ \e$AF4Rt7=08\e(B
+
+ \e$AP!P4S"NDWVD84z1m!8F4Rt!97{:E#,\e(B \"u(yu) \e$ATrSC\e(B u: \e$A1mJ>!C\e(B
+
+Pinyin base input method for Chinese charset GB2312 (`chinese-gb2312').
+
+Pinyin is the standared roman transliteration method for Chinese.
+Pinyin uses a sequence of Latin alphabetic characters for each Chinese
+character. The sequence is made by the combination of the initials
+\(the beginning sounds) and finals (the ending sounds).
+
+ initials: b p m f d t n l z c s zh ch sh r j q x g k h
+ finals: a o e i er ai ei oa ou an en ang eng ong i ia iao ie iu ian in
+ iang ing iong u ua uo uai ui uan un uan ueng yu yue yuan yun
+
+ (Note: In the correct Pinyin writing, the sequence \"yu\" in the last
+ four finals should be written by the character u-umlaut `\e$A(9\e(B'.)
+
+With this input method, you enter a Chinese character by first
+entering its pinyin spelling.
+
+\\<quail-translation-docstring>
+
+For instance, to input \e$ADc\e(B, you type \"n i C-n 3\". The first \"n i\"
+is a Pinyin, \"C-n\" selects the next group of candidates (each group
+contains at most 10 characters), \"3\" select the third character in
+that group.
+
+This input method supports only Han characters. The related input
+method `chinese-py-punct' is the combination of this method and
+`chinese-punct'; it supports both Han characters and punctuation
+characters.
+
+For double-width GB2312 characters corresponding to ASCII, use the
+input method `chinese-qj'.
+
+The correct Pinyin system specifies tones by diacritical marks, but
+this input method doesn't use them, which results in easy (you don't
+have to know the exact tones), but verbose (many characters are assigned
+to the same key sequence) input. You may also want to try the input
+method `chinese-tonepy' with which you must specify tones by digits
+\(1..5)."))
+ (insert " '((\"\C-?\" . quail-delete-last-char)
+ (\".\" . quail-next-translation)
+ (\">\" . quail-next-translation)
+ (\",\" . quail-prev-translation)
+ (\"<\" . quail-prev-translation))
+ nil nil nil nil)\n\n")
+ (insert "(quail-define-rules\n")
+ (let ((pos (point)))
+ (insert-buffer-substring dicbuf)
+ (goto-char pos)
+ (while (not (eobp))
+ (insert "(\"")
+ (skip-chars-forward "a-z")
+ (insert "\" \"")
+ (delete-char 1)
+ (end-of-line)
+ (insert "\")")
+ (forward-line 1)))
+ (insert ")\n"))
+
+;; Generate a code of a Quail package in the current buffer from
+;; Ziranma dictionary in the buffer DICBUF. The input method name of
+;; the Quail package is NAME, and the title string is TITLE.
+
+(defun ziranma-converter (dicbuf name title)
+ (let (dic)
+ (save-excursion
+ (set-buffer dicbuf)
+ (goto-char (point-min))
+ (search-forward "%keyname end\n")
+ (let ((table (make-hash-table :test 'equal))
+ elt pos key trans val)
+ (while (not (eobp))
+ (setq pos (point))
+ (skip-chars-forward "^ \t")
+ (setq key (buffer-substring pos (point)))
+ (skip-chars-forward " \t")
+ (setq trans (vector (buffer-substring (point) (line-end-position))))
+ (setq val (gethash key table))
+ (if val (setq trans (vconcat val trans)))
+ (puthash key trans table)
+ (forward-line 1))
+ (maphash #'(lambda (key trans)
+ (let ((len (length trans))
+ i)
+ (if (and (= len 1) (= (length (aref trans 0)) 1))
+ (setq trans (aref trans 0))
+ (setq i 0)
+ (while (and (< i len)
+ (= (length (aref trans i)) 1))
+ (setq i (1+ i)))
+ (if (= i len)
+ (setq trans (mapconcat 'identity trans "")))))
+ (setq dic (cons (cons key trans) dic)))
+ table)))
+ (setq dic (sort dic (function (lambda (x y) (string< (car x) (car y))))))
+ (goto-char (point-max))
+ (insert (format "%S\n" "\e$A::WVJdHk!K!>WTH;!?!K\e(B
+
+ \e$A<|EL6TUU1m\e(B:
+ \e$A)3)%)%)W)%)%)W)%)%)W)%)%)W)%)%)W)%)%)W)%)%)W)%)%)W)%)%)W)%)%)7\e(B
+ \e$A)'#Q\e(B \e$A)'#W\e(B \e$A)'#E\e(B \e$A)'#R\e(B \e$A)'#T\e(B \e$A)'#Y\e(B \e$A)'#U\e(Bsh\e$A)'#I\e(Bch\e$A)'#O\e(B \e$A)'#P\e(B \e$A)'\e(B
+ \e$A)'\e(B iu\e$A)'\e(B ua\e$A)'\e(B e\e$A)'\e(B uan\e$A)'\e(B ue\e$A)'\e(B uai\e$A)'\e(B u\e$A)'\e(B i\e$A)'\e(B o\e$A)'\e(B un\e$A)'\e(B
+ \e$A)'\e(B \e$A)'\e(B ia\e$A)'\e(B \e$A)'\e(B van\e$A)'\e(B ve\e$A)'\e(B ing\e$A)'\e(B \e$A)'\e(B \e$A)'\e(B uo\e$A)'\e(B vn\e$A)'\e(B
+ \e$A);)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)?\e(B
+ \e$A)'#A\e(B \e$A)'#S\e(B \e$A)'#D\e(B \e$A)'#F\e(B \e$A)'#G\e(B \e$A)'#H\e(B \e$A)'#J\e(B \e$A)'#K\e(B \e$A)'#L\e(B \e$A)'\e(B
+ \e$A)'\e(B a\e$A)'\e(Biong\e$A)'\e(Buang\e$A)'\e(B en\e$A)'\e(B eng\e$A)'\e(B ang\e$A)'\e(B an\e$A)'\e(B ao\e$A)'\e(B ai\e$A)'\e(B
+ \e$A)'\e(B \e$A)'\e(B ong\e$A)'\e(Biang\e$A)'\e(B \e$A)'\e(B ng\e$A)'\e(B \e$A)'\e(B \e$A)'\e(B \e$A)'\e(B \e$A)'\e(B
+ \e$A);)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)%)7\e(B
+ \e$A)'#Z\e(B \e$A)'#X\e(B \e$A)'#C\e(B \e$A)'#V\e(Bzh\e$A)'#B\e(B \e$A)'#N\e(B \e$A)'#M\e(B \e$A)'#,\e(B \e$A)'#.\e(B \e$A)'\e(B \e$A#/\e(B \e$A)'\e(B
+ \e$A)'\e(B ei\e$A)'\e(B ie\e$A)'\e(B iao\e$A)'\e(B ui\e$A)'\e(B ou\e$A)'\e(B in\e$A)'\e(B ian\e$A)'G0R3)':sR3)'7{:E)'\e(B
+ \e$A)'\e(B \e$A)'\e(B \e$A)'\e(B \e$A)'\e(B v\e$A)'\e(B \e$A)'\e(B \e$A)'\e(B \e$A)'\e(B \e$A)'\e(B \e$A)'\e(B \e$A)'\e(B
+ \e$A);)%)%)_)%)%)_)%)%)_)%)%)_)%)%)_)%)%)_)%)%)_)%)%)_)%)%)_)%)%)?\e(B
+
+
+Pinyin base input method for Chinese GB2312 characters (`chinese-gb2312').
+
+Pinyin is the standard roman transliteration method for Chinese.
+For the details of Pinyin system, see the documentation of the input
+method `chinese-py'.
+
+Unlike the standard spelling of Pinyin, in this input method all
+initials and finals are assigned to single keys (see the above table).
+For instance, the initial \"ch\" is assigned to the key `i', the final
+\"iu\" is assigned to the key `q', and tones 1, 2, 3, 4, and \e$AGaIy\e(B are
+assigned to the keys `q', `w', `e', `r', `t' respectively.
+
+\\<quail-translation-docstring>
+
+To input one-letter words, you type 4 keys, the first two for the
+Pinyin of the letter, next one for tone, and the last one is always a
+quote ('). For instance, \"vsq'\" input \e$AVP\e(B. Exceptions are these
+letters. You can input them just by typing a single key.
+
+ Character: \e$A04\e(B \e$A2;\e(B \e$A4N\e(B \e$A5D\e(B \e$A6~\e(B \e$A7"\e(B \e$A8v\e(B \e$A:M\e(B \e$A3v\e(B \e$A<0\e(B \e$A?I\e(B \e$AAK\e(B \e$AC;\e(B
+ Key: a b c d e f g h i j k l m
+ Character: \e$ADc\e(B \e$AE7\e(B \e$AF,\e(B \e$AF_\e(B \e$AHK\e(B \e$AH}\e(B \e$AK{\e(B \e$AJG\e(B \e$AWE\e(B \e$ANR\e(B \e$AP!\e(B \e$AR;\e(B \e$ATZ\e(B
+ Key: n o p q r s t u v w x y z
+
+To input two-letter words, you have two ways. One way is to type 4
+keys, two for the first Pinyin, two for the second Pinyin. For
+instance, \"vsgo\" inputs \e$AVP9z\e(B. Another way is to type 3 keys: 2
+initials of two letters, and quote ('). For instance, \"vg'\" also
+inputs \e$AVP9z\e(B.
+
+To input three-letter words, you type 4 keys: initials of three
+letters, and the last is quote ('). For instance, \"bjy'2\" inputs \e$A11\e(B
+\e$A>)Q<\e(B (the last `2' is to select one of the candidates).
+
+To input words of more than three letters, you type 4 keys, initials
+of the first three letters and the last letter. For instance,
+\"bjdt\" inputs \e$A11>)5gJSL(\e(B.
+
+To input symbols and punctuations, type `/' followed by one of `a' to
+`z', then select one of the candidates."))
+ (insert " '((\"\C-?\" . quail-delete-last-char)
+ (\".\" . quail-next-translation)
+ (\"[\" . quail-next-translation)
+ (\",\" . quail-prev-translation)
+ (\"]\" . quail-prev-translation))
+ nil nil nil nil)\n\n")
+ (insert "(quail-define-rules\n")
+ (dolist (elt dic)
+ (insert (format "(%S %S)\n" (car elt) (cdr elt))))
+ (insert ")\n")))
+
+(defun miscdic-convert (filename &optional dirname)
+ "Convert a dictionary file FILENAME into a Quail package.
+Optional argument DIRNAME if specified is the directory name under which
+the generated Quail package is saved."
+ (interactive "FInput method dictionary file: ")
+ (or (file-readable-p filename)
+ (error "%s does not exist" filename))
+ (let ((tail quail-misc-package-ext-info)
+ (default-buffer-file-coding-system 'iso-2022-7bit)
+ slot
+ name title dicfile coding quailfile converter copyright
+ dicbuf)
+ (while tail
+ (when (string-match (nth 2 (car tail)) filename)
+ (setq slot (car tail)
+ name (car slot)
+ title (nth 1 slot)
+ dicfile (nth 2 slot)
+ coding (nth 3 slot)
+ quailfile (nth 4 slot)
+ converter (nth 5 slot)
+ copyright (nth 6 slot))
+ (message "Converting %s to %s..." dicfile quailfile)
+ (with-temp-file (expand-file-name quailfile dirname)
+ (set-buffer-file-coding-system 'iso-2022-7bit)
+ (insert ";; Quail package `" name "' -*- coding:iso-2022-7bit; -*-\n")
+ (insert ";; Generated by the command `miscdic-convert'\n")
+ (insert ";; Date: " (current-time-string) "\n")
+ (insert ";; Source dictionary file: " dicfile "\n")
+ (insert ";; Copyright notice of the source file\n")
+ (insert ";;------------------------------------------------------\n")
+ (insert copyright "\n")
+ (insert ";;------------------------------------------------------\n")
+ (insert "\n")
+ (insert ";;; Code:\n\n")
+ (insert "(require 'quail)\n")
+ (insert "(quail-define-package \"" name "\" \""
+ (if (eq coding 'big5) "Chiense-BIG5" "Chienge-CNS")
+ "\" \"" title "\" t\n")
+ (let* ((coding-system-for-read coding)
+ (dicbuf (find-file-noselect filename)))
+ (funcall converter dicbuf name title)
+ (kill-buffer dicbuf)))
+ (message "Converting %s to %s...done" dicfile quailfile))
+ (setq tail (cdr tail)))))
+
+(defun batch-miscdic-convert ()
+ "Run `miscdic-convert' on the files remaing on the command line.
+Use this from the command line, with `-batch';
+it won't work in an interactive Emacs.
+If there's an argument \"-dir\", the next argument specifies a directory
+to store generated Quail packages."
+ (defvar command-line-args-left) ; Avoid compiler warning.
+ (if (not noninteractive)
+ (error "`batch-miscdic-convert' should be used only with -batch"))
+ (let ((dir default-directory)
+ filename)
+ (while command-line-args-left
+ (if (string= (car command-line-args-left) "-dir")
+ (progn
+ (setq command-line-args-left (cdr command-line-args-left))
+ (setq dir (car command-line-args-left))))
+ (setq filename (car command-line-args-left)
+ command-line-args-left (cdr command-line-args-left))
+ (if (file-directory-p filename)
+ (dolist (file (directory-files filename t nil t))
+ (miscdic-convert file dir))
+ (miscdic-convert filename dir))))
+ (kill-emacs 0))
+
;;; titdic-cnv.el ends here
;; Local Variables: