This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Redirection


-----BEGIN PGP SIGNED MESSAGE-----

On Sun, 12 Apr 1998, Colin Fox wrote:

> Date: Sun, 12 Apr 1998 14:40:14 -0700
> From: Colin Fox <colinf@rogers.wave.ca>
> To: karlheg@bittersweet.inetarena.com
> Cc: guile@cygnus.com
> Subject: Re: Redirection
> 
> > From: karlheg@bittersweet.inetarena.com (Karl M. Hegbloom)
> > >>>>> "Colin" == Colin Fox <colinf@rogers.wave.ca> writes:
> > 
> >     Colin> Can anyone point me at some documentation on how to do
> >     Colin> this? Or is it possible? (I don't want ALL of my stdout
> >     Colin> captured and redirected, just guile's).
> > 
> >  Well, I think you'll need either an editor buffer, or a history list.
> >  A history list would be simple enough, I guess.  Conceptually, it's
> >  just:
> > 
> >  (print (eval (read)))
> >    ... becomes:
> >  (print (push (eval (read)) history))
> 
> Thanks for the reply, but this isn't the solution I was hoping for.
> 
> The purpose of the built-in shell is convenience, and I lose that if
> I have to force the user to do the capturing. The Gimp does it with
> SIOD, which apparently allows you to specify it's stdin & stdout file
> handles.
> 
> In scheme's init.c, there is a section of code that reads:
> 
> scm_init_standard_ports ()
> {
> <manual entry snipped>
>   scm_def_inp = scm_stdio_to_port (stdin, 
> 				   (isatty (fileno (stdin)) ? "r0" : "r"),
> 				   "standard input");
>   scm_def_outp = scm_stdio_to_port (stdout, "w", "standard output");
>   scm_def_errp = scm_stdio_to_port (stderr, "w", "standard error");
> 
>   scm_cur_inp = scm_def_inp;
>   scm_cur_outp = scm_def_outp;
>   scm_cur_errp = scm_def_errp;
> }
> 
> As I said - I'm new to scheme. Can I use something here to change
> stdin & stdout? Actually, I only need to change stdout, since I'm sending
> guile my input directly.
> 

I think this is what you're looking for:

  call-with-output-file string proc

You can find it at:

  http://www-swiss.ai.mit.edu/scheme-home.html

Look there under 'Scheme Reference Manual' / Index for
'call-with-output-file'

- -----------------------------------------------------------------
   Martin Baulig - Angewandte Mathematik - Universitaet Trier

   baulig@castor.uni-trier.de, http://www.home-of-linux.org/
   Key: 1024-bit key with ID C8178435 created 1997/01/24 
   ID:  67 C1 84 A0 47 F5 11 C5  5F 68 4C 84 99 05 C3 92
   Finger me for public key or fetch finger.txt from the url above
- ------------------------------------------------------------------



-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv

iQCVAwUBNTICDIA8K7jIF4Q1AQGK3AQAvD0wJx3aE98+K6j7vqwfO1O+2kT99QYu
YrCBWwLgvZltTJpl2+dwsUbG62cCMEXd+jF2LMTfVs5dqpX9qy5LRUUlWwIc+1E6
5Cfd5wAoFfAE5tRO9GsnTvXHQdFSXfPO0VFhq4o6H2iR3BpNvpVI7qXxiicTwRYQ
SIvut8Tzbd4=
=AytT
-----END PGP SIGNATURE-----