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] |
Hi Dirk,
Thanks for getting me off my butt. We are still waiting to
incorporate the SCWM-inspired changes to the gh_ interface, but I have
changed the docs. Here is the new text for the gh_enter()
documentation, which should bear us over until the gn_enter()
semantics are finalized.
---------
@deftypefun void gh_enter (int @var{argc}, char *@var{argv}[], void (*@var{main_prog})())
Starts up a Scheme interpreter with all the builtin Scheme primitives.
@code{gh_enter()} never exits, and the user's code should all be in the
@code{@var{main_prog}()} function. @code{argc} and @code{argv} will be
passed to @var{main_prog}.
@deftypefun void main_prog (int @var{argc}, char *@var{argv}[])
This is the user's main program. It will be invoked by
@code{gh_enter()} after Guile has been started up.
@end deftypefun
Please note that @code{gh_enter} does not load @file{ice-9/boot-9.scm}, which
contains much of Guile's basic functionality, including some necessary
parts of Scheme. This is a limitation, and it is only so because the
basic Scheme language functions have not yet been separated from the
higher-level functionality provided by the @file{ice-9/boot-9.scm} module.
Here is a note from the Guile mailing list describing how to get around
this problem if you want to run some Guile code before you invoke
@code{gh_repl()}. It is a temporary solution, and a better way of
handling the loading of @file{ice-9/boot-9.scm} will soon be introduced.
@example
The next problem is that boot-9.scm may only be executed once, otherwise
you get a stack overflow. When entering the read-eval-print-loop (repl)
with gh_repl, guile loads boot-9.scm. Thus, if you did load boot-9.scm
yourself and then later enter the repl, guile will abort with a stack
overflow.
If you look a little into the guile mailing list archives, you can find a
temporary solution to the problem which I posted quite some time ago. It's
a trivial fix:
1) rename boot-9.scm into boot-9-tail.scm
2) create a new boot-9.scm, which only contains the following code:
(if (not (defined? 'provide))
(primitive-load-path "ice-9/boot-9-tail.scm"))
With this modification, boot-9.scm can be read several times.
@end example
Also note that you can use @code{gh_repl} inside @code{gh_enter} if you
want the program to be controled by a Scheme read--eval--print--loop.
Invoking @code{gh_repl} will load @file{ice-9/boot-9.scm}.
@end deftypefun