[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to process stdin with Guile
From: |
Torsten Bronger |
Subject: |
How to process stdin with Guile |
Date: |
Sun, 05 Mar 2006 22:42:05 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Hallöchen!
I have a more or less finished program which reads its instructions
from a script file with its own rather awkward syntax. The plan is
to switch that script file format to Guile.
I started with the following snippet:
static void*
inner_main (void *closure)
{
#include "scripttest.x"
scm_primitive_load (scm_from_locale_string("test.scm"));
cout << "The End." << endl;
}
int
main (int argc, char **argv)
{
scm_with_guile (inner_main, 0);
return 0;
}
This reads from the file test.scm, and it seems to work. My
questions are:
1) Will the result from scm_from_locale_string() garbage-collected
cleanly? (Normally I use Python where such things don't work so
automatically. ;-)
2) Is there a better alternative to scm_primitive_load()? The
tutorial uses gh_something which is deprecated. My concern is
that the program should be able to read from stdin, too, and I
question the protability of the file name "/dev/stdin".
Thanks!
Tschö,
Torsten.
--
Torsten Bronger, aquisgrana, europa vetus ICQ 264-296-646
- How to process stdin with Guile,
Torsten Bronger <=