Mercurial > hg > octave-max
changeset 2164:269db7306980
[project @ 1996-05-13 13:05:24 by jwe]
author | jwe |
---|---|
date | Mon, 13 May 1996 13:05:24 +0000 |
parents | 8901e415035a |
children | 83d91aa3759b |
files | src/pager.cc |
diffstat | 1 files changed, 54 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/pager.cc +++ b/src/pager.cc @@ -36,6 +36,7 @@ #include "defaults.h" #include "defun.h" #include "error.h" +#include "gripes.h" #include "help.h" #include "input.h" #include "oct-obj.h" @@ -58,6 +59,18 @@ // The diary file. static ofstream external_diary_file; +// The shell command to run as the pager. +static string Vpager_binary; + +// TRUE means that if output is going to the pager, it is sent as soon +// as it is available. Otherwise, it is buffered and only sent to the +// pager when it is time to print another prompt. +static bool Vpage_output_immediately; + +// TRUE means all output intended for the screen should be passed +// through the pager. +static bool Vpage_screen_output; + static sig_handler *saved_sigint_handler = 0; static int really_flush_to_pager = 0; @@ -75,7 +88,7 @@ { if (! external_pager) { - string pgr = user_pref.pager_binary; + string pgr = Vpager_binary; if (! pgr.empty ()) { @@ -144,22 +157,19 @@ int octave_pager_buf::sync (void) { - bool page_output = user_pref.page_screen_output; - bool page_immediately = user_pref.page_output_immediately; - if (really_flush_to_pager - || (page_output && page_immediately) - || ! page_output) + || (Vpage_screen_output && Vpage_output_immediately) + || ! Vpage_screen_output) { sputc ('\0'); char *buf = eback (); bool bypass_pager = (! interactive - || ! page_output + || ! Vpage_screen_output || (really_flush_to_pager - && page_output - && ! page_immediately + && Vpage_screen_output + && ! Vpage_output_immediately && ! more_than_a_screenful (buf))); do_sync (buf, bypass_pager); @@ -397,10 +407,44 @@ return pager_binary; } +static int +pager_binary (void) +{ + int status = 0; + + string s = builtin_string_variable ("PAGER"); + + if (s.empty ()) + { + gripe_invalid_value_specified ("PAGER"); + status = -1; + } + else + Vpager_binary = s; + + return status; +} + +static int +page_output_immediately (void) +{ + Vpage_output_immediately = check_preference ("page_output_immediately"); + + return 0; +} + +static int +page_screen_output (void) +{ + Vpage_screen_output = check_preference ("page_screen_output"); + + return 0; +} + void symbols_of_pager (void) { - DEFVAR (PAGER, default_pager (), 0, sv_pager_binary, + DEFVAR (PAGER, default_pager (), 0, pager_binary, "path to pager binary"); DEFVAR (page_output_immediately, 0.0, 0, page_output_immediately,