From 8d28f63562154e08d6b84a11d954f2c31496db6c Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sat, 25 Mar 2017 15:19:21 -0700 Subject: [PATCH] Add NFC_QC and Comp_EX tables. --- src/etc/ucd-converter.scm | 30 ++++------------- src/etc/ucd-raw-props/names.scm | 4 +-- src/runtime/ucd-table-comp_ex.scm | 37 ++++++++++++++++++++ src/runtime/ucd-table-nfc_qc.scm | 56 +++++++++++++++++++++++++++++++ 4 files changed, 102 insertions(+), 25 deletions(-) create mode 100644 src/runtime/ucd-table-comp_ex.scm create mode 100644 src/runtime/ucd-table-nfc_qc.scm diff --git a/src/etc/ucd-converter.scm b/src/etc/ucd-converter.scm index 6a9f50be2..10c5b46c3 100644 --- a/src/etc/ucd-converter.scm +++ b/src/etc/ucd-converter.scm @@ -424,8 +424,10 @@ USA. "CWL" "CWU" "Cased" + "Comp_Ex" "GCB" "Lower" + "NFC_QC" "NFD_QC" "Upper" "WB" @@ -433,8 +435,6 @@ USA. "canonical-dm" "ccc" "cf" - "dm" - "dt" "gc" "lc" "nt" @@ -493,17 +493,13 @@ USA. (define (metadata->code-generator metadata) (let ((name (metadata-name metadata)) (type-spec (metadata-type-spec metadata))) - (cond ((string=? name "NFC_QC") code-generator:nfc-qc) - ((string=? name "NFKC_QC") code-generator:nfc-qc) - ((string=? name "dt") code-generator:dt) - ((string=? name "gc") code-generator:gc) - ((string=? name "nt") code-generator:nt) - ((eq? type-spec 'boolean) code-generator:boolean) + (cond ((eq? type-spec 'boolean) code-generator:boolean) ((eq? type-spec 'byte) code-generator:byte) ((eq? type-spec 'code-point) code-generator:code-point) ((eq? type-spec 'code-point*) code-generator:code-point*) ((eq? type-spec 'code-point+) code-generator:code-point+) ((eq? type-spec 'rational-or-nan) code-generator:rational-or-nan) + ((mapped-enum-type? type-spec) code-generator:mapped-enum) ((unmapped-enum-type? type-spec) code-generator:unmapped-enum) (else (error "Unsupported metadata:" metadata))))) @@ -540,24 +536,12 @@ USA. ((trie-code-generator value-manager:rational-or-nan) prop-name metadata prop-alist proc-name)) -(define (code-generator:unmapped-enum prop-name metadata prop-alist proc-name) - ((trie-code-generator (unmapped-enum-value-manager #f metadata)) - prop-name metadata prop-alist proc-name)) - -(define (code-generator:dt prop-name metadata prop-alist proc-name) - ((trie-code-generator (mapped-enum-value-manager "none" metadata)) - prop-name metadata prop-alist proc-name)) - -(define (code-generator:gc prop-name metadata prop-alist proc-name) +(define (code-generator:mapped-enum prop-name metadata prop-alist proc-name) ((trie-code-generator (mapped-enum-value-manager #f metadata)) prop-name metadata prop-alist proc-name)) -(define (code-generator:nfc-qc prop-name metadata prop-alist proc-name) - ((trie-code-generator (mapped-enum-value-manager "Y" metadata)) - prop-name metadata prop-alist proc-name)) - -(define (code-generator:nt prop-name metadata prop-alist proc-name) - ((trie-code-generator (mapped-enum-value-manager "None" metadata)) +(define (code-generator:unmapped-enum prop-name metadata prop-alist proc-name) + ((trie-code-generator (unmapped-enum-value-manager #f metadata)) prop-name metadata prop-alist proc-name)) (define (value-manager default-string converter diff --git a/src/etc/ucd-raw-props/names.scm b/src/etc/ucd-raw-props/names.scm index 9de63ffdb..93dcf32d1 100644 --- a/src/etc/ucd-raw-props/names.scm +++ b/src/etc/ucd-raw-props/names.scm @@ -139,10 +139,10 @@ USA. ("Lower" lower-case boolean) ("Math" math boolean) ("NChar" noncharactor-code-point boolean) -("NFC_QC" nfc-quick-check (enum ("Y" . #t) ("N" . #f) ("M" . maybe))) +("NFC_QC" nfc-quick-check (enum ("Y" . yes) ("N" . no) ("M" . maybe))) ("NFD_QC" nfd-quick-check boolean) ("NFKC_CF" nfkc-case-fold code-point*) -("NFKC_QC" nfkc-quick-check (enum ("Y" . #t) ("N" . #f) ("M" . maybe))) +("NFKC_QC" nfkc-quick-check (enum ("Y" . yes) ("N" . no) ("M" . maybe))) ("NFKD_QC" nfkd-quick-check boolean) ("OAlpha" other-alphabetic boolean) ("ODI" other-default-ignorable-code-point boolean) diff --git a/src/runtime/ucd-table-comp_ex.scm b/src/runtime/ucd-table-comp_ex.scm new file mode 100644 index 000000000..dcc4558f0 --- /dev/null +++ b/src/runtime/ucd-table-comp_ex.scm @@ -0,0 +1,37 @@ +#| -*-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: Comp_Ex (full-composition-exclusion) + +;;; Generated from Unicode 9.0.0 + +(declare (usual-integrations)) + +(define (char-full-composition-exclusion? char) + (char-in-set? char char-set:full-composition-exclusion)) + +(define-deferred char-set:full-composition-exclusion + (char-set* '((832 . 834) (835 . 837) 884 894 903 (2392 . 2400) (2524 . 2526) 2527 2611 2614 (2649 . 2652) 2654 (2908 . 2910) 3907 3917 3922 3927 3932 3945 3955 (3957 . 3959) 3960 3969 3987 3997 4002 4007 4012 4025 8049 8051 8053 8055 8057 8059 8061 8123 8126 8137 8139 8147 8155 8163 8171 (8174 . 8176) 8185 8187 8189 (8192 . 8194) 8486 (8490 . 8492) (9001 . 9003) 10972 (63744 . 64014) 64016 64018 (64021 . 64031) 64032 64034 (64037 . 64039) (64042 . 64110) (64112 . 64218) 64285 64287 (64298 . 64311) (64312 . 64317) 64318 (64320 . 64322) (64323 . 64325) (64326 . 64335) (119134 . 119141) (119227 . 119233) (194560 . 195102)))) diff --git a/src/runtime/ucd-table-nfc_qc.scm b/src/runtime/ucd-table-nfc_qc.scm new file mode 100644 index 000000000..28825c598 --- /dev/null +++ b/src/runtime/ucd-table-nfc_qc.scm @@ -0,0 +1,56 @@ +#| -*-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: NFC_QC (nfc-quick-check) + +;;; Generated from Unicode 9.0.0 + +(declare (usual-integrations)) + +(define (ucd-nfc_qc-value char) + (let ((sv (char->integer char))) + (vector-ref |ucd-NFC_QC-table-5| (bytevector-u8-ref |ucd-NFC_QC-table-4| (fix:or (fix:lsh (bytevector-u8-ref |ucd-NFC_QC-table-3| (fix:or (fix:lsh (bytevector-u8-ref |ucd-NFC_QC-table-2| (fix:or (fix:lsh (bytevector-u8-ref |ucd-NFC_QC-table-1| (fix:or (fix:lsh (bytevector-u8-ref |ucd-NFC_QC-table-0| (fix:lsh sv -16)) 4) (fix:and 15 (fix:lsh sv -12)))) 4) (fix:and 15 (fix:lsh sv -8)))) 4) (fix:and 15 (fix:lsh sv -4)))) 4) (fix:and 15 sv)))))) + +(define-deferred |ucd-NFC_QC-table-0| + (vector->bytevector '#(0 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3))) + +(define-deferred |ucd-NFC_QC-table-1| + (vector->bytevector '#(0 1 2 3 4 4 4 4 4 4 4 4 4 4 4 5 4 6 4 4 4 4 4 4 4 4 4 4 4 7 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 8 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4))) + +(define-deferred |ucd-NFC_QC-table-2| + (vector->bytevector '#(0 0 0 1 0 0 2 0 0 3 4 5 6 7 0 8 9 10 0 0 0 0 0 0 0 0 0 11 0 0 0 12 13 14 0 15 0 0 0 0 0 0 16 0 0 0 0 0 17 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 18 19 20 0 0 0 0 21 22 0 23 24 25 0 0 0 0 0 0 0 0 0 0 0 26 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 18 18 27 0 0 0 0 0))) + +(define-deferred |ucd-NFC_QC-table-3| + (vector->bytevector + '#(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 0 0 6 7 0 0 0 0 0 0 0 0 0 0 0 0 8 0 0 0 0 0 0 0 0 0 0 0 0 0 9 0 10 0 0 0 0 0 11 0 12 0 0 0 0 0 13 0 14 0 0 0 0 0 0 0 0 0 0 0 0 0 11 0 15 0 0 0 0 0 11 0 16 0 0 0 0 0 0 0 17 0 0 0 0 0 0 18 19 0 0 0 0 0 11 0 16 0 0 0 0 0 0 20 21 0 0 0 0 0 0 22 23 24 25 26 22 23 24 0 0 0 0 0 0 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 27 28 0 0 29 30 31 0 0 0 0 0 0 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 33 0 0 0 34 35 36 37 38 39 0 0 0 0 0 0 0 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