unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Bruce Korb <bkorb@veritas.com>
Cc: guile-devel@gnu.org
Subject: Re: PLEASE: debugging embedded guile code
Date: Fri, 16 May 2003 13:27:00 -0700	[thread overview]
Message-ID: <3EC54994.50ED679A@veritas.com> (raw)
In-Reply-To: m34r3uwvaj.fsf@laruns.ossau.uklinux.net

Neil Jerram wrote:
> 
> >>>>> "Bruce" == Bruce Korb <bkorb@veritas.com> 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: #<variable 40288450 binding: #<procedure eval-client-input (str)>>
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


  reply	other threads:[~2003-05-16 20:27 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.GSO.3.96.1030209200016.26546A-100000@anh>
2003-02-25 14:19 ` PLEASE: debugging embedded guile code Joris van der Hoeven
2003-02-25 14:36   ` Dale P. Smith
2003-04-26 14:51     ` Neil Jerram
2003-04-26 16:40       ` Bruce Korb
2003-04-26 19:12         ` Neil Jerram
2003-04-26 20:13           ` Bruce Korb
2003-04-27 20:49             ` Neil Jerram
2003-04-27 21:57               ` Bruce Korb
2003-04-28 15:54                 ` Paul Jarc
2003-04-28 16:07                   ` Bruce Korb
2003-04-28 19:21                 ` Neil Jerram
2003-04-28 20:06                   ` Bruce Korb
2003-04-28 20:58                     ` Neil Jerram
2003-05-16 17:19                       ` Bruce Korb
2003-05-16 19:23                         ` Neil Jerram
2003-05-16 20:27                           ` Bruce Korb [this message]
2003-05-16 21:21                             ` Rob Browning
2003-05-16 21:56                               ` Bruce Korb
2003-05-17  0:31                                 ` Bruce Korb
2003-05-17  2:33                                   ` Bruce Korb
2003-05-19 15:00                                     ` Paul Jarc
2003-04-28 13:52       ` Mikael Djurfeldt
2003-04-28 19:26         ` Neil Jerram
2003-04-30  0:13           ` SRFI 34 Neil Jerram
2003-05-17  0:45             ` Marius Vollmer
2003-05-17  9:39               ` Neil Jerram
2003-05-17 20:36                 ` Marius Vollmer
2004-03-07 18:34                   ` Neil Jerram
2003-04-26 14:45   ` PLEASE: debugging embedded guile code Neil Jerram
     [not found] <Pine.GSO.4.33.0304261706460.1619-100000@sunanh>
2003-04-26 15:34 ` Neil Jerram
2003-04-26 15:40   ` Joris van der Hoeven
2003-04-26 19:30     ` Neil Jerram
2003-04-27  8:40       ` Joris van der Hoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3EC54994.50ED679A@veritas.com \
    --to=bkorb@veritas.com \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).