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)
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 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");
337 pager_ostream.flush ();
444 std::cout.write (msg,
len);
474 std::cout.write (msg,
len);
530 int nargin = args.length ();
554 std::string arg = args(0).xstring_value (
"diary: argument must be a string");
561 else if (arg ==
"off")
590 int nargin = args.length ();
599 std::string arg = args(0).xstring_value (R
"(more: argument must be string "on" or "off")");
603 else if (arg ==
"off")
606 error (R
"(more: argument must be "on" or "off")");
614 DEFUN (terminal_size, args, ,
626 int nargin = args.length ();
638 Matrix m = args(0).xmatrix_value (
"argument must be a 2-element array");
641 error (
"terminal_size: argument must be a 2-element array");
646 if (rows <= 0 || cols <= 0)
647 error (
"terminal_size: rows and columns must be positive integers");
655 DEFMETHOD (page_output_immediately, interp, args, nargout,
679 DEFMETHOD (page_screen_output, interp, args, nargout,
723 return output_sys.
PAGER (args, nargout);
726 DEFMETHOD (PAGER_FLAGS, interp, args, nargout,
static bool forced_interactive(void)
void insert(pid_t pid, child::child_event_handler f)
static int terminal_rows(void)
static int terminal_cols(void)
static void set_screen_size(int ht, int wd)
std::ostream & stream(void)
child_list & get_child_list(void)
bool interactive(void) const
bool page_output_immediately(void) const
octave_value page_output_immediately(const octave_value_list &args, int nargout)
bool page_screen_output(void) const
std::string PAGER_FLAGS(void) const
bool m_flushing_output_to_pager
bool sync(const char *msg, int len)
octave_value PAGER_FLAGS(const octave_value_list &args, int nargout)
bool write_to_diary_file(void) const
diary_stream m_diary_stream
output_system(interpreter &interp)
std::string pager_command(void) const
bool m_page_output_immediately
oprocstream * m_external_pager
void clear_external_pager(void)
std::string m_PAGER_FLAGS
interpreter & m_interpreter
pager_stream m_pager_stream
std::ostream & __stdout__(void)
octave_value PAGER(const octave_value_list &args, int nargout)
std::string m_diary_file_name
std::string diary_file_name(void) const
octave_value page_screen_output(const octave_value_list &args, int nargout)
void start_external_pager(void)
std::ofstream & external_diary_file(void)
bool m_really_flush_to_pager
std::ostream & __diary__(void)
void do_sync(const char *msg, int len, bool bypass_pager)
bool m_page_screen_output
std::ofstream m_external_diary_file
std::string PAGER(void) const
static std::string getenv(const std::string &name)
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,...)
std::string default_pager(void)
bool wifsignaled(int status)
bool wifexited(int status)
std::ofstream ofstream(const std::string &filename, const std::ios::openmode mode)
std::ostream & __stdout__(void)
output_system & __get_output_system__(const std::string &who)
std::ostream & __diary__(void)
static bool more_than_a_screenful(const char *s, int len)
static bool pager_event_handler(pid_t pid, int status)
static std::string default_pager(void)
octave_value::octave_value(const Array< char > &chm, char type) return retval
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)