diff options
| author | Eli Zaretskii | 2014-10-15 17:11:25 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2014-10-15 17:11:25 +0300 |
| commit | ed7ebd933a5294e0f27cb49268e7b6376de36648 (patch) | |
| tree | 90256953a29fa18f4cfb3945a6491567f8a8a6d0 /admin | |
| parent | 0b4d6d30be2822df7d6b086bbab32b8ff419ed5d (diff) | |
| parent | b8ec977659df3970a6c8afb7a5b79c9b61e08307 (diff) | |
| download | emacs-ed7ebd933a5294e0f27cb49268e7b6376de36648.tar.gz emacs-ed7ebd933a5294e0f27cb49268e7b6376de36648.zip | |
Update the bidirectional reordering engine for Unicode 6.3 and 7.0.
src/bidi.c (bidi_ignore_explicit_marks_for_paragraph_level): Remove
variable.
(bidi_get_type): Return the isolate initiators and terminator
types.
(bidi_isolate_fmt_char, bidi_paired_bracket_type)
(bidi_fetch_char_skip_isolates, find_first_strong_char)
(bidi_find_bracket_pairs, bidi_resolve_brackets): New functions.
(bidi_set_sos_type): Renamed from bidi_set_sor_type and updated
for the new features.
(bidi_push_embedding_level, bidi_pop_embedding_level): Update to
push and pop correctly for isolates.
(bidi_remember_char): Modified to accept an additional argument
and record the bidi type according to its value.
(bidi_cache_iterator_state): Accept an additional argument to only
update an existing state. Handle the new members of struct bidi_it.
(bidi_cache_find): Arguments changed: no lnger accepts a level,
instead accepts a flag telling it whether it is okay to return
unresolved neutrals.
(bidi_initialize): Initiate and staticpro the bracket-type uniprop
table. Initialize new isolate-related members.
(bidi_paragraph_init): Some code factored out into
find_first_strong_char.
(bidi_resolve_explicit_1): Function deleted, its code incorporated
into bidi_resolve_explicit.
(bidi_resolve_explicit): Support the isolate initiators and
terminator. Fix handling of embeddings and overrides according to
new UBA requirements. Record information about previously seen
characters here (moved from bidi_level_of_next_char).
(bidi_resolve_weak): Adapt to changes in struct members.
(FLAG_EMBEDDING_INSIDE, FLAG_OPPOSITE_INSIDE, MAX_BPA_STACK)
(STORE_BRACKET_CHARPOS, PUSH_BPA_STACK): New macros.
(bidi_resolve_neutral): Call bidi_resolve_brackets to handle the
paired bracket resolution. Handle isolate initiators and
terminator.
(bidi_type_of_next_char): Remove unneeded code for BN limit.
(bidi_level_of_next_char): Move the code that records information
about previous characters to bidi_resolve_explicit. Fix logic of
resolving neutrals and make sure their cache entries are updated.
Remove now unneeded special handling of PDF level.
src/dispextern.h (struct glyph): Enlarge the width of resolved_level.
(BIDI_MAXDEPTH): New macro, renamed from BIDI_MAXLEVEL and
enlarged per Unicode 6.3.
(enum bidi_bracket_type_t): New data type.
(struct bidi_saved_info): Leave only 2 type members out of 4.
Remove bytepos.
(struct bidi_stack): Add members necessary to support isolating
sequences.
(struct bidi_it): Add new members necessary to support isolating
sequences and bracket pair resolution.
src/xdisp.c (Fbidi_resolved_levels): New function.
(syms_of_xdisp): Defsubr it.
(append_glyph, append_composite_glyph, produce_image_glyph)
(append_stretch_glyph, append_glyphless_glyph): Convert aborts to
assertions.
(syms_of_xdisp) <inhibit-bidi-mirroring>: New variable.
src/term.c (append_glyph, append_composite_glyph)
(append_glyphless_glyph): Convert aborts to assertions.
src/.gdbinit (pgx): Display the character codepoint, resolved level,
and bidi type also for glyphless glyphs.
lisp/simple.el (what-cursor-position): Update to support the new bidi
characters.
lisp/descr-text.el (describe-char): Update to support the new bidi
characters.
admin/unidata/unidata-gen.el (unidata-prop-alist): New properties
'paired-bracket' and 'bracket-type', in support of the UBA 6.3.
(unidata-gen-table): Support PROP-IDX being a function.
(unidata-describe-bidi-bracket-type, unidata-gen-brackets-list)
(unidata-gen-bracket-type-list): New functions.
(unidata-check): Support checking the 'bracket-type' attribute.
(unidata-gen-files): Don't create backups for uni-*.el files.
admin/unidata/Makefile.in (${unidir}/charprop.el): Depend on
BidiMirroring.txt and BidiBrackets.txt.
admin/unidata/BidiBrackets.txt: New file, from Unicode.
etc/NEWS: Mention the UBA implementation update.
etc/HELLO: Remove now unneeded directional control characters.
doc/lispref/nonascii.texi (Character Properties): Document the new
properties 'bracket-type' and 'paired-bracket'.
doc/lisprefdisplay.texi (Bidirectional Display): Update the version of the
UBA to which we are conforming.
test/BidiCharacterTest.txt: New file, from Unicode.
test/biditest.el: New file.
Diffstat (limited to 'admin')
| -rw-r--r-- | admin/ChangeLog | 15 | ||||
| -rw-r--r-- | admin/unidata/BidiBrackets.txt | 176 | ||||
| -rw-r--r-- | admin/unidata/Makefile.in | 4 | ||||
| -rw-r--r-- | admin/unidata/unidata-gen.el | 69 |
4 files changed, 259 insertions, 5 deletions
diff --git a/admin/ChangeLog b/admin/ChangeLog index f3d6d048e21..e9fc535454b 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog | |||
| @@ -1,3 +1,18 @@ | |||
| 1 | 2014-10-15 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * unidata/unidata-gen.el (unidata-prop-alist): New properties | ||
| 4 | 'paired-bracket' and 'bracket-type', in support of the UBA 6.3. | ||
| 5 | (unidata-gen-table): Support PROP-IDX being a function. | ||
| 6 | (unidata-describe-bidi-bracket-type, unidata-gen-brackets-list) | ||
| 7 | (unidata-gen-bracket-type-list): New functions. | ||
| 8 | (unidata-check): Support checking the 'bracket-type' attribute. | ||
| 9 | (unidata-gen-files): Don't create backups for uni-*.el files. | ||
| 10 | |||
| 11 | * unidata/Makefile.in (${unidir}/charprop.el): Depend on | ||
| 12 | BidiMirroring.txt and BidiBrackets.txt. | ||
| 13 | |||
| 14 | * unidata/BidiBrackets.txt: New file, from Unicode. | ||
| 15 | |||
| 1 | 2014-10-13 Glenn Morris <rgm@gnu.org> | 16 | 2014-10-13 Glenn Morris <rgm@gnu.org> |
| 2 | 17 | ||
| 3 | * authors.el (authors-aliases, authors-fixed-case) | 18 | * authors.el (authors-aliases, authors-fixed-case) |
diff --git a/admin/unidata/BidiBrackets.txt b/admin/unidata/BidiBrackets.txt new file mode 100644 index 00000000000..2a0cc0c7a69 --- /dev/null +++ b/admin/unidata/BidiBrackets.txt | |||
| @@ -0,0 +1,176 @@ | |||
| 1 | # BidiBrackets-7.0.0.txt | ||
| 2 | # Date: 2014-01-21, 02:30:00 GMT [AG, LI, KW] | ||
| 3 | # | ||
| 4 | # Bidi_Paired_Bracket and Bidi_Paired_Bracket_Type Properties | ||
| 5 | # | ||
| 6 | # This file is a normative contributory data file in the Unicode | ||
| 7 | # Character Database. | ||
| 8 | # | ||
| 9 | # Copyright (c) 1991-2014 Unicode, Inc. | ||
| 10 | # For terms of use, see http://www.unicode.org/terms_of_use.html | ||
| 11 | # | ||
| 12 | # Bidi_Paired_Bracket is a normative property of type Miscellaneous, | ||
| 13 | # which establishes a mapping between characters that are treated as | ||
| 14 | # bracket pairs by the Unicode Bidirectional Algorithm. | ||
| 15 | # | ||
| 16 | # Bidi_Paired_Bracket_Type is a normative property of type Enumeration, | ||
| 17 | # which classifies characters into opening and closing paired brackets | ||
| 18 | # for the purposes of the Unicode Bidirectional Algorithm. | ||
| 19 | # | ||
| 20 | # This file lists the set of code points with Bidi_Paired_Bracket_Type | ||
| 21 | # property values Open and Close. The set is derived from the character | ||
| 22 | # properties General_Category (gc), Bidi_Class (bc), Bidi_Mirrored (Bidi_M), | ||
| 23 | # and Bidi_Mirroring_Glyph (bmg), as follows: two characters, A and B, | ||
| 24 | # form a bracket pair if A has gc=Ps and B has gc=Pe, both have bc=ON and | ||
| 25 | # Bidi_M=Y, and bmg of A is B. Bidi_Paired_Bracket (bpb) maps A to B and | ||
| 26 | # vice versa, and their Bidi_Paired_Bracket_Type (bpt) property values are | ||
| 27 | # Open (o) and Close (c), respectively. | ||
| 28 | # | ||
| 29 | # For legacy reasons, the characters U+FD3E ORNATE LEFT PARENTHESIS and | ||
| 30 | # U+FD3F ORNATE RIGHT PARENTHESIS do not mirror in bidirectional display | ||
| 31 | # and therefore do not form a bracket pair. | ||
| 32 | # | ||
| 33 | # The Unicode property value stability policy guarantees that characters | ||
| 34 | # which have bpt=o or bpt=c also have bc=ON and Bidi_M=Y. As a result, an | ||
| 35 | # implementation can optimize the lookup of the Bidi_Paired_Bracket_Type | ||
| 36 | # property values Open and Close by restricting the processing to characters | ||
| 37 | # with bc=ON. | ||
| 38 | # | ||
| 39 | # The format of the file is three fields separated by a semicolon. | ||
| 40 | # Field 0: Unicode code point value, represented as a hexadecimal value | ||
| 41 | # Field 1: Bidi_Paired_Bracket property value, a code point value or <none> | ||
| 42 | # Field 2: Bidi_Paired_Bracket_Type property value, one of the following: | ||
| 43 | # o Open | ||
| 44 | # c Close | ||
| 45 | # n None | ||
| 46 | # The names of the characters in field 0 are given in comments at the end | ||
| 47 | # of each line. | ||
| 48 | # | ||
| 49 | # For information on bidirectional paired brackets, see UAX #9: Unicode | ||
| 50 | # Bidirectional Algorithm, at http://www.unicode.org/unicode/reports/tr9/ | ||
| 51 | # | ||
| 52 | # This file was originally created by Andrew Glass and Laurentiu Iancu | ||
| 53 | # for Unicode 6.3. | ||
| 54 | |||
| 55 | 0028; 0029; o # LEFT PARENTHESIS | ||
| 56 | 0029; 0028; c # RIGHT PARENTHESIS | ||
| 57 | 005B; 005D; o # LEFT SQUARE BRACKET | ||
| 58 | 005D; 005B; c # RIGHT SQUARE BRACKET | ||
| 59 | 007B; 007D; o # LEFT CURLY BRACKET | ||
| 60 | 007D; 007B; c # RIGHT CURLY BRACKET | ||
| 61 | 0F3A; 0F3B; o # TIBETAN MARK GUG RTAGS GYON | ||
| 62 | 0F3B; 0F3A; c # TIBETAN MARK GUG RTAGS GYAS | ||
| 63 | 0F3C; 0F3D; o # TIBETAN MARK ANG KHANG GYON | ||
| 64 | 0F3D; 0F3C; c # TIBETAN MARK ANG KHANG GYAS | ||
| 65 | 169B; 169C; o # OGHAM FEATHER MARK | ||
| 66 | 169C; 169B; c # OGHAM REVERSED FEATHER MARK | ||
| 67 | 2045; 2046; o # LEFT SQUARE BRACKET WITH QUILL | ||
| 68 | 2046; 2045; c # RIGHT SQUARE BRACKET WITH QUILL | ||
| 69 | 207D; 207E; o # SUPERSCRIPT LEFT PARENTHESIS | ||
| 70 | 207E; 207D; c # SUPERSCRIPT RIGHT PARENTHESIS | ||
| 71 | 208D; 208E; o # SUBSCRIPT LEFT PARENTHESIS | ||
| 72 | 208E; 208D; c # SUBSCRIPT RIGHT PARENTHESIS | ||
| 73 | 2308; 2309; o # LEFT CEILING | ||
| 74 | 2309; 2308; c # RIGHT CEILING | ||
| 75 | 230A; 230B; o # LEFT FLOOR | ||
| 76 | 230B; 230A; c # RIGHT FLOOR | ||
| 77 | 2329; 232A; o # LEFT-POINTING ANGLE BRACKET | ||
| 78 | 232A; 2329; c # RIGHT-POINTING ANGLE BRACKET | ||
| 79 | 2768; 2769; o # MEDIUM LEFT PARENTHESIS ORNAMENT | ||
| 80 | 2769; 2768; c # MEDIUM RIGHT PARENTHESIS ORNAMENT | ||
| 81 | 276A; 276B; o # MEDIUM FLATTENED LEFT PARENTHESIS ORNAMENT | ||
| 82 | 276B; 276A; c # MEDIUM FLATTENED RIGHT PARENTHESIS ORNAMENT | ||
| 83 | 276C; 276D; o # MEDIUM LEFT-POINTING ANGLE BRACKET ORNAMENT | ||
| 84 | 276D; 276C; c # MEDIUM RIGHT-POINTING ANGLE BRACKET ORNAMENT | ||
| 85 | 276E; 276F; o # HEAVY LEFT-POINTING ANGLE QUOTATION MARK ORNAMENT | ||
| 86 | 276F; 276E; c # HEAVY RIGHT-POINTING ANGLE QUOTATION MARK ORNAMENT | ||
| 87 | 2770; 2771; o # HEAVY LEFT-POINTING ANGLE BRACKET ORNAMENT | ||
| 88 | 2771; 2770; c # HEAVY RIGHT-POINTING ANGLE BRACKET ORNAMENT | ||
| 89 | 2772; 2773; o # LIGHT LEFT TORTOISE SHELL BRACKET ORNAMENT | ||
| 90 | 2773; 2772; c # LIGHT RIGHT TORTOISE SHELL BRACKET ORNAMENT | ||
| 91 | 2774; 2775; o # MEDIUM LEFT CURLY BRACKET ORNAMENT | ||
| 92 | 2775; 2774; c # MEDIUM RIGHT CURLY BRACKET ORNAMENT | ||
| 93 | 27C5; 27C6; o # LEFT S-SHAPED BAG DELIMITER | ||
| 94 | 27C6; 27C5; c # RIGHT S-SHAPED BAG DELIMITER | ||
| 95 | 27E6; 27E7; o # MATHEMATICAL LEFT WHITE SQUARE BRACKET | ||
| 96 | 27E7; 27E6; c # MATHEMATICAL RIGHT WHITE SQUARE BRACKET | ||
| 97 | 27E8; 27E9; o # MATHEMATICAL LEFT ANGLE BRACKET | ||
| 98 | 27E9; 27E8; c # MATHEMATICAL RIGHT ANGLE BRACKET | ||
| 99 | 27EA; 27EB; o # MATHEMATICAL LEFT DOUBLE ANGLE BRACKET | ||
| 100 | 27EB; 27EA; c # MATHEMATICAL RIGHT DOUBLE ANGLE BRACKET | ||
| 101 | 27EC; 27ED; o # MATHEMATICAL LEFT WHITE TORTOISE SHELL BRACKET | ||
| 102 | 27ED; 27EC; c # MATHEMATICAL RIGHT WHITE TORTOISE SHELL BRACKET | ||
| 103 | 27EE; 27EF; o # MATHEMATICAL LEFT FLATTENED PARENTHESIS | ||
| 104 | 27EF; 27EE; c # MATHEMATICAL RIGHT FLATTENED PARENTHESIS | ||
| 105 | 2983; 2984; o # LEFT WHITE CURLY BRACKET | ||
| 106 | 2984; 2983; c # RIGHT WHITE CURLY BRACKET | ||
| 107 | 2985; 2986; o # LEFT WHITE PARENTHESIS | ||
| 108 | 2986; 2985; c # RIGHT WHITE PARENTHESIS | ||
| 109 | 2987; 2988; o # Z NOTATION LEFT IMAGE BRACKET | ||
| 110 | 2988; 2987; c # Z NOTATION RIGHT IMAGE BRACKET | ||
| 111 | 2989; 298A; o # Z NOTATION LEFT BINDING BRACKET | ||
| 112 | 298A; 2989; c # Z NOTATION RIGHT BINDING BRACKET | ||
| 113 | 298B; 298C; o # LEFT SQUARE BRACKET WITH UNDERBAR | ||
| 114 | 298C; 298B; c # RIGHT SQUARE BRACKET WITH UNDERBAR | ||
| 115 | 298D; 2990; o # LEFT SQUARE BRACKET WITH TICK IN TOP CORNER | ||
| 116 | 298E; 298F; c # RIGHT SQUARE BRACKET WITH TICK IN BOTTOM CORNER | ||
| 117 | 298F; 298E; o # LEFT SQUARE BRACKET WITH TICK IN BOTTOM CORNER | ||
| 118 | 2990; 298D; c # RIGHT SQUARE BRACKET WITH TICK IN TOP CORNER | ||
| 119 | 2991; 2992; o # LEFT ANGLE BRACKET WITH DOT | ||
| 120 | 2992; 2991; c # RIGHT ANGLE BRACKET WITH DOT | ||
| 121 | 2993; 2994; o # LEFT ARC LESS-THAN BRACKET | ||
| 122 | 2994; 2993; c # RIGHT ARC GREATER-THAN BRACKET | ||
| 123 | 2995; 2996; o # DOUBLE LEFT ARC GREATER-THAN BRACKET | ||
| 124 | 2996; 2995; c # DOUBLE RIGHT ARC LESS-THAN BRACKET | ||
| 125 | 2997; 2998; o # LEFT BLACK TORTOISE SHELL BRACKET | ||
| 126 | 2998; 2997; c # RIGHT BLACK TORTOISE SHELL BRACKET | ||
| 127 | 29D8; 29D9; o # LEFT WIGGLY FENCE | ||
| 128 | 29D9; 29D8; c # RIGHT WIGGLY FENCE | ||
| 129 | 29DA; 29DB; o # LEFT DOUBLE WIGGLY FENCE | ||
| 130 | 29DB; 29DA; c # RIGHT DOUBLE WIGGLY FENCE | ||
| 131 | 29FC; 29FD; o # LEFT-POINTING CURVED ANGLE BRACKET | ||
| 132 | 29FD; 29FC; c # RIGHT-POINTING CURVED ANGLE BRACKET | ||
| 133 | 2E22; 2E23; o # TOP LEFT HALF BRACKET | ||
| 134 | 2E23; 2E22; c # TOP RIGHT HALF BRACKET | ||
| 135 | 2E24; 2E25; o # BOTTOM LEFT HALF BRACKET | ||
| 136 | 2E25; 2E24; c # BOTTOM RIGHT HALF BRACKET | ||
| 137 | 2E26; 2E27; o # LEFT SIDEWAYS U BRACKET | ||
| 138 | 2E27; 2E26; c # RIGHT SIDEWAYS U BRACKET | ||
| 139 | 2E28; 2E29; o # LEFT DOUBLE PARENTHESIS | ||
| 140 | 2E29; 2E28; c # RIGHT DOUBLE PARENTHESIS | ||
| 141 | 3008; 3009; o # LEFT ANGLE BRACKET | ||
| 142 | 3009; 3008; c # RIGHT ANGLE BRACKET | ||
| 143 | 300A; 300B; o # LEFT DOUBLE ANGLE BRACKET | ||
| 144 | 300B; 300A; c # RIGHT DOUBLE ANGLE BRACKET | ||
| 145 | 300C; 300D; o # LEFT CORNER BRACKET | ||
| 146 | 300D; 300C; c # RIGHT CORNER BRACKET | ||
| 147 | 300E; 300F; o # LEFT WHITE CORNER BRACKET | ||
| 148 | 300F; 300E; c # RIGHT WHITE CORNER BRACKET | ||
| 149 | 3010; 3011; o # LEFT BLACK LENTICULAR BRACKET | ||
| 150 | 3011; 3010; c # RIGHT BLACK LENTICULAR BRACKET | ||
| 151 | 3014; 3015; o # LEFT TORTOISE SHELL BRACKET | ||
| 152 | 3015; 3014; c # RIGHT TORTOISE SHELL BRACKET | ||
| 153 | 3016; 3017; o # LEFT WHITE LENTICULAR BRACKET | ||
| 154 | 3017; 3016; c # RIGHT WHITE LENTICULAR BRACKET | ||
| 155 | 3018; 3019; o # LEFT WHITE TORTOISE SHELL BRACKET | ||
| 156 | 3019; 3018; c # RIGHT WHITE TORTOISE SHELL BRACKET | ||
| 157 | 301A; 301B; o # LEFT WHITE SQUARE BRACKET | ||
| 158 | 301B; 301A; c # RIGHT WHITE SQUARE BRACKET | ||
| 159 | FE59; FE5A; o # SMALL LEFT PARENTHESIS | ||
| 160 | FE5A; FE59; c # SMALL RIGHT PARENTHESIS | ||
| 161 | FE5B; FE5C; o # SMALL LEFT CURLY BRACKET | ||
| 162 | FE5C; FE5B; c # SMALL RIGHT CURLY BRACKET | ||
| 163 | FE5D; FE5E; o # SMALL LEFT TORTOISE SHELL BRACKET | ||
| 164 | FE5E; FE5D; c # SMALL RIGHT TORTOISE SHELL BRACKET | ||
| 165 | FF08; FF09; o # FULLWIDTH LEFT PARENTHESIS | ||
| 166 | FF09; FF08; c # FULLWIDTH RIGHT PARENTHESIS | ||
| 167 | FF3B; FF3D; o # FULLWIDTH LEFT SQUARE BRACKET | ||
| 168 | FF3D; FF3B; c # FULLWIDTH RIGHT SQUARE BRACKET | ||
| 169 | FF5B; FF5D; o # FULLWIDTH LEFT CURLY BRACKET | ||
| 170 | FF5D; FF5B; c # FULLWIDTH RIGHT CURLY BRACKET | ||
| 171 | FF5F; FF60; o # FULLWIDTH LEFT WHITE PARENTHESIS | ||
| 172 | FF60; FF5F; c # FULLWIDTH RIGHT WHITE PARENTHESIS | ||
| 173 | FF62; FF63; o # HALFWIDTH LEFT CORNER BRACKET | ||
| 174 | FF63; FF62; c # HALFWIDTH RIGHT CORNER BRACKET | ||
| 175 | |||
| 176 | # EOF | ||
diff --git a/admin/unidata/Makefile.in b/admin/unidata/Makefile.in index 4649b3b339d..05d3f929f18 100644 --- a/admin/unidata/Makefile.in +++ b/admin/unidata/Makefile.in | |||
| @@ -54,7 +54,9 @@ FORCE = | |||
| 54 | FORCE: | 54 | FORCE: |
| 55 | .PHONY: FORCE | 55 | .PHONY: FORCE |
| 56 | 56 | ||
| 57 | ${unidir}/charprop.el: ${FORCE} ${srcdir}/unidata-gen.el ${srcdir}/UnicodeData.txt | \ | 57 | ${unidir}/charprop.el: ${FORCE} ${srcdir}/unidata-gen.el \ |
| 58 | ${srcdir}/UnicodeData.txt ${srcdir}/BidiMirroring.txt \ | ||
| 59 | ${srcdir}/BidiBrackets.txt | \ | ||
| 58 | ${srcdir}/unidata-gen.elc unidata.txt | 60 | ${srcdir}/unidata-gen.elc unidata.txt |
| 59 | -if [ -f "$@" ]; then \ | 61 | -if [ -f "$@" ]; then \ |
| 60 | cd ${unidir} && chmod +w charprop.el `sed -n 's/^;; FILE: //p' < charprop.el`; \ | 62 | cd ${unidir} && chmod +w charprop.el `sed -n 's/^;; FILE: //p' < charprop.el`; \ |
diff --git a/admin/unidata/unidata-gen.el b/admin/unidata/unidata-gen.el index ec4f9d154d2..d10b260b470 100644 --- a/admin/unidata/unidata-gen.el +++ b/admin/unidata/unidata-gen.el | |||
| @@ -154,7 +154,8 @@ | |||
| 154 | ;; PROP: character property | 154 | ;; PROP: character property |
| 155 | ;; INDEX: index to each element of unidata-list for PROP. | 155 | ;; INDEX: index to each element of unidata-list for PROP. |
| 156 | ;; It may be a function that generates an alist of character codes | 156 | ;; It may be a function that generates an alist of character codes |
| 157 | ;; vs. the corresponding property values. | 157 | ;; vs. the corresponding property values. Currently, only character |
| 158 | ;; codepoints or symbol values are supported in this case. | ||
| 158 | ;; GENERATOR: function to generate a char-table | 159 | ;; GENERATOR: function to generate a char-table |
| 159 | ;; FILENAME: filename to store the char-table | 160 | ;; FILENAME: filename to store the char-table |
| 160 | ;; DOCSTRING: docstring for the property | 161 | ;; DOCSTRING: docstring for the property |
| @@ -273,7 +274,23 @@ is the character itself." | |||
| 273 | "Unicode bidi-mirroring characters. | 274 | "Unicode bidi-mirroring characters. |
| 274 | Property value is a character that has the corresponding mirroring image or nil. | 275 | Property value is a character that has the corresponding mirroring image or nil. |
| 275 | The value nil means that the actual property value of a character | 276 | The value nil means that the actual property value of a character |
| 276 | is the character itself."))) | 277 | is the character itself.") |
| 278 | (paired-bracket | ||
| 279 | unidata-gen-brackets-list unidata-gen-table-character "uni-brackets.el" | ||
| 280 | "Unicode bidi paired-bracket characters. | ||
| 281 | Property value is the paired bracket character, or nil. | ||
| 282 | The value nil means that the character is neither an opening nor | ||
| 283 | a closing paired bracket." | ||
| 284 | string) | ||
| 285 | (bracket-type | ||
| 286 | unidata-gen-bracket-type-list unidata-gen-table-symbol "uni-brackets.el" | ||
| 287 | "Unicode bidi paired-bracket type. | ||
| 288 | Property value is a symbol `o' (Open), `c' (Close), or `n' (None)." | ||
| 289 | unidata-describe-bidi-bracket-type | ||
| 290 | n | ||
| 291 | ;; The order of elements must be in sync with bidi_bracket_type_t | ||
| 292 | ;; in src/dispextern.h. | ||
| 293 | (n o c)))) | ||
| 277 | 294 | ||
| 278 | ;; Functions to access the above data. | 295 | ;; Functions to access the above data. |
| 279 | (defsubst unidata-prop-index (prop) (nth 1 (assq prop unidata-prop-alist))) | 296 | (defsubst unidata-prop-index (prop) (nth 1 (assq prop unidata-prop-alist))) |
| @@ -451,7 +468,10 @@ is the character itself."))) | |||
| 451 | (unidata-encode-val val-list (nth 2 elm))) | 468 | (unidata-encode-val val-list (nth 2 elm))) |
| 452 | (set-char-table-range table (cons (car elm) (nth 1 elm)) (nth 2 elm))) | 469 | (set-char-table-range table (cons (car elm) (nth 1 elm)) (nth 2 elm))) |
| 453 | 470 | ||
| 454 | (setq tail unidata-list) | 471 | (if (functionp prop-idx) |
| 472 | (setq tail (funcall prop-idx) | ||
| 473 | prop-idx 1) | ||
| 474 | (setq tail unidata-list)) | ||
| 455 | (while tail | 475 | (while tail |
| 456 | (setq elt (car tail) tail (cdr tail)) | 476 | (setq elt (car tail) tail (cdr tail)) |
| 457 | (setq range (car elt) | 477 | (setq range (car elt) |
| @@ -1157,6 +1177,12 @@ is the character itself."))) | |||
| 1157 | (string ?')))) | 1177 | (string ?')))) |
| 1158 | val " ")) | 1178 | val " ")) |
| 1159 | 1179 | ||
| 1180 | (defun unidata-describe-bidi-bracket-type (val) | ||
| 1181 | (cdr (assq val | ||
| 1182 | '((n . "Not a paired bracket character.") | ||
| 1183 | (o . "Opening paired bracket character.") | ||
| 1184 | (c . "Closing paired bracket character."))))) | ||
| 1185 | |||
| 1160 | (defun unidata-gen-mirroring-list () | 1186 | (defun unidata-gen-mirroring-list () |
| 1161 | (let ((head (list nil)) | 1187 | (let ((head (list nil)) |
| 1162 | tail) | 1188 | tail) |
| @@ -1170,6 +1196,36 @@ is the character itself."))) | |||
| 1170 | (setq tail (setcdr tail (list (list char mirror))))))) | 1196 | (setq tail (setcdr tail (list (list char mirror))))))) |
| 1171 | (cdr head))) | 1197 | (cdr head))) |
| 1172 | 1198 | ||
| 1199 | (defun unidata-gen-brackets-list () | ||
| 1200 | (let ((head (list nil)) | ||
| 1201 | tail) | ||
| 1202 | (with-temp-buffer | ||
| 1203 | (insert-file-contents (expand-file-name "BidiBrackets.txt" unidata-dir)) | ||
| 1204 | (goto-char (point-min)) | ||
| 1205 | (setq tail head) | ||
| 1206 | (while (re-search-forward | ||
| 1207 | "^\\([0-9A-F]+\\);\\s +\\([0-9A-F]+\\);\\s +\\([oc]\\)" | ||
| 1208 | nil t) | ||
| 1209 | (let ((char (string-to-number (match-string 1) 16)) | ||
| 1210 | (paired (match-string 2))) | ||
| 1211 | (setq tail (setcdr tail (list (list char paired))))))) | ||
| 1212 | (cdr head))) | ||
| 1213 | |||
| 1214 | (defun unidata-gen-bracket-type-list () | ||
| 1215 | (let ((head (list nil)) | ||
| 1216 | tail) | ||
| 1217 | (with-temp-buffer | ||
| 1218 | (insert-file-contents (expand-file-name "BidiBrackets.txt" unidata-dir)) | ||
| 1219 | (goto-char (point-min)) | ||
| 1220 | (setq tail head) | ||
| 1221 | (while (re-search-forward | ||
| 1222 | "^\\([0-9A-F]+\\);\\s +\\([0-9A-F]+\\);\\s +\\([oc]\\)" | ||
| 1223 | nil t) | ||
| 1224 | (let ((char (string-to-number (match-string 1) 16)) | ||
| 1225 | (type (match-string 3))) | ||
| 1226 | (setq tail (setcdr tail (list (list char type))))))) | ||
| 1227 | (cdr head))) | ||
| 1228 | |||
| 1173 | ;; Verify if we can retrieve correct values from the generated | 1229 | ;; Verify if we can retrieve correct values from the generated |
| 1174 | ;; char-tables. | 1230 | ;; char-tables. |
| 1175 | ;; | 1231 | ;; |
| @@ -1218,7 +1274,9 @@ is the character itself."))) | |||
| 1218 | ((eq generator 'unidata-gen-table-decomposition) | 1274 | ((eq generator 'unidata-gen-table-decomposition) |
| 1219 | (setq val1 (unidata-split-decomposition val1)))) | 1275 | (setq val1 (unidata-split-decomposition val1)))) |
| 1220 | (cond ((eq prop 'decomposition) | 1276 | (cond ((eq prop 'decomposition) |
| 1221 | (setq val1 (list char))))) | 1277 | (setq val1 (list char))) |
| 1278 | ((eq prop 'bracket-type) | ||
| 1279 | (setq val1 'n)))) | ||
| 1222 | (when (>= char check) | 1280 | (when (>= char check) |
| 1223 | (message "%S %04X" prop check) | 1281 | (message "%S %04X" prop check) |
| 1224 | (setq check (+ check #x400))) | 1282 | (setq check (+ check #x400))) |
| @@ -1261,6 +1319,9 @@ is the character itself."))) | |||
| 1261 | (describer (unidata-prop-describer prop)) | 1319 | (describer (unidata-prop-describer prop)) |
| 1262 | (default-value (unidata-prop-default prop)) | 1320 | (default-value (unidata-prop-default prop)) |
| 1263 | (val-list (unidata-prop-val-list prop)) | 1321 | (val-list (unidata-prop-val-list prop)) |
| 1322 | ;; Avoid creating backup files for those uni-*.el files | ||
| 1323 | ;; that hold more than one table. | ||
| 1324 | (backup-inhibited t) | ||
| 1264 | table) | 1325 | table) |
| 1265 | ;; Filename in this comment line is extracted by sed in | 1326 | ;; Filename in this comment line is extracted by sed in |
| 1266 | ;; Makefile. | 1327 | ;; Makefile. |