Mercurial > hg > octave-lojdl
changeset 2609:12bc9d0a50b5
[project @ 1997-01-18 00:17:36 by jwe]
author | jwe |
---|---|
date | Sat, 18 Jan 1997 00:17:37 +0000 |
parents | bac14003d9bb |
children | 8125b6f9c134 |
files | src/ChangeLog src/file-io.cc src/oct-stream.cc src/oct-stream.h |
diffstat | 4 files changed, 40 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +Fri Jan 17 18:13:10 1997 John W. Eaton <jwe@bevo.che.wisc.edu> + + * file-io.cc (Ffflush): Handle stdout as a special case. + + * oct-stream.cc (octave_stream_list::do_get_file_number): + Do the work for octave_stream::get_file_number. + (octave_stream_list::get_file_number): Convert to static function. + Wed Jan 8 11:42:44 1997 John W. Eaton <jwe@bevo.che.wisc.edu> * log.cc (sqrtm): For complex arg case, compute sqrt, not log.
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -168,12 +168,25 @@ if (nargin == 1) { - octave_stream *os = octave_stream_list::lookup (args(0)); + // XXX FIXME XXX -- any way to avoid special case for stdout? + + int fid = octave_stream_list::get_file_number (args (0)); + + if (fid == 1) + { + flush_octave_stdout (); - if (os) - retval = (double) os->flush (); + retval = 0.0; + } else - gripe_invalid_file_id ("fflush"); + { + octave_stream *os = octave_stream_list::lookup (fid); + + if (os) + retval = (double) os->flush (); + else + gripe_invalid_file_id ("fflush"); + } } else print_usage ("fflush");
--- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -2685,7 +2685,7 @@ } int -octave_stream_list::get_file_number (const octave_value& fid) const +octave_stream_list::do_get_file_number (const octave_value& fid) const { int retval = -1; @@ -2721,6 +2721,17 @@ return retval; } +int +octave_stream_list::get_file_number (const octave_value& fid) +{ + int retval = -1; + + if (instance) + retval = instance->do_get_file_number (fid); + + return retval; +} + /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/oct-stream.h +++ b/src/oct-stream.h @@ -492,6 +492,8 @@ static octave_value open_file_numbers (void); + static int get_file_number (const octave_value& fid); + private: Array<octave_stream*> list; @@ -517,7 +519,7 @@ octave_value do_open_file_numbers (void) const; - int get_file_number (const octave_value& fid) const; + int do_get_file_number (const octave_value& fid) const; }; #endif