From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Bruce Korb Newsgroups: gmane.lisp.guile.devel,gmane.lisp.guile.user Subject: Re: PLEASE: debugging embedded guile code Date: Fri, 16 May 2003 19:33:45 -0700 Organization: Home Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <3EC59F89.A9E9B958@veritas.com> References: <20030225093608.6a8935f8.dsmith@altustech.com> <3EAAB691.6AD935B5@veritas.com> <3EAAE877.7140ECB6@veritas.com> <3EAC5266.23DEEB7F@veritas.com> <3EAD89DB.9B0A1367@veritas.com> <87fzneoadk.fsf@raven.i.defaultvalue.org> <3EC55E9E.12D907E0@veritas.com> <3EC582D5.6FB4D63C@veritas.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1053138300 12480 80.91.224.249 (17 May 2003 02:25:00 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 17 May 2003 02:25:00 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat May 17 04:24:57 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19GrNL-0003Eb-00 for ; Sat, 17 May 2003 04:24:43 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19GrOT-00045r-09 for guile-devel@m.gmane.org; Fri, 16 May 2003 22:25:53 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 19GrNz-000400-00 for guile-devel@gnu.org; Fri, 16 May 2003 22:25:23 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 19GrNx-0003x0-00 for guile-devel@gnu.org; Fri, 16 May 2003 22:25:22 -0400 Original-Received: from bay-bridge.veritas.com ([143.127.3.10] helo=mtvmime02.veritas.com) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19GrNx-0003tz-00; Fri, 16 May 2003 22:25:21 -0400 Original-Received: from megami (unverified) by mtvmime02.veritas.com (Content Technologies SMTPRS 4.3.6) with SMTP id ; Fri, 16 May 2003 19:27:09 -0700 Original-Received: from veritas.com ([172.22.12.211]) (3481 bytes) by megami via sendmail with P:esmtp/R:smart_host/T:smtp (sender: ) id for ; Fri, 16 May 2003 19:25:19 -0700 (PDT) (Smail-3.2.0.101 1997-Dec-17 #15 built 2001-Aug-30) X-Mailer: Mozilla 4.8 [en] (X11; U; Linux 2.4.19-4GB i686) X-Accept-Language: en Original-To: Rob Browning , Neil Jerram , guile-devel@gnu.org, guile-user@gnu.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:2384 gmane.lisp.guile.user:1968 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2384 Bruce Korb wrote: > 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: > ... How do I make > that ``(list (primitive-eval (read p)))'' thing into a loop that > yields the last value? Answer: (begin ... ) EXCEPT: the problem now is that instead of getting the final result, the returned SCM is an SCM *PAIR*, not the value I need. That was because the result of the primitive-eval should not be listified: > (list (primitive-eval (read p))) ) ) ) OK. Here's what I have now: > (use-modules (ice-9 stack-catch)) > (use-modules (ice-9 debug)) > > (read-enable 'positions) > > (define (eval-client-input str) > (stack-catch #t > > (lambda () > (call-with-input-string > (string-append "(begin " str ")") ;;; <<--== ICK!! > (lambda (p) > (set-port-filename! p (tpl-file)) > (set-port-line! p (string->number (tpl-file-line "%2$d"))) > (primitive-eval (read p)) ) ) ) > > (lambda (key . args) > (apply display-error > (fluid-ref the-last-stack) > (current-error-port) > args) > (set! stack-saved? #f) > (error "exiting") ) > ) ) It's really close, but for two problems: 1. "primitive-eval" doesn't seem to like comments: > ERROR: In procedure list: > ERROR: end of file in ./auto_gen.tpl > Error in template ./auto_gen.tpl, line 675 > DEFINITIONS ERROR in ./auto_gen.tpl line 675 for autogen.texi: > exiting > Failing Guile command: = = = = = > > (shell "[ -f autogen.texi.ori ] && rm -f autogen.texi.ori > rm -rf ${tempdir}") > (set-writable #t) > > ;; Local Variables: > ;; indent-tabs-mode: nil > ;; mode: texinfo > ;; End: > > ================================= 2. if you notice, the lines beginning with "ERROR:" still don't have the line number, but I see the file name there!! (Please note: by this point, I've run through many templates. Likely this is the only one with scheme comments at the end.) 3. It seems (current-error-port) is set to something that got squirreled away when gh_enter got called. I've scoured the manual now. How do I simply set error port to the current stderr? _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel