Mercurial > octave
diff libinterp/corefcn/toplev.cc @ 19849:1c9ed5b4c73d
input.h: change meaning of interactive and forced_interactive global variables.
* libinterp/corefcn/input.h, libinterp/corefcn/input.cc: the interactive var
is set at the start of Octave session if the session would be interactive.
The forced_interactive is set only by the "--interactive" option. This means
that in a forced interactive session, interactive is false, and that in a not
forced interactive session with the "--interactive" option, forced_interactive
is true. This is a bit counter-intuitive. Also when it matters if a session
is interactive or not, it should not matter if it was forced not, only whether
is interactive. Change this logic. Interactive means we are running a
interactive session, forced interactive means the interactive session needed to
be forced.
* libinterp/octave.cc: during Octave initialization, as soon as we identify if
this would be an interactive session, check with forced_interactive to adjust
the value of this variables.
* libinterp/corefcn/error.cc, libinterp/corefcn/oct-stream.cc,
libinterp/corefcn/pager.cc, libinterp/corefcn/dirfns.cc,
libinterp/corefcn/sighandlers.cc, libinterp/corefcn/sysdep.cc,
libinterp/corefcn/toplev.cc, libinterp/parse-tree/lex.ll,
libinterp/parse-tree/oct-parse.in.yy: replace all checks for
"(interactive || forced_interactive)" with simply interactive. On the few
cases where forced_interactive was not checked, it was replaced with
"(interactive && ! forced_interactive)", just like "! interactive" got
replaced by "(! interactive || forced_interactive)", only to conserve the
logic. I am uncertain if such checks are not actually bugs though.
author | Carnë Draug <carandraug@octave.org> |
---|---|
date | Tue, 24 Feb 2015 17:09:42 +0000 |
parents | 9f6ee9cb749c |
children | 4f45eaf83908 |
line wrap: on
line diff
--- a/libinterp/corefcn/toplev.cc Tue Feb 24 10:41:57 2015 -0800 +++ b/libinterp/corefcn/toplev.cc Tue Feb 24 17:09:42 2015 +0000 @@ -572,7 +572,7 @@ // The big loop. - octave_lexer *lxr = ((interactive || forced_interactive) + octave_lexer *lxr = (interactive ? new octave_lexer () : new octave_lexer (stdin)); @@ -600,7 +600,7 @@ octave_quit (); - if (! (interactive || forced_interactive)) + if (! interactive) { bool quit = (tree_return_command::returning || tree_break_command::breaking); @@ -617,7 +617,7 @@ if (error_state) { - if (! (interactive || forced_interactive)) + if (! interactive) { // We should exit with a nonzero status. retval = 1; @@ -730,7 +730,7 @@ OCTAVE_SAFE_CALL (flush_octave_stdout, ()); - if (! quitting_gracefully && (interactive || forced_interactive)) + if (! quitting_gracefully && interactive) { octave_stdout << "\n";