From cad5b8294e9471e6c6e168108754507cee1b1e0c Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sat, 11 Feb 2017 14:40:18 -0800 Subject: [PATCH] Implement unicode-char-code?. --- src/runtime/char.scm | 8 +++++--- src/runtime/predicate-metadata.scm | 2 ++ src/runtime/runtime.pkg | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/runtime/char.scm b/src/runtime/char.scm index 0f13d3d94..21977494d 100644 --- a/src/runtime/char.scm +++ b/src/runtime/char.scm @@ -375,9 +375,11 @@ USA. (define (unicode-char? object) (and (char? object) - (let ((n (char->integer object))) - (and (unicode-scalar-value? n) - (not (non-character? n)))))) + (unicode-char-code? (char->integer object)))) + +(define (unicode-char-code? object) + (and (unicode-scalar-value? object) + (not (non-character? object)))) (define-integrable (unicode-code-point? object) (and (index-fixnum? object) diff --git a/src/runtime/predicate-metadata.scm b/src/runtime/predicate-metadata.scm index 06082e347..89070c697 100644 --- a/src/runtime/predicate-metadata.scm +++ b/src/runtime/predicate-metadata.scm @@ -316,6 +316,8 @@ USA. '<= index-fixnum?) (register-predicate! unicode-scalar-value? 'unicode-scalar-value '<= unicode-code-point?) + (register-predicate! unicode-char-code? 'unicode-char-code + '<= unicode-scalar-value?) (register-predicate! uninterned-symbol? 'uninterned-symbol '<= symbol?) (register-predicate! weak-list? 'weak-list) (register-predicate! weak-pair? 'weak-pair) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index eb5d8af92..939011029 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -1395,6 +1395,7 @@ USA. radix? set-char-bits unicode-char->scalar-value + unicode-char-code? unicode-char? unicode-code-point-general-category unicode-code-point? -- 2.25.1