From: Chris Hanson Date: Sun, 10 Feb 2019 00:20:33 +0000 (-0800) Subject: Put char-set microcode table back in data structure. Edwin needs this. X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=ebc215f0605036a6a04bafaefbbba9d191c14494;p=mit-scheme.git Put char-set microcode table back in data structure. Edwin needs this. --- diff --git a/src/edwin/edwin.pkg b/src/edwin/edwin.pkg index 1cf785ae4..01a52a721 100644 --- a/src/edwin/edwin.pkg +++ b/src/edwin/edwin.pkg @@ -154,7 +154,7 @@ USA. (files "string") (parent (edwin)) (import (runtime character-set) - (char-set-table %char-set-table)) + char-set-table) (export (edwin) (set-vector-8b-length! set-string-length!) (vector-8b-length string-length) diff --git a/src/runtime/char-set.scm b/src/runtime/char-set.scm index 61b40fbe8..10398e25b 100644 --- a/src/runtime/char-set.scm +++ b/src/runtime/char-set.scm @@ -39,11 +39,13 @@ USA. ;;; The HIGH range sequence is a u24 bytevector implementing an inversion list. (define-record-type - (%make-char-set low high predicate) + (%make-char-set low high predicate table) char-set? (low %char-set-low) (high %char-set-high) - (predicate %char-set-predicate)) + (predicate %char-set-predicate) + ;; backwards compatibility for Edwin: + (table %char-set-table)) (define (make-char-set low high) (letrec @@ -55,8 +57,17 @@ USA. (and (bitless-char? char) (char-in-set? char char-set))))) (register-predicate! predicate 'char-set-predicate - '<= bitless-char?) - predicate))))) + '<= bitless-char?) + predicate)) + (delay + (let ((table (make-bytevector #x100))) + (do ((cp 0 (fix:+ cp 1))) + ((not (fix:< cp #x100))) + (bytevector-u8-set! table cp + (if (%code-point-in-char-set? cp char-set) + 1 + 0))) + table))))) char-set)) (define-integrable %low-cps-per-byte 8) @@ -440,6 +451,9 @@ USA. (define (char-set-predicate char-set) (force (%char-set-predicate char-set))) +(define (char-set-table char-set) + (force (%char-set-table char-set))) + (define (char-set=? char-set . char-sets) (every (lambda (char-set*) (and (bytevector=? (%char-set-low char-set*) @@ -637,14 +651,6 @@ USA. (error:bad-range-argument end 'ascii-range->char-set)) (char-set (cons start end))) -(define (%char-set-table char-set) - (let ((table (make-bytevector #x100))) - (do ((cp 0 (fix:+ cp 1))) - ((not (fix:< cp #x100))) - (bytevector-u8-set! table cp - (if (%code-point-in-char-set? cp char-set) 1 0))) - table)) - (define (8-bit-char-set? char-set) (and (char-set? char-set) (let ((high (%char-set-high char-set))) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 1e418b522..c6c058815 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -1483,9 +1483,7 @@ USA. re-compile-char-set string->char-set) (export (runtime regular-sexpression) - normalize-ranges) - (export (runtime legacy-string) - (char-set-table %char-set-table))) + normalize-ranges)) (define-package (runtime compiler-info) (files "infstr" "infutl")