Mercurial > hg > octave-terminal
changeset 3100:bea2f5be3eab
[project @ 1997-11-14 10:07:50 by jwe]
author | jwe |
---|---|
date | Fri, 14 Nov 1997 10:08:13 +0000 |
parents | 8ce6fed79320 |
children | f9806795b6d5 |
files | src/ChangeLog src/input.cc src/parse.h |
diffstat | 3 files changed, 23 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,15 @@ Fri Nov 14 01:53:13 1997 John W. Eaton <jwe@bevo.che.wisc.edu> + * parse.y (eval_string (const string&, bool, int&, int)): No + longer static. + * parse.h: Provide declaration. + * input.cc (get_user_input (const octave_value_list&, bool, int)): + New arg, nargout. Pass it to eval_string. + (keyboard): Pass nargout = 0 to get_user_input. + (input): Pass nargout to get_user_input. + * input.cc (get_user_input (const octave_value_list&, bool)): - Return octave_value() if user enters `quit', `exit', or `return'. + Return octave_value_list() 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.
--- a/src/input.cc +++ b/src/input.cc @@ -474,9 +474,9 @@ // If the user simply hits return, this will produce an empty matrix. static octave_value_list -get_user_input (const octave_value_list& args, bool debug = false) +get_user_input (const octave_value_list& args, bool debug, int nargout) { - octave_value retval; + octave_value_list retval; int nargin = args.length (); @@ -534,18 +534,20 @@ { // XXX FIXME XXX -- fix gnu_readline and octave_gets instead! if (input_buf.length () == 1 && input_buf[0] == '\n') - retval = ""; + retval(0) = ""; else - retval = input_buf; + retval(0) = input_buf; } else { int parse_status = 0; - retval = eval_string (input_buf, (! debug), parse_status); + bool silent = ! debug; - if (retval.is_undefined ()) - retval = Matrix (); + retval = eval_string (input_buf, silent, parse_status, nargout); + + if (! debug && retval.length == 0) + retval(0) = Matrix (); } } else @@ -559,7 +561,7 @@ error_state = 0; - retval = octave_value (); + retval = octave_value_list (); goto again; } @@ -567,7 +569,7 @@ return retval; } -DEFUN (input, args, , +DEFUN (input, args, nargout, "input (PROMPT [, S])\n\ \n\ Prompt user for input. If the second argument is present, return\n\ @@ -578,7 +580,7 @@ int nargin = args.length (); if (nargin == 1 || nargin == 2) - retval = get_user_input (args); + retval = get_user_input (args, false, nargout); else print_usage ("input"); @@ -615,7 +617,7 @@ Vsaving_history = true; - retval = get_user_input (args, true); + retval = get_user_input (args, true, 0); unwind_protect::run_frame ("keyboard"); }