diff options
| author | Glenn Morris | 2015-06-16 23:43:03 -0700 |
|---|---|---|
| committer | Glenn Morris | 2015-06-16 23:43:03 -0700 |
| commit | d67d49ceb31777cb731a56b9518bf1a1f2a94d25 (patch) | |
| tree | 37aea7063e35326b069c12d9f4c16e5cf172d57f /admin | |
| parent | c9e2003b44b446a2f994039d9fc73d387cf6a1df (diff) | |
| download | emacs-d67d49ceb31777cb731a56b9518bf1a1f2a94d25.tar.gz emacs-d67d49ceb31777cb731a56b9518bf1a1f2a94d25.zip | |
Generate char-script-table from Unicode source. (Bug#20789)
* admin/unidata/Makefile.in (AWK): New, set by configure.
(all): Add charscript.el.
(blocks): New variable.
(charscript.el, ${unidir}/charscript.el): New targets.
(extraclean): Also remove generated charscript.el.
* admin/unidata/blocks.awk: New script.
* admin/unidata/Blocks.txt: New data file, from unicode.org.
* lisp/international/characters.el: Load charscript.
* src/Makefile.in (charscript): New variable.
(${charscript}): New target.
(${lispintdir}/characters.elc): Depend on charscript.elc.
(temacs$(EXEEXT)): Depend on charscript.
; * admin/unidata/README: Mention Blocks.txt.
; * .gitignore: Add lisp/international/charscript.el.
Diffstat (limited to 'admin')
| -rw-r--r-- | admin/unidata/Blocks.txt | 298 | ||||
| -rw-r--r-- | admin/unidata/Makefile.in | 16 | ||||
| -rw-r--r-- | admin/unidata/README | 4 | ||||
| -rwxr-xr-x | admin/unidata/blocks.awk | 225 |
4 files changed, 541 insertions, 2 deletions
diff --git a/admin/unidata/Blocks.txt b/admin/unidata/Blocks.txt new file mode 100644 index 00000000000..0a4a5807635 --- /dev/null +++ b/admin/unidata/Blocks.txt | |||
| @@ -0,0 +1,298 @@ | |||
| 1 | # Blocks-8.0.0.txt | ||
| 2 | # Date: 2014-11-10, 23:04:00 GMT [KW] | ||
| 3 | # | ||
| 4 | # Unicode Character Database | ||
| 5 | # Copyright (c) 1991-2014 Unicode, Inc. | ||
| 6 | # For terms of use, see http://www.unicode.org/terms_of_use.html | ||
| 7 | # For documentation, see http://www.unicode.org/reports/tr44/ | ||
| 8 | # | ||
| 9 | # Format: | ||
| 10 | # Start Code..End Code; Block Name | ||
| 11 | |||
| 12 | # ================================================ | ||
| 13 | |||
| 14 | # Note: When comparing block names, casing, whitespace, hyphens, | ||
| 15 | # and underbars are ignored. | ||
| 16 | # For example, "Latin Extended-A" and "latin extended a" are equivalent. | ||
| 17 | # For more information on the comparison of property values, | ||
| 18 | # see UAX #44: http://www.unicode.org/reports/tr44/ | ||
| 19 | # | ||
| 20 | # All block ranges start with a value where (cp MOD 16) = 0, | ||
| 21 | # and end with a value where (cp MOD 16) = 15. In other words, | ||
| 22 | # the last hexadecimal digit of the start of range is ...0 | ||
| 23 | # and the last hexadecimal digit of the end of range is ...F. | ||
| 24 | # This constraint on block ranges guarantees that allocations | ||
| 25 | # are done in terms of whole columns, and that code chart display | ||
| 26 | # never involves splitting columns in the charts. | ||
| 27 | # | ||
| 28 | # All code points not explicitly listed for Block | ||
| 29 | # have the value No_Block. | ||
| 30 | |||
| 31 | # Property: Block | ||
| 32 | # | ||
| 33 | # @missing: 0000..10FFFF; No_Block | ||
| 34 | |||
| 35 | 0000..007F; Basic Latin | ||
| 36 | 0080..00FF; Latin-1 Supplement | ||
| 37 | 0100..017F; Latin Extended-A | ||
| 38 | 0180..024F; Latin Extended-B | ||
| 39 | 0250..02AF; IPA Extensions | ||
| 40 | 02B0..02FF; Spacing Modifier Letters | ||
| 41 | 0300..036F; Combining Diacritical Marks | ||
| 42 | 0370..03FF; Greek and Coptic | ||
| 43 | 0400..04FF; Cyrillic | ||
| 44 | 0500..052F; Cyrillic Supplement | ||
| 45 | 0530..058F; Armenian | ||
| 46 | 0590..05FF; Hebrew | ||
| 47 | 0600..06FF; Arabic | ||
| 48 | 0700..074F; Syriac | ||
| 49 | 0750..077F; Arabic Supplement | ||
| 50 | 0780..07BF; Thaana | ||
| 51 | 07C0..07FF; NKo | ||
| 52 | 0800..083F; Samaritan | ||
| 53 | 0840..085F; Mandaic | ||
| 54 | 08A0..08FF; Arabic Extended-A | ||
| 55 | 0900..097F; Devanagari | ||
| 56 | 0980..09FF; Bengali | ||
| 57 | 0A00..0A7F; Gurmukhi | ||
| 58 | 0A80..0AFF; Gujarati | ||
| 59 | 0B00..0B7F; Oriya | ||
| 60 | 0B80..0BFF; Tamil | ||
| 61 | 0C00..0C7F; Telugu | ||
| 62 | 0C80..0CFF; Kannada | ||
| 63 | 0D00..0D7F; Malayalam | ||
| 64 | 0D80..0DFF; Sinhala | ||
| 65 | 0E00..0E7F; Thai | ||
| 66 | 0E80..0EFF; Lao | ||
| 67 | 0F00..0FFF; Tibetan | ||
| 68 | 1000..109F; Myanmar | ||
| 69 | 10A0..10FF; Georgian | ||
| 70 | 1100..11FF; Hangul Jamo | ||
| 71 | 1200..137F; Ethiopic | ||
| 72 | 1380..139F; Ethiopic Supplement | ||
| 73 | 13A0..13FF; Cherokee | ||
| 74 | 1400..167F; Unified Canadian Aboriginal Syllabics | ||
| 75 | 1680..169F; Ogham | ||
| 76 | 16A0..16FF; Runic | ||
| 77 | 1700..171F; Tagalog | ||
| 78 | 1720..173F; Hanunoo | ||
| 79 | 1740..175F; Buhid | ||
| 80 | 1760..177F; Tagbanwa | ||
| 81 | 1780..17FF; Khmer | ||
| 82 | 1800..18AF; Mongolian | ||
| 83 | 18B0..18FF; Unified Canadian Aboriginal Syllabics Extended | ||
| 84 | 1900..194F; Limbu | ||
| 85 | 1950..197F; Tai Le | ||
| 86 | 1980..19DF; New Tai Lue | ||
| 87 | 19E0..19FF; Khmer Symbols | ||
| 88 | 1A00..1A1F; Buginese | ||
| 89 | 1A20..1AAF; Tai Tham | ||
| 90 | 1AB0..1AFF; Combining Diacritical Marks Extended | ||
| 91 | 1B00..1B7F; Balinese | ||
| 92 | 1B80..1BBF; Sundanese | ||
| 93 | 1BC0..1BFF; Batak | ||
| 94 | 1C00..1C4F; Lepcha | ||
| 95 | 1C50..1C7F; Ol Chiki | ||
| 96 | 1CC0..1CCF; Sundanese Supplement | ||
| 97 | 1CD0..1CFF; Vedic Extensions | ||
| 98 | 1D00..1D7F; Phonetic Extensions | ||
| 99 | 1D80..1DBF; Phonetic Extensions Supplement | ||
| 100 | 1DC0..1DFF; Combining Diacritical Marks Supplement | ||
| 101 | 1E00..1EFF; Latin Extended Additional | ||
| 102 | 1F00..1FFF; Greek Extended | ||
| 103 | 2000..206F; General Punctuation | ||
| 104 | 2070..209F; Superscripts and Subscripts | ||
| 105 | 20A0..20CF; Currency Symbols | ||
| 106 | 20D0..20FF; Combining Diacritical Marks for Symbols | ||
| 107 | 2100..214F; Letterlike Symbols | ||
| 108 | 2150..218F; Number Forms | ||
| 109 | 2190..21FF; Arrows | ||
| 110 | 2200..22FF; Mathematical Operators | ||
| 111 | 2300..23FF; Miscellaneous Technical | ||
| 112 | 2400..243F; Control Pictures | ||
| 113 | 2440..245F; Optical Character Recognition | ||
| 114 | 2460..24FF; Enclosed Alphanumerics | ||
| 115 | 2500..257F; Box Drawing | ||
| 116 | 2580..259F; Block Elements | ||
| 117 | 25A0..25FF; Geometric Shapes | ||
| 118 | 2600..26FF; Miscellaneous Symbols | ||
| 119 | 2700..27BF; Dingbats | ||
| 120 | 27C0..27EF; Miscellaneous Mathematical Symbols-A | ||
| 121 | 27F0..27FF; Supplemental Arrows-A | ||
| 122 | 2800..28FF; Braille Patterns | ||
| 123 | 2900..297F; Supplemental Arrows-B | ||
| 124 | 2980..29FF; Miscellaneous Mathematical Symbols-B | ||
| 125 | 2A00..2AFF; Supplemental Mathematical Operators | ||
| 126 | 2B00..2BFF; Miscellaneous Symbols and Arrows | ||
| 127 | 2C00..2C5F; Glagolitic | ||
| 128 | 2C60..2C7F; Latin Extended-C | ||
| 129 | 2C80..2CFF; Coptic | ||
| 130 | 2D00..2D2F; Georgian Supplement | ||
| 131 | 2D30..2D7F; Tifinagh | ||
| 132 | 2D80..2DDF; Ethiopic Extended | ||
| 133 | 2DE0..2DFF; Cyrillic Extended-A | ||
| 134 | 2E00..2E7F; Supplemental Punctuation | ||
| 135 | 2E80..2EFF; CJK Radicals Supplement | ||
| 136 | 2F00..2FDF; Kangxi Radicals | ||
| 137 | 2FF0..2FFF; Ideographic Description Characters | ||
| 138 | 3000..303F; CJK Symbols and Punctuation | ||
| 139 | 3040..309F; Hiragana | ||
| 140 | 30A0..30FF; Katakana | ||
| 141 | 3100..312F; Bopomofo | ||
| 142 | 3130..318F; Hangul Compatibility Jamo | ||
| 143 | 3190..319F; Kanbun | ||
| 144 | 31A0..31BF; Bopomofo Extended | ||
| 145 | 31C0..31EF; CJK Strokes | ||
| 146 | 31F0..31FF; Katakana Phonetic Extensions | ||
| 147 | 3200..32FF; Enclosed CJK Letters and Months | ||
| 148 | 3300..33FF; CJK Compatibility | ||
| 149 | 3400..4DBF; CJK Unified Ideographs Extension A | ||
| 150 | 4DC0..4DFF; Yijing Hexagram Symbols | ||
| 151 | 4E00..9FFF; CJK Unified Ideographs | ||
| 152 | A000..A48F; Yi Syllables | ||
| 153 | A490..A4CF; Yi Radicals | ||
| 154 | A4D0..A4FF; Lisu | ||
| 155 | A500..A63F; Vai | ||
| 156 | A640..A69F; Cyrillic Extended-B | ||
| 157 | A6A0..A6FF; Bamum | ||
| 158 | A700..A71F; Modifier Tone Letters | ||
| 159 | A720..A7FF; Latin Extended-D | ||
| 160 | A800..A82F; Syloti Nagri | ||
| 161 | A830..A83F; Common Indic Number Forms | ||
| 162 | A840..A87F; Phags-pa | ||
| 163 | A880..A8DF; Saurashtra | ||
| 164 | A8E0..A8FF; Devanagari Extended | ||
| 165 | A900..A92F; Kayah Li | ||
| 166 | A930..A95F; Rejang | ||
| 167 | A960..A97F; Hangul Jamo Extended-A | ||
| 168 | A980..A9DF; Javanese | ||
| 169 | A9E0..A9FF; Myanmar Extended-B | ||
| 170 | AA00..AA5F; Cham | ||
| 171 | AA60..AA7F; Myanmar Extended-A | ||
| 172 | AA80..AADF; Tai Viet | ||
| 173 | AAE0..AAFF; Meetei Mayek Extensions | ||
| 174 | AB00..AB2F; Ethiopic Extended-A | ||
| 175 | AB30..AB6F; Latin Extended-E | ||
| 176 | AB70..ABBF; Cherokee Supplement | ||
| 177 | ABC0..ABFF; Meetei Mayek | ||
| 178 | AC00..D7AF; Hangul Syllables | ||
| 179 | D7B0..D7FF; Hangul Jamo Extended-B | ||
| 180 | D800..DB7F; High Surrogates | ||
| 181 | DB80..DBFF; High Private Use Surrogates | ||
| 182 | DC00..DFFF; Low Surrogates | ||
| 183 | E000..F8FF; Private Use Area | ||
| 184 | F900..FAFF; CJK Compatibility Ideographs | ||
| 185 | FB00..FB4F; Alphabetic Presentation Forms | ||
| 186 | FB50..FDFF; Arabic Presentation Forms-A | ||
| 187 | FE00..FE0F; Variation Selectors | ||
| 188 | FE10..FE1F; Vertical Forms | ||
| 189 | FE20..FE2F; Combining Half Marks | ||
| 190 | FE30..FE4F; CJK Compatibility Forms | ||
| 191 | FE50..FE6F; Small Form Variants | ||
| 192 | FE70..FEFF; Arabic Presentation Forms-B | ||
| 193 | FF00..FFEF; Halfwidth and Fullwidth Forms | ||
| 194 | FFF0..FFFF; Specials | ||
| 195 | 10000..1007F; Linear B Syllabary | ||
| 196 | 10080..100FF; Linear B Ideograms | ||
| 197 | 10100..1013F; Aegean Numbers | ||
| 198 | 10140..1018F; Ancient Greek Numbers | ||
| 199 | 10190..101CF; Ancient Symbols | ||
| 200 | 101D0..101FF; Phaistos Disc | ||
| 201 | 10280..1029F; Lycian | ||
| 202 | 102A0..102DF; Carian | ||
| 203 | 102E0..102FF; Coptic Epact Numbers | ||
| 204 | 10300..1032F; Old Italic | ||
| 205 | 10330..1034F; Gothic | ||
| 206 | 10350..1037F; Old Permic | ||
| 207 | 10380..1039F; Ugaritic | ||
| 208 | 103A0..103DF; Old Persian | ||
| 209 | 10400..1044F; Deseret | ||
| 210 | 10450..1047F; Shavian | ||
| 211 | 10480..104AF; Osmanya | ||
| 212 | 10500..1052F; Elbasan | ||
| 213 | 10530..1056F; Caucasian Albanian | ||
| 214 | 10600..1077F; Linear A | ||
| 215 | 10800..1083F; Cypriot Syllabary | ||
| 216 | 10840..1085F; Imperial Aramaic | ||
| 217 | 10860..1087F; Palmyrene | ||
| 218 | 10880..108AF; Nabataean | ||
| 219 | 108E0..108FF; Hatran | ||
| 220 | 10900..1091F; Phoenician | ||
| 221 | 10920..1093F; Lydian | ||
| 222 | 10980..1099F; Meroitic Hieroglyphs | ||
| 223 | 109A0..109FF; Meroitic Cursive | ||
| 224 | 10A00..10A5F; Kharoshthi | ||
| 225 | 10A60..10A7F; Old South Arabian | ||
| 226 | 10A80..10A9F; Old North Arabian | ||
| 227 | 10AC0..10AFF; Manichaean | ||
| 228 | 10B00..10B3F; Avestan | ||
| 229 | 10B40..10B5F; Inscriptional Parthian | ||
| 230 | 10B60..10B7F; Inscriptional Pahlavi | ||
| 231 | 10B80..10BAF; Psalter Pahlavi | ||
| 232 | 10C00..10C4F; Old Turkic | ||
| 233 | 10C80..10CFF; Old Hungarian | ||
| 234 | 10E60..10E7F; Rumi Numeral Symbols | ||
| 235 | 11000..1107F; Brahmi | ||
| 236 | 11080..110CF; Kaithi | ||
| 237 | 110D0..110FF; Sora Sompeng | ||
| 238 | 11100..1114F; Chakma | ||
| 239 | 11150..1117F; Mahajani | ||
| 240 | 11180..111DF; Sharada | ||
| 241 | 111E0..111FF; Sinhala Archaic Numbers | ||
| 242 | 11200..1124F; Khojki | ||
| 243 | 11280..112AF; Multani | ||
| 244 | 112B0..112FF; Khudawadi | ||
| 245 | 11300..1137F; Grantha | ||
| 246 | 11480..114DF; Tirhuta | ||
| 247 | 11580..115FF; Siddham | ||
| 248 | 11600..1165F; Modi | ||
| 249 | 11680..116CF; Takri | ||
| 250 | 11700..1173F; Ahom | ||
| 251 | 118A0..118FF; Warang Citi | ||
| 252 | 11AC0..11AFF; Pau Cin Hau | ||
| 253 | 12000..123FF; Cuneiform | ||
| 254 | 12400..1247F; Cuneiform Numbers and Punctuation | ||
| 255 | 12480..1254F; Early Dynastic Cuneiform | ||
| 256 | 13000..1342F; Egyptian Hieroglyphs | ||
| 257 | 14400..1467F; Anatolian Hieroglyphs | ||
| 258 | 16800..16A3F; Bamum Supplement | ||
| 259 | 16A40..16A6F; Mro | ||
| 260 | 16AD0..16AFF; Bassa Vah | ||
| 261 | 16B00..16B8F; Pahawh Hmong | ||
| 262 | 16F00..16F9F; Miao | ||
| 263 | 1B000..1B0FF; Kana Supplement | ||
| 264 | 1BC00..1BC9F; Duployan | ||
| 265 | 1BCA0..1BCAF; Shorthand Format Controls | ||
| 266 | 1D000..1D0FF; Byzantine Musical Symbols | ||
| 267 | 1D100..1D1FF; Musical Symbols | ||
| 268 | 1D200..1D24F; Ancient Greek Musical Notation | ||
| 269 | 1D300..1D35F; Tai Xuan Jing Symbols | ||
| 270 | 1D360..1D37F; Counting Rod Numerals | ||
| 271 | 1D400..1D7FF; Mathematical Alphanumeric Symbols | ||
| 272 | 1D800..1DAAF; Sutton SignWriting | ||
| 273 | 1E800..1E8DF; Mende Kikakui | ||
| 274 | 1EE00..1EEFF; Arabic Mathematical Alphabetic Symbols | ||
| 275 | 1F000..1F02F; Mahjong Tiles | ||
| 276 | 1F030..1F09F; Domino Tiles | ||
| 277 | 1F0A0..1F0FF; Playing Cards | ||
| 278 | 1F100..1F1FF; Enclosed Alphanumeric Supplement | ||
| 279 | 1F200..1F2FF; Enclosed Ideographic Supplement | ||
| 280 | 1F300..1F5FF; Miscellaneous Symbols and Pictographs | ||
| 281 | 1F600..1F64F; Emoticons | ||
| 282 | 1F650..1F67F; Ornamental Dingbats | ||
| 283 | 1F680..1F6FF; Transport and Map Symbols | ||
| 284 | 1F700..1F77F; Alchemical Symbols | ||
| 285 | 1F780..1F7FF; Geometric Shapes Extended | ||
| 286 | 1F800..1F8FF; Supplemental Arrows-C | ||
| 287 | 1F900..1F9FF; Supplemental Symbols and Pictographs | ||
| 288 | 20000..2A6DF; CJK Unified Ideographs Extension B | ||
| 289 | 2A700..2B73F; CJK Unified Ideographs Extension C | ||
| 290 | 2B740..2B81F; CJK Unified Ideographs Extension D | ||
| 291 | 2B820..2CEAF; CJK Unified Ideographs Extension E | ||
| 292 | 2F800..2FA1F; CJK Compatibility Ideographs Supplement | ||
| 293 | E0000..E007F; Tags | ||
| 294 | E0100..E01EF; Variation Selectors Supplement | ||
| 295 | F0000..FFFFF; Supplementary Private Use Area-A | ||
| 296 | 100000..10FFFF; Supplementary Private Use Area-B | ||
| 297 | |||
| 298 | # EOF | ||
diff --git a/admin/unidata/Makefile.in b/admin/unidata/Makefile.in index 6c81d32484a..954e9faacae 100644 --- a/admin/unidata/Makefile.in +++ b/admin/unidata/Makefile.in | |||
| @@ -23,6 +23,8 @@ | |||
| 23 | 23 | ||
| 24 | SHELL = @SHELL@ | 24 | SHELL = @SHELL@ |
| 25 | 25 | ||
| 26 | AWK = @AWK@ | ||
| 27 | |||
| 26 | srcdir = @srcdir@ | 28 | srcdir = @srcdir@ |
| 27 | top_srcdir = @top_srcdir@ | 29 | top_srcdir = @top_srcdir@ |
| 28 | top_builddir = @top_builddir@ | 30 | top_builddir = @top_builddir@ |
| @@ -51,7 +53,7 @@ am__v_at_1 = | |||
| 51 | 53 | ||
| 52 | .PHONY: all unifiles | 54 | .PHONY: all unifiles |
| 53 | 55 | ||
| 54 | all: ${top_srcdir}/src/macuvs.h unifiles | 56 | all: ${top_srcdir}/src/macuvs.h unifiles ${unidir}/charscript.el |
| 55 | 57 | ||
| 56 | ## Specify .elc as an order-only prereq so as to not needlessly rebuild | 58 | ## Specify .elc as an order-only prereq so as to not needlessly rebuild |
| 57 | ## target just because the .elc is missing. | 59 | ## target just because the .elc is missing. |
| @@ -94,6 +96,16 @@ unifiles: ${unidir}/charprop.el | |||
| 94 | [ -f $(unidir)/$$f ] || exec $(MAKE) PHONY_EXTRAS=$< $<; \ | 96 | [ -f $(unidir)/$$f ] || exec $(MAKE) PHONY_EXTRAS=$< $<; \ |
| 95 | done | 97 | done |
| 96 | 98 | ||
| 99 | |||
| 100 | .PHONY: charscript.el | ||
| 101 | charscript.el: ${unidir}/charscript.el | ||
| 102 | |||
| 103 | blocks = ${srcdir}/blocks.awk | ||
| 104 | |||
| 105 | ${unidir}/charscript.el: ${srcdir}/Blocks.txt ${blocks} | ||
| 106 | $(AM_V_GEN)$(AWK) -f ${blocks} < $< > $@ | ||
| 107 | |||
| 108 | |||
| 97 | .PHONY: clean bootstrap-clean distclean maintainer-clean extraclean | 109 | .PHONY: clean bootstrap-clean distclean maintainer-clean extraclean |
| 98 | 110 | ||
| 99 | clean: | 111 | clean: |
| @@ -110,7 +122,7 @@ maintainer-clean: distclean | |||
| 110 | ## change and it slows down bootstrap (a tiny bit). | 122 | ## change and it slows down bootstrap (a tiny bit). |
| 111 | ## Cf leim/ja-dic (which is much slower). | 123 | ## Cf leim/ja-dic (which is much slower). |
| 112 | extraclean: | 124 | extraclean: |
| 113 | rm -f ${top_srcdir}/src/macuvs.h | 125 | rm -f ${top_srcdir}/src/macuvs.h ${unidir}/charscript.el* |
| 114 | ifneq (,$(wildcard $(unidir)/charprop.el)) | 126 | ifneq (,$(wildcard $(unidir)/charprop.el)) |
| 115 | cd $(unidir) && \ | 127 | cd $(unidir) && \ |
| 116 | rm -f `sed -n 's/^;; FILE: //p' < charprop.el` charprop.el | 128 | rm -f `sed -n 's/^;; FILE: //p' < charprop.el` charprop.el |
diff --git a/admin/unidata/README b/admin/unidata/README index e0d0e00417f..8ad0a12d728 100644 --- a/admin/unidata/README +++ b/admin/unidata/README | |||
| @@ -16,3 +16,7 @@ http://www.unicode.org/ivd/data/2014-05-16/IVD_Sequences.txt | |||
| 16 | UnicodeData.txt | 16 | UnicodeData.txt |
| 17 | http://www.unicode.org/Public/UNIDATA/UnicodeData.txt | 17 | http://www.unicode.org/Public/UNIDATA/UnicodeData.txt |
| 18 | 2014-03-10 | 18 | 2014-03-10 |
| 19 | |||
| 20 | Blocks.txt | ||
| 21 | http://www.unicode.org/Public/8.0.0/ucd/Blocks.txt | ||
| 22 | 2014-11-10 | ||
diff --git a/admin/unidata/blocks.awk b/admin/unidata/blocks.awk new file mode 100755 index 00000000000..892ac58c927 --- /dev/null +++ b/admin/unidata/blocks.awk | |||
| @@ -0,0 +1,225 @@ | |||
| 1 | #!/usr/bin/awk -f | ||
| 2 | |||
| 3 | ## Copyright (C) 2015 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ## Author: Glenn Morris <rgm@gnu.org> | ||
| 6 | |||
| 7 | ## This file is part of GNU Emacs. | ||
| 8 | |||
| 9 | ## GNU Emacs is free software: you can redistribute it and/or modify | ||
| 10 | ## it under the terms of the GNU General Public License as published by | ||
| 11 | ## the Free Software Foundation, either version 3 of the License, or | ||
| 12 | ## (at your option) any later version. | ||
| 13 | |||
| 14 | ## GNU Emacs is distributed in the hope that it will be useful, | ||
| 15 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | ## GNU General Public License for more details. | ||
| 18 | |||
| 19 | ## You should have received a copy of the GNU General Public License | ||
| 20 | ## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | |||
| 22 | ### Commentary: | ||
| 23 | |||
| 24 | ## This script takes as input Unicode's Blocks.txt | ||
| 25 | ## (http://www.unicode.org/Public/UNIDATA/Blocks.txt) | ||
| 26 | ## and produces output for Emacs's lisp/international/charscript.el. | ||
| 27 | |||
| 28 | ## It lumps together all the blocks belonging to the same language. | ||
| 29 | ## E.g., "Basic Latin", "Latin-1 Supplement", "Latin Extended-A", | ||
| 30 | ## etc. are all lumped together under "latin". | ||
| 31 | |||
| 32 | ## The Unicode blocks actually extend past some of these ranges with | ||
| 33 | ## undefined codepoints. | ||
| 34 | |||
| 35 | ## For additional details, see <http://debbugs.gnu.org/20789#11>. | ||
| 36 | |||
| 37 | ## Things to do after installing a new version of Blocks.txt: | ||
| 38 | ## Check the output against the old output. | ||
| 39 | ## Adjust the alias array, and the name2alias function for any new | ||
| 40 | ## entries, if necessary. | ||
| 41 | ## Check fix_start (and fix_end) to see if entries need adding/removing. | ||
| 42 | ## Review the hard-coded splits at the end of the main body. | ||
| 43 | |||
| 44 | ### Code: | ||
| 45 | |||
| 46 | BEGIN { | ||
| 47 | ## Hard-coded names. See name2alias for the rest. | ||
| 48 | alias["ipa extensions"] = "phonetic" | ||
| 49 | alias["letterlike symbols"] = "symbol" | ||
| 50 | alias["number forms"] = "symbol" | ||
| 51 | alias["miscellaneous technical"] = "symbol" | ||
| 52 | alias["control pictures"] = "symbol" | ||
| 53 | alias["optical character recognition"] = "symbol" | ||
| 54 | alias["enclosed alphanumerics"] = "symbol" | ||
| 55 | alias["box drawing"] = "symbol" | ||
| 56 | alias["block elements"] = "symbol" | ||
| 57 | alias["miscellaneous symbols"] = "symbol" | ||
| 58 | alias["cjk strokes"] = "cjk-misc" | ||
| 59 | alias["cjk symbols and punctuation"] = "cjk-misc" | ||
| 60 | alias["halfwidth and fullwidth forms"] = "cjk-misc" | ||
| 61 | alias["common indic number forms"] = "north-indic-number" | ||
| 62 | |||
| 63 | tohex["a"] = 10 | ||
| 64 | tohex["b"] = 11 | ||
| 65 | tohex["c"] = 12 | ||
| 66 | tohex["d"] = 13 | ||
| 67 | tohex["e"] = 14 | ||
| 68 | tohex["f"] = 15 | ||
| 69 | |||
| 70 | fix_start["0080"] = "00A0" | ||
| 71 | ## Define fix_end here if you need it. | ||
| 72 | } | ||
| 73 | |||
| 74 | ## From admin/charsets/. | ||
| 75 | ## With gawk's --non-decimal-data switch we wouldn't need this. | ||
| 76 | function decode_hex(str , n, len, i, c) { | ||
| 77 | n = 0 | ||
| 78 | len = length(str) | ||
| 79 | for (i = 1; i <= len; i++) | ||
| 80 | { | ||
| 81 | c = substr (str, i, 1) | ||
| 82 | if (c >= "0" && c <= "9") | ||
| 83 | n = n * 16 + (c - "0") | ||
| 84 | else | ||
| 85 | n = n * 16 + tohex[tolower(c)] | ||
| 86 | } | ||
| 87 | return n | ||
| 88 | } | ||
| 89 | |||
| 90 | function name2alias(name , w, w2) { | ||
| 91 | name = tolower(name) | ||
| 92 | if (alias[name]) return alias[name] | ||
| 93 | else if (name ~ /for symbols/) return "symbol" | ||
| 94 | else if (name ~ /latin|combining .* marks|spacing modifier|tone letters|alphabetic presentation/) return "latin" | ||
| 95 | else if (name ~ /cjk|yijing|enclosed ideograph|kangxi/) return "han" | ||
| 96 | else if (name ~ /arabic/) return "arabic" | ||
| 97 | else if (name ~ /^greek/) return "greek" | ||
| 98 | else if (name ~ /^coptic/) return "coptic" | ||
| 99 | else if (name ~ /cuneiform number/) return "cuneiform-numbers-and-punctuation" | ||
| 100 | else if (name ~ /cuneiform/) return "cuneiform" | ||
| 101 | else if (name ~ /mathematical alphanumeric symbol/) return "mathematical" | ||
| 102 | else if (name ~ /punctuation|mathematical|arrows|currency|superscript|small form variants|geometric|dingbats|enclosed|alchemical|pictograph|emoticon|transport/) return "symbol" | ||
| 103 | else if (name ~ /canadian aboriginal/) return "canadian-aboriginal" | ||
| 104 | else if (name ~ /katakana|hiragana/) return "kana" | ||
| 105 | else if (name ~ /myanmar/) return "burmese" | ||
| 106 | else if (name ~ /hangul/) return "hangul" | ||
| 107 | else if (name ~ /khmer/) return "khmer" | ||
| 108 | else if (name ~ /braille/) return "braille" | ||
| 109 | else if (name ~ /^yi /) return "yi" | ||
| 110 | else if (name ~ /surrogates|private use|variation selectors/) return 0 | ||
| 111 | else if (name ~/^(specials|tags)$/) return 0 | ||
| 112 | else if (name ~ /linear b/) return "linear-b" | ||
| 113 | else if (name ~ /aramaic/) return "aramaic" | ||
| 114 | else if (name ~ /rumi num/) return "rumi-number" | ||
| 115 | else if (name ~ /duployan|shorthand/) return "duployan-shorthand" | ||
| 116 | else if (name ~ /sutton signwriting/) return "sutton-sign-writing" | ||
| 117 | |||
| 118 | sub(/ (extended|extensions|supplement).*/, "", name) | ||
| 119 | sub(/numbers/, "number", name) | ||
| 120 | sub(/numerals/, "numeral", name) | ||
| 121 | sub(/symbols/, "symbol", name) | ||
| 122 | sub(/forms$/, "form", name) | ||
| 123 | sub(/tiles$/, "tile", name) | ||
| 124 | sub(/^new /, "", name) | ||
| 125 | sub(/ (characters|hieroglyphs|cursive)$/, "", name) | ||
| 126 | gsub(/ /, "-", name) | ||
| 127 | |||
| 128 | return name | ||
| 129 | } | ||
| 130 | |||
| 131 | /^[0-9A-F]/ { | ||
| 132 | sep = index($1, "..") | ||
| 133 | len = length($1) | ||
| 134 | s = substr($1,1,sep-1) | ||
| 135 | e = substr($1,sep+2,len-sep-2) | ||
| 136 | $1 = "" | ||
| 137 | sub(/^ */, "", $0) | ||
| 138 | i++ | ||
| 139 | start[i] = fix_start[s] ? fix_start[s] : s | ||
| 140 | end[i] = fix_end[e] ? fix_end[e]: e | ||
| 141 | name[i] = $0 | ||
| 142 | |||
| 143 | alt[i] = name2alias(name[i]) | ||
| 144 | |||
| 145 | if (!alt[i]) | ||
| 146 | { | ||
| 147 | i-- | ||
| 148 | next | ||
| 149 | } | ||
| 150 | |||
| 151 | ## Combine adjacent ranges with the same name. | ||
| 152 | if (alt[i] == alt[i-1] && decode_hex(start[i]) == 1 + decode_hex(end[i-1])) | ||
| 153 | { | ||
| 154 | end[i-1] = end[i] | ||
| 155 | name[i-1] = (name[i-1] ", " name[i]) | ||
| 156 | i-- | ||
| 157 | } | ||
| 158 | |||
| 159 | ## Some hard-coded splits. | ||
| 160 | if (start[i] == "0370") | ||
| 161 | { | ||
| 162 | end[i] = "03E1" | ||
| 163 | i++ | ||
| 164 | start[i] = "03E2" | ||
| 165 | end[i] = "03EF" | ||
| 166 | alt[i] = "coptic" | ||
| 167 | i++ | ||
| 168 | start[i] = "03F0" | ||
| 169 | end[i] = "03FF" | ||
| 170 | alt[i] = "greek" | ||
| 171 | } | ||
| 172 | else if (start[i] == "FB00") | ||
| 173 | { | ||
| 174 | end[i] = "FB06" | ||
| 175 | i++ | ||
| 176 | start[i] = "FB13" | ||
| 177 | end[i] = "FB17" | ||
| 178 | alt[i] = "armenian" | ||
| 179 | i++ | ||
| 180 | start[i] = "FB1D" | ||
| 181 | end[i] = "FB4F" | ||
| 182 | alt[i] = "hebrew" | ||
| 183 | } | ||
| 184 | else if (start[i] == "FF00") | ||
| 185 | { | ||
| 186 | end[i] = "FF60" | ||
| 187 | i++ | ||
| 188 | start[i] = "FF61" | ||
| 189 | end[i] = "FF9F" | ||
| 190 | alt[i] = "kana" | ||
| 191 | i++ | ||
| 192 | start[i] = "FFA0" | ||
| 193 | end[i] = "FFDF" | ||
| 194 | alt[i] = "hangul" | ||
| 195 | i++ | ||
| 196 | start[i] = "FFE0" | ||
| 197 | end[i] = "FFEF" | ||
| 198 | alt[i] = "cjk-misc" | ||
| 199 | } | ||
| 200 | } | ||
| 201 | |||
| 202 | END { | ||
| 203 | print ";;; charscript.el --- character script table" | ||
| 204 | print ";;; Automatically generated from admin/unidata/Blocks.txt" | ||
| 205 | print "(let (script-list)" | ||
| 206 | print " (dolist (elt '(" | ||
| 207 | |||
| 208 | for (j=1;j<=i;j++) | ||
| 209 | { | ||
| 210 | printf(" (#x%s #x%s %s)", start[j], end[j], alt[j]) | ||
| 211 | ## Fuzz to decide whether worth printing original name as a comment. | ||
| 212 | if (name[j] && alt[j] != tolower(name[j]) && alt[j] !~ /-/) | ||
| 213 | printf(" ; %s", name[j]) | ||
| 214 | printf("\n") | ||
| 215 | } | ||
| 216 | |||
| 217 | print " ))" | ||
| 218 | print " (set-char-table-range char-script-table" | ||
| 219 | print " (cons (car elt) (nth 1 elt)) (nth 2 elt))" | ||
| 220 | print " (or (memq (nth 2 elt) script-list)" | ||
| 221 | print " (setq script-list (cons (nth 2 elt) script-list))))" | ||
| 222 | print " (set-char-table-extra-slot char-script-table 0 (nreverse script-list)))" | ||
| 223 | print "" | ||
| 224 | print "(provide 'charscript)" | ||
| 225 | } | ||