mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-08 02:40:17 +02:00
Fix continuation marking, and some tests.
* libguile/continuations.c (continuation_mark): Mark the vm continuations. * libguile/vm.c (vm_cont_mark): Fix the marking function. (vm_mark): Fix this one too -- the size is a number of STACKITEMS, which we foolishly assume are the same size as SCM. * test-suite/tests/ftw.test: Make our stat hacks verifyable without assuming that they are interpreted. * test-suite/tests/r5rs_pitfall.test: Re-indent.
This commit is contained in:
parent
107139eaad
commit
7ff017002d
4 changed files with 28 additions and 28 deletions
|
@ -25,18 +25,19 @@
|
|||
;; what ice-9/posix.scm stat:dev and stat:ino do (which in turn match
|
||||
;; libguile/filesys.c of course)
|
||||
|
||||
(or (equal? (procedure-source stat:dev)
|
||||
'(lambda (f) (vector-ref f 0)))
|
||||
(error "oops, unexpected stat:dev definition"))
|
||||
(define (stat:dev! st dev)
|
||||
(vector-set! st 0 dev))
|
||||
|
||||
(or (equal? (procedure-source stat:ino)
|
||||
'(lambda (f) (vector-ref f 1)))
|
||||
(error "oops, unexpected stat:ino definition"))
|
||||
(define (stat:ino! st ino)
|
||||
(vector-set! st 1 ino))
|
||||
|
||||
(let* ((s (stat "/"))
|
||||
(i (stat:ino s))
|
||||
(d (stat:dev s)))
|
||||
(stat:ino! s (1+ i))
|
||||
(stat:dev! s (1+ d))
|
||||
(if (not (and (= (stat:ino s) (1+ i))
|
||||
(= (stat:dev s) (1+ d))))
|
||||
(error "unexpected definitions of stat:dev and stat:ino")))
|
||||
|
||||
;;
|
||||
;; visited?-proc
|
||||
|
|
|
@ -27,15 +27,15 @@
|
|||
(syntax-rules ()
|
||||
((_ test-id value expression)
|
||||
(run-test test-id #t (lambda ()
|
||||
(false-if-exception
|
||||
(equal? expression value)))))))
|
||||
(false-if-exception
|
||||
(equal? expression value)))))))
|
||||
|
||||
(define-syntax should-be-but-isnt
|
||||
(syntax-rules ()
|
||||
((_ test-id value expression)
|
||||
(run-test test-id #f (lambda ()
|
||||
(false-if-exception
|
||||
(equal? expression value)))))))
|
||||
(false-if-exception
|
||||
(equal? expression value)))))))
|
||||
|
||||
(define call/cc call-with-current-continuation)
|
||||
|
||||
|
@ -65,7 +65,7 @@
|
|||
(should-be 1.2 #t
|
||||
(letrec ((x (call/cc list)) (y (call/cc list)))
|
||||
(cond ((procedure? x) (x (pair? y)))
|
||||
((procedure? y) (y (pair? x))))
|
||||
((procedure? y) (y (pair? x))))
|
||||
(let ((x (car x)) (y (car y)))
|
||||
(and (call/cc x) (call/cc y) (call/cc x)))))
|
||||
|
||||
|
@ -75,11 +75,11 @@
|
|||
;; http://groups.google.com/groups?selm=19890302162742.4.ALAN%40PIGPEN.AI.MIT.EDU
|
||||
(should-be 1.3 #t
|
||||
(letrec ((x (call-with-current-continuation
|
||||
(lambda (c)
|
||||
(list #T c)))))
|
||||
(lambda (c)
|
||||
(list #T c)))))
|
||||
(if (car x)
|
||||
((cadr x) (list #F (lambda () x)))
|
||||
(eq? x ((cadr x))))))
|
||||
((cadr x) (list #F (lambda () x)))
|
||||
(eq? x ((cadr x))))))
|
||||
|
||||
;; Section 2: Proper call/cc and procedure application
|
||||
|
||||
|
@ -300,12 +300,12 @@
|
|||
(define res1 #f)
|
||||
(define res2 #f)
|
||||
(set! res1 (map (lambda (x)
|
||||
(if (= x 0)
|
||||
(call/cc (lambda (k) (set! cont k) 0))
|
||||
0))
|
||||
'(1 0 2)))
|
||||
(if (= x 0)
|
||||
(call/cc (lambda (k) (set! cont k) 0))
|
||||
0))
|
||||
'(1 0 2)))
|
||||
(if (not executed-k)
|
||||
(begin (set! executed-k #t)
|
||||
(set! res2 res1)
|
||||
(cont 1)))
|
||||
(begin (set! executed-k #t)
|
||||
(set! res2 res1)
|
||||
(cont 1)))
|
||||
res2))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue