-;;; titdic-cnv.el --- convert cxterm dictionary (TIT format) to Quail package
+;;; titdic-cnv.el --- convert cxterm dictionary (TIT format) to Quail package -*- coding:iso-2022-7bit; -*-
;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
;; Licensed to the Free Software Foundation.
;; dictionary. The extra docstring in this alist is to add more
;; information.
;; The command describe-input-method shows the automatically generated
-;; docstring, then an extra docstrings while replacing the form \<VAR>
+;; docstring, then an extra docstring while replacing the form \<VAR>
;; by the value of variable VAR. For instance, the form
;; \<quail-translation-docstring> is replaced by a description about
;; how to select a translation from a list of candidates.
("chinese-ccdospy" "\e$AKuF4\e(B"
"Pinyin base input method for Chinese charset GB2312 \(`chinese-gb2312').
-Pinyin is the standared roman transliteration method for Chinese.
+Pinyin is the standard Roman transliteration method for Chinese.
For the detail of Pinyin system, see the documentation of the input
method `chinese-py'.
difference is that you type a single key for these Pinyin spelling.
Pinyin: zh en eng ang ch an ao ai ong sh ing yu(\e$A(9\e(B)
keyseq: a f g h i j k l s u y v
-For expample:
+For example:
Chinese: \e$A0!\e(B \e$A9{\e(B \e$AVP\e(B \e$AND\e(B \e$A9b\e(B \e$ASq\e(B \e$AH+\e(B
Pinyin: a guo zhong wen guang yu quan
Keyseq: a1 guo4 as1 wf4 guh1 yu..6 qvj6
(tit-keyprompt nil))
(princ ";; Quail package `")
- (princ package)
- (princ "' generated by the command `titdic-convert'\n;;\tDate: ")
+ (princ package) (princ "' -*- coding:iso-2022-7bit; -*-\n")
+ (princ ";; Generated by the command `titdic-convert'\n;;\tDate: ")
(princ (current-time-string))
(princ "\n;;\tOriginal TIT dictionary file: ")
(princ (file-name-nondirectory filename))
Optional argument DIRNAME if specified is the directory name under which
the generated Quail package is saved."
(interactive "FTIT dictionary file: ")
- (with-temp-file (tit-make-quail-package-file-name filename dirname)
- (set-buffer-file-coding-system 'iso-2022-7bit)
- (let ((standard-output (current-buffer)))
- (with-temp-buffer
- (let ((coding-system-for-read 'no-conversion))
- (insert-file-contents (expand-file-name filename)))
- (set-buffer-multibyte t)
+ (let ((coding-system-for-write 'iso-2022-7bit))
+ (with-temp-file (tit-make-quail-package-file-name filename dirname)
+ (set-buffer-file-coding-system 'iso-2022-7bit)
+ (let ((standard-output (current-buffer)))
+ (with-temp-buffer
+ (set-buffer-multibyte nil)
+ (let ((coding-system-for-read 'no-conversion))
+ (insert-file-contents (expand-file-name filename)))
- ;; Decode the buffer contents from the encoding specified by a
- ;; value of the key "ENCODE:".
- (if (not (search-forward "\nBEGIN" nil t))
- (error "TIT dictionary doesn't have body part"))
- (let ((limit (point))
- coding-system slot)
- (goto-char (point-min))
- (if (re-search-forward "^ENCODE:[ \t]*" limit t)
- (progn
- (goto-char (match-end 0))
- (setq tit-encode (tit-read-key-value)))
- (setq tit-encode tit-default-encode))
- (setq slot (assoc tit-encode tit-encode-list))
- (if (not slot)
- (error "Invalid ENCODE: value in TIT dictionary"))
- (setq coding-system (nth 1 slot))
- (message "Decoding with coding system %s..." coding-system)
+ ;; Decode the buffer contents from the encoding specified by a
+ ;; value of the key "ENCODE:".
+ (if (not (search-forward "\nBEGIN" nil t))
+ (error "TIT dictionary doesn't have body part"))
+ (let ((limit (point))
+ coding-system slot)
+ (goto-char (point-min))
+ (if (re-search-forward "^ENCODE:[ \t]*" limit t)
+ (progn
+ (goto-char (match-end 0))
+ (setq tit-encode (tit-read-key-value)))
+ (setq tit-encode tit-default-encode))
+ (setq slot (assoc tit-encode tit-encode-list))
+ (if (not slot)
+ (error "Invalid ENCODE: value in TIT dictionary"))
+ (setq coding-system (nth 1 slot))
+ (message "Decoding with coding system %s..." coding-system)
+ (goto-char (point-min))
+ (decode-coding-region (point-min) (point-max) coding-system))
+
+ ;; Set point the starting position of the body part.
(goto-char (point-min))
- (decode-coding-region (point-min) (point-max) coding-system))
-
- ;; Set point the starting position of the body part.
- (goto-char (point-min))
- (if (not (search-forward "\nBEGIN" nil t))
- (error "TIT dictionary can't be decoded correctly"))
-
- ;; Process the header part.
- (forward-line 1)
- (narrow-to-region (point-min) (point))
- (tit-process-header filename)
- (widen)
-
- ;; Process the body part. For speed, we turn off multibyte facility.
- (with-current-buffer standard-output
- (set-buffer-multibyte nil))
- (set-buffer-multibyte nil)
- (tit-process-body)))))
+ (if (not (search-forward "\nBEGIN" nil t))
+ (error "TIT dictionary can't be decoded correctly"))
+
+ ;; Process the header part.
+ (forward-line 1)
+ (narrow-to-region (point-min) (point))
+ (tit-process-header filename)
+ (widen)
+
+ ;; Process the body part. For speed, we turn off multibyte facility.
+ (with-current-buffer standard-output
+ (set-buffer-multibyte nil))
+ (set-buffer-multibyte nil)
+ (tit-process-body))))))
;;;###autoload
(defun batch-titdic-convert (&optional force)