;;; The HIGH range sequence is a u24 bytevector implementing an inversion list.
(define-record-type <char-set>
- (%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
(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)
(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*)
(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)))