(%make-char (%char-code char)
(fix:andc (%char-bits char) bits)))
\f
+(define (unicode-char? object)
+ (and (char? object)
+ (legal-code-32? (char->integer object))))
+
+(define-guarantee unicode-char "a Unicode character")
+
+(define (unicode-scalar-value? object)
+ (and (index-fixnum? object)
+ (fix:< object char-code-limit)
+ (not (illegal? 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))))
+
+(define-integrable (legal-code-16? pt)
+ (not (illegal? 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 (non-character? pt)
+ (or (and (fix:>= pt #xD800) (fix:< pt #xE000))
+ (and (fix:>= pt #xFDD0) (fix:< pt #xFDF0))
+ (fix:= #x00FFFE (fix:and #x00FFFE pt))))
+
+|#
+
(define (8-bit-char? object)
(and (char? object)
(fix:< (char->integer object) 256)))
(files "char")
(parent (runtime))
(export ()
+ (error:not-wide-char error:not-unicode-char)
+ (guarantee-wide-char guarantee-unicode-char)
+ (wide-char? unicode-char?)
8-bit-char?
ascii->char
char->ascii
digit->char
error:not-char
error:not-radix
+ error:not-unicode-char
+ error:not-unicode-scalar-value
guarantee-8-bit-char
guarantee-char
guarantee-radix
+ guarantee-unicode-char
+ guarantee-unicode-scalar-value
integer->char
make-char
name->char
radix?
- set-char-bits)
+ set-char-bits
+ unicode-char?
+ unicode-scalar-value?)
(export (runtime string)
%char<?
downcase-table
(export (runtime parser)
downcase-table
identity-table)
+ (export (runtime unicode)
+ legal-code-16?
+ legal-code-32?)
(initialization (initialize-package!)))
(define-package (runtime character-set)
(files "unicode")
(parent (runtime))
(export ()
- (error:not-wide-char error:not-unicode-char)
- (guarantee-wide-char guarantee-unicode-char)
- (wide-char? unicode-char?)
(wide-string->utf16-be-string string->utf16-be-string)
(wide-string->utf16-le-string string->utf16-le-string)
(wide-string->utf16-string string->utf16-string)
call-with-utf8-input-string
call-with-utf8-output-string
combine-utf16-surrogates
- error:not-unicode-char
- error:not-unicode-scalar-value
error:not-utf16-be-string
error:not-utf16-high-surrogate
error:not-utf16-le-string
error:not-wide-string
for-all-chars-in-string?
for-any-char-in-string?
- guarantee-unicode-char
- guarantee-unicode-scalar-value
guarantee-utf16-be-string
guarantee-utf16-high-surrogate
guarantee-utf16-le-string
string->utf8-string
string->utf8-string
string->wide-string
- unicode-char?
- unicode-scalar-value?
utf16-be-string->wide-string
utf16-be-string-length
utf16-be-string-valid?
(procedure port)
(get-output-string! port))))
\f
-;;;; Unicode characters
-
-(define (unicode-char? object)
- (and (char? object)
- (legal-code-32? (char->integer object))))
-
-(define-guarantee unicode-char "a Unicode character")
-
-(define (unicode-scalar-value? object)
- (and (index-fixnum? object)
- (fix:< object char-code-limit)
- (not (illegal? 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))))
-
-(define-integrable (legal-code-16? pt)
- (not (illegal? 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 (non-character? pt)
- (or (and (fix:>= pt #xD800) (fix:< pt #xE000))
- (and (fix:>= pt #xFDD0) (fix:< pt #xFDF0))
- (fix:= #x00FFFE (fix:and #x00FFFE pt))))
-
-|#
-\f
;;;; Unicode strings
(define-structure (wide-string (type-descriptor <wide-string>)