[gambit-list] Write to console from inside _gsi.scm?

Marc Feeley feeley at iro.umontreal.ca
Tue Oct 24 22:36:53 EDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 24-Oct-06, at 10:19 PM, Andrew Lentvorski wrote:

> How do I write out to the console from _gsi.scm?  I presume that I  
> need to just specify the correct stream?  What would that be at  
> that point?
>
> If I do a (write "FOO!") inside _gsi.scm, it seems to get eaten.  
> Similarly, it gets eaten if I specify it in main() inside _gsi.scm.
>
> I can do a write from inside _repl.scm as it seems to set things up  
> before that as well as provides me with an available stream to  
> write to.
>
> Thanks,
> -a

If you just do (write "foo!") it will go the the current output-port,  
which is initially connected to "stdout" (the port in the global  
variable ##stdout-port).  But you have only directed the console to  
the screen, so you should use the port in the global variable  
##console-port, i.e. do

   (write "foo!" ##console-port)

or

   (current-output-port ##console-port)
   (write "foo!")

When you start a REPL, the REPL connects the current output-port to  
the console.

Marc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFFPs3F//V9Zc2T/v4RAgE7AJ9dd4sRgOrXvYTVV0n9XuZlXBLuygCdFM1+
k6A/Sz29+izVw5SNnu1oA4I=
=8t06
-----END PGP SIGNATURE-----



More information about the Gambit-list mailing list