aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2002-07-24 22:18:11 +0000
committerDave Love2002-07-24 22:18:11 +0000
commitc7211fed54e6961e2fb0e2d1cd687937b2f657eb (patch)
tree0d3a7eb058e92862affed4e94d70eb8fd4221a6d
parenta5e5d4add1def89b8f985d832683e9d7691e44ae (diff)
downloademacs-c7211fed54e6961e2fb0e2d1cd687937b2f657eb.tar.gz
emacs-c7211fed54e6961e2fb0e2d1cd687937b2f657eb.zip
Doc fixes.
(tit-process-header): Add coding cookie. (titdic-convert): Force writing as iso-2022-7bit.
-rw-r--r--lisp/international/titdic-cnv.el97
1 files changed, 49 insertions, 48 deletions
diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el
index e7caf3da9ba..87fff7a8b9b 100644
--- a/lisp/international/titdic-cnv.el
+++ b/lisp/international/titdic-cnv.el
@@ -1,4 +1,4 @@
1;;; titdic-cnv.el --- convert cxterm dictionary (TIT format) to Quail package 1;;; titdic-cnv.el --- convert cxterm dictionary (TIT format) to Quail package -*- coding:iso-2022-7bit; -*-
2 2
3;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. 3;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
4;; Licensed to the Free Software Foundation. 4;; Licensed to the Free Software Foundation.
@@ -73,7 +73,7 @@
73;; dictionary. The extra docstring in this alist is to add more 73;; dictionary. The extra docstring in this alist is to add more
74;; information. 74;; information.
75;; The command describe-input-method shows the automatically generated 75;; The command describe-input-method shows the automatically generated
76;; docstring, then an extra docstrings while replacing the form \<VAR> 76;; docstring, then an extra docstring while replacing the form \<VAR>
77;; by the value of variable VAR. For instance, the form 77;; by the value of variable VAR. For instance, the form
78;; \<quail-translation-docstring> is replaced by a description about 78;; \<quail-translation-docstring> is replaced by a description about
79;; how to select a translation from a list of candidates. 79;; how to select a translation from a list of candidates.
@@ -84,7 +84,7 @@
84 ("chinese-ccdospy" "$AKuF4(B" 84 ("chinese-ccdospy" "$AKuF4(B"
85 "Pinyin base input method for Chinese charset GB2312 \(`chinese-gb2312'). 85 "Pinyin base input method for Chinese charset GB2312 \(`chinese-gb2312').
86 86
87Pinyin is the standared roman transliteration method for Chinese. 87Pinyin is the standard Roman transliteration method for Chinese.
88For the detail of Pinyin system, see the documentation of the input 88For the detail of Pinyin system, see the documentation of the input
89method `chinese-py'. 89method `chinese-py'.
90 90
@@ -92,7 +92,7 @@ This input method works almost the same way as `chinese-py'. The
92difference is that you type a single key for these Pinyin spelling. 92difference is that you type a single key for these Pinyin spelling.
93 Pinyin: zh en eng ang ch an ao ai ong sh ing yu($A(9(B) 93 Pinyin: zh en eng ang ch an ao ai ong sh ing yu($A(9(B)
94 keyseq: a f g h i j k l s u y v 94 keyseq: a f g h i j k l s u y v
95For expample: 95For example:
96 Chinese: $A0!(B $A9{(B $AVP(B $AND(B $A9b(B $ASq(B $AH+(B 96 Chinese: $A0!(B $A9{(B $AVP(B $AND(B $A9b(B $ASq(B $AH+(B
97 Pinyin: a guo zhong wen guang yu quan 97 Pinyin: a guo zhong wen guang yu quan
98 Keyseq: a1 guo4 as1 wf4 guh1 yu..6 qvj6 98 Keyseq: a1 guo4 as1 wf4 guh1 yu..6 qvj6
@@ -267,8 +267,8 @@ SPC, 6, 3, 4, or 7 specifing a tone (SPC:$(0?v(N(B, 6:$(0Dm(N(B, 3:$(0&9Vy
267 (tit-keyprompt nil)) 267 (tit-keyprompt nil))
268 268
269 (princ ";; Quail package `") 269 (princ ";; Quail package `")
270 (princ package) 270 (princ package) (princ "' -*- coding:iso-2022-7bit; -*-\n")
271 (princ "' generated by the command `titdic-convert'\n;;\tDate: ") 271 (princ ";; Generated by the command `titdic-convert'\n;;\tDate: ")
272 (princ (current-time-string)) 272 (princ (current-time-string))
273 (princ "\n;;\tOriginal TIT dictionary file: ") 273 (princ "\n;;\tOriginal TIT dictionary file: ")
274 (princ (file-name-nondirectory filename)) 274 (princ (file-name-nondirectory filename))
@@ -465,50 +465,51 @@ SPC, 6, 3, 4, or 7 specifing a tone (SPC:$(0?v(N(B, 6:$(0Dm(N(B, 3:$(0&9Vy
465Optional argument DIRNAME if specified is the directory name under which 465Optional argument DIRNAME if specified is the directory name under which
466the generated Quail package is saved." 466the generated Quail package is saved."
467 (interactive "FTIT dictionary file: ") 467 (interactive "FTIT dictionary file: ")
468 (with-temp-file (tit-make-quail-package-file-name filename dirname) 468 (let ((coding-system-for-write 'iso-2022-7bit))
469 (set-buffer-file-coding-system 'iso-2022-7bit) 469 (with-temp-file (tit-make-quail-package-file-name filename dirname)
470 (let ((standard-output (current-buffer))) 470 (set-buffer-file-coding-system 'iso-2022-7bit)
471 (with-temp-buffer 471 (let ((standard-output (current-buffer)))
472 (let ((coding-system-for-read 'no-conversion)) 472 (with-temp-buffer
473 (insert-file-contents (expand-file-name filename))) 473 (set-buffer-multibyte nil)
474 (set-buffer-multibyte t) 474 (let ((coding-system-for-read 'no-conversion))
475 (insert-file-contents (expand-file-name filename)))
475 476
476 ;; Decode the buffer contents from the encoding specified by a 477 ;; Decode the buffer contents from the encoding specified by a
477 ;; value of the key "ENCODE:". 478 ;; value of the key "ENCODE:".
478 (if (not (search-forward "\nBEGIN" nil t)) 479 (if (not (search-forward "\nBEGIN" nil t))
479 (error "TIT dictionary doesn't have body part")) 480 (error "TIT dictionary doesn't have body part"))
480 (let ((limit (point)) 481 (let ((limit (point))
481 coding-system slot) 482 coding-system slot)
482 (goto-char (point-min)) 483 (goto-char (point-min))
483 (if (re-search-forward "^ENCODE:[ \t]*" limit t) 484 (if (re-search-forward "^ENCODE:[ \t]*" limit t)
484 (progn 485 (progn
485 (goto-char (match-end 0)) 486 (goto-char (match-end 0))
486 (setq tit-encode (tit-read-key-value))) 487 (setq tit-encode (tit-read-key-value)))
487 (setq tit-encode tit-default-encode)) 488 (setq tit-encode tit-default-encode))
488 (setq slot (assoc tit-encode tit-encode-list)) 489 (setq slot (assoc tit-encode tit-encode-list))
489 (if (not slot) 490 (if (not slot)
490 (error "Invalid ENCODE: value in TIT dictionary")) 491 (error "Invalid ENCODE: value in TIT dictionary"))
491 (setq coding-system (nth 1 slot)) 492 (setq coding-system (nth 1 slot))
492 (message "Decoding with coding system %s..." coding-system) 493 (message "Decoding with coding system %s..." coding-system)
494 (goto-char (point-min))
495 (decode-coding-region (point-min) (point-max) coding-system))
496
497 ;; Set point the starting position of the body part.
493 (goto-char (point-min)) 498 (goto-char (point-min))
494 (decode-coding-region (point-min) (point-max) coding-system)) 499 (if (not (search-forward "\nBEGIN" nil t))
495 500 (error "TIT dictionary can't be decoded correctly"))
496 ;; Set point the starting position of the body part. 501
497 (goto-char (point-min)) 502 ;; Process the header part.
498 (if (not (search-forward "\nBEGIN" nil t)) 503 (forward-line 1)
499 (error "TIT dictionary can't be decoded correctly")) 504 (narrow-to-region (point-min) (point))
500 505 (tit-process-header filename)
501 ;; Process the header part. 506 (widen)
502 (forward-line 1) 507
503 (narrow-to-region (point-min) (point)) 508 ;; Process the body part. For speed, we turn off multibyte facility.
504 (tit-process-header filename) 509 (with-current-buffer standard-output
505 (widen) 510 (set-buffer-multibyte nil))
506 511 (set-buffer-multibyte nil)
507 ;; Process the body part. For speed, we turn off multibyte facility. 512 (tit-process-body))))))
508 (with-current-buffer standard-output
509 (set-buffer-multibyte nil))
510 (set-buffer-multibyte nil)
511 (tit-process-body)))))
512 513
513;;;###autoload 514;;;###autoload
514(defun batch-titdic-convert (&optional force) 515(defun batch-titdic-convert (&optional force)