Mercurial > hg > octave-lyh
changeset 2658:dd71eb0bb414
[project @ 1997-02-03 04:49:57 by jwe]
author | jwe |
---|---|
date | Mon, 03 Feb 1997 04:50:10 +0000 |
parents | 7457014d8985 |
children | 5ea93b07a88b |
files | liboctave/ChangeLog liboctave/cmd-hist.cc liboctave/cmd-hist.h src/Stack.h src/octave.cc |
diffstat | 5 files changed, 44 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,9 @@ +Sun Feb 2 22:33:44 1997 John W. Eaton <jwe@bevo.che.wisc.edu> + + * 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 <jwe@bevo.che.wisc.edu> * f2c-main.c: Change C++-style comments to C-style comments.
--- a/liboctave/cmd-hist.cc +++ b/liboctave/cmd-hist.cc @@ -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
--- a/liboctave/cmd-hist.h +++ b/liboctave/cmd-hist.h @@ -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 ());