Implement 5.19
This commit is contained in:
@@ -74,4 +74,27 @@
|
||||
|
||||
(display "\nex-5.19 - breakpoint\n")
|
||||
|
||||
(define (set-breakpoint machine label n)
|
||||
((machine 'set-breakpoint) label n))
|
||||
|
||||
(define (cancel-breakpoint machine label n)
|
||||
((machine 'cancel-breakpoint) label n))
|
||||
|
||||
(define (proceed machine)
|
||||
(machine 'proceed))
|
||||
|
||||
(set-register-contents! factorial-machine 'n 6)
|
||||
(set-register-contents! factorial-machine 'val 0)
|
||||
|
||||
(set-breakpoint factorial-machine 'fact-loop 1)
|
||||
(start factorial-machine)
|
||||
|
||||
(assert (get-register-contents factorial-machine 'n) 6)
|
||||
(proceed factorial-machine)
|
||||
(assert (get-register-contents factorial-machine 'n) 5)
|
||||
(proceed factorial-machine)
|
||||
(cancel-breakpoint factorial-machine 'fact-loop 1)
|
||||
(assert (get-register-contents factorial-machine 'n) 4)
|
||||
(proceed factorial-machine)
|
||||
(assert (get-register-contents factorial-machine 'val) 720)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user