26 #if defined (HAVE_CONFIG_H)
69 std::cerr <<
"warning: connection to external pager lost (pid = "
70 << pid <<
')' << std::endl;
71 std::cerr <<
"warning: flushing pending output (please wait)"
97 int chars_this_line = 0;
99 for (
int i = 0; i <
len; i++)
103 count += chars_this_line / cols + 1;
110 if (count > available_rows)
119 std::string pager_binary = sys::env::getenv (
"PAGER");
121 if (pager_binary.empty ())
132 char *buf = pbase ();
134 int len = pptr () - buf;
136 if (output_sys.
sync (buf,
len))
140 seekoff (0, std::ios::beg);
151 std::size_t
len = pptr () - buf;
173 char *buf = pbase ();
175 int len = pptr () - buf;
178 external_diary_file.write (buf,
len);
181 seekoff (0, std::ios::beg);
268 : m_interpreter (interp), m_pager_stream (), m_diary_stream (),
269 m_external_pager (nullptr), m_external_diary_file (),
271 m_PAGER_FLAGS (), m_page_output_immediately (false),
272 m_page_screen_output (false), m_write_to_diary_file (false),
273 m_really_flush_to_pager (false), m_flushing_output_to_pager (false)
286 "PAGER_FLAGS",
false);
294 "page_output_immediately");
302 "page_screen_output");
335 pager_ostream.flush ();
454 std::cout.write (msg,
len);
485 std::cout.write (msg,
len);
540 int nargin = args.length ();
564 std::string arg = args(0).xstring_value (
"diary: argument must be a string");
571 else if (arg ==
"off")
600 int nargin = args.length ();
609 std::string arg = args(0).xstring_value (R
"(more: argument must be string "on" or "off")");
613 else if (arg ==
"off")
616 error (R
"(more: argument must be "on" or "off")");
624 DEFUN (terminal_size, args, ,
637 int nargin = args.length ();
649 Matrix m = args(0).xmatrix_value (
"argument must be a 2-element array");
652 error (
"terminal_size: argument must be a 2-element array");
657 if (rows <= 0 || cols <= 0)
658 error (
"terminal_size: rows and columns must be positive integers");
666 DEFMETHOD (page_output_immediately, interp, args, nargout,
690 DEFMETHOD (page_screen_output, interp, args, nargout,
734 return output_sys.
PAGER (args, nargout);
737 DEFMETHOD (PAGER_FLAGS, interp, args, nargout,
static bool forced_interactive(void)
void insert(pid_t pid, child::child_event_handler f)
static int terminal_cols(void)
static void set_screen_size(int ht, int wd)
static int terminal_rows(void)
std::ostream & stream(void)
Provides threadsafe access to octave.
bool interpreter_output(const std::string &msg)
event_manager & get_event_manager(void)
bool server_mode(void) const
child_list & get_child_list(void)
bool interactive(void) const
pager_stream m_pager_stream
std::ofstream & external_diary_file(void)
std::string PAGER_FLAGS(void) const
std::string PAGER(void) const
diary_stream m_diary_stream
std::ostream & __diary__(void)
bool page_screen_output(void) const
interpreter & m_interpreter
std::string diary_file_name(void) const
octave_value page_screen_output(const octave_value_list &args, int nargout)
octave_value PAGER_FLAGS(const octave_value_list &args, int nargout)
bool m_flushing_output_to_pager
oprocstream * m_external_pager
bool sync(const char *msg, int len)
bool write_to_diary_file(void) const
void start_external_pager(void)
void clear_external_pager(void)
std::string pager_command(void) const
bool m_page_screen_output
output_system(interpreter &interp)
std::string m_PAGER_FLAGS
octave_value PAGER(const octave_value_list &args, int nargout)
bool page_output_immediately(void) const
bool m_really_flush_to_pager
std::string m_diary_file_name
bool m_page_output_immediately
void do_sync(const char *msg, int len, bool bypass_pager)
std::ofstream m_external_diary_file
std::ostream & __stdout__(void)
octave_value page_output_immediately(const octave_value_list &args, int nargout)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
OCTINTERP_API void print_usage(void)
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void error(const char *fmt,...)
output_system & __get_output_system__(void)
std::ofstream ofstream(const std::string &filename, const std::ios::openmode mode)
bool wifexited(int status)
bool wifsignaled(int status)
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
octave_value set_internal_variable(bool &var, const octave_value_list &args, int nargout, const char *nm)