diff options
| author | Kenichi Handa | 2011-07-07 07:43:48 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2011-07-07 07:43:48 +0900 |
| commit | c805dec0b5fa81b5c9f2b724e2ec12a17d723aca (patch) | |
| tree | c29a8490c976fdf4dbf64ef1b13a57f7d1110cc1 /lisp | |
| parent | 5c62d133468c354b47a1643092add8292e084765 (diff) | |
| download | emacs-c805dec0b5fa81b5c9f2b724e2ec12a17d723aca.tar.gz emacs-c805dec0b5fa81b5c9f2b724e2ec12a17d723aca.zip | |
Add C interface for Unicode character property table.
Diffstat (limited to 'lisp')
19 files changed, 59 insertions, 59 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 89b33dc7a62..b85a1680286 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,39 @@ | |||
| 1 | 2011-07-06 Kenichi Handa <handa@m17n.org> | ||
| 2 | |||
| 3 | * international/characters.el (build-unicode-category-table): | ||
| 4 | Delete it. | ||
| 5 | (unicode-category-table): Set it by | ||
| 6 | unicode-prroperty-table-internal. | ||
| 7 | |||
| 8 | * international/mule-cmds.el (char-code-property-alist): Moved to | ||
| 9 | to src/chartab.c. | ||
| 10 | (get-char-code-property): Call unicode-property-table-internal to | ||
| 11 | load a file. Call get-unicode-property-internal where necessary. | ||
| 12 | (put-char-code-property): Call unicode-property-table-internal to | ||
| 13 | load a file. Call put-unicode-property-internal where necessary. | ||
| 14 | put-unicode-property-internal where necessary. | ||
| 15 | (char-code-property-description): Call | ||
| 16 | unicode-property-table-internal to load a file. | ||
| 17 | |||
| 18 | * international/charprop.el: | ||
| 19 | * international/uni-bidi.el: | ||
| 20 | * international/uni-category.el: | ||
| 21 | * international/uni-combining.el: | ||
| 22 | * international/uni-comment.el: | ||
| 23 | * international/uni-decimal.el: | ||
| 24 | * international/uni-decomposition.el: | ||
| 25 | * international/uni-digit.el: | ||
| 26 | * international/uni-lowercase.el: | ||
| 27 | * international/uni-mirrored.el: | ||
| 28 | * international/uni-name.el: | ||
| 29 | * international/uni-numeric.el: | ||
| 30 | * international/uni-old-name.el: | ||
| 31 | * international/uni-titlecase.el: | ||
| 32 | * international/uni-uppercase.el: Regenerate. | ||
| 33 | |||
| 34 | * loadup.el: Load international/charprop.el before | ||
| 35 | international/characters. | ||
| 36 | |||
| 1 | 2011-06-22 Richard Stallman <rms@gnu.org> | 37 | 2011-06-22 Richard Stallman <rms@gnu.org> |
| 2 | 38 | ||
| 3 | * mail/sendmail.el (mail-bury): If Rmail is in use, return nicely | 39 | * mail/sendmail.el (mail-bury): If Rmail is in use, return nicely |
diff --git a/lisp/international/characters.el b/lisp/international/characters.el index 455cbe697d6..a9657c17b9f 100644 --- a/lisp/international/characters.el +++ b/lisp/international/characters.el | |||
| @@ -1206,22 +1206,8 @@ Setup char-width-table appropriate for non-CJK language environment." | |||
| 1206 | 1206 | ||
| 1207 | ;;; Setting unicode-category-table. | 1207 | ;;; Setting unicode-category-table. |
| 1208 | 1208 | ||
| 1209 | ;; This macro is to build unicode-category-table at compile time so | 1209 | (setq unicode-category-table |
| 1210 | ;; that C code can access the table efficiently. | 1210 | (unicode-property-table-internal 'general-category)) |
| 1211 | (defmacro build-unicode-category-table () | ||
| 1212 | (let ((table (make-char-table 'unicode-category-table nil))) | ||
| 1213 | (dotimes (i #x110000) | ||
| 1214 | (if (or (< i #xD800) | ||
| 1215 | (and (>= i #xF900) (< i #x30000)) | ||
| 1216 | (and (>= i #xE0000) (< i #xE0200))) | ||
| 1217 | (aset table i (get-char-code-property i 'general-category)))) | ||
| 1218 | (set-char-table-range table '(#xE000 . #xF8FF) 'Co) | ||
| 1219 | (set-char-table-range table '(#xF0000 . #xFFFFD) 'Co) | ||
| 1220 | (set-char-table-range table '(#x100000 . #x10FFFD) 'Co) | ||
| 1221 | (optimize-char-table table 'eq) | ||
| 1222 | table)) | ||
| 1223 | |||
| 1224 | (setq unicode-category-table (build-unicode-category-table)) | ||
| 1225 | (map-char-table #'(lambda (key val) | 1211 | (map-char-table #'(lambda (key val) |
| 1226 | (if (and val | 1212 | (if (and val |
| 1227 | (or (and (/= (aref (symbol-name val) 0) ?M) | 1213 | (or (and (/= (aref (symbol-name val) 0) ?M) |
diff --git a/lisp/international/charprop.el b/lisp/international/charprop.el index 5c3efcc9d07..919666010b1 100644 --- a/lisp/international/charprop.el +++ b/lisp/international/charprop.el | |||
| @@ -1,8 +1,4 @@ | |||
| 1 | ;; Copyright (C) 1991-2010 Unicode, Inc. | 1 | ;; Automatically generated by unidata-gen.el. |
| 2 | ;; This file was generated from the Unicode data file at | ||
| 3 | ;; http://www.unicode.org/Public/UNIDATA/UnicodeData.txt. | ||
| 4 | ;; See lisp/international/README for the copyright and permission notice. | ||
| 5 | |||
| 6 | ;; FILE: uni-name.el | 2 | ;; FILE: uni-name.el |
| 7 | (define-char-code-property 'name "uni-name.el" | 3 | (define-char-code-property 'name "uni-name.el" |
| 8 | "Unicode character name. | 4 | "Unicode character name. |
| @@ -45,7 +41,7 @@ Property value is an integer or a floating point.") | |||
| 45 | ;; FILE: uni-mirrored.el | 41 | ;; FILE: uni-mirrored.el |
| 46 | (define-char-code-property 'mirrored "uni-mirrored.el" | 42 | (define-char-code-property 'mirrored "uni-mirrored.el" |
| 47 | "Unicode bidi mirrored flag. | 43 | "Unicode bidi mirrored flag. |
| 48 | Property value is a symbol `Y' or `N'.") | 44 | Property value is a symbol `Y' or `N'. See also the property `mirroring'.") |
| 49 | ;; FILE: uni-old-name.el | 45 | ;; FILE: uni-old-name.el |
| 50 | (define-char-code-property 'old-name "uni-old-name.el" | 46 | (define-char-code-property 'old-name "uni-old-name.el" |
| 51 | "Unicode old names as published in Unicode 1.0. | 47 | "Unicode old names as published in Unicode 1.0. |
| @@ -66,6 +62,11 @@ Property value is a character.") | |||
| 66 | (define-char-code-property 'titlecase "uni-titlecase.el" | 62 | (define-char-code-property 'titlecase "uni-titlecase.el" |
| 67 | "Unicode simple titlecase mapping. | 63 | "Unicode simple titlecase mapping. |
| 68 | Property value is a character.") | 64 | Property value is a character.") |
| 65 | ;; FILE: uni-mirrored.el | ||
| 66 | (define-char-code-property 'mirroring "uni-mirrored.el" | ||
| 67 | "Unicode bidi-mirroring characters. | ||
| 68 | Property value is a character that has the corresponding mirroring image, | ||
| 69 | or nil for non-mirrored character.") | ||
| 69 | ;; Local Variables: | 70 | ;; Local Variables: |
| 70 | ;; coding: utf-8 | 71 | ;; coding: utf-8 |
| 71 | ;; no-byte-compile: t | 72 | ;; no-byte-compile: t |
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index b3f17bb3fcf..e75a22d6415 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el | |||
| @@ -2709,16 +2709,6 @@ See also `locale-charset-language-names', `locale-language-names', | |||
| 2709 | 2709 | ||
| 2710 | ;;; Character property | 2710 | ;;; Character property |
| 2711 | 2711 | ||
| 2712 | ;; Each element has the form (PROP . TABLE). | ||
| 2713 | ;; PROP is a symbol representing a character property. | ||
| 2714 | ;; TABLE is a char-table containing the property value for each character. | ||
| 2715 | ;; TABLE may be a name of file to load to build a char-table. | ||
| 2716 | ;; Don't modify this variable directly but use `define-char-code-property'. | ||
| 2717 | |||
| 2718 | (defvar char-code-property-alist nil | ||
| 2719 | "Alist of character property name vs char-table containing property values. | ||
| 2720 | Internal use only.") | ||
| 2721 | |||
| 2722 | (put 'char-code-property-table 'char-table-extra-slots 5) | 2712 | (put 'char-code-property-table 'char-table-extra-slots 5) |
| 2723 | 2713 | ||
| 2724 | (defun define-char-code-property (name table &optional docstring) | 2714 | (defun define-char-code-property (name table &optional docstring) |
| @@ -2770,32 +2760,23 @@ See also the documentation of `get-char-code-property' and | |||
| 2770 | 2760 | ||
| 2771 | (defun get-char-code-property (char propname) | 2761 | (defun get-char-code-property (char propname) |
| 2772 | "Return the value of CHAR's PROPNAME property." | 2762 | "Return the value of CHAR's PROPNAME property." |
| 2773 | (let ((slot (assq propname char-code-property-alist))) | 2763 | (let ((table (unicode-property-table-internal propname))) |
| 2774 | (if slot | 2764 | (if table |
| 2775 | (let (table value func) | 2765 | (let ((func (char-table-extra-slot table 1))) |
| 2776 | (if (stringp (cdr slot)) | ||
| 2777 | (load (cdr slot) nil t)) | ||
| 2778 | (setq table (cdr slot) | ||
| 2779 | value (aref table char) | ||
| 2780 | func (char-table-extra-slot table 1)) | ||
| 2781 | (if (functionp func) | 2766 | (if (functionp func) |
| 2782 | (setq value (funcall func char value table))) | 2767 | (funcall func char (aref table char) table) |
| 2783 | value) | 2768 | (get-unicode-property-internal table char))) |
| 2784 | (plist-get (aref char-code-property-table char) propname)))) | 2769 | (plist-get (aref char-code-property-table char) propname)))) |
| 2785 | 2770 | ||
| 2786 | (defun put-char-code-property (char propname value) | 2771 | (defun put-char-code-property (char propname value) |
| 2787 | "Store CHAR's PROPNAME property with VALUE. | 2772 | "Store CHAR's PROPNAME property with VALUE. |
| 2788 | It can be retrieved with `(get-char-code-property CHAR PROPNAME)'." | 2773 | It can be retrieved with `(get-char-code-property CHAR PROPNAME)'." |
| 2789 | (let ((slot (assq propname char-code-property-alist))) | 2774 | (let ((table (unicode-property-table-internal propname))) |
| 2790 | (if slot | 2775 | (if table |
| 2791 | (let (table func) | 2776 | (let ((func (char-table-extra-slot table 2))) |
| 2792 | (if (stringp (cdr slot)) | ||
| 2793 | (load (cdr slot) nil t)) | ||
| 2794 | (setq table (cdr slot) | ||
| 2795 | func (char-table-extra-slot table 2)) | ||
| 2796 | (if (functionp func) | 2777 | (if (functionp func) |
| 2797 | (funcall func char value table) | 2778 | (funcall func char value table) |
| 2798 | (aset table char value))) | 2779 | (put-unicode-property-internal table char value))) |
| 2799 | (let* ((plist (aref char-code-property-table char)) | 2780 | (let* ((plist (aref char-code-property-table char)) |
| 2800 | (x (plist-put plist propname value))) | 2781 | (x (plist-put plist propname value))) |
| 2801 | (or (eq x plist) | 2782 | (or (eq x plist) |
| @@ -2805,13 +2786,9 @@ It can be retrieved with `(get-char-code-property CHAR PROPNAME)'." | |||
| 2805 | (defun char-code-property-description (prop value) | 2786 | (defun char-code-property-description (prop value) |
| 2806 | "Return a description string of character property PROP's value VALUE. | 2787 | "Return a description string of character property PROP's value VALUE. |
| 2807 | If there's no description string for VALUE, return nil." | 2788 | If there's no description string for VALUE, return nil." |
| 2808 | (let ((slot (assq prop char-code-property-alist))) | 2789 | (let ((table (unicode-property-table-internal prop))) |
| 2809 | (if slot | 2790 | (if table |
| 2810 | (let (table func) | 2791 | (let ((func (char-table-extra-slot table 3))) |
| 2811 | (if (stringp (cdr slot)) | ||
| 2812 | (load (cdr slot) nil t)) | ||
| 2813 | (setq table (cdr slot) | ||
| 2814 | func (char-table-extra-slot table 3)) | ||
| 2815 | (if (functionp func) | 2792 | (if (functionp func) |
| 2816 | (funcall func value)))))) | 2793 | (funcall func value)))))) |
| 2817 | 2794 | ||
diff --git a/lisp/international/uni-bidi.el b/lisp/international/uni-bidi.el index 9e571ef9d0d..e7682c6d8ff 100644 --- a/lisp/international/uni-bidi.el +++ b/lisp/international/uni-bidi.el | |||
| Binary files differ | |||
diff --git a/lisp/international/uni-category.el b/lisp/international/uni-category.el index 80538f7b416..a4455decc52 100644 --- a/lisp/international/uni-category.el +++ b/lisp/international/uni-category.el | |||
| Binary files differ | |||
diff --git a/lisp/international/uni-combining.el b/lisp/international/uni-combining.el index 2ee74d8b818..227b9d0af79 100644 --- a/lisp/international/uni-combining.el +++ b/lisp/international/uni-combining.el | |||
| Binary files differ | |||
diff --git a/lisp/international/uni-comment.el b/lisp/international/uni-comment.el index dcc717977c7..c9743064bd4 100644 --- a/lisp/international/uni-comment.el +++ b/lisp/international/uni-comment.el | |||
| Binary files differ | |||
diff --git a/lisp/international/uni-decimal.el b/lisp/international/uni-decimal.el index 22207a224b0..2c424ffb5de 100644 --- a/lisp/international/uni-decimal.el +++ b/lisp/international/uni-decimal.el | |||
| Binary files differ | |||
diff --git a/lisp/international/uni-decomposition.el b/lisp/international/uni-decomposition.el index f35bcebfed8..b0bf07bbe85 100644 --- a/lisp/international/uni-decomposition.el +++ b/lisp/international/uni-decomposition.el | |||
| Binary files differ | |||
diff --git a/lisp/international/uni-digit.el b/lisp/international/uni-digit.el index 692dea1edc8..fc52fd8c28c 100644 --- a/lisp/international/uni-digit.el +++ b/lisp/international/uni-digit.el | |||
| Binary files differ | |||
diff --git a/lisp/international/uni-lowercase.el b/lisp/international/uni-lowercase.el index 7cc601159f0..41890018204 100644 --- a/lisp/international/uni-lowercase.el +++ b/lisp/international/uni-lowercase.el | |||
| Binary files differ | |||
diff --git a/lisp/international/uni-mirrored.el b/lisp/international/uni-mirrored.el index 5129a93396d..006cf575591 100644 --- a/lisp/international/uni-mirrored.el +++ b/lisp/international/uni-mirrored.el | |||
| Binary files differ | |||
diff --git a/lisp/international/uni-name.el b/lisp/international/uni-name.el index 5b9e8323d21..7fac18b278d 100644 --- a/lisp/international/uni-name.el +++ b/lisp/international/uni-name.el | |||
| Binary files differ | |||
diff --git a/lisp/international/uni-numeric.el b/lisp/international/uni-numeric.el index 278ad683fe4..d16e8c00870 100644 --- a/lisp/international/uni-numeric.el +++ b/lisp/international/uni-numeric.el | |||
| Binary files differ | |||
diff --git a/lisp/international/uni-old-name.el b/lisp/international/uni-old-name.el index 2e283492408..4e704e5cdd0 100644 --- a/lisp/international/uni-old-name.el +++ b/lisp/international/uni-old-name.el | |||
| Binary files differ | |||
diff --git a/lisp/international/uni-titlecase.el b/lisp/international/uni-titlecase.el index 729a469d103..b8098c81876 100644 --- a/lisp/international/uni-titlecase.el +++ b/lisp/international/uni-titlecase.el | |||
| Binary files differ | |||
diff --git a/lisp/international/uni-uppercase.el b/lisp/international/uni-uppercase.el index 0714b14794f..899276eb725 100644 --- a/lisp/international/uni-uppercase.el +++ b/lisp/international/uni-uppercase.el | |||
| Binary files differ | |||
diff --git a/lisp/loadup.el b/lisp/loadup.el index 4c677523689..792827dd913 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el | |||
| @@ -123,11 +123,11 @@ | |||
| 123 | ;; multilingual text. | 123 | ;; multilingual text. |
| 124 | (load "international/mule-cmds") | 124 | (load "international/mule-cmds") |
| 125 | (load "case-table") | 125 | (load "case-table") |
| 126 | (load "international/characters") | ||
| 127 | (load "composite") | ||
| 128 | ;; This file doesn't exist when building a development version of Emacs | 126 | ;; This file doesn't exist when building a development version of Emacs |
| 129 | ;; from the repository. It is generated just after temacs is built. | 127 | ;; from the repository. It is generated just after temacs is built. |
| 130 | (load "international/charprop.el" t) | 128 | (load "international/charprop.el" t) |
| 129 | (load "international/characters") | ||
| 130 | (load "composite") | ||
| 131 | 131 | ||
| 132 | ;; Load language-specific files. | 132 | ;; Load language-specific files. |
| 133 | (load "language/chinese") | 133 | (load "language/chinese") |