From: Chris Hanson Date: Mon, 30 Jan 2017 02:06:02 +0000 (-0800) Subject: Use boot inits in char.scm. X-Git-Tag: mit-scheme-pucked-9.2.12~227^2~29 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=4cf7eefd47bf7b3a6b1558e916f3a76be42d5a01;p=mit-scheme.git Use boot inits in char.scm. --- diff --git a/src/runtime/char.scm b/src/runtime/char.scm index 499eafb08..7a4d51530 100644 --- a/src/runtime/char.scm +++ b/src/runtime/char.scm @@ -144,35 +144,29 @@ USA. (define downcase-table) (define upcase-table) - -(define (initialize-case-conversions!) - (set! downcase-table (make-bytevector #x100)) - (set! upcase-table (make-bytevector #x100)) - (do ((i 0 (fix:+ i 1))) - ((fix:= i #x100)) - (bytevector-u8-set! downcase-table i i) - (bytevector-u8-set! upcase-table i i)) - (let ((case-range - (lambda (uc-low uc-high lc-low) - (do ((i uc-low (fix:+ i 1)) - (j lc-low (fix:+ j 1))) - ((fix:> i uc-high)) - (bytevector-u8-set! downcase-table i j) - (bytevector-u8-set! upcase-table j i))))) - (case-range 65 90 97) - (case-range 192 214 224) - (case-range 216 222 248))) +(add-boot-init! + (lambda () + (set! downcase-table (make-bytevector #x100)) + (set! upcase-table (make-bytevector #x100)) + (do ((i 0 (fix:+ i 1))) + ((fix:= i #x100)) + (bytevector-u8-set! downcase-table i i) + (bytevector-u8-set! upcase-table i i)) + (let ((case-range + (lambda (uc-low uc-high lc-low) + (do ((i uc-low (fix:+ i 1)) + (j lc-low (fix:+ j 1))) + ((fix:> i uc-high)) + (bytevector-u8-set! downcase-table i j) + (bytevector-u8-set! upcase-table j i))))) + (case-range 65 90 97) + (case-range 192 214 224) + (case-range 216 222 248)))) -(define 0-code) -(define upper-a-code) -(define lower-a-code) - -(define (initialize-package!) - (set! 0-code (char->integer #\0)) - ;; Next two codes are offset by 10 to speed up CHAR->DIGIT. - (set! upper-a-code (fix:- (char->integer #\A) 10)) - (set! lower-a-code (fix:- (char->integer #\a) 10)) - (initialize-case-conversions!)) +(define-deferred 0-code (char->integer #\0)) +;; Next two codes are offset by 10 to speed up CHAR->DIGIT. +(define-deferred upper-a-code (fix:- (char->integer #\A) 10)) +(define-deferred lower-a-code (fix:- (char->integer #\a) 10)) (define (radix? object) (and (index-fixnum? object) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 80032d950..9a2e6567b 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -1394,8 +1394,7 @@ USA. unicode-char? unicode-code-point? unicode-scalar-value->char - unicode-scalar-value?) - (initialization (initialize-package!))) + unicode-scalar-value?)) (define-package (runtime character-set) (files "chrset")