# HG changeset patch # User jwe # Date 976850085 0 # Node ID 41404c6f4e69046fc89a4911e1bfa9ffb388ae71 # Parent 4c230f72b1d22bcbcda2ce9b32e0cb79c6a46109 [project @ 2000-12-15 03:14:44 by jwe] diff -r 4c230f72b1d2 -r 41404c6f4e69 src/ChangeLog --- a/src/ChangeLog Thu Dec 14 23:02:49 2000 +0000 +++ b/src/ChangeLog Fri Dec 15 03:14:45 2000 +0000 @@ -1,3 +1,15 @@ +2000-12-14 John W. Eaton + + * pager.h (octave_pager_buf::diary_skip): New data member. + (octave_pager_buf::octave_pager_buf): Initialize it. + * pager.cc (octave_pager_buf::set_diary_skip): New function. + (octave_pager_stream::set_diary_skip): New function. + (octave_pager_buf::sync): Call flush_current_contents_to_diary + instead of octave_diary.write. + (octave_pager_buf::flush_current_contents_to_diary): Use + diary_skip, reset when done. + (open_diary_file): Call octave_stdout.set_diary_skip here. + 2000-12-06 John W. Eaton * DLD-FUNCTIONS/minmax.cc (EMPTY_RETURN_CHECK): New macro. diff -r 4c230f72b1d2 -r 41404c6f4e69 src/pager.cc --- a/src/pager.cc Thu Dec 14 23:02:49 2000 +0000 +++ b/src/pager.cc Fri Dec 15 03:14:45 2000 +0000 @@ -241,7 +241,7 @@ seekoff (0, std::ios::beg); - octave_diary.write (buf, len); + flush_current_contents_to_diary (); } } @@ -251,11 +251,19 @@ void octave_pager_buf::flush_current_contents_to_diary (void) { - char *buf = eback (); + char *buf = eback () + diary_skip; - int len = pptr () - buf; + size_t len = pptr () - buf; octave_diary.write (buf, len); + + diary_skip = 0; +} + +void +octave_pager_buf::set_diary_skip (void) +{ + diary_skip = pptr () - eback (); } int @@ -305,6 +313,13 @@ pb->flush_current_contents_to_diary (); } +void +octave_pager_stream::set_diary_skip (void) +{ + if (pb) + pb->set_diary_skip (); +} + octave_diary_stream *octave_diary_stream::instance = 0; octave_diary_stream::octave_diary_stream (void) : std::ostream (), db (0) @@ -379,6 +394,11 @@ { close_diary_file (); + // If there is pending output in the pager buf, it should not go + // into the diary file. + + octave_stdout.set_diary_skip (); + external_diary_file.open (diary_file.c_str (), std::ios::app); if (! external_diary_file) diff -r 4c230f72b1d2 -r 41404c6f4e69 src/pager.h --- a/src/pager.h Thu Dec 14 23:02:49 2000 +0000 +++ b/src/pager.h Fri Dec 15 03:14:45 2000 +0000 @@ -36,13 +36,20 @@ { public: - octave_pager_buf (int size = 0) : std::strstreambuf (size) { } + octave_pager_buf (int size = 0) + : std::strstreambuf (size), diary_skip (0) { } void flush_current_contents_to_diary (void); + void set_diary_skip (void); + protected: int sync (void); + +private: + + size_t diary_skip; }; class @@ -58,6 +65,8 @@ void flush_current_contents_to_diary (void); + void set_diary_skip (void); + static octave_pager_stream& stream (void); private: