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] |
Hello schemers. Currently guile has problems with initialization. If, for example, I want to execute scheme code before the repl was called for the first time, I have to load boot-9 manually. Later, when I enter the repl, guile exits with a stack overflow because boot-9 is executed for the second time. The same happens when the repl is to be entered more than once. I suggest to rename ice-9/boot.scm to ice-9/boot-9-tail.scm and have a new file ice-9/boot-9.scm which just contains the following lines: ------------------------------ cut here ------------------------- [standard copyright header] ;;; This file is the first thing loaded into Guile. If not done before, it ;;; loads boot-9-tail.scm, which adds many mundane definitions and a few that ;;; are interesting. ;;; ;;; The module system (hence the hierarchical namespace) are also defined in ;;; boot-9-tail.scm file. ;; (if (not (defined? 'provide)) (primitive-load-path "ice-9/boot-9-tail.scm")) ------------------------------ cut here ------------------------- This allows to have boot-9 loaded by initialization files and enter a repl later. I also have patched guile to be able to leave and re-enter the repl. The patches are agains 19980505 snapshot, but apply also to 19980629, hopefully also to newer snapshots. The basic change is that scm_shell does not call exit any more but returns an integer exit status. Thus gh_repl and other caller functions can decide whether to exit or not. I decided to let gh_repl return the exit status. The only problem that currently remains for me is, that when you leave the guile repl by pressing ctrl-d, you cannot re-enter: The ctrl-d character seems to remain in guile's input buffer and results in an immediate exit. If you leave guile with (exit) instead, everything is fine. Best regards, Dirk Herrmann *** ../../guile/libguile/gh_init.c Tue Nov 25 18:20:21 1997 --- ./gh_init.c Tue May 5 16:16:55 1998 *************** *** 74,84 **** /* offer a REPL to the C programmer; for now I just invoke the ice-9 REPL that is written in Scheme */ ! void gh_repl (int argc, char *argv[]) { /* gh_eval_str ("(top-repl)"); */ ! scm_shell (argc, argv); } /* libguile programmers need exception handling mechanisms; here is --- 74,84 ---- /* offer a REPL to the C programmer; for now I just invoke the ice-9 REPL that is written in Scheme */ ! int gh_repl (int argc, char *argv[]) { /* gh_eval_str ("(top-repl)"); */ ! return scm_shell (argc, argv); } /* libguile programmers need exception handling mechanisms; here is *** ../../guile-core-19980505/libguile/script.c Sat Apr 18 23:58:47 1998 --- ./script.c Tue May 5 16:18:05 1998 *************** *** 648,654 **** } ! void scm_shell (argc, argv) int argc; char **argv; --- 648,654 ---- } ! int scm_shell (argc, argv) int argc; char **argv; *************** *** 666,672 **** } } ! exit (scm_exit_status (scm_eval_x (scm_compile_shell_switches (argc,argv)))); } --- 666,672 ---- } } ! return scm_exit_status (scm_eval_x (scm_compile_shell_switches (argc,argv))); } *** ../../guile-core-19980505/libguile/guile.c Tue May 27 00:32:46 1997 --- ./guile.c Tue May 5 16:17:16 1998 *************** *** 57,63 **** inner_main (void *closure, int argc, char **argv) { /* module initializations would go here */ ! scm_shell (argc, argv); } int --- 57,63 ---- inner_main (void *closure, int argc, char **argv) { /* module initializations would go here */ ! exit (scm_shell (argc, argv)); } int *** ../../guile-core-19980505/libguile/gh_test_repl.c Tue Nov 25 18:20:23 1997 --- ./gh_test_repl.c Tue May 5 16:24:15 1998 *************** *** 101,107 **** gh_procedure_p (cf), gh_vector_p (cf)); gh_eval_str("(c-vector-test 200)"); ! gh_repl (argc, argv); } int --- 101,107 ---- gh_procedure_p (cf), gh_vector_p (cf)); gh_eval_str("(c-vector-test 200)"); ! exit (gh_repl (argc, argv)); } int *** ../../guile-core-19980505/libguile/script.h Tue May 27 00:33:48 1997 --- ./script.h Tue May 5 16:18:28 1998 *************** *** 55,61 **** extern int scm_count_argv SCM_P ((char **argv)); extern void scm_shell_usage SCM_P ((int fatal, char *message)); extern SCM scm_compile_shell_switches SCM_P ((int argc, char **argv)); ! extern void scm_shell SCM_P ((int argc, char **argv)); extern char *scm_usage_name; extern void scm_init_script (); --- 55,61 ---- extern int scm_count_argv SCM_P ((char **argv)); extern void scm_shell_usage SCM_P ((int fatal, char *message)); extern SCM scm_compile_shell_switches SCM_P ((int argc, char **argv)); ! extern int scm_shell SCM_P ((int argc, char **argv)); extern char *scm_usage_name; extern void scm_init_script (); *** ../../guile-core-19980505/libguile/gh.h Sun Mar 1 08:25:59 1998 --- ./gh.h Tue May 5 16:23:38 1998 *************** *** 61,67 **** #endif /* __GNUC__ */ void gh_enter(int argc, char *argv[], void (*c_main_prog)()); ! void gh_repl(int argc, char *argv[]); SCM gh_catch(SCM tag, scm_catch_body_t body, void *body_data, scm_catch_handler_t handler, void *handler_data); --- 61,67 ---- #endif /* __GNUC__ */ void gh_enter(int argc, char *argv[], void (*c_main_prog)()); ! int gh_repl(int argc, char *argv[]); SCM gh_catch(SCM tag, scm_catch_body_t body, void *body_data, scm_catch_handler_t handler, void *handler_data);