From 54cebdedc14fab8c6a8b482d8f1ae53c6c51e0f7 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Fri, 17 Feb 2017 22:20:14 -0800 Subject: [PATCH] Add ucd-table-ccc. --- src/etc/ucd-converter.scm | 35 ++++++++++++++--------- src/runtime/runtime.pkg | 12 ++++---- src/runtime/ucd-table-ccc.scm | 54 +++++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+), 21 deletions(-) create mode 100644 src/runtime/ucd-table-ccc.scm diff --git a/src/etc/ucd-converter.scm b/src/etc/ucd-converter.scm index 4f9b4bb23..bbef6d858 100644 --- a/src/etc/ucd-converter.scm +++ b/src/etc/ucd-converter.scm @@ -395,6 +395,7 @@ USA. "Lower" "Upper" "WSpace" + "ccc" "cf" "gc" "lc" @@ -455,6 +456,7 @@ USA. ((string=? "nv" (metadata-name metadata)) code-generator:nv) ((mapped-enum-type? type-spec) code-generator:mapped-enum) ((eq? 'boolean type-spec) code-generator:boolean) + ((eq? 'byte type-spec) code-generator:byte) ((eq? 'code-point type-spec) code-generator:code-point) ((eq? 'code-point* type-spec) code-generator:code-point*) ((eq? 'code-point+ type-spec) code-generator:code-point+) @@ -473,7 +475,7 @@ USA. (car value-map))) prop-alist)))))) -(define (hashed-code-generator keep-value? value-converter default-value +(define (hashed-code-generator default-string value-converter default-value runtime-value-converter) (lambda (prop-name metadata prop-alist proc-name) (let ((table-name (symbol "char-map:" (metadata-full-name metadata))) @@ -483,8 +485,8 @@ USA. (lambda (cp) (cons cp value))) (expand-cpr (car p)))) - (filter (lambda (p) - (keep-value? (cdr p))) + (remove (lambda (p) + (ustring=? default-string (cdr p))) prop-alist)))) (with-notification (lambda (port) @@ -518,11 +520,10 @@ USA. (string-splitter #\space #f)) (define (code-point-filter value) - (and (string? value) - (not (string=? "#" value)))) + (not (ustring=? "#" value))) (define code-generator:code-point - (hashed-code-generator code-point-filter + (hashed-code-generator "#" string->cp (lambda (char-expr) char-expr) (lambda (sv-expr) `(integer->char ,sv-expr)))) @@ -534,17 +535,27 @@ USA. `(map integer->char ,svs-expr)) (define code-generator:code-point* - (hashed-code-generator code-point-filter + (hashed-code-generator "#" string->cps code-points-default code-points-converter)) (define code-generator:code-point+ - (hashed-code-generator code-point-filter + (hashed-code-generator "#" string->cps code-points-default code-points-converter)) +(define code-generator:byte + (hashed-code-generator "0" + (lambda (string) + (let ((n (string->number string 10 #t))) + (if (not (and (fix:<= 0 n) (fix:<= n 254))) + (error "Illegal ccc value:" string)) + n)) + (lambda (char-expr) char-expr 0) + (lambda (sv-expr) sv-expr))) + (define (converter:mapped-enum metadata) (let ((name (symbol->string (metadata-full-name metadata))) (translations @@ -561,17 +572,13 @@ USA. (default-object))))) (define code-generator:nt - (hashed-code-generator (lambda (value) - (and (string? value) - (not (string=? "None" value)))) + (hashed-code-generator "None" (converter:mapped-enum (prop-metadata "nt")) (lambda (char-expr) char-expr #f) (lambda (sv-expr) sv-expr))) (define code-generator:nv - (hashed-code-generator (lambda (value) - (and (string? value) - (not (string=? "NaN" value)))) + (hashed-code-generator "NaN" (lambda (string) (string->number string 10 #t)) (lambda (char-expr) char-expr #f) (lambda (sv-expr) sv-expr))) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 0aceb056a..a3d12341a 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -1479,6 +1479,7 @@ USA. (define-package (runtime ucd-tables) (files "ucd-table-alpha" + "ucd-table-ccc" "ucd-table-cf" "ucd-table-cwcf" "ucd-table-cwl" @@ -1497,16 +1498,10 @@ USA. (parent (runtime)) (export () char-alphabetic? - char-changes-when-case-folded? - char-changes-when-lower-cased? - char-changes-when-upper-cased? char-lower-case? char-upper-case? char-whitespace? char-set:alphabetic - char-set:changes-when-case-folded - char-set:changes-when-lower-cased - char-set:changes-when-upper-cased char-set:lower-case char-set:upper-case char-set:whitespace) @@ -1521,7 +1516,10 @@ USA. ucd-suc-value ucd-uc-value) (export (runtime ucd-glue) - ucd-nt-value)) + char-set:changes-when-case-folded + ucd-nt-value) + (export (runtime ustring) + ucd-ccc-value)) (define-package (runtime ucd-glue) (files "ucd-glue") diff --git a/src/runtime/ucd-table-ccc.scm b/src/runtime/ucd-table-ccc.scm new file mode 100644 index 000000000..dea0957e9 --- /dev/null +++ b/src/runtime/ucd-table-ccc.scm @@ -0,0 +1,54 @@ +#| -*-Scheme-*- + +Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, + 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, + 2017 Massachusetts Institute of Technology + +This file is part of MIT/GNU Scheme. + +MIT/GNU Scheme is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +MIT/GNU Scheme is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with MIT/GNU Scheme; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, +USA. + +|# + +;;;; UCD property: ccc (combining-class) + +;;; Generated from Unicode 9.0.0 + +(declare (usual-integrations)) + +(define (ucd-ccc-value char) + (hash-table-ref char-map:combining-class char (lambda () 0))) + +(define-deferred char-map:combining-class + (let ((table (make-non-pointer-hash-table))) + (for-each + (lambda (p) + (hash-table-set! table (integer->char (car p)) (cdr p))) + '((768 . 230) (769 . 230) (770 . 230) (771 . 230) (772 . 230) (773 . 230) (774 . 230) (775 . 230) (776 . 230) (777 . 230) (778 . 230) (779 . 230) (780 . 230) (781 . 230) (782 . 230) (783 . 230) (784 . 230) (785 . 230) (786 . 230) (787 . 230) (788 . 230) (789 . 232) (790 . 220) (791 . 220) (792 . 220) (793 . 220) (794 . 232) (795 . 216) (796 . 220) (797 . 220) (798 . 220) (799 . 220) (800 . 220) (801 . 202) (802 . 202) (803 . 220) (804 . 220) (805 . 220) (806 . 220) (807 . 202) (808 . 202) (809 . 220) (810 . 220) (811 . 220) (812 . 220) (813 . 220) (814 . 220) (815 . 220) (816 . 220) (817 . 220) (818 . 220) (819 . 220) (820 . 1) (821 . 1) (822 . 1) (823 . 1) (824 . 1) (825 . 220) (826 . 220) (827 . 220) (828 . 220) (829 . 230) (830 . 230) (831 . 230) (832 . 230) + (833 . 230) (834 . 230) (835 . 230) (836 . 230) (837 . 240) (838 . 230) (839 . 220) (840 . 220) (841 . 220) (842 . 230) (843 . 230) (844 . 230) (845 . 220) (846 . 220) (848 . 230) (849 . 230) (850 . 230) (851 . 220) (852 . 220) (853 . 220) (854 . 220) (855 . 230) (856 . 232) (857 . 220) (858 . 220) (859 . 230) (860 . 233) (861 . 234) (862 . 234) (863 . 233) (864 . 234) (865 . 234) (866 . 233) (867 . 230) (868 . 230) (869 . 230) (870 . 230) (871 . 230) (872 . 230) (873 . 230) (874 . 230) (875 . 230) (876 . 230) (877 . 230) (878 . 230) (879 . 230) (1155 . 230) (1156 . 230) (1157 . 230) (1158 . 230) (1159 . 230) (1425 . 220) (1426 . 230) (1427 . 230) (1428 . 230) (1429 . 230) (1430 . 220) (1431 . 230) (1432 . 230) (1433 . 230) (1434 . 222) (1435 . 220) (1436 . 230) (1437 . 230) (1438 . 230) + (1439 . 230) (1440 . 230) (1441 . 230) (1442 . 220) (1443 . 220) (1444 . 220) (1445 . 220) (1446 . 220) (1447 . 220) (1448 . 230) (1449 . 230) (1450 . 220) (1451 . 230) (1452 . 230) (1453 . 222) (1454 . 228) (1455 . 230) (1456 . 10) (1457 . 11) (1458 . 12) (1459 . 13) (1460 . 14) (1461 . 15) (1462 . 16) (1463 . 17) (1464 . 18) (1465 . 19) (1466 . 19) (1467 . 20) (1468 . 21) (1469 . 22) (1471 . 23) (1473 . 24) (1474 . 25) (1476 . 230) (1477 . 220) (1479 . 18) (1552 . 230) (1553 . 230) (1554 . 230) (1555 . 230) (1556 . 230) (1557 . 230) (1558 . 230) (1559 . 230) (1560 . 30) (1561 . 31) (1562 . 32) (1611 . 27) (1612 . 28) (1613 . 29) (1614 . 30) (1615 . 31) (1616 . 32) (1617 . 33) (1618 . 34) (1619 . 230) (1620 . 230) (1621 . 220) (1622 . 220) (1623 . 230) (1624 . 230) (1625 . 230) (1626 . 230) (1627 . 230) + (1628 . 220) (1629 . 230) (1630 . 230) (1631 . 220) (1648 . 35) (1750 . 230) (1751 . 230) (1752 . 230) (1753 . 230) (1754 . 230) (1755 . 230) (1756 . 230) (1759 . 230) (1760 . 230) (1761 . 230) (1762 . 230) (1763 . 220) (1764 . 230) (1767 . 230) (1768 . 230) (1770 . 220) (1771 . 230) (1772 . 230) (1773 . 220) (1809 . 36) (1840 . 230) (1841 . 220) (1842 . 230) (1843 . 230) (1844 . 220) (1845 . 230) (1846 . 230) (1847 . 220) (1848 . 220) (1849 . 220) (1850 . 230) (1851 . 220) (1852 . 220) (1853 . 230) (1854 . 220) (1855 . 230) (1856 . 230) (1857 . 230) (1858 . 220) (1859 . 230) (1860 . 220) (1861 . 230) (1862 . 220) (1863 . 230) (1864 . 220) (1865 . 230) (1866 . 230) (2027 . 230) (2028 . 230) (2029 . 230) (2030 . 230) (2031 . 230) (2032 . 230) (2033 . 230) (2034 . 220) (2035 . 230) (2070 . 230) (2071 . 230) (2072 . 230) (2073 . 230) + (2075 . 230) (2076 . 230) (2077 . 230) (2078 . 230) (2079 . 230) (2080 . 230) (2081 . 230) (2082 . 230) (2083 . 230) (2085 . 230) (2086 . 230) (2087 . 230) (2089 . 230) (2090 . 230) (2091 . 230) (2092 . 230) (2093 . 230) (2137 . 220) (2138 . 220) (2139 . 220) (2260 . 230) (2261 . 230) (2262 . 230) (2263 . 230) (2264 . 230) (2265 . 230) (2266 . 230) (2267 . 230) (2268 . 230) (2269 . 230) (2270 . 230) (2271 . 230) (2272 . 230) (2273 . 230) (2275 . 220) (2276 . 230) (2277 . 230) (2278 . 220) (2279 . 230) (2280 . 230) (2281 . 220) (2282 . 230) (2283 . 230) (2284 . 230) (2285 . 220) (2286 . 220) (2287 . 220) (2288 . 27) (2289 . 28) (2290 . 29) (2291 . 230) (2292 . 230) (2293 . 230) (2294 . 220) (2295 . 230) (2296 . 230) (2297 . 220) (2298 . 220) (2299 . 230) (2300 . 230) (2301 . 230) (2302 . 230) (2303 . 230) (2364 . 7) (2381 . 9) + (2385 . 230) (2386 . 220) (2387 . 230) (2388 . 230) (2492 . 7) (2509 . 9) (2620 . 7) (2637 . 9) (2748 . 7) (2765 . 9) (2876 . 7) (2893 . 9) (3021 . 9) (3149 . 9) (3157 . 84) (3158 . 91) (3260 . 7) (3277 . 9) (3405 . 9) (3530 . 9) (3640 . 103) (3641 . 103) (3642 . 9) (3656 . 107) (3657 . 107) (3658 . 107) (3659 . 107) (3768 . 118) (3769 . 118) (3784 . 122) (3785 . 122) (3786 . 122) (3787 . 122) (3864 . 220) (3865 . 220) (3893 . 220) (3895 . 220) (3897 . 216) (3953 . 129) (3954 . 130) (3956 . 132) (3962 . 130) (3963 . 130) (3964 . 130) (3965 . 130) (3968 . 130) (3970 . 230) (3971 . 230) (3972 . 9) (3974 . 230) (3975 . 230) (4038 . 220) (4151 . 7) (4153 . 9) (4154 . 9) (4237 . 220) (4957 . 230) (4958 . 230) (4959 . 230) (5908 . 9) (5940 . 9) (6098 . 9) (6109 . 230) (6313 . 228) (6457 . 222) + (6458 . 230) (6459 . 220) (6679 . 230) (6680 . 220) (6752 . 9) (6773 . 230) (6774 . 230) (6775 . 230) (6776 . 230) (6777 . 230) (6778 . 230) (6779 . 230) (6780 . 230) (6783 . 220) (6832 . 230) (6833 . 230) (6834 . 230) (6835 . 230) (6836 . 230) (6837 . 220) (6838 . 220) (6839 . 220) (6840 . 220) (6841 . 220) (6842 . 220) (6843 . 230) (6844 . 230) (6845 . 220) (6964 . 7) (6980 . 9) (7019 . 230) (7020 . 220) (7021 . 230) (7022 . 230) (7023 . 230) (7024 . 230) (7025 . 230) (7026 . 230) (7027 . 230) (7082 . 9) (7083 . 9) (7142 . 7) (7154 . 9) (7155 . 9) (7223 . 7) (7376 . 230) (7377 . 230) (7378 . 230) (7380 . 1) (7381 . 220) (7382 . 220) (7383 . 220) (7384 . 220) (7385 . 220) (7386 . 230) (7387 . 230) (7388 . 220) (7389 . 220) (7390 . 220) (7391 . 220) (7392 . 230) (7394 . 1) (7395 . 1) (7396 . 1) (7397 . 1) + (7398 . 1) (7399 . 1) (7400 . 1) (7405 . 220) (7412 . 230) (7416 . 230) (7417 . 230) (7616 . 230) (7617 . 230) (7618 . 220) (7619 . 230) (7620 . 230) (7621 . 230) (7622 . 230) (7623 . 230) (7624 . 230) (7625 . 230) (7626 . 220) (7627 . 230) (7628 . 230) (7629 . 234) (7630 . 214) (7631 . 220) (7632 . 202) (7633 . 230) (7634 . 230) (7635 . 230) (7636 . 230) (7637 . 230) (7638 . 230) (7639 . 230) (7640 . 230) (7641 . 230) (7642 . 230) (7643 . 230) (7644 . 230) (7645 . 230) (7646 . 230) (7647 . 230) (7648 . 230) (7649 . 230) (7650 . 230) (7651 . 230) (7652 . 230) (7653 . 230) (7654 . 230) (7655 . 230) (7656 . 230) (7657 . 230) (7658 . 230) (7659 . 230) (7660 . 230) (7661 . 230) (7662 . 230) (7663 . 230) (7664 . 230) (7665 . 230) (7666 . 230) (7667 . 230) (7668 . 230) (7669 . 230) (7675 . 230) (7676 . 233) (7677 . 220) (7678 . 230) + (7679 . 220) (8400 . 230) (8401 . 230) (8402 . 1) (8403 . 1) (8404 . 230) (8405 . 230) (8406 . 230) (8407 . 230) (8408 . 1) (8409 . 1) (8410 . 1) (8411 . 230) (8412 . 230) (8417 . 230) (8421 . 1) (8422 . 1) (8423 . 230) (8424 . 220) (8425 . 230) (8426 . 1) (8427 . 1) (8428 . 220) (8429 . 220) (8430 . 220) (8431 . 220) (8432 . 230) (11503 . 230) (11504 . 230) (11505 . 230) (11647 . 9) (11744 . 230) (11745 . 230) (11746 . 230) (11747 . 230) (11748 . 230) (11749 . 230) (11750 . 230) (11751 . 230) (11752 . 230) (11753 . 230) (11754 . 230) (11755 . 230) (11756 . 230) (11757 . 230) (11758 . 230) (11759 . 230) (11760 . 230) (11761 . 230) (11762 . 230) (11763 . 230) (11764 . 230) (11765 . 230) (11766 . 230) (11767 . 230) (11768 . 230) (11769 . 230) (11770 . 230) (11771 . 230) (11772 . 230) (11773 . 230) (11774 . 230) (11775 . 230) (12330 . 218) (12331 . 228) + (12332 . 232) (12333 . 222) (12334 . 224) (12335 . 224) (12441 . 8) (12442 . 8) (42607 . 230) (42612 . 230) (42613 . 230) (42614 . 230) (42615 . 230) (42616 . 230) (42617 . 230) (42618 . 230) (42619 . 230) (42620 . 230) (42621 . 230) (42654 . 230) (42655 . 230) (42736 . 230) (42737 . 230) (43014 . 9) (43204 . 9) (43232 . 230) (43233 . 230) (43234 . 230) (43235 . 230) (43236 . 230) (43237 . 230) (43238 . 230) (43239 . 230) (43240 . 230) (43241 . 230) (43242 . 230) (43243 . 230) (43244 . 230) (43245 . 230) (43246 . 230) (43247 . 230) (43248 . 230) (43249 . 230) (43307 . 220) (43308 . 220) (43309 . 220) (43347 . 9) (43443 . 7) (43456 . 9) (43696 . 230) (43698 . 230) (43699 . 230) (43700 . 220) (43703 . 230) (43704 . 230) (43710 . 230) (43711 . 230) (43713 . 230) (43766 . 9) (44013 . 9) (64286 . 26) (65056 . 230) (65057 . 230) (65058 . 230) (65059 . 230) (65060 . 230) (65061 . 230) + (65062 . 230) (65063 . 220) (65064 . 220) (65065 . 220) (65066 . 220) (65067 . 220) (65068 . 220) (65069 . 220) (65070 . 230) (65071 . 230) (66045 . 220) (66272 . 220) (66422 . 230) (66423 . 230) (66424 . 230) (66425 . 230) (66426 . 230) (68109 . 220) (68111 . 230) (68152 . 230) (68153 . 1) (68154 . 220) (68159 . 9) (68325 . 230) (68326 . 220) (69702 . 9) (69759 . 9) (69817 . 9) (69818 . 7) (69888 . 230) (69889 . 230) (69890 . 230) (69939 . 9) (69940 . 9) (70003 . 7) (70080 . 9) (70090 . 7) (70197 . 9) (70198 . 7) (70377 . 7) (70378 . 9) (70460 . 7) (70477 . 9) (70502 . 230) (70503 . 230) (70504 . 230) (70505 . 230) (70506 . 230) (70507 . 230) (70508 . 230) (70512 . 230) (70513 . 230) (70514 . 230) (70515 . 230) (70516 . 230) (70722 . 9) (70726 . 7) (70850 . 9) (70851 . 7) (71103 . 9) (71104 . 7) (71231 . 9) (71350 . 9) (71351 . 7) (71467 . 9) + (72767 . 9) (92912 . 1) (92913 . 1) (92914 . 1) (92915 . 1) (92916 . 1) (92976 . 230) (92977 . 230) (92978 . 230) (92979 . 230) (92980 . 230) (92981 . 230) (92982 . 230) (113822 . 1) (119141 . 216) (119142 . 216) (119143 . 1) (119144 . 1) (119145 . 1) (119149 . 226) (119150 . 216) (119151 . 216) (119152 . 216) (119153 . 216) (119154 . 216) (119163 . 220) (119164 . 220) (119165 . 220) (119166 . 220) (119167 . 220) (119168 . 220) (119169 . 220) (119170 . 220) (119173 . 230) (119174 . 230) (119175 . 230) (119176 . 230) (119177 . 230) (119178 . 220) (119179 . 220) (119210 . 230) (119211 . 230) (119212 . 230) (119213 . 230) (119362 . 230) (119363 . 230) (119364 . 230) (122880 . 230) (122881 . 230) (122882 . 230) (122883 . 230) (122884 . 230) (122885 . 230) (122886 . 230) (122888 . 230) (122889 . 230) (122890 . 230) (122891 . 230) (122892 . 230) (122893 . 230) (122894 . 230) (122895 . 230) (122896 . 230) (122897 . 230) (122898 . 230) + (122899 . 230) (122900 . 230) (122901 . 230) (122902 . 230) (122903 . 230) (122904 . 230) (122907 . 230) (122908 . 230) (122909 . 230) (122910 . 230) (122911 . 230) (122912 . 230) (122913 . 230) (122915 . 230) (122916 . 230) (122918 . 230) (122919 . 230) (122920 . 230) (122921 . 230) (122922 . 230) (125136 . 220) (125137 . 220) (125138 . 220) (125139 . 220) (125140 . 220) (125141 . 220) (125142 . 220) (125252 . 230) (125253 . 230) (125254 . 230) (125255 . 230) (125256 . 230) (125257 . 230) (125258 . 7))) + table)) -- 2.25.1