]> code.delx.au - gnu-emacs/blobdiff - lisp/language/viet-util.el
Add new maintainer (deego).
[gnu-emacs] / lisp / language / viet-util.el
index 19b182c4382cdc840f51fbf39f0ba6f6ca1c7b2a..1b72ff07d8bd46aaf2f2b9a8464d91cc2cfbb963 100644 (file)
@@ -1,4 +1,4 @@
-;;; viet-util.el ---  utilities for Vietnamese
+;;; viet-util.el --- utilities for Vietnamese  -*- coding: iso-2022-7bit; -*-
 
 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
 ;; Licensed to the Free Software Foundation.
 
 ;; Vietnamese uses ASCII characters and additional 134 unique
 ;; characters (these are Latin alphabets with various diacritical and
-;; tone marks).  As far as I know, Vietnamese now has 4 different ways
-;; for representing these characters: VISCII, VSCII, VIQR, and
-;; Unicode.  VISCII and VSCII are simple 1-byte code which assigns 134
-;; unique characters in control-code area (0x00..0x1F) and right half
-;; area (0x80..0xFF).  VIQR is a menmonic encoding specification
-;; representing diacritical marks by following ASCII characters.
+;; tone marks).  As far as I know, Vietnamese now has 5 different ways
+;; for representing these characters: VISCII, TCVN-5712, VPS, VIQR,
+;; and Unicode.  VISCII, TCVN-5712 and VPS are simple 1-byte code
+;; which assigns 134 unique characters in control-code area
+;; (0x00..0x1F) and right half area (0x80..0xFF).  VIQR is a menmonic
+;; encoding specification representing diacritical marks by following
+;; ASCII characters.
 
 ;;; Code:
 
-(defun setup-vietnamese-environment ()
-  "Setup multilingual environment (MULE) for Vietnamese VISCII users."
-  (interactive)
-  (setup-8-bit-environment "Vietnamese" nil 'vietnamese-viscii
-                          "vietnamese-viqr"))
+;;;###autoload
+(defun viet-encode-viscii-char (char)
+  "Return VISCII character code of CHAR if appropriate."
+  (aref (char-table-extra-slot viet-viscii-nonascii-translation-table 0)
+       char))
 
 ;; VIQR is a menmonic encoding specification for Vietnamese.
 ;; It represents diacritical marks by ASCII characters as follows:
 
 ;;;###autoload
 (defun viet-decode-viqr-region (from to)
-  "Convert `VIQR' mnemonics of the current region to Vietnamese characaters.
+  "Convert `VIQR' mnemonics of the current region to Vietnamese characters.
 When called from a program, expects two arguments,
 positions (integers or markers) specifying the stretch of the region."
   (interactive "r")
@@ -238,13 +239,13 @@ positions (integers or markers) specifying the stretch of the region."
 
 ;;;###autoload
 (defun viet-decode-viqr-buffer ()
-  "Convert `VIQR' mnemonics of the current buffer to Vietnamese characaters."
+  "Convert `VIQR' mnemonics of the current buffer to Vietnamese characters."
   (interactive)
   (viet-decode-viqr-region (point-min) (point-max)))
 
 ;;;###autoload
 (defun viet-encode-viqr-region (from to)
-  "Convert Vietnamese characaters of the current region to `VIQR' mnemonics.
+  "Convert Vietnamese characters of the current region to `VIQR' mnemonics.
 When called from a program, expects two arguments,
 positions (integers or markers) specifying the stretch of the region."
   (interactive "r")
@@ -261,7 +262,7 @@ positions (integers or markers) specifying the stretch of the region."
 
 ;;;###autoload
 (defun viet-encode-viqr-buffer ()
-  "Convert Vietnamese characaters of the current buffer to `VIQR' mnemonics."
+  "Convert Vietnamese characters of the current buffer to `VIQR' mnemonics."
   (interactive)
   (viet-encode-viqr-region (point-min) (point-max)))
 
@@ -277,10 +278,8 @@ positions (integers or markers) specifying the stretch of the region."
 
 ;;;###autoload
 (defun viqr-pre-write-conversion (from to)
-  (let ((old-buf (current-buffer))
-       (work-buf (get-buffer-create " *viet-work*")))
-    (set-buffer work-buf)
-    (erase-buffer)
+  (let ((old-buf (current-buffer)))
+    (set-buffer (generate-new-buffer " *temp*"))
     (if (stringp from)
        (insert from)
       (insert-buffer-substring old-buf from to))