Mercurial > hg > octave-lojdl
changeset 3477:4b79cb009dd4
[project @ 2000-01-26 00:55:22 by jwe]
author | jwe |
---|---|
date | Wed, 26 Jan 2000 00:55:23 +0000 |
parents | 78e1e0007f0f |
children | 32dd5d5e8c8f |
files | src/ChangeLog src/pager.cc src/pager.h |
diffstat | 3 files changed, 41 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@ 2000-01-25 John W. Eaton <jwe@bevo.che.wisc.edu> + * pager.cc (octave_pager_buf::flush_current_contents_to_diary): + New function. + (octave_pager_stream::flush_current_contents_to_diary): + Ditto. + (close_diary_file): Use the new octave_pager_stream function to + try to flush the current buffer to the diary when it is closed. + * variables.cc (Fexist): Return 6 for built-in constants. * pt-plot.cc (Fgshow): Don't append " " after last arg.
--- a/src/pager.cc +++ b/src/pager.cc @@ -250,6 +250,16 @@ return 0; } +void +octave_pager_buf::flush_current_contents_to_diary (void) +{ + char *buf = eback (); + + int len = pptr () - buf; + + octave_diary.write (buf, len); +} + int octave_diary_buf::sync (void) { @@ -290,6 +300,13 @@ return *instance; } +void +octave_pager_stream::flush_current_contents_to_diary (void) +{ + if (pb) + pb->flush_current_contents_to_diary (); +} + octave_diary_stream *octave_diary_stream::instance = 0; octave_diary_stream::octave_diary_stream (void) : ostream (), db (0) @@ -339,6 +356,19 @@ static void close_diary_file (void) { + // Try to flush the current buffer to the diary now, so that things + // like + // + // function foo () + // diary on; + // ... + // diary off; + // endfunction + // + // will do the right thing. + + octave_stdout.flush_current_contents_to_diary (); + if (external_diary_file.is_open ()) { octave_diary.flush ();
--- a/src/pager.h +++ b/src/pager.h @@ -39,6 +39,8 @@ octave_pager_buf (int size = 0) : strstreambuf (size) { } + void flush_current_contents_to_diary (void); + protected: int sync (void); @@ -55,6 +57,8 @@ ~octave_pager_stream (void); + void flush_current_contents_to_diary (void); + static octave_pager_stream& stream (void); private: