Functions | Variables

pager.cc File Reference

#include <fstream>
#include <iostream>
#include <string>
#include "cmd-edit.h"
#include "oct-env.h"
#include "singleton-cleanup.h"
#include "defaults.h"
#include "defun.h"
#include "error.h"
#include "gripes.h"
#include "input.h"
#include "oct-obj.h"
#include "pager.h"
#include "procstream.h"
#include "sighandlers.h"
#include "unwind-prot.h"
#include "utils.h"
#include "variables.h"
Include dependency graph for pager.cc:

Go to the source code of this file.

Functions

static void clear_external_pager (void)
static void close_diary_file (void)
static std::string default_pager (void)
 DEFUN (PAGER, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {@var{val} =} PAGER ()\n\ @deftypefnx {Built-in Function} {@var{old_val} =} PAGER (@var{new_val})\n\ @deftypefnx {Built-in Function} {} PAGER (@var{new_val}, \"local\")\n\ Query or set the internal variable that specifies the program to use\n\ to display terminal output on your system. The default value is\n\ normally @code{\"less\"}, @code{\"more\"}, or\n\ @code{\"pg\"}, depending on what programs are installed on your system.\n\ @xref{Installation}.\n\ \n\ When called from inside a function with the \"local\" option, the variable is\n\ changed locally for the function and any subroutines it calls. The original\n\ variable value is restored when exiting the function.\n\ @seealso{more, page_screen_output, page_output_immediately, PAGER_FLAGS}\n\ @end deftypefn")
 DEFUN (PAGER_FLAGS, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {@var{val} =} PAGER_FLAGS ()\n\ @deftypefnx {Built-in Function} {@var{old_val} =} PAGER_FLAGS (@var{new_val})\n\ @deftypefnx {Built-in Function} {} PAGER_FLAGS (@var{new_val}, \"local\")\n\ Query or set the internal variable that specifies the options to pass\n\ to the pager.\n\ \n\ When called from inside a function with the \"local\" option, the variable is\n\ changed locally for the function and any subroutines it calls. The original\n\ variable value is restored when exiting the function.\n\ @seealso{PAGER}\n\ @end deftypefn")
 DEFUN (diary, args,,"-*- texinfo -*-\n\ @deftypefn {Command} {} diary options\n\ Record a list of all commands @emph{and} the output they produce, mixed\n\ together just as you see them on your terminal. Valid options are:\n\ \n\ @table @code\n\ @item on\n\ Start recording your session in a file called @file{diary} in your\n\ current working directory.\n\ \n\ @item off\n\ Stop recording your session in the diary file.\n\ \n\ @item @var{file}\n\ Record your session in the file named @var{file}.\n\ @end table\n\ \n\ With no arguments, @code{diary} toggles the current diary state.\n\ @end deftypefn")
 DEFUN (more, args,,"-*- texinfo -*-\n\ @deftypefn {Command} {} more\n\ @deftypefnx {Command} {} more on\n\ @deftypefnx {Command} {} more off\n\ Turn output pagination on or off. Without an argument, @code{more}\n\ toggles the current state.\n\ The current state can be determined via @code{page_screen_output}.\n\ @end deftypefn")
 DEFUN (terminal_size,,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} terminal_size ()\n\ Return a two-element row vector containing the current size of the\n\ terminal window in characters (rows and columns).\n\ @seealso{list_in_columns}\n\ @end deftypefn")
 DEFUN (page_output_immediately, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {@var{val} =} page_output_immediately ()\n\ @deftypefnx {Built-in Function} {@var{old_val} =} page_output_immediately (@var{new_val})\n\ @deftypefnx {Built-in Function} {} page_output_immediately (@var{new_val}, \"local\")\n\ Query or set the internal variable that controls whether Octave sends\n\ output to the pager as soon as it is available. Otherwise, Octave\n\ buffers its output and waits until just before the prompt is printed to\n\ flush it to the pager.\n\ \n\ When called from inside a function with the \"local\" option, the variable is\n\ changed locally for the function and any subroutines it calls. The original\n\ variable value is restored when exiting the function.\n\ @end deftypefn")
 DEFUN (page_screen_output, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {@var{val} =} page_screen_output ()\n\ @deftypefnx {Built-in Function} {@var{old_val} =} page_screen_output (@var{new_val})\n\ @deftypefnx {Built-in Function} {} page_screen_output (@var{new_val}, \"local\")\n\ Query or set the internal variable that controls whether output intended\n\ for the terminal window that is longer than one page is sent through a\n\ pager. This allows you to view one screenful at a time. Some pagers\n\ (such as @code{less}---see @ref{Installation}) are also capable of moving\n\ backward on the output.\n\ \n\ When called from inside a function with the \"local\" option, the variable is\n\ changed locally for the function and any subroutines it calls. The original\n\ variable value is restored when exiting the function.\n\ @end deftypefn")
static void do_sync (const char *msg, int len, bool bypass_pager)
void flush_octave_stdout (void)
static bool more_than_a_screenful (const char *s, int len)
static void open_diary_file (void)
static std::string pager_command (void)
static bool pager_event_handler (pid_t pid, int status)

Variables

static std::string diary_file
static std::ofstream external_diary_file
static oprocstreamexternal_pager = 0
static bool flushing_output_to_pager = false
static bool really_flush_to_pager = false
static bool Vpage_output_immediately = false
static bool Vpage_screen_output = true
static std::string VPAGER = default_pager ()
static std::string VPAGER_FLAGS
static bool write_to_diary_file = false

Function Documentation

static void clear_external_pager ( void   )  [static]

Definition at line 93 of file pager.cc.

References procstreambase::pid(), and octave_child_list::remove().

Referenced by flush_octave_stdout().

static void close_diary_file ( void   )  [static]
static std::string default_pager ( void   )  [static]

Definition at line 61 of file pager.cc.

References octave_env::getenv().

DEFUN ( PAGER  ,
args  ,
nargout   
)

Definition at line 677 of file pager.cc.

References SET_NONEMPTY_INTERNAL_STRING_VARIABLE.

DEFUN ( PAGER_FLAGS  ,
args  ,
nargout   
)

Definition at line 697 of file pager.cc.

References SET_NONEMPTY_INTERNAL_STRING_VARIABLE.

DEFUN ( diary  ,
args   
)
DEFUN ( more  ,
args   
)

Definition at line 586 of file pager.cc.

References arg(), error(), error_state, print_usage(), and Vpage_screen_output.

DEFUN ( terminal_size   ) 
DEFUN ( page_output_immediately  ,
args  ,
nargout   
)

Definition at line 640 of file pager.cc.

References SET_INTERNAL_VARIABLE.

DEFUN ( page_screen_output  ,
args  ,
nargout   
)

Definition at line 658 of file pager.cc.

References SET_INTERNAL_VARIABLE.

static void do_sync ( const char msg,
int  len,
bool  bypass_pager 
) [static]

Definition at line 143 of file pager.cc.

References octave_child_list::insert(), pager_command(), and procstreambase::pid().

Referenced by octave_pager_buf::sync().

void flush_octave_stdout ( void   ) 
static bool more_than_a_screenful ( const char s,
int  len 
) [static]

Definition at line 201 of file pager.cc.

References command_editor::terminal_cols(), and command_editor::terminal_rows().

Referenced by octave_pager_buf::sync().

static void open_diary_file ( void   )  [static]
static std::string pager_command ( void   )  [static]

Definition at line 132 of file pager.cc.

References VPAGER, and VPAGER_FLAGS.

Referenced by do_sync().

static bool pager_event_handler ( pid_t  pid,
int  status 
) [static]

Definition at line 105 of file pager.cc.

References WIFEXITED, and WIFSIGNALLED.


Variable Documentation

std::string diary_file [static]

Definition at line 55 of file pager.cc.

Referenced by DEFUN(), and open_diary_file().

std::ofstream external_diary_file [static]

Definition at line 58 of file pager.cc.

Referenced by close_diary_file(), open_diary_file(), and octave_diary_buf::sync().

oprocstream* external_pager = 0 [static]

Definition at line 49 of file pager.cc.

bool flushing_output_to_pager = false [static]

Definition at line 90 of file pager.cc.

Referenced by flush_octave_stdout().

bool really_flush_to_pager = false [static]

Definition at line 88 of file pager.cc.

Referenced by flush_octave_stdout(), and octave_pager_buf::sync().

bool Vpage_output_immediately = false [static]

Definition at line 82 of file pager.cc.

Referenced by octave_pager_buf::sync().

bool Vpage_screen_output = true [static]

Definition at line 86 of file pager.cc.

Referenced by DEFUN(), and octave_pager_buf::sync().

std::string VPAGER = default_pager () [static]

Definition at line 74 of file pager.cc.

Referenced by pager_command().

std::string VPAGER_FLAGS [static]

Definition at line 77 of file pager.cc.

Referenced by pager_command().

bool write_to_diary_file = false [static]

Definition at line 52 of file pager.cc.

Referenced by DEFUN(), and octave_diary_buf::sync().

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines