1 (defconst mule-charset-mapping-table-alist
2 '((arabic-digit "http://www.m17n.org/mule/mappings/arabic0.txt")
3 (arabic-1-column "http://www.m17n.org/mule/mappings/arabic1.txt")
4 (arabic-2-column "http://www.m17n.org/mule/mappings/arabic2.txt")
5 (ipa "http://www.m17n.org/mule/mappings/ipa.txt")
8 (defvar mule-charset-http-url-root "~/pub/http/")
10 (defun mule-charset-url-to-filename (url)
11 (when (string-match "http://" url)
12 (expand-file-name (substring url (match-end 0))
13 mule-charset-http-url-root)))
15 (defun mule-charset-maybe-retrieve-url (url)
16 (call-process "wget" nil nil nil
17 "-q" "-P" (expand-file-name
18 mule-charset-http-url-root) "-m" url))
20 (defun mule-charset-check-mapping (coded-charset &optional url)
23 (car (cdr (assq coded-charset mule-charset-mapping-table-alist)))))
24 (mule-charset-maybe-retrieve-url url)
25 (let ((file (mule-charset-url-to-filename url))
27 (if (file-exists-p file)
29 (setq buf (find-file-noselect file))
30 (with-current-buffer buf
31 (goto-char (point-min))
32 (let (code ucs chr ret)
35 "^0x\\([0-9A-F]+\\)\t\\(0x[0-9A-F]+\\( 0x[0-9A-F]+\\)\\)"
37 (setq code (string-to-int (match-string 1) 16)
39 (if (string-match " " ucs)
41 (list (cons coded-charset code)
42 (cons '->decomposition
45 (substring str 2) 16))
46 (split-string ucs " ")))))
47 (setq ucs (string-to-int ucs 16))
48 (setq chr (decode-char coded-charset code))
49 (if (or (setq ret (get-char-attribute chr 'ucs))
50 (setq ret (get-char-attribute chr 'ucs-mule))
51 (setq ret (get-char-attribute chr '=>ucs))
52 (setq ret (get-char-attribute chr '->ucs)))
54 (put-char-attribute chr 'ucs-mule ucs))
55 (put-char-attribute (decode-char 'ucs ucs)
56 coded-charset code))))))
58 (with-current-buffer "*scratch*"
59 (insert (format "%s is not found!!!\n" file))))))
61 (dolist (cell mule-charset-mapping-table-alist)
62 (mule-charset-check-mapping (car cell)(cadr cell)))