diff options
| author | Eli Zaretskii | 2013-12-04 18:58:05 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2013-12-04 18:58:05 +0200 |
| commit | ad82612405604b7d20d86fe6b3283f91bee5e60a (patch) | |
| tree | 569b5c2c0e1e57df688bcde545d6bdf77711fdb3 /admin | |
| parent | 456760a5b4595b84f230e527ab148d296e7f8252 (diff) | |
| download | emacs-ad82612405604b7d20d86fe6b3283f91bee5e60a.tar.gz emacs-ad82612405604b7d20d86fe6b3283f91bee5e60a.zip | |
Fix bug #16043 with crashes when displaying new bidi control characters.
src/bidi.c (bidi_get_type, bidi_get_category): Handle the isolate
directional control characters. Update type and category
determination according to the UBA from Unicode v6.3.
(bidi_category_t): New category EXPLICIT_FORMATTING.
src/dispextern.h (bidi_type_t): Update to include new bidirectional
properties introduced with Unicode v6.3.
admin/unidata/unidata-gen.el (unidata-prop-alist): Update bidi-class
to include the new isolate-related classes introduced with Unicode
v6.3.
(unidata-encode-val): Accept an additional optional argument, a
warning message to emit when UnicodeData.txt defines bidi-class
values that are not in unidata-prop-alist. Add a comment
explaining what should maintainers do if/when such a warning ever
appears.
(unidata-gen-table): Call unidata-encode-val with 3rd arg non-nil
when generating uni-bidi.el.
Diffstat (limited to 'admin')
| -rw-r--r-- | admin/ChangeLog | 13 | ||||
| -rw-r--r-- | admin/unidata/unidata-gen.el | 32 |
2 files changed, 39 insertions, 6 deletions
diff --git a/admin/ChangeLog b/admin/ChangeLog index 7d23542a84e..730253e616f 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2013-12-04 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * unidata/unidata-gen.el (unidata-prop-alist): Update bidi-class | ||
| 4 | to include the new isolate-related classes introduced with Unicode | ||
| 5 | v6.3. | ||
| 6 | (unidata-encode-val): Accept an additional optional argument, a | ||
| 7 | warning message to emit when UnicodeData.txt defines bidi-class | ||
| 8 | values that are not in unidata-prop-alist. Add a comment | ||
| 9 | explaining what should maintainers do if/when such a warning ever | ||
| 10 | appears. | ||
| 11 | (unidata-gen-table): Call unidata-encode-val with 3rd arg non-nil | ||
| 12 | when generating uni-bidi.el. | ||
| 13 | |||
| 1 | 2013-12-01 Glenn Morris <rgm@gnu.org> | 14 | 2013-12-01 Glenn Morris <rgm@gnu.org> |
| 2 | 15 | ||
| 3 | * unidata/Makefile.in (${DSTDIR}/charprop.el): | 16 | * unidata/Makefile.in (${DSTDIR}/charprop.el): |
diff --git a/admin/unidata/unidata-gen.el b/admin/unidata/unidata-gen.el index 42e1cc0bc3c..fa8f81636e3 100644 --- a/admin/unidata/unidata-gen.el +++ b/admin/unidata/unidata-gen.el | |||
| @@ -194,8 +194,8 @@ Property value is an integer." | |||
| 194 | 4 unidata-gen-table-symbol "uni-bidi.el" | 194 | 4 unidata-gen-table-symbol "uni-bidi.el" |
| 195 | "Unicode bidi class. | 195 | "Unicode bidi class. |
| 196 | Property value is one of the following symbols: | 196 | Property value is one of the following symbols: |
| 197 | L, LRE, LRO, R, AL, RLE, RLO, PDF, EN, ES, ET, | 197 | L, LRE, LRO, LRI, R, AL, RLE, RLO, RLI, FSI, PDF, PDI, |
| 198 | AN, CS, NSM, BN, B, S, WS, ON" | 198 | EN, ES, ET, AN, CS, NSM, BN, B, S, WS, ON" |
| 199 | unidata-describe-bidi-class | 199 | unidata-describe-bidi-class |
| 200 | ;; The assignment of default values to blocks of code points | 200 | ;; The assignment of default values to blocks of code points |
| 201 | ;; follows the file DerivedBidiClass.txt from the Unicode | 201 | ;; follows the file DerivedBidiClass.txt from the Unicode |
| @@ -205,7 +205,8 @@ Property value is one of the following symbols: | |||
| 205 | (#xFB1D #xFB4F R) (#x10800 #x10FFF R) (#x1E800 #x1EFFF R)) | 205 | (#xFB1D #xFB4F R) (#x10800 #x10FFF R) (#x1E800 #x1EFFF R)) |
| 206 | ;; The order of elements must be in sync with bidi_type_t in | 206 | ;; The order of elements must be in sync with bidi_type_t in |
| 207 | ;; src/dispextern.h. | 207 | ;; src/dispextern.h. |
| 208 | (L R EN AN BN B AL LRE LRO RLE RLO PDF ES ET CS NSM S WS ON)) | 208 | (L R EN AN BN B AL LRE LRO RLE RLO PDF LRI RLI FSI PDI |
| 209 | ES ET CS NSM S WS ON)) | ||
| 209 | (decomposition | 210 | (decomposition |
| 210 | 5 unidata-gen-table-decomposition "uni-decomposition.el" | 211 | 5 unidata-gen-table-decomposition "uni-decomposition.el" |
| 211 | "Unicode decomposition mapping. | 212 | "Unicode decomposition mapping. |
| @@ -397,12 +398,17 @@ is the character itself."))) | |||
| 397 | ;; If VAL is one of VALn, just return n. | 398 | ;; If VAL is one of VALn, just return n. |
| 398 | ;; Otherwise, VAL-LIST is modified to this: | 399 | ;; Otherwise, VAL-LIST is modified to this: |
| 399 | ;; ((nil . 0) (VAL1 . 1) (VAL2 . 2) ... (VAL . n+1)) | 400 | ;; ((nil . 0) (VAL1 . 1) (VAL2 . 2) ... (VAL . n+1)) |
| 401 | ;; | ||
| 402 | ;; WARN is an optional warning to display when the value list is | ||
| 403 | ;; extended, for property values that need to be in sync with other | ||
| 404 | ;; parts of Emacs; currently only used for bidi-class. | ||
| 400 | 405 | ||
| 401 | (defun unidata-encode-val (val-list val) | 406 | (defun unidata-encode-val (val-list val &optional warn) |
| 402 | (let ((slot (assoc val val-list)) | 407 | (let ((slot (assoc val val-list)) |
| 403 | val-code) | 408 | val-code) |
| 404 | (if slot | 409 | (if slot |
| 405 | (cdr slot) | 410 | (cdr slot) |
| 411 | (if warn (message warn val)) | ||
| 406 | (setq val-code (length val-list)) | 412 | (setq val-code (length val-list)) |
| 407 | (nconc val-list (list (cons val val-code))) | 413 | (nconc val-list (list (cons val val-code))) |
| 408 | val-code))) | 414 | val-code))) |
| @@ -413,6 +419,16 @@ is the character itself."))) | |||
| 413 | (let ((table (make-char-table 'char-code-property-table)) | 419 | (let ((table (make-char-table 'char-code-property-table)) |
| 414 | (prop-idx (unidata-prop-index prop)) | 420 | (prop-idx (unidata-prop-index prop)) |
| 415 | (vec (make-vector 128 0)) | 421 | (vec (make-vector 128 0)) |
| 422 | ;; When this warning is printed, there's a need to make the | ||
| 423 | ;; following changes: | ||
| 424 | ;; (1) update unidata-prop-alist with the new bidi-class values; | ||
| 425 | ;; (2) extend bidi_type_t enumeration on src/dispextern.h to | ||
| 426 | ;; include the new classes; | ||
| 427 | ;; (3) possibly update the assertion in bidi.c:bidi_check_type; and | ||
| 428 | ;; (4) possibly update the switch cases in | ||
| 429 | ;; bidi.c:bidi_get_type and bidi.c:bidi_get_category. | ||
| 430 | (bidi-warning "\ | ||
| 431 | ** Found new bidi-class '%s', please update bidi.c and dispextern.h") | ||
| 416 | tail elt range val val-code idx slot | 432 | tail elt range val val-code idx slot |
| 417 | prev-range-data) | 433 | prev-range-data) |
| 418 | (setq val-list (cons nil (copy-sequence val-list))) | 434 | (setq val-list (cons nil (copy-sequence val-list))) |
| @@ -438,7 +454,9 @@ is the character itself."))) | |||
| 438 | (setq elt (car tail) tail (cdr tail)) | 454 | (setq elt (car tail) tail (cdr tail)) |
| 439 | (setq range (car elt) | 455 | (setq range (car elt) |
| 440 | val (funcall val-func (nth prop-idx elt))) | 456 | val (funcall val-func (nth prop-idx elt))) |
| 441 | (setq val-code (if val (unidata-encode-val val-list val))) | 457 | (setq val-code (if val (unidata-encode-val val-list val |
| 458 | (and (eq prop 'bidi-class) | ||
| 459 | bidi-warning)))) | ||
| 442 | (if (consp range) | 460 | (if (consp range) |
| 443 | (when val-code | 461 | (when val-code |
| 444 | (set-char-table-range table range val-code) | 462 | (set-char-table-range table range val-code) |
| @@ -486,7 +504,9 @@ is the character itself."))) | |||
| 486 | (setq new-val (funcall val-func (nth prop-idx elt))) | 504 | (setq new-val (funcall val-func (nth prop-idx elt))) |
| 487 | (if (not (eq val new-val)) | 505 | (if (not (eq val new-val)) |
| 488 | (setq val new-val | 506 | (setq val new-val |
| 489 | val-code (if val (unidata-encode-val val-list val)))) | 507 | val-code (if val (unidata-encode-val |
| 508 | val-list val (and (eq prop 'bidi-class) | ||
| 509 | bidi-warning))))) | ||
| 490 | (if val-code | 510 | (if val-code |
| 491 | (aset vec (- range start) val-code)) | 511 | (aset vec (- range start) val-code)) |
| 492 | (setq tail (cdr tail))) | 512 | (setq tail (cdr tail))) |