Mercurial > octave-nkf
comparison src/pager.cc @ 3756:41404c6f4e69
[project @ 2000-12-15 03:14:44 by jwe]
author | jwe |
---|---|
date | Fri, 15 Dec 2000 03:14:45 +0000 |
parents | aa31644d9779 |
children | 13905c3a24af |
comparison
equal
deleted
inserted
replaced
3755:4c230f72b1d2 | 3756:41404c6f4e69 |
---|---|
239 { | 239 { |
240 do_sync (buf, len, bypass_pager); | 240 do_sync (buf, len, bypass_pager); |
241 | 241 |
242 seekoff (0, std::ios::beg); | 242 seekoff (0, std::ios::beg); |
243 | 243 |
244 octave_diary.write (buf, len); | 244 flush_current_contents_to_diary (); |
245 } | 245 } |
246 } | 246 } |
247 | 247 |
248 return 0; | 248 return 0; |
249 } | 249 } |
250 | 250 |
251 void | 251 void |
252 octave_pager_buf::flush_current_contents_to_diary (void) | 252 octave_pager_buf::flush_current_contents_to_diary (void) |
253 { | 253 { |
254 char *buf = eback (); | 254 char *buf = eback () + diary_skip; |
255 | 255 |
256 int len = pptr () - buf; | 256 size_t len = pptr () - buf; |
257 | 257 |
258 octave_diary.write (buf, len); | 258 octave_diary.write (buf, len); |
259 | |
260 diary_skip = 0; | |
261 } | |
262 | |
263 void | |
264 octave_pager_buf::set_diary_skip (void) | |
265 { | |
266 diary_skip = pptr () - eback (); | |
259 } | 267 } |
260 | 268 |
261 int | 269 int |
262 octave_diary_buf::sync (void) | 270 octave_diary_buf::sync (void) |
263 { | 271 { |
301 void | 309 void |
302 octave_pager_stream::flush_current_contents_to_diary (void) | 310 octave_pager_stream::flush_current_contents_to_diary (void) |
303 { | 311 { |
304 if (pb) | 312 if (pb) |
305 pb->flush_current_contents_to_diary (); | 313 pb->flush_current_contents_to_diary (); |
314 } | |
315 | |
316 void | |
317 octave_pager_stream::set_diary_skip (void) | |
318 { | |
319 if (pb) | |
320 pb->set_diary_skip (); | |
306 } | 321 } |
307 | 322 |
308 octave_diary_stream *octave_diary_stream::instance = 0; | 323 octave_diary_stream *octave_diary_stream::instance = 0; |
309 | 324 |
310 octave_diary_stream::octave_diary_stream (void) : std::ostream (), db (0) | 325 octave_diary_stream::octave_diary_stream (void) : std::ostream (), db (0) |
376 | 391 |
377 static void | 392 static void |
378 open_diary_file (void) | 393 open_diary_file (void) |
379 { | 394 { |
380 close_diary_file (); | 395 close_diary_file (); |
396 | |
397 // If there is pending output in the pager buf, it should not go | |
398 // into the diary file. | |
399 | |
400 octave_stdout.set_diary_skip (); | |
381 | 401 |
382 external_diary_file.open (diary_file.c_str (), std::ios::app); | 402 external_diary_file.open (diary_file.c_str (), std::ios::app); |
383 | 403 |
384 if (! external_diary_file) | 404 if (! external_diary_file) |
385 error ("diary: can't open diary file `%s'", diary_file.c_str ()); | 405 error ("diary: can't open diary file `%s'", diary_file.c_str ()); |