Move Unicode char predicates to "char.scm".
authorChris Hanson <org/chris-hanson/cph>
Mon, 31 May 2010 00:37:45 +0000 (17:37 -0700)
committerChris Hanson <org/chris-hanson/cph>
Mon, 31 May 2010 00:37:45 +0000 (17:37 -0700)
src/runtime/char.scm
src/runtime/runtime.pkg
src/runtime/unicode.scm

index 1c1354f0d5ee6a09b47607f6f1a12f55dce5f091..dd25c9913ee36264b22b3d53fc0ab60c8c48938c 100644 (file)
@@ -87,6 +87,42 @@ USA.
   (%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)))
index 5307eea8a87b1948cb0e1f9b8846c1c02ce613af..d4d6fe6c95504752f2df876bb3b47b4087e1be0b 100644 (file)
@@ -1014,6 +1014,9 @@ USA.
   (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
@@ -1051,14 +1054,20 @@ USA.
          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
@@ -1066,6 +1075,9 @@ USA.
   (export (runtime parser)
          downcase-table
          identity-table)
+  (export (runtime unicode)
+         legal-code-16?
+         legal-code-32?)
   (initialization (initialize-package!)))
 
 (define-package (runtime character-set)
@@ -5228,9 +5240,6 @@ USA.
   (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)
@@ -5254,8 +5263,6 @@ USA.
          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
@@ -5268,8 +5275,6 @@ USA.
          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
@@ -5307,8 +5312,6 @@ USA.
          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?
index b29875f22b8c0f1edf0662832fb33d5700fded7c..d0ae2ab469d77c83cd59ea2483501d50290f664a 100644 (file)
@@ -160,44 +160,6 @@ USA.
       (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>)