From: Chris Hanson Date: Fri, 6 Jan 2017 04:03:07 +0000 (-0800) Subject: Fix definitions of legal code points. X-Git-Tag: mit-scheme-pucked-9.2.12~227^2~213 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=793aede77883046e0f00991d220e9dd33d1d5f1a;p=mit-scheme.git Fix definitions of legal code points. --- diff --git a/src/runtime/char.scm b/src/runtime/char.scm index 7cc34701a..bb90f90d8 100644 --- a/src/runtime/char.scm +++ b/src/runtime/char.scm @@ -97,32 +97,26 @@ USA. (define (unicode-scalar-value? object) (and (index-fixnum? object) (fix:< object char-code-limit) - (not (illegal? object)))) + (not (surrogate? object)) + (not (non-character? object)))) (define-guarantee unicode-scalar-value "a Unicode scalar value") (define-integrable (legal-code-32? pt) (and (fix:< pt char-code-limit) - (not (illegal? pt)))) + (not (surrogate? pt)) + (not (non-character? pt)))) (define-integrable (legal-code-16? pt) - (not (illegal? pt))) + (and (not (surrogate? pt)) + (not (non-character? pt)))) -(define-integrable (illegal? pt) - (or (and (fix:>= pt #xD800) (fix:< pt #xE000)) - (fix:= pt #xFFFE) - (fix:= pt #xFFFF))) - -#| - -Not used at the moment. +(define-integrable (surrogate? pt) + (and (fix:<= #xD800 pt) (fix:< pt #xDFFF))) (define-integrable (non-character? pt) - (or (and (fix:>= pt #xD800) (fix:< pt #xE000)) - (and (fix:>= pt #xFDD0) (fix:< pt #xFDF0)) - (fix:= #x00FFFE (fix:and #x00FFFE pt)))) - -|# + (or (and (fix:<= #xFDD0 pt) (fix:< pt #xFDF0)) + (fix:= (fix:and #xFFFE pt) #xFFFE))) (define (8-bit-char? object) (and (char? object)