annotate libinterp/corefcn/pager.cc @ 33658:b1d6e40ac737 stable tip

NEWS.9.md: Fix typo and minor formatting changes. * etc/NEWS.9.md: Fix typo. Adjust whitespace. Use markdown syntax for code snippets.
author Markus Mützel <markus.muetzel@gmx.de>
date Wed, 05 Jun 2024 11:27:35 +0200
parents 2e484f9f1f18
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
32632
2e484f9f1f18 maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 32589
diff changeset
3 // Copyright (C) 1993-2024 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
25
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
26 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21200
diff changeset
27 # include "config.h"
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
28 #endif
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
29
3503
d14c483b3c12 [project @ 2000-02-01 04:06:07 by jwe]
jwe
parents: 3477
diff changeset
30 #include <fstream>
8950
d865363208d6 include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
31 #include <iostream>
1755
3a9462b655f1 [project @ 1996-01-22 04:47:22 by jwe]
jwe
parents: 1742
diff changeset
32 #include <string>
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
33
24734
5d8c4cbc56d7 don't use singleton pattern for child_list
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
34 #include "child-list.h"
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2847
diff changeset
35 #include "cmd-edit.h"
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2847
diff changeset
36 #include "oct-env.h"
21921
ecfcc8527661 hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents: 21748
diff changeset
37 #include "oct-syscalls.h"
2101
c64b49a4cba3 [project @ 1996-04-28 11:59:25 by jwe]
jwe
parents: 2100
diff changeset
38
25460
627d6bde9b8d solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents: 25440
diff changeset
39 #include "defaults.h"
1352
19c10b8657d5 [project @ 1995-09-05 08:11:57 by jwe]
jwe
parents: 1343
diff changeset
40 #include "defun.h"
19c10b8657d5 [project @ 1995-09-05 08:11:57 by jwe]
jwe
parents: 1343
diff changeset
41 #include "error.h"
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21075
diff changeset
42 #include "errwarn.h"
2110
dece5cc39e00 [project @ 1996-04-30 12:38:20 by jwe]
jwe
parents: 2103
diff changeset
43 #include "input.h"
25460
627d6bde9b8d solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents: 25440
diff changeset
44 #include "interpreter.h"
25440
893344cee100 rename defaults source files to installation-data
John W. Eaton <jwe@octave.org>
parents: 25439
diff changeset
45 #include "interpreter-private.h"
22089
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 22049
diff changeset
46 #include "octave.h"
20940
48b2ad5ee801 maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents: 20939
diff changeset
47 #include "ovl.h"
1352
19c10b8657d5 [project @ 1995-09-05 08:11:57 by jwe]
jwe
parents: 1343
diff changeset
48 #include "pager.h"
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13951
diff changeset
49 #include "procstream.h"
990
d2dd114ba5dd [project @ 1994-12-15 05:58:17 by jwe]
jwe
parents: 988
diff changeset
50 #include "sighandlers.h"
2100
49cdc5b183bc [project @ 1996-04-28 11:26:32 by jwe]
jwe
parents: 2099
diff changeset
51 #include "unwind-prot.h"
2201
e5db2ea7f7c8 [project @ 1996-05-15 05:37:55 by jwe]
jwe
parents: 2200
diff changeset
52 #include "utils.h"
2368
bf6a96fd9b7e [project @ 1996-10-11 23:44:38 by jwe]
jwe
parents: 2210
diff changeset
53 #include "variables.h"
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
54
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 31105
diff changeset
55 OCTAVE_BEGIN_NAMESPACE(octave)
29960
939bef0b66e0 merge "namespace octave" and OCTAVE_NAMESPACE_BEGIN/END blocks
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
56
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
57 static bool
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
58 pager_event_handler (pid_t pid, int status)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
59 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
60 bool retval = false;
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
61
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
62 if (pid > 0)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
63 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
64 if (sys::wifexited (status) || sys::wifsignaled (status))
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
65 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
66 // Avoid warning() since that will put us back in the pager,
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
67 // which would be bad news.
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
68
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
69 std::cerr << "warning: connection to external pager lost (pid = "
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
70 << pid << ')' << std::endl;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
71 std::cerr << "warning: flushing pending output (please wait)"
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
72 << std::endl;
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
73
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
74 // Request removal of this PID from the list of child
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
75 // processes.
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
76
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
77 retval = true;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
78 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
79 }
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
80
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
81 return retval;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
82 }
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
83
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
84 // Assume our terminal wraps long lines.
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
85
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
86 static bool
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
87 more_than_a_screenful (const char *s, int len)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
88 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
89 if (s)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
90 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
91 int available_rows = command_editor::terminal_rows () - 2;
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
92
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
93 int cols = command_editor::terminal_cols ();
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
94
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
95 int count = 0;
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
96
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
97 int chars_this_line = 0;
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
98
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
99 for (int i = 0; i < len; i++)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
100 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
101 if (*s++ == '\n')
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
102 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
103 count += chars_this_line / cols + 1;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
104 chars_this_line = 0;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
105 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
106 else
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
107 chars_this_line++;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
108 }
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
109
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
110 if (count > available_rows)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
111 return true;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
112 }
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
113
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
114 return false;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
115 }
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
116
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
117 static std::string
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
118 default_pager ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
119 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
120 std::string pager_binary = sys::env::getenv ("PAGER");
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
121
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
122 if (pager_binary.empty ())
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
123 pager_binary = config::default_pager ();
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
124
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
125 return pager_binary;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
126 }
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
127
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
128 int
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
129 pager_buf::sync ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
130 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
131 output_system& output_sys = __get_output_system__ ();
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
132
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
133 char *buf = pbase ();
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
134
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
135 int len = pptr () - buf;
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
136
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
137 if (output_sys.sync (buf, len))
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
138 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
139 flush_current_contents_to_diary ();
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
140
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
141 seekoff (0, std::ios::beg);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
142 }
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
143
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
144 return 0;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
145 }
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
146
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
147 void
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
148 pager_buf::flush_current_contents_to_diary ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
149 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
150 char *buf = pbase () + m_diary_skip;
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
151
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
152 std::size_t len = pptr () - buf;
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
153
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
154 octave_diary.write (buf, len);
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
155
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
156 m_diary_skip = 0;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
157 }
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
158
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
159 void
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
160 pager_buf::set_diary_skip ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
161 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
162 m_diary_skip = pptr () - pbase ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
163 }
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
164
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
165 int
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
166 diary_buf::sync ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
167 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
168 output_system& output_sys = __get_output_system__ ();
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
169
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
170 std::ofstream& external_diary_file = output_sys.external_diary_file ();
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
171
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
172 if (output_sys.write_to_diary_file () && external_diary_file)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
173 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
174 char *buf = pbase ();
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
175
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
176 int len = pptr () - buf;
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
177
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
178 if (len > 0)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
179 external_diary_file.write (buf, len);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
180 }
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
181
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
182 seekoff (0, std::ios::beg);
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
183
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
184 return 0;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
185 }
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
186
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
187 pager_stream::pager_stream () : std::ostream (nullptr), m_pb (nullptr)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
188 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
189 m_pb = new pager_buf ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
190 rdbuf (m_pb);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
191 setf (unitbuf);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
192 }
3477
4b79cb009dd4 [project @ 2000-01-26 00:55:22 by jwe]
jwe
parents: 3373
diff changeset
193
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
194 pager_stream::~pager_stream ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
195 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
196 flush ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
197 delete m_pb;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
198 }
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
199
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
200 std::ostream&
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
201 pager_stream::stream ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
202 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
203 return *this;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
204 }
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
205
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
206 void
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
207 pager_stream::flush_current_contents_to_diary ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
208 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
209 if (m_pb)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
210 m_pb->flush_current_contents_to_diary ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
211 }
3756
41404c6f4e69 [project @ 2000-12-15 03:14:44 by jwe]
jwe
parents: 3584
diff changeset
212
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
213 void
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
214 pager_stream::set_diary_skip ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
215 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
216 if (m_pb)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
217 m_pb->set_diary_skip ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
218 }
13266
c053740eb2aa improve memory use for the pager and diary streams (bug #34431)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
219
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
220 // Reinitialize the pager buffer to avoid hanging on to large internal
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
221 // buffers when they might not be needed. This function should only be
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
222 // called when the pager is not in use. For example, just before
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
223 // getting command-line input.
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
224
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
225 void
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
226 pager_stream::reset ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
227 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
228 delete m_pb;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
229 m_pb = new pager_buf ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
230 rdbuf (m_pb);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
231 setf (unitbuf);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
232 }
13266
c053740eb2aa improve memory use for the pager and diary streams (bug #34431)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
233
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
234 diary_stream::diary_stream () : std::ostream (nullptr), m_db (nullptr)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
235 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
236 m_db = new diary_buf ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
237 rdbuf (m_db);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
238 setf (unitbuf);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
239 }
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
240
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
241 diary_stream::~diary_stream ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
242 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
243 flush ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
244 delete m_db;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
245 }
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
246
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
247 std::ostream&
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
248 diary_stream::stream ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
249 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
250 return *this;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
251 }
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
252
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
253 // Reinitialize the diary buffer to avoid hanging on to large internal
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
254 // buffers when they might not be needed. This function should only be
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
255 // called when the pager is not in use. For example, just before
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
256 // getting command-line input.
13266
c053740eb2aa improve memory use for the pager and diary streams (bug #34431)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
257
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
258 void
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
259 diary_stream::reset ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
260 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
261 delete m_db;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
262 m_db = new diary_buf ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
263 rdbuf (m_db);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
264 setf (unitbuf);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
265 }
13266
c053740eb2aa improve memory use for the pager and diary streams (bug #34431)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
266
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
267 void
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
268 flush_stdout ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
269 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
270 output_system& output_sys = __get_output_system__ ();
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13951
diff changeset
271
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
272 output_sys.flush_stdout ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
273 }
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13951
diff changeset
274
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
275 output_system::output_system (interpreter& interp)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
276 : m_interpreter (interp), m_pager_stream (), m_diary_stream (),
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
277 m_external_pager (nullptr), m_external_diary_file (),
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
278 m_diary_file_name ("diary"), m_PAGER (default_pager ()),
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
279 m_PAGER_FLAGS (), m_page_output_immediately (false),
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
280 m_page_screen_output (false), m_write_to_diary_file (false),
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
281 m_really_flush_to_pager (false), m_flushing_output_to_pager (false)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
282 { }
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13951
diff changeset
283
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
284 octave_value
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
285 output_system::PAGER (const octave_value_list& args,
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
286 int nargout)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
287 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
288 return set_internal_variable (m_PAGER, args, nargout, "PAGER", false);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
289 }
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13951
diff changeset
290
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
291 octave_value
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
292 output_system::PAGER_FLAGS (const octave_value_list& args,
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
293 int nargout)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
294 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
295 return set_internal_variable (m_PAGER_FLAGS, args, nargout,
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
296 "PAGER_FLAGS", false);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
297 }
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13951
diff changeset
298
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
299 octave_value
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
300 output_system::page_output_immediately (const octave_value_list& args,
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
301 int nargout)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
302 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
303 return set_internal_variable (m_page_output_immediately, args, nargout,
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
304 "page_output_immediately");
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
305 }
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
306
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
307 octave_value
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
308 output_system::page_screen_output (const octave_value_list& args,
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
309 int nargout)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
310 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
311 return set_internal_variable (m_page_screen_output, args, nargout,
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
312 "page_screen_output");
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
313 }
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
314
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
315 std::string
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
316 output_system::pager_command () const
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
317 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
318 std::string cmd = m_PAGER;
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
319
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
320 if (! (cmd.empty () || m_PAGER_FLAGS.empty ()))
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
321 cmd += ' ' + m_PAGER_FLAGS;
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
322
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
323 return cmd;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
324 }
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
325
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
326 void
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
327 output_system::reset ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
328 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
329 flush_stdout ();
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
330
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
331 m_pager_stream.reset ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
332 m_diary_stream.reset ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
333 }
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
334
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
335 void
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
336 output_system::flush_stdout ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
337 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
338 if (! m_flushing_output_to_pager)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
339 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
340 unwind_protect_var<bool> restore_var1 (m_really_flush_to_pager);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
341 unwind_protect_var<bool> restore_var2 (m_flushing_output_to_pager);
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
342
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
343 m_really_flush_to_pager = true;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
344 m_flushing_output_to_pager = true;
2100
49cdc5b183bc [project @ 1996-04-28 11:26:32 by jwe]
jwe
parents: 2099
diff changeset
345
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
346 std::ostream& pager_ostream = m_pager_stream.stream ();
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
347
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
348 pager_ostream.flush ();
2206
9be05ffc288a [project @ 1996-05-15 07:32:58 by jwe]
jwe
parents: 2201
diff changeset
349
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
350 clear_external_pager ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
351 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
352 }
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
353
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
354 void
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
355 output_system::close_diary ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
356 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
357 // Try to flush the current buffer to the diary now, so that things
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
358 // like
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
359 //
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
360 // function foo ()
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
361 // diary on;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
362 // ...
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
363 // diary off;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
364 // endfunction
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
365 //
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
366 // will do the right thing.
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
367
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
368 m_pager_stream.flush_current_contents_to_diary ();
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
369
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
370 if (m_external_diary_file.is_open ())
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
371 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
372 octave_diary.flush ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
373 m_external_diary_file.close ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
374 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
375 }
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
376
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
377 void
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
378 output_system::open_diary ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
379 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
380 close_diary ();
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
381
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
382 // If there is pending output in the pager buf, it should not go
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
383 // into the diary file.
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
384
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
385 m_pager_stream.set_diary_skip ();
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
386
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
387 m_external_diary_file.open (m_diary_file_name.c_str (), std::ios::app);
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
388
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
389 if (! m_external_diary_file)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
390 error ("diary: can't open diary file '%s'", m_diary_file_name.c_str ());
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
391 }
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
392
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
393 bool
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
394 output_system::sync (const char *buf, int len)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
395 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
396 // FIXME: The following seems to be a bit of a mess.
29254
11343ca3c125 allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
397
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
398 if (m_interpreter.server_mode ()
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
399 || ! m_interpreter.interactive ()
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
400 || application::forced_interactive ()
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
401 || m_really_flush_to_pager
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
402 || (m_page_screen_output && m_page_output_immediately)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
403 || ! m_page_screen_output)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
404 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
405 bool bypass_pager = (m_interpreter.server_mode ()
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
406 || ! m_interpreter.interactive ()
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
407 || application::forced_interactive ()
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
408 || ! m_page_screen_output
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
409 || (m_really_flush_to_pager
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
410 && m_page_screen_output
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
411 && ! m_page_output_immediately
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
412 && ! more_than_a_screenful (buf, len)));
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
413
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
414 if (len > 0)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
415 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
416 do_sync (buf, len, bypass_pager);
3477
4b79cb009dd4 [project @ 2000-01-26 00:55:22 by jwe]
jwe
parents: 3373
diff changeset
417
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
418 return true;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
419 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
420 }
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
421
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
422 return false;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
423 }
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
424
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
425 void
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
426 output_system::clear_external_pager ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
427 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
428 if (m_external_pager)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
429 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
430 child_list& kids = m_interpreter.get_child_list ();
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
431
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
432 kids.remove (m_external_pager->pid ());
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
433
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
434 delete m_external_pager;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
435 m_external_pager = nullptr;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
436 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
437 }
3477
4b79cb009dd4 [project @ 2000-01-26 00:55:22 by jwe]
jwe
parents: 3373
diff changeset
438
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
439 void
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
440 output_system::start_external_pager ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
441 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
442 if (m_external_pager)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
443 return;
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
444
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
445 std::string pgr = pager_command ();
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
446
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
447 if (! pgr.empty ())
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
448 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
449 m_external_pager = new oprocstream (pgr.c_str ());
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
450
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
451 child_list& kids = m_interpreter.get_child_list ();
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
452
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
453 kids.insert (m_external_pager->pid (),
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
454 pager_event_handler);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
455 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
456 }
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
457
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
458 void
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
459 output_system::do_sync (const char *msg, int len, bool bypass_pager)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
460 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
461 if (msg && len > 0)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
462 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
463 if (bypass_pager)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
464 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
465 if (m_interpreter.server_mode ())
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
466 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
467 event_manager& evmgr = m_interpreter.get_event_manager ();
29254
11343ca3c125 allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
468
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
469 evmgr.interpreter_output (std::string (msg, len));
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
470 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
471 else
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
472 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
473 std::cout.write (msg, len);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
474 std::cout.flush ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
475 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
476 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
477 else
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
478 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
479 start_external_pager ();
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
480
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
481 if (m_external_pager)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
482 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
483 if (m_external_pager->good ())
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
484 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
485 m_external_pager->write (msg, len);
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
486
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
487 m_external_pager->flush ();
581
bc813f5eb025 [project @ 1994-08-07 01:02:15 by jwe]
jwe
parents: 529
diff changeset
488
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
489 #if defined (EPIPE)
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
490 if (errno == EPIPE)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
491 m_external_pager->setstate (std::ios::failbit);
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
492 #endif
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
493 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
494 else
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
495 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
496 // FIXME: something is not right with the
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
497 // pager. If it died then we should receive a
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
498 // signal for that. If there is some other problem,
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
499 // then what?
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
500 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
501 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
502 else
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
503 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
504 std::cout.write (msg, len);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
505 std::cout.flush ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
506 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
507 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
508 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
509 }
3756
41404c6f4e69 [project @ 2000-12-15 03:14:44 by jwe]
jwe
parents: 3584
diff changeset
510
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
511 std::ostream&
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
512 __stdout__ ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
513 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
514 output_system& output_sys = __get_output_system__ ();
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
515
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
516 return output_sys.__stdout__ ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
517 }
581
bc813f5eb025 [project @ 1994-08-07 01:02:15 by jwe]
jwe
parents: 529
diff changeset
518
32589
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
519 std::ostream&
05b4479c29d8 maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents: 31771
diff changeset
520 __diary__ ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
521 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
522 output_system& output_sys = __get_output_system__ ();
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
523
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
524 return output_sys.__diary__ ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
525 }
29958
32c3a5805893 move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29655
diff changeset
526
27444
160930a3e5ee eliminate some calls to global __get_SUBSYSTEM__ functions
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
527 DEFMETHOD (diary, interp, args, nargout,
160930a3e5ee eliminate some calls to global __get_SUBSYSTEM__ functions
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
528 doc: /* -*- texinfo -*-
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
529 @deftypefn {} {} diary
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
530 @deftypefnx {} {} diary on
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
531 @deftypefnx {} {} diary off
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
532 @deftypefnx {} {} diary @var{filename}
22820
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
533 @deftypefnx {} {[@var{status}, @var{diaryfile}] =} diary
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
534 Record a list of all commands @emph{and} the output they produce, mixed
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
535 together just as they appear on the terminal.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
536
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
537 Valid options are:
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
538
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
539 @table @asis
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
540 @item on
22820
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
541 Start recording a session in a file called @file{diary} in the current working
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
542 directory.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
543
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
544 @item off
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
545 Stop recording the session in the diary file.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
546
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
547 @item @var{filename}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
548 Record the session in the file named @var{filename}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
549 @end table
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
550
22820
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
551 With no input or output arguments, @code{diary} toggles the current diary
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
552 state.
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
553
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
554 If output arguments are requested, @code{diary} ignores inputs and returns
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
555 the current status. The boolean @var{status} indicates whether recording is on
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
556 or off, and @var{diaryfile} is the name of the file where the session is
22910
23847979b91e maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 22820
diff changeset
557 stored.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
558 @seealso{history, evalc}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
559 @end deftypefn */)
581
bc813f5eb025 [project @ 1994-08-07 01:02:15 by jwe]
jwe
parents: 529
diff changeset
560 {
20817
3d551b2ae928 Use variable name nargin consistently in C++ code.
Rik <rik@octave.org>
parents: 20801
diff changeset
561 int nargin = args.length ();
1755
3a9462b655f1 [project @ 1996-01-22 04:47:22 by jwe]
jwe
parents: 1742
diff changeset
562
20817
3d551b2ae928 Use variable name nargin consistently in C++ code.
Rik <rik@octave.org>
parents: 20801
diff changeset
563 if (nargin > 1)
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
564 print_usage ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
565
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29960
diff changeset
566 output_system& output_sys = interp.get_output_system ();
1306
f92615001614 [project @ 1995-05-15 19:54:29 by jwe]
jwe
parents: 1192
diff changeset
567
22820
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
568 if (nargout > 0)
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
569 {
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
570 // Querying diary variables
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
571 if (nargout == 1)
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
572 return ovl (output_sys.write_to_diary_file ());
22820
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
573 else
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
574 return ovl (output_sys.write_to_diary_file (),
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
575 output_sys.diary_file_name ());
22820
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
576 }
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
577
20817
3d551b2ae928 Use variable name nargin consistently in C++ code.
Rik <rik@octave.org>
parents: 20801
diff changeset
578 if (nargin == 0)
581
bc813f5eb025 [project @ 1994-08-07 01:02:15 by jwe]
jwe
parents: 529
diff changeset
579 {
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
580 output_sys.write_to_diary_file (! output_sys.write_to_diary_file ());
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
581 output_sys.open_diary ();
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
582 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
583 else
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
584 {
20817
3d551b2ae928 Use variable name nargin consistently in C++ code.
Rik <rik@octave.org>
parents: 20801
diff changeset
585 std::string arg = args(0).xstring_value ("diary: argument must be a string");
1755
3a9462b655f1 [project @ 1996-01-22 04:47:22 by jwe]
jwe
parents: 1742
diff changeset
586
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
587 if (arg == "on")
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
588 {
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
589 output_sys.write_to_diary_file (true);
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
590 output_sys.open_diary ();
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
591 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
592 else if (arg == "off")
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
593 {
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
594 output_sys.close_diary ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
595 output_sys.write_to_diary_file (false);
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
596 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
597 else
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
598 {
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
599 output_sys.diary_file_name (arg);
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
600 output_sys.write_to_diary_file (true);
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
601 output_sys.open_diary ();
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
602 }
581
bc813f5eb025 [project @ 1994-08-07 01:02:15 by jwe]
jwe
parents: 529
diff changeset
603 }
20820
eed8ec05f1c8 always return value from DEFUN functions
John W. Eaton <jwe@octave.org>
parents: 20817
diff changeset
604
20941
a4f5da7c5463 maint: Replace "octave_value_list ()" with "ovl ()".
Rik <rik@octave.org>
parents: 20940
diff changeset
605 return ovl ();
581
bc813f5eb025 [project @ 1994-08-07 01:02:15 by jwe]
jwe
parents: 529
diff changeset
606 }
bc813f5eb025 [project @ 1994-08-07 01:02:15 by jwe]
jwe
parents: 529
diff changeset
607
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
608 DEFMETHOD (more, interp, args, ,
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
609 doc: /* -*- texinfo -*-
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
610 @deftypefn {} {} more
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
611 @deftypefnx {} {} more on
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
612 @deftypefnx {} {} more off
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
613 Turn output pagination on or off.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
614
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
615 Without an argument, @code{more} toggles the current state.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
616
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
617 The current state can be determined via @code{page_screen_output}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
618 @seealso{page_screen_output, page_output_immediately, PAGER, PAGER_FLAGS}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
619 @end deftypefn */)
1409
e282214c41a5 [project @ 1995-09-15 06:41:08 by jwe]
jwe
parents: 1358
diff changeset
620 {
20897
9aad16a799c9 maint: Replace argc variable name with nargin in C++ code.
Rik <rik@octave.org>
parents: 20853
diff changeset
621 int nargin = args.length ();
1409
e282214c41a5 [project @ 1995-09-15 06:41:08 by jwe]
jwe
parents: 1358
diff changeset
622
20897
9aad16a799c9 maint: Replace argc variable name with nargin in C++ code.
Rik <rik@octave.org>
parents: 20853
diff changeset
623 if (nargin > 1)
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
624 print_usage ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
625
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29960
diff changeset
626 output_system& output_sys = interp.get_output_system ();
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
627
20897
9aad16a799c9 maint: Replace argc variable name with nargin in C++ code.
Rik <rik@octave.org>
parents: 20853
diff changeset
628 if (nargin > 0)
1409
e282214c41a5 [project @ 1995-09-15 06:41:08 by jwe]
jwe
parents: 1358
diff changeset
629 {
23803
90689bdbe048 Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents: 23795
diff changeset
630 std::string arg = args(0).xstring_value (R"(more: argument must be string "on" or "off")");
1409
e282214c41a5 [project @ 1995-09-15 06:41:08 by jwe]
jwe
parents: 1358
diff changeset
631
1755
3a9462b655f1 [project @ 1996-01-22 04:47:22 by jwe]
jwe
parents: 1742
diff changeset
632 if (arg == "on")
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
633 output_sys.page_screen_output (true);
1755
3a9462b655f1 [project @ 1996-01-22 04:47:22 by jwe]
jwe
parents: 1742
diff changeset
634 else if (arg == "off")
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
635 output_sys.page_screen_output (false);
1409
e282214c41a5 [project @ 1995-09-15 06:41:08 by jwe]
jwe
parents: 1358
diff changeset
636 else
23803
90689bdbe048 Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents: 23795
diff changeset
637 error (R"(more: argument must be "on" or "off")");
1409
e282214c41a5 [project @ 1995-09-15 06:41:08 by jwe]
jwe
parents: 1358
diff changeset
638 }
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
639 else
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
640 output_sys.page_screen_output (! output_sys.page_screen_output ());
1409
e282214c41a5 [project @ 1995-09-15 06:41:08 by jwe]
jwe
parents: 1358
diff changeset
641
20941
a4f5da7c5463 maint: Replace "octave_value_list ()" with "ovl ()".
Rik <rik@octave.org>
parents: 20940
diff changeset
642 return ovl ();
1409
e282214c41a5 [project @ 1995-09-15 06:41:08 by jwe]
jwe
parents: 1358
diff changeset
643 }
e282214c41a5 [project @ 1995-09-15 06:41:08 by jwe]
jwe
parents: 1358
diff changeset
644
27159
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
645 DEFUN (terminal_size, args, ,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
646 doc: /* -*- texinfo -*-
30888
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30588
diff changeset
647 @deftypefn {} {[@var{rows}, @var{cols}] =} terminal_size ()
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30588
diff changeset
648 @deftypefnx {} {} terminal_size ([@var{rows}, @var{cols}])
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30588
diff changeset
649 Query or set the size of the terminal window. If called with no arguments,
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30588
diff changeset
650 return a two-element row vector containing the current size of the terminal
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30588
diff changeset
651 window in characters (rows and columns). If called with a two-element vector
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30588
diff changeset
652 of integer values, set the terminal size and return the previous setting.
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30588
diff changeset
653 Setting the size manually should not be needed when using readline for
32d2b6604a9f doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents: 30588
diff changeset
654 command-line editing.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
655 @seealso{list_in_columns}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
656 @end deftypefn */)
5673
0dc67016832b [project @ 2006-03-16 03:08:58 by jwe]
jwe
parents: 5307
diff changeset
657 {
27159
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
658 int nargin = args.length ();
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
659
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
660 if (nargin > 1)
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
661 print_usage ();
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
662
5673
0dc67016832b [project @ 2006-03-16 03:08:58 by jwe]
jwe
parents: 5307
diff changeset
663 RowVector size (2, 0.0);
0dc67016832b [project @ 2006-03-16 03:08:58 by jwe]
jwe
parents: 5307
diff changeset
664
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29960
diff changeset
665 size(0) = command_editor::terminal_rows ();
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29960
diff changeset
666 size(1) = command_editor::terminal_cols ();
5673
0dc67016832b [project @ 2006-03-16 03:08:58 by jwe]
jwe
parents: 5307
diff changeset
667
27159
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
668 if (nargin == 1)
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
669 {
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
670 Matrix m = args(0).xmatrix_value ("argument must be a 2-element array");
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
671
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
672 if (m.numel () != 2)
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
673 error ("terminal_size: argument must be a 2-element array");
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
674
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29960
diff changeset
675 int rows = math::x_nint (m(0));
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29960
diff changeset
676 int cols = math::x_nint (m(1));
27159
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
677
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
678 if (rows <= 0 || cols <= 0)
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
679 error ("terminal_size: rows and columns must be positive integers");
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
680
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29960
diff changeset
681 command_editor::set_screen_size (rows, cols);
27159
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
682 }
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
683
21127
df7891224709 maint: Use "return ovl (...)" in DEFUN macros.
Rik <rik@octave.org>
parents: 21100
diff changeset
684 return ovl (size);
5673
0dc67016832b [project @ 2006-03-16 03:08:58 by jwe]
jwe
parents: 5307
diff changeset
685 }
0dc67016832b [project @ 2006-03-16 03:08:58 by jwe]
jwe
parents: 5307
diff changeset
686
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
687 DEFMETHOD (page_output_immediately, interp, args, nargout,
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
688 doc: /* -*- texinfo -*-
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
689 @deftypefn {} {@var{val} =} page_output_immediately ()
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
690 @deftypefnx {} {@var{old_val} =} page_output_immediately (@var{new_val})
30588
ed17822e7662 doc: Always have a return value for functions which set internal variables (bug #61681)
Rik <rik@octave.org>
parents: 30564
diff changeset
691 @deftypefnx {} {@var{old_val} =} page_output_immediately (@var{new_val}, "local")
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
692 Query or set the internal variable that controls whether Octave sends
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
693 output to the pager as soon as it is available.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
694
27579
f6417502613a doc: expand page_output_immediately doc string, mention page_screen_output
Mike Miller <mtmiller@octave.org>
parents: 26376
diff changeset
695 When the value is @code{false}, Octave buffers its output and waits until just
f6417502613a doc: expand page_output_immediately doc string, mention page_screen_output
Mike Miller <mtmiller@octave.org>
parents: 26376
diff changeset
696 before the prompt is printed to flush it to the pager. This is the default.
f6417502613a doc: expand page_output_immediately doc string, mention page_screen_output
Mike Miller <mtmiller@octave.org>
parents: 26376
diff changeset
697
f6417502613a doc: expand page_output_immediately doc string, mention page_screen_output
Mike Miller <mtmiller@octave.org>
parents: 26376
diff changeset
698 When @code{page_screen_output} is @code{false}, this variable has no effect.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
699
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
700 When called from inside a function with the @qcode{"local"} option, the
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
701 variable is changed locally for the function and any subroutines it calls.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
702 The original variable value is restored when exiting the function.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
703 @seealso{page_screen_output, more, PAGER, PAGER_FLAGS}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
704 @end deftypefn */)
2097
19ba1a7dcfbb [project @ 1996-04-28 10:40:15 by jwe]
jwe
parents: 2093
diff changeset
705 {
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29960
diff changeset
706 output_system& output_sys = interp.get_output_system ();
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
707
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
708 return output_sys.page_output_immediately (args, nargout);
2164
269db7306980 [project @ 1996-05-13 13:05:24 by jwe]
jwe
parents: 2146
diff changeset
709 }
269db7306980 [project @ 1996-05-13 13:05:24 by jwe]
jwe
parents: 2146
diff changeset
710
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
711 DEFMETHOD (page_screen_output, interp, args, nargout,
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
712 doc: /* -*- texinfo -*-
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
713 @deftypefn {} {@var{val} =} page_screen_output ()
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
714 @deftypefnx {} {@var{old_val} =} page_screen_output (@var{new_val})
30588
ed17822e7662 doc: Always have a return value for functions which set internal variables (bug #61681)
Rik <rik@octave.org>
parents: 30564
diff changeset
715 @deftypefnx {} {@var{old_val} =} page_screen_output (@var{new_val}, "local")
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
716 Query or set the internal variable that controls whether output intended
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
717 for the terminal window that is longer than one page is sent through a
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
718 pager.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
719
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
720 This allows you to view one screenful at a time. Some pagers
30377
26f2daafa270 doc: Use consistent styling for @ref, @xref, @pxref statements.
Rik <rik@octave.org>
parents: 30162
diff changeset
721 (such as @code{less}---@pxref{Installation}) are also capable of moving
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
722 backward on the output.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
723
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
724 When called from inside a function with the @qcode{"local"} option, the
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
725 variable is changed locally for the function and any subroutines it calls.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
726 The original variable value is restored when exiting the function.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
727 @seealso{more, page_output_immediately, PAGER, PAGER_FLAGS}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
728 @end deftypefn */)
2164
269db7306980 [project @ 1996-05-13 13:05:24 by jwe]
jwe
parents: 2146
diff changeset
729 {
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29960
diff changeset
730 output_system& output_sys = interp.get_output_system ();
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
731
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
732 return output_sys.page_screen_output (args, nargout);
2164
269db7306980 [project @ 1996-05-13 13:05:24 by jwe]
jwe
parents: 2146
diff changeset
733 }
269db7306980 [project @ 1996-05-13 13:05:24 by jwe]
jwe
parents: 2146
diff changeset
734
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
735 DEFMETHOD (PAGER, interp, args, nargout,
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
736 doc: /* -*- texinfo -*-
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
737 @deftypefn {} {@var{val} =} PAGER ()
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
738 @deftypefnx {} {@var{old_val} =} PAGER (@var{new_val})
30588
ed17822e7662 doc: Always have a return value for functions which set internal variables (bug #61681)
Rik <rik@octave.org>
parents: 30564
diff changeset
739 @deftypefnx {} {@var{old_val} =} PAGER (@var{new_val}, "local")
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
740 Query or set the internal variable that specifies the program to use
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
741 to display terminal output on your system.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
742
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
743 The default value is normally @qcode{"less"}, @qcode{"more"}, or
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
744 @qcode{"pg"}, depending on what programs are installed on your system.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
745 @xref{Installation}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
746
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
747 When called from inside a function with the @qcode{"local"} option, the
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
748 variable is changed locally for the function and any subroutines it calls.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
749 The original variable value is restored when exiting the function.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
750 @seealso{PAGER_FLAGS, page_output_immediately, more, page_screen_output}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
751 @end deftypefn */)
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5778
diff changeset
752 {
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29960
diff changeset
753 output_system& output_sys = interp.get_output_system ();
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
754
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
755 return output_sys.PAGER (args, nargout);
2097
19ba1a7dcfbb [project @ 1996-04-28 10:40:15 by jwe]
jwe
parents: 2093
diff changeset
756 }
19ba1a7dcfbb [project @ 1996-04-28 10:40:15 by jwe]
jwe
parents: 2093
diff changeset
757
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
758 DEFMETHOD (PAGER_FLAGS, interp, args, nargout,
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
759 doc: /* -*- texinfo -*-
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
760 @deftypefn {} {@var{val} =} PAGER_FLAGS ()
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
761 @deftypefnx {} {@var{old_val} =} PAGER_FLAGS (@var{new_val})
30588
ed17822e7662 doc: Always have a return value for functions which set internal variables (bug #61681)
Rik <rik@octave.org>
parents: 30564
diff changeset
762 @deftypefnx {} {@var{old_val} =} PAGER_FLAGS (@var{new_val}, "local")
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
763 Query or set the internal variable that specifies the options to pass
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
764 to the pager.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
765
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
766 When called from inside a function with the @qcode{"local"} option, the
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
767 variable is changed locally for the function and any subroutines it calls.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
768 The original variable value is restored when exiting the function.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
769 @seealso{PAGER, more, page_screen_output, page_output_immediately}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
770 @end deftypefn */)
6144
e8868fde0fc5 [project @ 2006-11-07 20:52:18 by jwe]
jwe
parents: 5823
diff changeset
771 {
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29960
diff changeset
772 output_system& output_sys = interp.get_output_system ();
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
773
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
774 return output_sys.PAGER_FLAGS (args, nargout);
6144
e8868fde0fc5 [project @ 2006-11-07 20:52:18 by jwe]
jwe
parents: 5823
diff changeset
775 }
29958
32c3a5805893 move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29655
diff changeset
776
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 31105
diff changeset
777 OCTAVE_END_NAMESPACE(octave)