From 7530278a8da931f6ccd06ff1b675e63283f3c402 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Mon, 30 Jan 2017 01:40:19 -0800 Subject: [PATCH] Implement char->scalar-value. --- src/runtime/char.scm | 5 +++++ src/runtime/runtime.pkg | 1 + 2 files changed, 6 insertions(+) diff --git a/src/runtime/char.scm b/src/runtime/char.scm index 506904cff..aee593767 100644 --- a/src/runtime/char.scm +++ b/src/runtime/char.scm @@ -380,6 +380,11 @@ USA. (define-guarantee unicode-char "a Unicode character") (define-guarantee unicode-scalar-value "a Unicode scalar value") +(define (char->scalar-value char #!optional caller) + (let ((n (char->integer char))) + (guarantee unicode-scalar-value? n caller) + n)) + (define (unicode-char->scalar-value char #!optional caller) (guarantee unicode-char? char caller) (char->integer char)) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 826dd1ce4..046eabde9 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -1339,6 +1339,7 @@ USA. char->digit char->integer char->name + char->scalar-value char-ascii? char-bit:control char-bit:hyper -- 2.25.1