# HG changeset patch # User jwe # Date 854945410 0 # Node ID dd71eb0bb4141026e37a6671e0de02de5ea0c1dd # Parent 7457014d8985ee2791e9eba90181e1d70bdedb44 [project @ 1997-02-03 04:49:57 by jwe] diff -r 7457014d8985 -r dd71eb0bb414 liboctave/ChangeLog --- a/liboctave/ChangeLog Mon Feb 03 03:27:11 1997 +0000 +++ b/liboctave/ChangeLog Mon Feb 03 04:50:10 1997 +0000 @@ -1,3 +1,9 @@ +Sun Feb 2 22:33:44 1997 John W. Eaton + + * cmd-hist.cc (command_history::read): New arg, must_exist. + Set line_in_file here too. + (command_history::read_range): New arg, must_exist. + Fri Jan 31 09:21:57 1997 John W. Eaton * f2c-main.c: Change C++-style comments to C-style comments. diff -r 7457014d8985 -r dd71eb0bb414 liboctave/cmd-hist.cc --- a/liboctave/cmd-hist.cc Mon Feb 03 03:27:11 1997 +0000 +++ b/liboctave/cmd-hist.cc Mon Feb 03 04:50:10 1997 +0000 @@ -179,7 +179,13 @@ } void -command_history::read (const string& f_arg) +command_history::read (bool must_exist) +{ + read (xfile, must_exist); +} + +void +command_history::read (const string& f_arg, bool must_exist) { string f = f_arg; @@ -190,17 +196,27 @@ { int status = ::read_history (f.c_str ()); - if (status != 0) + if (status != 0 && must_exist) error (status); else - ::using_history (); + { + lines_in_file = where (); + + ::using_history (); + } } else error ("command_history::read: missing file name"); } +command_history::read_range (int from, int to, bool must_exist) +{ + read_range (xfile, from, to, must_exist); +} + void -command_history::read_range (const string& f_arg, int from, int to) +command_history::read_range (const string& f_arg, int from, int to, + bool must_exist) { if (from < 0) from = lines_in_file; @@ -214,12 +230,13 @@ { int status = ::read_history_range (f.c_str (), from, to); - if (status != 0) + if (status != 0 && must_exist) error (status); else { + lines_in_file = where (); + ::using_history (); - lines_in_file = where (); } } else diff -r 7457014d8985 -r dd71eb0bb414 liboctave/cmd-hist.h --- a/liboctave/cmd-hist.h Mon Feb 03 03:27:11 1997 +0000 +++ b/liboctave/cmd-hist.h Mon Feb 03 04:50:10 1997 +0000 @@ -32,7 +32,9 @@ { public: - command_history (const string& = string (), int = -1); + command_history (const string& = string (), int = -1, bool = false) + + command_history (const string& = string (), int = -1) ~command_history (void) { initialized = false; } @@ -64,9 +66,14 @@ int is_stifled (void); - void read (const string& = string ()); + void read (bool = true); + + void read (const string& = string (), bool = true) - void read_range (const string& = string (), int = -1, int = -1); + void read_range (int = -1, int = -1, bool = true) + + void read_range (const string& = string (), int = -1, int = -1, + bool = true) void write (const string& = string ()); diff -r 7457014d8985 -r dd71eb0bb414 src/Stack.h --- a/src/Stack.h Mon Feb 03 03:27:11 1997 +0000 +++ b/src/Stack.h Mon Feb 03 04:50:10 1997 +0000 @@ -45,8 +45,10 @@ Stack { public: - inline Stack (void) { } - inline virtual ~Stack (void) { } + + Stack (void) { } + + virtual ~Stack (void) { } virtual void push (const T& item) = 0; diff -r 7457014d8985 -r dd71eb0bb414 src/octave.cc --- a/src/octave.cc Mon Feb 03 03:27:11 1997 +0000 +++ b/src/octave.cc Mon Feb 03 04:50:10 1997 +0000 @@ -533,7 +533,7 @@ execute_startup_files (); - octave_command_history.read (); + octave_command_history.read (false); if (! inhibit_startup_message && reading_startup_message_printed) cout << endl;