fixed struct initialization problem in fasl-read.

This commit is contained in:
Abdulaziz Ghuloum 2008-02-18 23:37:01 -05:00
parent 259d43ca37
commit 81f6c50341
3 changed files with 14 additions and 5 deletions

View File

@ -62,6 +62,15 @@
(define who 'fasl-read) (define who 'fasl-read)
(define (make-struct rtd n)
(import (ikarus system $fx))
(let f ([i 0] [n n] [s ($make-struct rtd n)])
(cond
[($fx= i n) s]
[else
($struct-set! s i 0)
(f ($fx+ i 1) n s)])))
(define (read-u8 p) (define (read-u8 p)
(let ([b (get-u8 p)]) (let ([b (get-u8 p)])
(when (eof-object? b) (when (eof-object? b)
@ -265,7 +274,7 @@
[(#\{) [(#\{)
(let ([n (read-int p)]) (let ([n (read-int p)])
(let ([rtd (read)]) (let ([rtd (read)])
(let ([x ($make-struct rtd n)]) (let ([x (make-struct rtd n)])
(when m (put-mark m x)) (when m (put-mark m x))
(let f ([i 0]) (let f ([i 0])
(unless (fx= i n) (unless (fx= i n)

View File

@ -35,7 +35,7 @@
(cond (cond
[(not (file-exists? ikfasl)) #f] [(not (file-exists? ikfasl)) #f]
[(<= (file-ctime ikfasl) (file-ctime filename)) [(<= (file-ctime ikfasl) (file-ctime filename))
(printf (fprintf (current-error-port)
"WARNING: not using fasl file ~s because it is older \ "WARNING: not using fasl file ~s because it is older \
than the source file ~s\n" than the source file ~s\n"
ikfasl ikfasl
@ -50,7 +50,7 @@
(if (serialized-library? x) (if (serialized-library? x)
(apply sk (serialized-library-contents x)) (apply sk (serialized-library-contents x))
(begin (begin
(printf (fprintf (current-error-port)
"WARNING: not using fasl file ~s because it was \ "WARNING: not using fasl file ~s because it was \
compiled with a different version of ikarus.\n" compiled with a different version of ikarus.\n"
ikfasl) ikfasl)
@ -58,7 +58,7 @@
(define (do-serialize-library filename contents) (define (do-serialize-library filename contents)
(let ([ikfasl (string-append filename fasl-extension)]) (let ([ikfasl (string-append filename fasl-extension)])
(printf "Serializing ~s\n" ikfasl) (fprintf (current-error-port) "Serializing ~s\n" ikfasl)
(let ([p (open-file-output-port ikfasl (file-options no-fail))]) (let ([p (open-file-output-port ikfasl (file-options no-fail))])
(fasl-write (make-serialized-library contents) p) (fasl-write (make-serialized-library contents) p)
(close-output-port p)))) (close-output-port p))))

View File

@ -1 +1 @@
1399 1400