# HG changeset patch # User jwe # Date 879499829 0 # Node ID f4acdc9a77cc7fa22850c5b4f0155c4b8075fd64 # Parent d12c312d1cfb78803165149608ee93d2f04cca36 [project @ 1997-11-14 09:30:20 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@ Fri Nov 14 01:53:13 1997 John W. Eaton + * input.cc (get_user_input (const octave_value_list&, bool)): + Return octave_value() if user enters `quit', `exit', or `return'. + If debugging, let eval_string handle the printing chores and + reset error_state before asking for more input. + + * input.cc (Fkeyboard): Unconditionally turn on history here. + * lex.l (have_continuation, have_ellipsis_continuation): Declare arg as bool, not int. Change callers. diff --git a/src/input.cc b/src/input.cc --- a/src/input.cc +++ b/src/input.cc @@ -64,6 +64,7 @@ #include "sighandlers.h" #include "symtab.h" #include "sysdep.h" +#include "unwind-prot.h" #include "utils.h" #include "variables.h" @@ -541,14 +542,9 @@ { int parse_status = 0; - retval = eval_string (input_buf, true, parse_status); + retval = eval_string (input_buf, (! debug), parse_status); - if (retval.is_defined ()) - { - if (debug) - retval.print (octave_stdout); - } - else + if (retval.is_undefined ()) retval = Matrix (); } } @@ -556,7 +552,17 @@ error ("input: reading user-input failed!"); if (debug) - goto again; + { + // Clear error_state so that if errors were encountered while + // evaluating user input, extra error messages will not be + // printed after we return. + + error_state = 0; + + retval = octave_value (); + + goto again; + } return retval; } @@ -579,6 +585,12 @@ return retval; } +static void +restore_command_history (void *) +{ + command_history::ignore_entries (! Vsaving_history); +} + DEFUN (keyboard, args, , "keyboard (PROMPT)\n\ \n\ @@ -589,7 +601,24 @@ int nargin = args.length (); if (nargin == 0 || nargin == 1) - retval = get_user_input (args, true); + { + unwind_protect::begin_frame ("keyboard"); + + // XXX FIXME XXX -- we shouldn't need both the + // command_history object and the + // Vsaving_history variable... + command_history::ignore_entries (false); + + unwind_protect::add (restore_command_history, 0); + + unwind_protect_bool (Vsaving_history); + + Vsaving_history = true; + + retval = get_user_input (args, true); + + unwind_protect::run_frame ("keyboard"); + } else print_usage ("keyboard");