[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PLEASE: debugging embedded guile code
From: |
Bruce Korb |
Subject: |
Re: PLEASE: debugging embedded guile code |
Date: |
Fri, 16 May 2003 17:31:17 -0700 |
OK. Some real progress. (Remember this all works when I evaluate
the Guile commands using gh_eval_str):
../agen5/autogen -L ../autoopts -Taginfo -bcolumns -DLEVEL=section \
../columns/opts.def
ERROR: Unbound variable: optname-to
Error in template ../autoopts/aginfo.tpl, line 154
DEFINITIONS ERROR in ../autoopts/aginfo.tpl line 154 for columns.texi:
exiting
Failing Guile command: = = = = =
(set! opt-name (string-tr! (get "name") optname-from optname-to))
(string-append down-prog-name " " opt-name)
* * * * * * * * * * * * * * * * *
The issue here is that gh_eval_str processes the *entire* string and
returns the result of the last expression. This "eval-client-input"
function does not behave in the same way:
> (define (eval-client-input str)
> (stack-catch #t
> (lambda ()
> (call-with-input-string str
> (lambda (p)
> (set-port-filename! p (tpl-file))
> (set-port-line! p (string->number (tpl-file-line "%2$d")))
> (list (primitive-eval (read p))))))
> (lambda (key . args)
> (apply display-error
> (fluid-ref the-last-stack)
> (current-error-port)
> args)
> (set! stack-saved? #f)
> #f
> ) ) )
Before this failing command, the following was eval-ed at once:
> (define optname-from "A-Z_^")
> (define optname-to "a-z--")
so "optname-from" is found, but "optname-to" is not. How do I make
that ``(list (primitive-eval (read p)))'' thing into a loop that
yields the last value?
ALSO: notice that the Guile error message is not including the file
and line numbers. Someone suggested:
> (read-enable 'positions)
> (debug-enable 'show-file-name)
but I get errors when I do that.
BY THE WAY: when I finally have this working, I'll write it up
so nobody has to go through all this pain again. It's pretty awful. :(