summaryrefslogtreecommitdiff
path: root/libguile/script.c
diff options
context:
space:
mode:
authorMarius Vollmer <mvo@zagadka.de>2001-11-05 23:11:50 +0000
committerMarius Vollmer <mvo@zagadka.de>2001-11-05 23:11:50 +0000
commit3682a51a3553a5196995c94077b73b85f4e600f8 (patch)
treebfb5599a50586655954efbfabef64df72399433f /libguile/script.c
parent52ce56fc79f06b4f6990fc1a0818f885bc182bc0 (diff)
downloadguile-3682a51a3553a5196995c94077b73b85f4e600f8.tar.gz
(scm_shell_usage, scm_compile_shell_switches): Prepend
a call to turn-on-debugging when --debug has been given instead of turning it on directly. Also, handle new `--no-debug' option, which might suppress the call to turn-on-debugging.
Diffstat (limited to 'libguile/script.c')
-rw-r--r--libguile/script.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/libguile/script.c b/libguile/script.c
index 2f740659c..948662a04 100644
--- a/libguile/script.c
+++ b/libguile/script.c
@@ -384,6 +384,9 @@ scm_shell_usage (int fatal, char *message)
" command line arguments\n"
" -ds do -s script at this point\n"
" --debug start with debugging evaluator and backtraces\n"
+ " --no-debug start with normal evaluator\n"
+ " Default is to enable debugging for interactive\n"
+ " use, but not for `-s' and `-c'.\n"
" -q inhibit loading of user init file\n"
" --emacs enable Emacs protocol (experimental)\n"
" --use-srfi=LS load SRFI modules for the SRFIs in LS,\n"
@@ -403,6 +406,7 @@ SCM_SYMBOL (sym_load, "load");
SCM_SYMBOL (sym_eval_string, "eval-string");
SCM_SYMBOL (sym_command_line, "command-line");
SCM_SYMBOL (sym_begin, "begin");
+SCM_SYMBOL (sym_turn_on_debugging, "turn-on-debugging");
SCM_SYMBOL (sym_load_user_init, "load-user-init");
SCM_SYMBOL (sym_top_repl, "top-repl");
SCM_SYMBOL (sym_quit, "quit");
@@ -433,6 +437,9 @@ scm_compile_shell_switches (int argc, char **argv)
int interactive = 1; /* Should we go interactive when done? */
int inhibit_user_init = 0; /* Don't load user init file */
int use_emacs_interface = 0;
+ int turn_on_debugging = 0;
+ int dont_turn_on_debugging = 0;
+
int i;
char *argv0 = guile;
@@ -524,12 +531,16 @@ scm_compile_shell_switches (int argc, char **argv)
tail);
}
- else if (! strcmp (argv[i], "--debug")) /* debug eval + backtraces */
+ else if (! strcmp (argv[i], "--debug"))
+ {
+ turn_on_debugging = 1;
+ dont_turn_on_debugging = 0;
+ }
+
+ else if (! strcmp (argv[i], "--no-debug"))
{
- SCM_DEVAL_P = 1;
- SCM_BACKTRACE_P = 1;
- SCM_RECORD_POSITIONS_P = 1;
- SCM_RESET_DEBUG_MODE;
+ dont_turn_on_debugging = 1;
+ turn_on_debugging = 0;
}
else if (! strcmp (argv[i], "--emacs")) /* use emacs protocol */
@@ -644,10 +655,17 @@ scm_compile_shell_switches (int argc, char **argv)
tail = scm_cons (scm_cons (sym_load_user_init, SCM_EOL), tail);
}
+ /* If debugging was requested, or we are interactive and debugging
+ was not explicitely turned off, turn on debugging. */
+ if (turn_on_debugging || (interactive && !dont_turn_on_debugging))
+ {
+ tail = scm_cons (scm_cons (sym_turn_on_debugging, SCM_EOL), tail);
+ }
+
{
SCM val = scm_cons (sym_begin, tail);
-#if 0
+#if 1
scm_write (val, SCM_UNDEFINED);
scm_newline (SCM_UNDEFINED);
#endif