From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Bruce Korb Newsgroups: gmane.lisp.guile.user,gmane.lisp.guile.devel Subject: Re: PLEASE: debugging embedded guile code Date: Fri, 16 May 2003 13:27:00 -0700 Organization: Home Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Message-ID: <3EC54994.50ED679A@veritas.com> References: <20030225093608.6a8935f8.dsmith@altustech.com> <3EAAB691.6AD935B5@veritas.com> <3EAAE877.7140ECB6@veritas.com> <3EAC5266.23DEEB7F@veritas.com> <3EAD89DB.9B0A1367@veritas.com> <3EC51D90.DCD7EC5E@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 1053116335 22183 80.91.224.249 (16 May 2003 20:18:55 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 16 May 2003 20:18:55 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri May 16 22:18:52 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 19GlfH-0005lJ-00 for ; Fri, 16 May 2003 22:18:51 +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 19Glfe-000807-02 for guile-user@m.gmane.org; Fri, 16 May 2003 16:19:14 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 19Glf9-0007hy-00 for guile-user@gnu.org; Fri, 16 May 2003 16:18:43 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 19Glf3-0007RH-00 for guile-user@gnu.org; Fri, 16 May 2003 16:18:40 -0400 Original-Received: from bay-bridge.veritas.com ([143.127.3.10] helo=mtvmime03.VERITAS.COM) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19Glf3-0007Nq-00; Fri, 16 May 2003 16:18:37 -0400 Original-Received: from megami (unverified) by mtvmime03.VERITAS.COM ; Fri, 16 May 2003 13:18:54 -0700 Original-Received: from veritas.com([172.22.12.211]) (3568 bytes) by megami via sendmail with P:esmtp/R:smart_host/T:smtp (sender: ) id for ; Fri, 16 May 2003 13:18:35 -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: Neil Jerram Original-cc: guile-user@gnu.org X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: General Guile related discussions List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.user:1964 gmane.lisp.guile.devel:2372 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2372 Neil Jerram wrote: > > >>>>> "Bruce" == Bruce Korb writes: > > Bruce> Based on your example, I would need to emit this to libguile: > > Bruce> (eval-client-input "...whatever...") > > Bruce> The problem is that the ``...whatever...'' is likely to > Bruce> often include double quotes, backslashes and all kinds of > Bruce> interesting stuff. I don't particularly want to go over > Bruce> the string and reformat it so that the reader can > Bruce> reconstruct what I already have in hand. > > You don't have to. You can do something like this: > > SCM str = gh_str02scm( "...whatever..." ); > SCM proc = scm_c_lookup( "eval-client-input" ); > scm_call_1(proc, str); > > Does this make sense? Except for this: ERROR: In procedure apply: ERROR: Wrong type argument in position 1: #> ABEND-ing in LOAD_TPL state Last Guile command: = = = = = (setenv "SHELL" "/bin/sh") = = = = = Here's da code: First, this is evaluated: (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 ) ) ) The ``tpl-file'' and ``tpl-file-line'' thingeys are my own pre-registered callback functions for getting file name and line number. Then this function is invoked with "pzStr" pointing to the Guile command noted above: > static inline SCM ag_eval( tCC* pzStr ) > { > static SCM proc = SCM_UNDEFINED; > SCM str = gh_str02scm( pzStr ); > pzLastScheme = pzStr; > > if (proc == SCM_UNDEFINED) > proc = scm_permanent_object( scm_c_lookup( "eval-client-input" )); > str = scm_call_1(proc, str); > pzLastScheme = NULL; > return str; > } My "atexit()" proc notices that pzLastScheme is not NULL. If I replace all that code with just, ``return gh_eval_str( pzStr )'' it all works. So, it's not quite equivalent yet, but it seems close. _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user