aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2009-12-09 00:57:02 +0000
committerKenichi Handa2009-12-09 00:57:02 +0000
commitae63e572b3b87e1cb148c9f26cd6e37804d1af6c (patch)
treedb798e339992163765526bfaa0e1ed5b58f59c5f
parente2f3c6923a614b73e0c73bcb22ba78db7b5e01be (diff)
downloademacs-ae63e572b3b87e1cb148c9f26cd6e37804d1af6c.tar.gz
emacs-ae63e572b3b87e1cb148c9f26cd6e37804d1af6c.zip
(ucs-names): Supply a sufficiently fine ranges instead of
pre-calculating accurate ranges. Iterate with bigger gc-cons-threshold.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/international/mule-cmds.el73
2 files changed, 38 insertions, 41 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 269e28a63e9..7813b0ce2eb 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12009-12-09 Kenichi Handa <handa@m17n.org>
2
3 * international/mule-cmds.el (ucs-names): Supply a sufficiently
4 fine ranges instead of pre-calculating accurate ranges. Iterate
5 with bigger gc-cons-threshold.
6
12009-12-08 Dan Nicolaescu <dann@ics.uci.edu> 72009-12-08 Dan Nicolaescu <dann@ics.uci.edu>
2 8
3 Add support for stashing a snapshot of the current tree. 9 Add support for stashing a snapshot of the current tree.
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index c13d96ec7b5..a817769c11d 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -2889,47 +2889,38 @@ on encoding."
2889(defun ucs-names () 2889(defun ucs-names ()
2890 "Return alist of (CHAR-NAME . CHAR-CODE) pairs cached in `ucs-names'." 2890 "Return alist of (CHAR-NAME . CHAR-CODE) pairs cached in `ucs-names'."
2891 (or ucs-names 2891 (or ucs-names
2892 (let ((ranges 2892 (let ((bmp-ranges
2893 (purecopy 2893 '((#x0000 . #x33FF)
2894 ;; We precompute at compile-time the ranges of chars 2894 ;; (#x3400 . #x4DBF) CJK Ideograph Extension A
2895 ;; that have names, so that at runtime, building the 2895 (#x4DC0 . #x4DFF)
2896 ;; table can be done faster, since most of the time is 2896 ;; (#x4E00 . #x9FFF) CJK Ideograph
2897 ;; spent looking for the chars that do have a name. 2897 (#xA000 . #x0D7FF)
2898 (eval-when-compile 2898 ;; (#xD800 . #xFAFF) Surrogate/Private
2899 (let ((ranges ()) 2899 (#xFB00 . #xFFFD)))
2900 (first 0) 2900 (upper-ranges
2901 (last 0)) 2901 '((#x10000 . #x134FF)
2902 (dotimes-with-progress-reporter (c #xEFFFF) 2902 ;; (#x13500 . #x1CFFF) unsed
2903 "Finding Unicode characters with names..." 2903 (#x1D000 . #x1FFFF)
2904 (unless (or 2904 ;; (#x20000 . #xDFFFF) CJK Ideograph Extension A, B, etc, unsed
2905 ;; CJK Ideograph Extension Arch 2905 (#xE0000 . #xE01FF)))
2906 (and (>= c #x3400 ) (<= c #x4dbf )) 2906 (gc-cons-threshold 10000000)
2907 ;; CJK Ideograph 2907 c end name names)
2908 (and (>= c #x4e00 ) (<= c #x9fff )) 2908 (dolist (range bmp-ranges)
2909 ;; Private/Surrogate 2909 (setq c (car range)
2910 (and (>= c #xd800 ) (<= c #xfaff )) 2910 end (cdr range))
2911 ;; CJK Ideograph Extensions B, C 2911 (while (<= c end)
2912 (and (>= c #x20000) (<= c #x2ffff)) 2912 (if (setq name (get-char-code-property c 'name))
2913 (null (get-char-code-property c 'name))) 2913 (push (cons name c) names))
2914 ;; This char has a name. 2914 (if (setq name (get-char-code-property c 'old-name))
2915 (if (<= c (1+ last)) 2915 (push (cons name c) names))
2916 ;; Extend the current range. 2916 (setq c (1+ c))))
2917 (setq last c) 2917 (dolist (range upper-ranges)
2918 ;; We have to split the range. 2918 (setq c (car range)
2919 (push (cons first last) ranges) 2919 end (cdr range))
2920 (setq first (setq last c))))) 2920 (while (<= c end)
2921 (cons (cons first last) ranges))))) 2921 (if (setq name (get-char-code-property c 'name))
2922 name names) 2922 (push (cons name c) names))
2923 (dolist (range ranges) 2923 (setq c (1+ c))))
2924 (let ((c (car range))
2925 (end (cdr range)))
2926 (while (<= c end)
2927 (if (setq name (get-char-code-property c 'name))
2928 (push (cons name c) names)
2929 (error "Wrong range"))
2930 (if (setq name (get-char-code-property c 'old-name))
2931 (push (cons name c) names))
2932 (setq c (1+ c)))))
2933 (setq ucs-names names)))) 2924 (setq ucs-names names))))
2934 2925
2935(defvar ucs-completions (lazy-completion-table ucs-completions ucs-names) 2926(defvar ucs-completions (lazy-completion-table ucs-completions ucs-names)