]> code.delx.au - gnu-emacs/blobdiff - lisp/international/ja-dic-cnv.el
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-25
[gnu-emacs] / lisp / international / ja-dic-cnv.el
index 34b53804df82eddf621538e1baaafefcbfa5f555..682a2a8f2b5286a385732b1cca39e475f16a2ea3 100644 (file)
@@ -1,4 +1,4 @@
-;;; ja-dic-cnv.el --- Convert a Japanese dictionary (SKK-JISYO.L) to Emacs Lisp
+;;; ja-dic-cnv.el --- convert a Japanese dictionary (SKK-JISYO.L) to Emacs Lisp
 
 ;; Copyright (C) 1995, 2000 Electrotechnical Laboratory, JAPAN.
 ;; Licensed to the Free Software Foundation.
 (defvar ja-dic-filename "ja-dic.el")
 
 ;; To make a generated ja-dic.el smaller.
-(make-coding-system
- 'iso-2022-7bit-short
- 2 ?J
+(define-coding-system 'iso-2022-7bit-short
  "Like `iso-2022-7bit' but no ASCII designation before SPC."
- '(ascii nil nil nil t t nil t)
- '((safe-charsets . t)))
+  :coding-type 'iso-2022
+  :mnemonic ?J
+  :charset-list 'iso-2022
+  :designation [(ascii t) nil nil nil]
+  :flags '(short 7-bit designation))
 
 (defun skkdic-convert-okuri-ari (skkbuf buf)
   (message "Processing OKURI-ARI entries ...")
   (save-excursion
     (set-buffer buf)
     (insert ")\n\n")))
-         
+
 (defconst skkdic-prefix-list '(skkdic-prefix-list))
 
 (defun skkdic-convert-prefix (skkbuf buf)
   (save-excursion
     (set-buffer buf)
     (insert ")\n\n")))
-         
+
 ;; FROM and TO point the head and tail of "/J../J../.../".
 (defun skkdic-get-candidate-list (from to)
   (let (candidates)
     (goto-char from)
-    (while (re-search-forward "/\\cj+" to t)
+    (while (re-search-forward "/[^/ \n]+" to t)
       (setq candidates (cons (buffer-substring (1+ (match-beginning 0))
                                               (match-end 0))
                             candidates)))
       (setq candidates (cdr candidates)))
     (nreverse l)))
 
-(defconst skkdic-okuri-nasi-entries (list nil))
-(defconst skkdic-okuri-nasi-entries-count 0)
+(defvar skkdic-okuri-nasi-entries (list nil))
+(defvar skkdic-okuri-nasi-entries-count 0)
 
 (defun skkdic-collect-okuri-nasi ()
   (message "Collecting OKURI-NASI entries ...")
@@ -358,13 +359,15 @@ The name of generated file is specified by the variable `ja-dic-filename'."
       (set-buffer buf)
       (erase-buffer)
       (buffer-disable-undo)
-      (insert ";; ja-dic.el -- dictionary for Japanese input method\n"
+      (insert ";;; ja-dic.el --- dictionary for Japanese input method"
+             " -*-coding: iso-2022-jp;-*-\n"
              ";;\tGenerated by the command `skkdic-convert'\n"
              ";;\tDate: " (current-time-string) "\n"
              ";;\tOriginal SKK dictionary file: "
              (file-name-nondirectory filename)
              "\n\n"
-             ";;; Comment:\n\n"
+             ";; This file is part of GNU Emacs.\n\n"
+             ";;; Commentary:\n\n"
              ";; Do byte-compile this file again after any modification.\n\n"
              ";;; Start of the header of the original SKK dictionary.\n\n")
       (set-buffer skkbuf)
@@ -405,7 +408,7 @@ The name of generated file is specified by the variable `ja-dic-filename'."
        (goto-char to)
        (skkdic-convert-prefix skkbuf buf)
 
-       ;; 
+       ;;
        (skkdic-collect-okuri-nasi)
 
        ;; Convert okuri-nasi general entries.
@@ -415,7 +418,7 @@ The name of generated file is specified by the variable `ja-dic-filename'."
        (save-excursion
          (set-buffer buf)
          (goto-char (point-max))
-         (insert ";;\n(provide 'ja-dic)\n\n;; ja-dic.el ends here\n")))
+         (insert ";;\n(provide 'ja-dic)\n\n;;; ja-dic.el ends here\n")))
 
       ;; Save the working buffer.
       (set-buffer buf)
@@ -474,7 +477,7 @@ To get complete usage, invoke:
                (- ch)                  ;  represented by a negative code.
              (if (= ch ?\e$B!<\e(B)              ; `\e$B!<\e(B' is represented by 0.
                  0
-               (- (nth 2 (split-char ch)) 32))))
+               (- (logand (encode-char ch 'japanese-jisx0208) #xFF) 32))))
       (setq i (1+ i)))
     vec))
 
@@ -553,7 +556,7 @@ To get complete usage, invoke:
             entry)
         (while l
           (setq count (1+ count))
-          (if (= (% count 10) 0)
+          (if (= (% count 10000) 0)
               (message (format "%d entries" count)))
           (setq entry (skkdic-extract-conversion-data (car l)))
           (set-nested-alist (car entry) (cdr entry) map)
@@ -562,4 +565,9 @@ To get complete usage, invoke:
 
 (provide 'ja-dic-cnv)
 
-;; ja-dic-cnv.el ends here
+;; Local Variables:
+;; coding: iso-2022-7bit
+;; End:
+
+;;; arch-tag: dec06fb0-8118-45b1-80d7-dc360b6fd3b2
+;;; ja-dic-cnv.el ends here