<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
You have to crack the locat structure, here's a helper function that I
use:<br>
<br>
(define (continuation-location cont)<br>
(let (<br>
(locat (##continuation-locat cont))<br>
)<br>
(if locat<br>
(let* ( <br>
(container (##locat-container locat))<br>
(path (##container->path container))<br>
(position (##locat-position locat))<br>
(filepos (##position->filepos position))<br>
(line (fx+ (##filepos-line filepos) 1))<br>
(col (fx+ (##filepos-col filepos) 1))<br>
)<br>
(values path line col)<br>
)<br>
(values #f #f #f)<br>
)<br>
)<br>
)<br>
<br>
<br>
The guts of this Marc posted a while back for FILE and LINE macros....
v. useful!<br>
<br>
Cheers<br>
Darren<br>
<br>
<br>
lowly coder wrote:
<blockquote
cite="mid:858d2cda0906210010m59612123l47b4e2e0284c41d8@mail.gmail.com"
type="cite">~/test$ gsi test.scm -e "(a)"<br>
*** ERROR IN a, "test.scm"@1.23 -- Unbound variable: b<br>
~/test$ gsi test.scm -e "(run)"<br>
#f<br>
#("/home/x/test/test.scm" 1441792)<br>
#("/home/x/test/test.scm" 1048576)<br>
#("/home/x/test/test.scm" 786432)<br>
#f<br>
#((string) 0)<br>
#f<br>
#f<br>
25<br>
~/test$ cat test.scm<br>
(define (a) (pp (+ 20 b)))<br>
<br>
<br>
(define (run)<br>
(let ((old-handler (current-exception-handler)))<br>
(with-exception-handler<br>
(lambda (e)<br>
(with-exception-handler<br>
old-handler<br>
(lambda ()<br>
<br>
(##continuation-capture<br>
(lambda (old-cont)<br>
(do<br>
;((cur-frame cont (##continuation-next-frame cur-frame #t)))<br>
((cont old-cont (##continuation-next-frame cont #t)))<br>
((not cont))<br>
(pp (##continuation-locat cont)))<br>
<br>
(##continuation-return old-cont 5)))<br>
<br>
)))<br>
(lambda ()<br>
(a)))))<br>
<br>
<br>
Why is it ... that when I print out the continuations by frame, I can't
get the data that I want (which ##cmd-b apparently does get, which is:
test.scm, line 1, character 23).<br>
<br>
This baffles me.<br>
<br>
(I'm trying to write a gambit debugger in gambit, teehee)<br>
<br>
Thanks!<br>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Gambit-list mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a>
<a class="moz-txt-link-freetext" href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a>
</pre>
</blockquote>
<br>
</body>
</html>