]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix default values of character properties.
authorKenichi Handa <handa@m17n.org>
Tue, 23 Aug 2011 11:48:07 +0000 (20:48 +0900)
committerKenichi Handa <handa@m17n.org>
Tue, 23 Aug 2011 11:48:07 +0000 (20:48 +0900)
20 files changed:
admin/ChangeLog
admin/unidata/unidata-gen.el
lisp/ChangeLog
lisp/international/charprop.el
lisp/international/uni-bidi.el
lisp/international/uni-category.el
lisp/international/uni-combining.el
lisp/international/uni-comment.el
lisp/international/uni-decimal.el
lisp/international/uni-decomposition.el
lisp/international/uni-digit.el
lisp/international/uni-lowercase.el
lisp/international/uni-mirrored.el
lisp/international/uni-name.el
lisp/international/uni-numeric.el
lisp/international/uni-old-name.el
lisp/international/uni-titlecase.el
lisp/international/uni-uppercase.el
src/ChangeLog
src/chartab.c

index bc38edfc8d4d57f82ce5c761a0751611b16bf68d..f8eb071d96db1c27bafc254991d6f0894749ad6b 100644 (file)
@@ -1,3 +1,17 @@
+2011-08-23  Kenichi Handa  <handa@m17n.org>
+
+       * unidata/unidata-gen.el (unidata-prop-alist): Provide default
+       values for name, general-category, canonical-combining-class,
+       mirrored, and bidi-class.  Describe the meaning of value nil for
+       decimal-digit-value, digit-value, numeric-value, uppercase,
+       lowercase, titlecase, and mirroring.
+       (unidata-gen-table): Handle the case that default-value is a
+       list.  Set default values of characters not listed in a table.
+       (unidata-get-name): Return an empty string if a value in a
+       char-table is nil.
+       (unidata-get-decomposition): Return a list of character itself if
+       a value in a char-table is nil.
+
 2011-08-15  Eli Zaretskii  <eliz@gnu.org>
 
        * unidata/bidimirror.awk: File removed.
index ab1dcd134ac550a9c4bc2365e349681ad140edb5..03399eae213ce93c2317debb397c8b32f549ec49 100644 (file)
     (setq unidata-list (cdr table))))
 
 ;; Alist of this form:
-;;   (PROP INDEX GENERATOR FILENAME DOCSTRING DESCRIBER VAL-LIST)
+;;   (PROP INDEX GENERATOR FILENAME DOCSTRING DESCRIBER DEFAULT VAL-LIST)
 ;; PROP: character property
 ;; INDEX: index to each element of unidata-list for PROP.
 ;;   It may be a function that generates an alist of character codes
 ;; FILENAME: filename to store the char-table
 ;; DOCSTRING: docstring for the property
 ;; DESCRIBER: function to call to get a description string of property value
-;; DEFAULT: the default value of the property
+;; DEFAULT: the default value of the property.  It may have the form
+;;   (VAL0 (FROM1 TO1 VAL1) ...) which indicates that the default
+;;   value is VAL0 except for characters in the ranges specified by
+;;   FROMn and TOn (incusive).  The default value of characters
+;;   between FROMn and TOn is VALn.
 ;; VAL-LIST: list of specially ordered property values
 
 (defconst unidata-prop-alist
   '((name
      1 unidata-gen-table-name "uni-name.el"
      "Unicode character name.
-Property value is a string.")
+Property value is a string."
+     nil
+     "")
     (general-category
      2 unidata-gen-table-symbol "uni-category.el"
      "Unicode general category.
@@ -170,7 +176,7 @@ Property value is one of the following symbols:
   Lu, Ll, Lt, Lm, Lo, Mn, Mc, Me, Nd, Nl, No, Pc, Pd, Ps, Pe, Pi, Pf, Po,
   Sm, Sc, Sk, So, Zs, Zl, Zp, Cc, Cf, Cs, Co, Cn"
      unidata-describe-general-category
-     nil
+     Cn
      ;; The order of elements must be in sync with unicode_category_t
      ;; in src/character.h.
      (Lu Ll Lt Lm Lo Mn Mc Me Nd Nl No Pc Pd Ps Pe Pi Pf Po
@@ -179,7 +185,8 @@ Property value is one of the following symbols:
      3 unidata-gen-table-integer "uni-combining.el"
      "Unicode canonical combining class.
 Property value is an integer."
-     unidata-describe-canonical-combining-class)
+     unidata-describe-canonical-combining-class
+     0)
     (bidi-class
      4 unidata-gen-table-symbol "uni-bidi.el"
      "Unicode bidi class.
@@ -187,7 +194,8 @@ Property value is one of the following symbols:
   L, LRE, LRO, R, AL, RLE, RLO, PDF, EN, ES, ET,
   AN, CS, NSM, BN, B, S, WS, ON"
      unidata-describe-bidi-class
-     L
+     (L (#x0600 #x06FF AL) (#x0590 #x05FF R) (#x07C0 #x08FF R)
+       (#xFB1D #xFB4F R) (#x10800 #x10FFF R) (#x1E800 #x1EFFF R))
      ;; The order of elements must be in sync with bidi_type_t in
      ;; src/dispextern.h.
      (L R EN AN BN B AL LRE LRO RLE RLO PDF ES ET CS NSM S WS ON))
@@ -202,19 +210,24 @@ one of these symbols representing compatibility formatting tag:
     (decimal-digit-value
      6 unidata-gen-table-integer "uni-decimal.el"
      "Unicode numeric value (decimal digit).
-Property value is an integer.")
+Property value is an integer 0..9, or nil.
+The value nil stands for NaN \"Numeric_Value\".")
     (digit-value
      7 unidata-gen-table-integer "uni-digit.el"
      "Unicode numeric value (digit).
-Property value is an integer.")
+Property value is an integer 0..9, or nil.
+The value nil stands for NaN \"Numeric_Value\".")
     (numeric-value
      8 unidata-gen-table-numeric "uni-numeric.el"
      "Unicode numeric value (numeric).
-Property value is an integer or a floating point.")
+Property value is an integer, a floating point, or nil.
+The value nil stands for NaN \"Numeric_Value\".")
     (mirrored
      9 unidata-gen-table-symbol "uni-mirrored.el"
      "Unicode bidi mirrored flag.
-Property value is a symbol `Y' or `N'.  See also the property `mirroring'.")
+Property value is a symbol `Y' or `N'.  See also the property `mirroring'."
+     nil
+     N)
     (old-name
      10 unidata-gen-table-name "uni-old-name.el"
      "Unicode old names as published in Unicode 1.0.
@@ -226,23 +239,30 @@ Property value is a string.")
     (uppercase
      12 unidata-gen-table-character "uni-uppercase.el"
      "Unicode simple uppercase mapping.
-Property value is a character."
+Property value is a character or nil.
+The value nil means that the actual property value of a character
+is the character itself."
      string)
     (lowercase
      13 unidata-gen-table-character "uni-lowercase.el"
      "Unicode simple lowercase mapping.
-Property value is a character."
+Property value is a character or nil.
+The value nil means that the actual property value of a character
+is the character itself."
      string)
     (titlecase
      14 unidata-gen-table-character "uni-titlecase.el"
      "Unicode simple titlecase mapping.
-Property value is a character."
+Property value is a character or nil.
+The value nil means that the actual property value of a character
+is the character itself."
      string)
     (mirroring
      unidata-gen-mirroring-list unidata-gen-table-character "uni-mirrored.el"
      "Unicode bidi-mirroring characters.
-Property value is a character that has the corresponding mirroring image,
-or nil for non-mirrored character.")))
+Property value is a character that has the corresponding mirroring image or nil.
+The value nil means that the actual property value of a character
+is the character itself.")))
 
 ;; Functions to access the above data.
 (defsubst unidata-prop-index (prop) (nth 1 (assq prop unidata-prop-alist)))
@@ -393,9 +413,18 @@ or nil for non-mirrored character.")))
     (while tail
       (setcar tail (cons (car tail) val-code))
       (setq tail (cdr tail) val-code (1+ val-code)))
-    (setq default-value (unidata-encode-val val-list default-value))
-    (set-char-table-range table t default-value)
-    (set-char-table-range table nil default-value)
+    (if (consp default-value)
+       (setq default-value (copy-sequence default-value))
+      (setq default-value (list default-value)))
+    (setcar default-value
+           (unidata-encode-val val-list (car default-value)))
+    (set-char-table-range table t (car default-value))
+    (set-char-table-range table nil (car default-value))
+    (dolist (elm (cdr default-value))
+      (setcar (nthcdr 2 elm)
+             (unidata-encode-val val-list (nth 2 elm)))
+      (set-char-table-range table (cons (car elm) (nth 1 elm)) (nth 2 elm)))
+
     (setq tail unidata-list)
     (while tail
       (setq elt (car tail) tail (cdr tail))
@@ -419,17 +448,27 @@ or nil for non-mirrored character.")))
                (setq prev-range-data (cons (cons from to) val-code)))))
        (let* ((start (lsh (lsh range -7) 7))
               (limit (+ start 127))
-              str count new-val)
-         (fillarray vec 0)
-         ;; See the comment above.
-         (when (and prev-range-data
-                    (>= (cdr (car prev-range-data)) start))
-           (let ((from (car (car prev-range-data)))
-                 (to (cdr (car prev-range-data)))
-                 (vcode (cdr prev-range-data)))
+              str count new-val from to vcode)
+         (fillarray vec (car default-value))
+         (dolist (elm (cdr default-value))
+           (setq from (car elm) to (nth 1 elm))
+           (when (and (<= from limit)
+                      (or (>= from start) (>= to start)))
+             (setq from (max from start)
+                   to (min to limit)
+                   vcode (nth 2 elm))
              (while (<= from to)
                (aset vec (- from start) vcode)
                (setq from (1+ from)))))
+         ;; See the comment above.
+         (when (and prev-range-data
+                    (>= (cdr (car prev-range-data)) start))
+           (setq from (car (car prev-range-data))
+                 to (cdr (car prev-range-data))
+                 vcode (cdr prev-range-data))
+           (while (<= from to)
+             (aset vec (- from start) vcode)
+             (setq from (1+ from))))
          (setq prev-range-data nil)
          (if val-code
              (aset vec (- range start) val-code))
@@ -669,7 +708,7 @@ or nil for non-mirrored character.")))
            (aset table c name)
            (if (= c char)
                (setq val name))))
-       val)))
+       (or val ""))))
 
    ((and (integerp val) (> val 0))
     (let* ((symbol-table (aref (char-table-extra-slot table 4) 1))
@@ -695,7 +734,9 @@ or nil for non-mirrored character.")))
            ((eq sym 'CJK\ COMPATIBILITY\ IDEOGRAPH)
             (format "%s-%04X" sym char))
            ((eq sym 'VARIATION\ SELECTOR)
-            (format "%s-%d" sym (+ (- char #xe0100) 17))))))))
+            (format "%s-%d" sym (+ (- char #xe0100) 17))))))
+
+   (t "")))
 
 ;; Store VAL as the name of CHAR in TABLE.
 
@@ -707,6 +748,9 @@ or nil for non-mirrored character.")))
 
 (defun unidata-get-decomposition (char val table)
   (cond
+   ((not val)
+    (list char))
+
    ((consp val)
     val)
 
@@ -747,7 +791,8 @@ or nil for non-mirrored character.")))
            (aset vec idx (nconc word-list tail-list)))
        (dotimes (i 128)
          (aset table (+ first-char i) (aref vec i)))
-       (aref vec (- char first-char)))))
+       (setq val (aref vec (- char first-char)))
+       (or val (list char)))))
 
    ;; Hangul syllable
    ((and (eq val 0) (>= char #xAC00) (<= char #xD7A3))
index 38c536af62c051b99e69376e8090c4d0f05bb9e6..37fc5eb1a28218696e2a5d02d9571fc9490b3114 100644 (file)
@@ -1,3 +1,21 @@
+2011-08-23  Kenichi Handa  <handa@m17n.org>
+
+       * international/charprop.el:
+       * international/uni-bidi.el:
+       * international/uni-category.el:
+       * international/uni-combining.el:
+       * international/uni-comment.el:
+       * international/uni-decimal.el:
+       * international/uni-decomposition.el:
+       * international/uni-digit.el:
+       * international/uni-lowercase.el:
+       * international/uni-mirrored.el:
+       * international/uni-name.el:
+       * international/uni-numeric.el:
+       * international/uni-old-name.el:
+       * international/uni-titlecase.el:
+       * international/uni-uppercase.el: Regenerate.
+
 2011-08-18  Chong Yidong  <cyd@stupidchicken.com>
 
        * international/characters.el: Add L and R categories.
index 919666010b1532079769a3ba32f3de21cbe9246d..2424e87ae4472a182be52b76a6efd957b2cf8506 100644 (file)
@@ -29,15 +29,18 @@ one of these symbols representing compatibility formatting tag:
 ;; FILE: uni-decimal.el
 (define-char-code-property 'decimal-digit-value "uni-decimal.el"
   "Unicode numeric value (decimal digit).
-Property value is an integer.")
+Property value is an integer 0..9, or nil.
+The value nil stands for NaN \"Numeric_Value\".")
 ;; FILE: uni-digit.el
 (define-char-code-property 'digit-value "uni-digit.el"
   "Unicode numeric value (digit).
-Property value is an integer.")
+Property value is an integer 0..9, or nil.
+The value nil stands for NaN \"Numeric_Value\".")
 ;; FILE: uni-numeric.el
 (define-char-code-property 'numeric-value "uni-numeric.el"
   "Unicode numeric value (numeric).
-Property value is an integer or a floating point.")
+Property value is an integer, a floating point, or nil.
+The value nil stands for NaN \"Numeric_Value\".")
 ;; FILE: uni-mirrored.el
 (define-char-code-property 'mirrored "uni-mirrored.el"
   "Unicode bidi mirrored flag.
@@ -53,20 +56,27 @@ Property value is a string.")
 ;; FILE: uni-uppercase.el
 (define-char-code-property 'uppercase "uni-uppercase.el"
   "Unicode simple uppercase mapping.
-Property value is a character.")
+Property value is a character or nil.
+The value nil means that the actual property value of a character
+is the character itself.")
 ;; FILE: uni-lowercase.el
 (define-char-code-property 'lowercase "uni-lowercase.el"
   "Unicode simple lowercase mapping.
-Property value is a character.")
+Property value is a character or nil.
+The value nil means that the actual property value of a character
+is the character itself.")
 ;; FILE: uni-titlecase.el
 (define-char-code-property 'titlecase "uni-titlecase.el"
   "Unicode simple titlecase mapping.
-Property value is a character.")
+Property value is a character or nil.
+The value nil means that the actual property value of a character
+is the character itself.")
 ;; FILE: uni-mirrored.el
 (define-char-code-property 'mirroring "uni-mirrored.el"
   "Unicode bidi-mirroring characters.
-Property value is a character that has the corresponding mirroring image,
-or nil for non-mirrored character.")
+Property value is a character that has the corresponding mirroring image or nil.
+The value nil means that the actual property value of a character
+is the character itself.")
 ;; Local Variables:
 ;; coding: utf-8
 ;; no-byte-compile: t
index e7682c6d8ffca6a2c50a63bff9ecac7beea60f8f..9fa7b53b50873adcf2df6fb4b87cd0ce4770c52d 100644 (file)
Binary files a/lisp/international/uni-bidi.el and b/lisp/international/uni-bidi.el differ
index a4455decc5292b66a0f9ccb773dbb4227d7335a0..94b7c18b6e2f99a8be1aac32cd9f2eba9f187679 100644 (file)
Binary files a/lisp/international/uni-category.el and b/lisp/international/uni-category.el differ
index 227b9d0af79bdce4a97728e4838bed5d69fcd978..1437ff9acbd88a1036df3dc0de61b0f21a503785 100644 (file)
Binary files a/lisp/international/uni-combining.el and b/lisp/international/uni-combining.el differ
index c9743064bd4751703bdd5e1a27e84305743e0f5f..21ccfe3ffe796615789e624a8dff14f3d24e2dd0 100644 (file)
Binary files a/lisp/international/uni-comment.el and b/lisp/international/uni-comment.el differ
index 2c424ffb5ded901d92b381119a6f1ad3386c9617..096257add209bbb8d16621e3f7451b12fb2865d7 100644 (file)
Binary files a/lisp/international/uni-decimal.el and b/lisp/international/uni-decimal.el differ
index b0bf07bbe857c03aa47b689fbf30596df437d15c..b9660cdab0aa2724492461cbf7414e9e80e5d24f 100644 (file)
Binary files a/lisp/international/uni-decomposition.el and b/lisp/international/uni-decomposition.el differ
index fc52fd8c28cdaceb2ffc58a845b9606b588ac12d..efb78b0e43dd04993b15f2adfb604bf732ca2249 100644 (file)
Binary files a/lisp/international/uni-digit.el and b/lisp/international/uni-digit.el differ
index 41890018204a9776df7cb6551c78bf4f88f98004..7afd9503cb3e84cab181fbb14bcb908460f46049 100644 (file)
Binary files a/lisp/international/uni-lowercase.el and b/lisp/international/uni-lowercase.el differ
index 006cf575591a146a5b0ce5121703c445e3979644..e650166c24c23f60a327a9d0462d5b44a9a56fd0 100644 (file)
Binary files a/lisp/international/uni-mirrored.el and b/lisp/international/uni-mirrored.el differ
index 7fac18b278d1c25b3c88f1581417355d3ad52fd0..8b6816310672556fb0205b845f2f71fc6edbcd7e 100644 (file)
Binary files a/lisp/international/uni-name.el and b/lisp/international/uni-name.el differ
index d16e8c00870fdfae6023e3fd220ccd50152b2287..a1865f1fb233ddfcf21848c56a60edfb5cb6d8a2 100644 (file)
Binary files a/lisp/international/uni-numeric.el and b/lisp/international/uni-numeric.el differ
index 4e704e5cdd0676d3c291521d3062d34fa444e1ce..de2d67b9450eb80f6203f5f09bf8e632fc63db95 100644 (file)
Binary files a/lisp/international/uni-old-name.el and b/lisp/international/uni-old-name.el differ
index b8098c818763cc523766c49600b26ea951afdc67..517edb20445e18a87ab8186e98a7e932295f9b41 100644 (file)
Binary files a/lisp/international/uni-titlecase.el and b/lisp/international/uni-titlecase.el differ
index 899276eb7253f308cbd481036771465c1d1aad64..fcb22d72470964a719b6039f6fdcf74931eec737 100644 (file)
Binary files a/lisp/international/uni-uppercase.el and b/lisp/international/uni-uppercase.el differ
index 85a55b2b7c93d61873c22b4987bb9c03df3ea335..5b4e0023ac647ad37bd37f233e8da2e89a58f758 100644 (file)
@@ -1,3 +1,8 @@
+2011-08-22  Kenichi Handa  <handa@m17n.org>
+
+       * chartab.c (Fset_char_table_extra_slot): Do not inhibit setting a
+       extra slot even if the purpose is char-code-property-table.
+
 2011-08-19  Eli Zaretskii  <eliz@gnu.org>
 
        * xfaces.c (face_at_buffer_position): Avoid repeated evaluation of
index 0cabaac4cf5569e1d3cb2759277c2ab5acf140fa..1d4ac04312a0397ae94b6ca1d1cc88d72934db29 100644 (file)
@@ -589,8 +589,6 @@ DEFUN ("set-char-table-extra-slot", Fset_char_table_extra_slot,
   (Lisp_Object char_table, Lisp_Object n, Lisp_Object value)
 {
   CHECK_CHAR_TABLE (char_table);
-  if (EQ (XCHAR_TABLE (char_table)->purpose, Qchar_code_property_table))
-    error ("Can't change extra-slot of char-code-property-table");
   CHECK_NUMBER (n);
   if (XINT (n) < 0
       || XINT (n) >= CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (char_table)))