[gambit-list] stepper hook

Christian christian at pflanze.mine.nu
Thu Jul 20 10:48:00 EDT 2006


Hello

I want to add code to store the current continuation of each step in
the single-stepper (to be able to feed it to ##repl-within or
similar).

How can I do it?

I have found the ##main-stepper hook and the (##step-handler leapable?
$code rte execute-body . other) definition. I've tried:

(define conts '())

(define (stepper-init)
  (set! ##main-stepper
	(vector
	 (make-vector 7
		      (lambda args
			(apply (lambda (leapable? $code rte execute-body . other)
				 (set! conts (cons $code conts))
				 (apply ##step-handler args))
			       args)))
	 #f #f #f #f #f #f #f)))


But I can't manage to extract the continuation out of either |$code|,
|rte|, |execute-body| or |other|.

How is |$code| being structured? (I'm seeing that $code is being
extracted out of cont in several places, so maybe it's not possible to
the the continuation this way.)

I've also tried:

(define (stepper-init)
  (set! ##main-stepper
	(vector
	 (make-vector 7
		      (lambda args
			(##continuation-capture
			 (lambda (cont)
			   (set! conts (cons cont conts))
			   (let ((res (apply ##step-handler args)))
			     (step);; attempt against stepping being turned off
			     res)))))
	 #f #f #f #f #f #f #f)))

but somehow single-stepping seems to be turned off after a few steps
(even if my above code is compiled). I don't get any interesting
continuation this way.

Could you please guide me a bit?

Thanks
Christian.




More information about the Gambit-list mailing list