annotate libinterp/corefcn/pager.cc @ 29655:32f4357ac8d9

maint: merge stable to default.
author Markus Mützel <markus.muetzel@gmx.de>
date Wed, 12 May 2021 19:28:54 +0200
parents aef11bb4e6d1 d13d090cb03a
children 32c3a5805893
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 //
29358
0a5b15007766 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27926
diff changeset
3 // Copyright (C) 1993-2021 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
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
55 namespace octave
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
56 {
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
57 static bool
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
58 pager_event_handler (pid_t pid, int status)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
59 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
60 bool retval = false;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
61
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
62 if (pid > 0)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
63 {
27102
84ff9953faa1 where possible, eliminate octave:: namespace qualifier inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26377
diff changeset
64 if (sys::wifexited (status) || sys::wifsignaled (status))
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
65 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
66 // Avoid warning() since that will put us back in the pager,
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
67 // which would be bad news.
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
68
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
69 std::cerr << "warning: connection to external pager lost (pid = "
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
70 << pid << ')' << std::endl;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
71 std::cerr << "warning: flushing pending output (please wait)"
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
72 << std::endl;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
73
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
74 // Request removal of this PID from the list of child
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
75 // processes.
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
76
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
77 retval = true;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
78 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
79 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
80
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
81 return retval;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
82 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
83
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
84 // Assume our terminal wraps long lines.
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
85
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
86 static bool
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
87 more_than_a_screenful (const char *s, int len)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
88 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
89 if (s)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
90 {
27102
84ff9953faa1 where possible, eliminate octave:: namespace qualifier inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26377
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
27102
84ff9953faa1 where possible, eliminate octave:: namespace qualifier inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26377
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
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
95 int count = 0;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
96
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
97 int chars_this_line = 0;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
98
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
99 for (int i = 0; i < len; i++)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
100 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
101 if (*s++ == '\n')
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
102 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
103 count += chars_this_line / cols + 1;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
104 chars_this_line = 0;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
105 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
106 else
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
107 chars_this_line++;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
108 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
109
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
110 if (count > available_rows)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
111 return true;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
112 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
113
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
114 return false;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
115 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
116
25460
627d6bde9b8d solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents: 25440
diff changeset
117 static std::string default_pager (void)
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
118 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
119 std::string pager_binary = sys::env::getenv ("PAGER");
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
120
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
121 if (pager_binary.empty ())
25460
627d6bde9b8d solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents: 25440
diff changeset
122 pager_binary = config::default_pager ();
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
123
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
124 return pager_binary;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
125 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
126
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
127 int
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
128 pager_buf::sync (void)
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
129 {
27102
84ff9953faa1 where possible, eliminate octave:: namespace qualifier inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26377
diff changeset
130 output_system& output_sys = __get_output_system__ ("pager_buf::sync");
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
131
27926
3b4526d90476 use pbase to access start of put buffer in classes derived from stingbuf
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
132 char *buf = pbase ();
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
133
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
134 int len = pptr () - buf;
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
135
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
136 if (output_sys.sync (buf, len))
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
137 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
138 flush_current_contents_to_diary ();
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
139
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
140 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
141 }
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
142
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
143 return 0;
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
144 }
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
145
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
146 void
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
147 pager_buf::flush_current_contents_to_diary (void)
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
148 {
27926
3b4526d90476 use pbase to access start of put buffer in classes derived from stingbuf
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
149 char *buf = pbase () + diary_skip;
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
150
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
151 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
152
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
153 octave_diary.write (buf, len);
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
154
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
155 diary_skip = 0;
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
156 }
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
157
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
158 void
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
159 pager_buf::set_diary_skip (void)
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
160 {
27926
3b4526d90476 use pbase to access start of put buffer in classes derived from stingbuf
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
161 diary_skip = pptr () - pbase ();
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
162 }
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
163
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
164 int
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
165 diary_buf::sync (void)
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
166 {
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
167 output_system& output_sys = __get_output_system__ ("__stdout__");
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
168
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
169 std::ofstream& external_diary_file = output_sys.external_diary_file ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
170
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
171 if (output_sys.write_to_diary_file () && external_diary_file)
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
172 {
27926
3b4526d90476 use pbase to access start of put buffer in classes derived from stingbuf
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
173 char *buf = pbase ();
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
174
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
175 int len = pptr () - buf;
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
176
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
177 if (len > 0)
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
178 external_diary_file.write (buf, len);
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
179 }
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
180
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
181 seekoff (0, std::ios::beg);
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
182
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
183 return 0;
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
184 }
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
185
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23457
diff changeset
186 pager_stream::pager_stream (void) : std::ostream (nullptr), pb (nullptr)
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
187 {
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
188 pb = new pager_buf ();
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
189 rdbuf (pb);
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
190 setf (unitbuf);
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
191 }
3477
4b79cb009dd4 [project @ 2000-01-26 00:55:22 by jwe]
jwe
parents: 3373
diff changeset
192
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
193 pager_stream::~pager_stream (void)
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
194 {
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
195 flush ();
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
196 delete pb;
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
197 }
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
198
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
199 std::ostream& pager_stream::stream (void)
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
200 {
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
201 return *this;
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
202 }
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
203
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
204 void pager_stream::flush_current_contents_to_diary (void)
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
205 {
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
206 if (pb)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
207 pb->flush_current_contents_to_diary ();
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
208 }
3756
41404c6f4e69 [project @ 2000-12-15 03:14:44 by jwe]
jwe
parents: 3584
diff changeset
209
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
210 void pager_stream::set_diary_skip (void)
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
211 {
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
212 if (pb)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
213 pb->set_diary_skip ();
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
214 }
13266
c053740eb2aa improve memory use for the pager and diary streams (bug #34431)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
215
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
216 // Reinitialize the pager buffer to avoid hanging on to large internal
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
217 // buffers when they might not be needed. This function should only be
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
218 // called when the pager is not in use. For example, just before
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
219 // getting command-line input.
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
220
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
221 void pager_stream::reset (void)
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
222 {
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
223 delete pb;
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
224 pb = new pager_buf ();
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
225 rdbuf (pb);
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
226 setf (unitbuf);
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
227 }
13266
c053740eb2aa improve memory use for the pager and diary streams (bug #34431)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
228
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23457
diff changeset
229 diary_stream::diary_stream (void) : std::ostream (nullptr), db (nullptr)
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
230 {
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
231 db = new diary_buf ();
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
232 rdbuf (db);
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
233 setf (unitbuf);
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
234 }
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
235
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
236 diary_stream::~diary_stream (void)
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
237 {
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
238 flush ();
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
239 delete db;
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
240 }
2093
0b7c868bc4df [project @ 1996-04-28 08:58:41 by jwe]
jwe
parents: 2086
diff changeset
241
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
242 std::ostream& diary_stream::stream (void)
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
243 {
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
244 return *this;
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
245 }
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
246
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
247 // Reinitialize the diary buffer to avoid hanging on to large internal
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
248 // buffers when they might not be needed. This function should only be
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
249 // called when the pager is not in use. For example, just before
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
250 // 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
251
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
252 void diary_stream::reset (void)
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
253 {
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
254 delete db;
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
255 db = new diary_buf ();
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
256 rdbuf (db);
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
257 setf (unitbuf);
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
258 }
13266
c053740eb2aa improve memory use for the pager and diary streams (bug #34431)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
259
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
260 void flush_stdout (void)
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
261 {
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
262 output_system& output_sys = __get_output_system__ ("flush_stdout");
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13951
diff changeset
263
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
264 output_sys.flush_stdout ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
265 }
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13951
diff changeset
266
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
267 output_system::output_system (interpreter& interp)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
268 : m_interpreter (interp), m_pager_stream (), m_diary_stream (),
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
269 m_external_pager (nullptr), m_external_diary_file (),
25460
627d6bde9b8d solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents: 25440
diff changeset
270 m_diary_file_name ("diary"), m_PAGER (default_pager ()),
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
271 m_PAGER_FLAGS (), m_page_output_immediately (false),
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
272 m_page_screen_output (false), m_write_to_diary_file (false),
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
273 m_really_flush_to_pager (false), m_flushing_output_to_pager (false)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
274 { }
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13951
diff changeset
275
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
276 octave_value output_system::PAGER (const octave_value_list& args,
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
277 int nargout)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
278 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
279 return set_internal_variable (m_PAGER, args, nargout, "PAGER", false);
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
280 }
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13951
diff changeset
281
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
282 octave_value output_system::PAGER_FLAGS (const octave_value_list& args,
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
283 int nargout)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
284 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
285 return set_internal_variable (m_PAGER_FLAGS, args, nargout,
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
286 "PAGER_FLAGS", false);
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
287 }
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13951
diff changeset
288
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
289 octave_value
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
290 output_system::page_output_immediately (const octave_value_list& args,
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
291 int nargout)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
292 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
293 return set_internal_variable (m_page_output_immediately, args, nargout,
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
294 "page_output_immediately");
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
295 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
296
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
297 octave_value
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
298 output_system::page_screen_output (const octave_value_list& args,
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
299 int nargout)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
300 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
301 return set_internal_variable (m_page_screen_output, args, nargout,
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
302 "page_screen_output");
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
303 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
304
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
305 std::string output_system::pager_command (void) const
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
306 {
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
307 std::string cmd = m_PAGER;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
308
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
309 if (! (cmd.empty () || m_PAGER_FLAGS.empty ()))
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
310 cmd += ' ' + m_PAGER_FLAGS;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
311
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
312 return cmd;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
313 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
314
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
315 void output_system::reset (void)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
316 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
317 flush_stdout ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
318
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
319 m_pager_stream.reset ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
320 m_diary_stream.reset ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
321 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
322
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
323 void output_system::flush_stdout (void)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
324 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
325 if (! 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
326 {
28857
43ad651cf5a0 eliminate unnecessary uses of octave:: namespace qualifier
John W. Eaton <jwe@octave.org>
parents: 28823
diff changeset
327 unwind_protect_var<bool> restore_var1 (m_really_flush_to_pager);
43ad651cf5a0 eliminate unnecessary uses of octave:: namespace qualifier
John W. Eaton <jwe@octave.org>
parents: 28823
diff changeset
328 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
329
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
330 m_really_flush_to_pager = true;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
331 m_flushing_output_to_pager = true;
2100
49cdc5b183bc [project @ 1996-04-28 11:26:32 by jwe]
jwe
parents: 2099
diff changeset
332
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
333 std::ostream& pager_ostream = m_pager_stream.stream ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
334
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
335 pager_ostream.flush ();
2206
9be05ffc288a [project @ 1996-05-15 07:32:58 by jwe]
jwe
parents: 2201
diff changeset
336
23060
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
337 clear_external_pager ();
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
338 }
baf03cdb28b5 move pager and diary classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22910
diff changeset
339 }
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
340
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
341 void output_system::close_diary (void)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
342 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
343 // Try to flush the current buffer to the diary now, so that things
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
344 // like
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
345 //
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
346 // function foo ()
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
347 // diary on;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
348 // ...
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
349 // diary off;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
350 // endfunction
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
351 //
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
352 // will do the right thing.
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
353
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
354 m_pager_stream.flush_current_contents_to_diary ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
355
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
356 if (m_external_diary_file.is_open ())
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
357 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
358 octave_diary.flush ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
359 m_external_diary_file.close ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
360 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
361 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
362
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
363 void output_system::open_diary (void)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
364 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
365 close_diary ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
366
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
367 // If there is pending output in the pager buf, it should not go
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
368 // into the diary file.
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
369
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
370 m_pager_stream.set_diary_skip ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
371
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
372 m_external_diary_file.open (m_diary_file_name.c_str (), std::ios::app);
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
373
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
374 if (! m_external_diary_file)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
375 error ("diary: can't open diary file '%s'", m_diary_file_name.c_str ());
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
376 }
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
377
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
378 bool output_system::sync (const char *buf, int len)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
379 {
29254
11343ca3c125 allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
380 // FIXME: The following seems to be a bit of a mess.
11343ca3c125 allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
381
11343ca3c125 allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
382 if (m_interpreter.server_mode ()
11343ca3c125 allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
383 || ! m_interpreter.interactive ()
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
384 || application::forced_interactive ()
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
385 || m_really_flush_to_pager
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
386 || (m_page_screen_output && m_page_output_immediately)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
387 || ! m_page_screen_output)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
388 {
29254
11343ca3c125 allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
389 bool bypass_pager = (m_interpreter.server_mode ()
11343ca3c125 allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
390 || ! m_interpreter.interactive ()
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
391 || application::forced_interactive ()
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
392 || ! m_page_screen_output
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
393 || (m_really_flush_to_pager
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
394 && m_page_screen_output
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
395 && ! m_page_output_immediately
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
396 && ! more_than_a_screenful (buf, len)));
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
397
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
398 if (len > 0)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
399 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
400 do_sync (buf, len, bypass_pager);
3477
4b79cb009dd4 [project @ 2000-01-26 00:55:22 by jwe]
jwe
parents: 3373
diff changeset
401
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
402 return true;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
403 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
404 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
405
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
406 return false;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
407 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
408
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
409 void output_system::clear_external_pager (void)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
410 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
411 if (m_external_pager)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
412 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
413 child_list& kids = m_interpreter.get_child_list ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
414
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
415 kids.remove (m_external_pager->pid ());
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
416
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
417 delete m_external_pager;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
418 m_external_pager = nullptr;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
419 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
420 }
3477
4b79cb009dd4 [project @ 2000-01-26 00:55:22 by jwe]
jwe
parents: 3373
diff changeset
421
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
422 void output_system::start_external_pager (void)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
423 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
424 if (m_external_pager)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
425 return;
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
426
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
427 std::string pgr = pager_command ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
428
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
429 if (! pgr.empty ())
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
430 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
431 m_external_pager = new oprocstream (pgr.c_str ());
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
432
27102
84ff9953faa1 where possible, eliminate octave:: namespace qualifier inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26377
diff changeset
433 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
434
26369
0249ba4c9589 Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents: 25460
diff changeset
435 kids.insert (m_external_pager->pid (),
0249ba4c9589 Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents: 25460
diff changeset
436 pager_event_handler);
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
437 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
438 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
439
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
440 void output_system::do_sync (const char *msg, int len, bool bypass_pager)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
441 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
442 if (msg && len > 0)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
443 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
444 if (bypass_pager)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
445 {
29254
11343ca3c125 allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
446 if (m_interpreter.server_mode ())
11343ca3c125 allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
447 {
11343ca3c125 allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
448 event_manager& evmgr = m_interpreter.get_event_manager ();
11343ca3c125 allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
449
11343ca3c125 allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
450 evmgr.interpreter_output (std::string (msg, len));
11343ca3c125 allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
451 }
11343ca3c125 allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
452 else
11343ca3c125 allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
453 {
11343ca3c125 allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
454 std::cout.write (msg, len);
11343ca3c125 allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
455 std::cout.flush ();
11343ca3c125 allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
456 }
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
457 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
458 else
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
459 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
460 start_external_pager ();
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
461
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
462 if (m_external_pager)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
463 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
464 if (m_external_pager->good ())
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
465 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
466 m_external_pager->write (msg, len);
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
467
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
468 m_external_pager->flush ();
581
bc813f5eb025 [project @ 1994-08-07 01:02:15 by jwe]
jwe
parents: 529
diff changeset
469
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
470 #if defined (EPIPE)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
471 if (errno == EPIPE)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
472 m_external_pager->setstate (std::ios::failbit);
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
473 #endif
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
474 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
475 else
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
476 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
477 // FIXME: something is not right with the
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
478 // pager. If it died then we should receive a
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
479 // signal for that. If there is some other problem,
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
480 // then what?
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
481 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
482 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
483 else
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
484 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
485 std::cout.write (msg, len);
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
486 std::cout.flush ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
487 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
488 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
489 }
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
490 }
3756
41404c6f4e69 [project @ 2000-12-15 03:14:44 by jwe]
jwe
parents: 3584
diff changeset
491
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
492 std::ostream& __stdout__ (void)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
493 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
494 output_system& output_sys = __get_output_system__ ("__stdout__");
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
495
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
496 return output_sys.__stdout__ ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
497 }
581
bc813f5eb025 [project @ 1994-08-07 01:02:15 by jwe]
jwe
parents: 529
diff changeset
498
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
499 std::ostream& __diary__ (void)
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
500 {
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
501 output_system& output_sys = __get_output_system__ ("__diary__");
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
502
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
503 return output_sys.__diary__ ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
504 }
581
bc813f5eb025 [project @ 1994-08-07 01:02:15 by jwe]
jwe
parents: 529
diff changeset
505 }
bc813f5eb025 [project @ 1994-08-07 01:02:15 by jwe]
jwe
parents: 529
diff changeset
506
27444
160930a3e5ee eliminate some calls to global __get_SUBSYSTEM__ functions
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
507 DEFMETHOD (diary, interp, args, nargout,
160930a3e5ee eliminate some calls to global __get_SUBSYSTEM__ functions
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
508 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
509 @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
510 @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
511 @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
512 @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
513 @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
514 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
515 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
516
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
517 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
518
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
519 @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
520 @item on
22820
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
521 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
522 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
523
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
524 @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
525 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
526
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
527 @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
528 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
529 @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
530
22820
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
531 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
532 state.
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
533
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
534 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
535 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
536 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
537 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
538 @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
539 @end deftypefn */)
581
bc813f5eb025 [project @ 1994-08-07 01:02:15 by jwe]
jwe
parents: 529
diff changeset
540 {
20817
3d551b2ae928 Use variable name nargin consistently in C++ code.
Rik <rik@octave.org>
parents: 20801
diff changeset
541 int nargin = args.length ();
1755
3a9462b655f1 [project @ 1996-01-22 04:47:22 by jwe]
jwe
parents: 1742
diff changeset
542
20817
3d551b2ae928 Use variable name nargin consistently in C++ code.
Rik <rik@octave.org>
parents: 20801
diff changeset
543 if (nargin > 1)
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
544 print_usage ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
545
27444
160930a3e5ee eliminate some calls to global __get_SUBSYSTEM__ functions
John W. Eaton <jwe@octave.org>
parents: 27301
diff changeset
546 octave::output_system& output_sys = interp.get_output_system ();
1306
f92615001614 [project @ 1995-05-15 19:54:29 by jwe]
jwe
parents: 1192
diff changeset
547
22820
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
548 if (nargout > 0)
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
549 {
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
550 // Querying diary variables
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
551 if (nargout == 1)
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
552 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
553 else
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
554 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
555 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
556 }
c97b26662858 Add Octave-only query mode for diary command to find status.
Rik <rik@octave.org>
parents: 22755
diff changeset
557
20817
3d551b2ae928 Use variable name nargin consistently in C++ code.
Rik <rik@octave.org>
parents: 20801
diff changeset
558 if (nargin == 0)
581
bc813f5eb025 [project @ 1994-08-07 01:02:15 by jwe]
jwe
parents: 529
diff changeset
559 {
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
560 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
561 output_sys.open_diary ();
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
562 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
563 else
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
564 {
20817
3d551b2ae928 Use variable name nargin consistently in C++ code.
Rik <rik@octave.org>
parents: 20801
diff changeset
565 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
566
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
567 if (arg == "on")
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
568 {
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
569 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
570 output_sys.open_diary ();
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
571 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
572 else if (arg == "off")
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
573 {
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
574 output_sys.close_diary ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
575 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
576 }
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
577 else
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
578 {
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
579 output_sys.diary_file_name (arg);
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 (true);
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 }
581
bc813f5eb025 [project @ 1994-08-07 01:02:15 by jwe]
jwe
parents: 529
diff changeset
583 }
20820
eed8ec05f1c8 always return value from DEFUN functions
John W. Eaton <jwe@octave.org>
parents: 20817
diff changeset
584
20941
a4f5da7c5463 maint: Replace "octave_value_list ()" with "ovl ()".
Rik <rik@octave.org>
parents: 20940
diff changeset
585 return ovl ();
581
bc813f5eb025 [project @ 1994-08-07 01:02:15 by jwe]
jwe
parents: 529
diff changeset
586 }
bc813f5eb025 [project @ 1994-08-07 01:02:15 by jwe]
jwe
parents: 529
diff changeset
587
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
588 DEFMETHOD (more, interp, args, ,
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
589 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
590 @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
591 @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
592 @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
593 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
594
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
595 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
596
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
597 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
598 @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
599 @end deftypefn */)
1409
e282214c41a5 [project @ 1995-09-15 06:41:08 by jwe]
jwe
parents: 1358
diff changeset
600 {
20897
9aad16a799c9 maint: Replace argc variable name with nargin in C++ code.
Rik <rik@octave.org>
parents: 20853
diff changeset
601 int nargin = args.length ();
1409
e282214c41a5 [project @ 1995-09-15 06:41:08 by jwe]
jwe
parents: 1358
diff changeset
602
20897
9aad16a799c9 maint: Replace argc variable name with nargin in C++ code.
Rik <rik@octave.org>
parents: 20853
diff changeset
603 if (nargin > 1)
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
604 print_usage ();
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
605
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
606 octave::output_system& output_sys = interp.get_output_system ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
607
20897
9aad16a799c9 maint: Replace argc variable name with nargin in C++ code.
Rik <rik@octave.org>
parents: 20853
diff changeset
608 if (nargin > 0)
1409
e282214c41a5 [project @ 1995-09-15 06:41:08 by jwe]
jwe
parents: 1358
diff changeset
609 {
23803
90689bdbe048 Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents: 23795
diff changeset
610 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
611
1755
3a9462b655f1 [project @ 1996-01-22 04:47:22 by jwe]
jwe
parents: 1742
diff changeset
612 if (arg == "on")
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
613 output_sys.page_screen_output (true);
1755
3a9462b655f1 [project @ 1996-01-22 04:47:22 by jwe]
jwe
parents: 1742
diff changeset
614 else if (arg == "off")
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
615 output_sys.page_screen_output (false);
1409
e282214c41a5 [project @ 1995-09-15 06:41:08 by jwe]
jwe
parents: 1358
diff changeset
616 else
23803
90689bdbe048 Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents: 23795
diff changeset
617 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
618 }
20801
a542a9bf177e eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
619 else
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
620 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
621
20941
a4f5da7c5463 maint: Replace "octave_value_list ()" with "ovl ()".
Rik <rik@octave.org>
parents: 20940
diff changeset
622 return ovl ();
1409
e282214c41a5 [project @ 1995-09-15 06:41:08 by jwe]
jwe
parents: 1358
diff changeset
623 }
e282214c41a5 [project @ 1995-09-15 06:41:08 by jwe]
jwe
parents: 1358
diff changeset
624
27159
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
625 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
626 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
627 @deftypefn {} {} terminal_size ()
27159
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
628 Query or set the size of the terminal window. If called with no
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
629 arguments, return a two-element row vector containing the current size
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
630 of the terminal window in characters (rows and columns). If called with
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
631 a two-element vector of integer values, set the terminal size and return
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
632 the previous setting. Setting the size manually should not be needed
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
633 when using readline for 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
634 @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
635 @end deftypefn */)
5673
0dc67016832b [project @ 2006-03-16 03:08:58 by jwe]
jwe
parents: 5307
diff changeset
636 {
27159
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
637 int nargin = args.length ();
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
638
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
639 if (nargin > 1)
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
640 print_usage ();
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
641
5673
0dc67016832b [project @ 2006-03-16 03:08:58 by jwe]
jwe
parents: 5307
diff changeset
642 RowVector size (2, 0.0);
0dc67016832b [project @ 2006-03-16 03:08:58 by jwe]
jwe
parents: 5307
diff changeset
643
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21743
diff changeset
644 size(0) = octave::command_editor::terminal_rows ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21743
diff changeset
645 size(1) = octave::command_editor::terminal_cols ();
5673
0dc67016832b [project @ 2006-03-16 03:08:58 by jwe]
jwe
parents: 5307
diff changeset
646
27159
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
647 if (nargin == 1)
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
648 {
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
649 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
650
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
651 if (m.numel () != 2)
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
652 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
653
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
654 int rows = octave::math::x_nint (m(0));
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
655 int cols = octave::math::x_nint (m(1));
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
656
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
657 if (rows <= 0 || cols <= 0)
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
658 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
659
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
660 octave::command_editor::set_screen_size (rows, cols);
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
661 }
25d0c4b5a3aa allow terminal_size function to set screen size
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
662
21127
df7891224709 maint: Use "return ovl (...)" in DEFUN macros.
Rik <rik@octave.org>
parents: 21100
diff changeset
663 return ovl (size);
5673
0dc67016832b [project @ 2006-03-16 03:08:58 by jwe]
jwe
parents: 5307
diff changeset
664 }
0dc67016832b [project @ 2006-03-16 03:08:58 by jwe]
jwe
parents: 5307
diff changeset
665
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
666 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
667 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
668 @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
669 @deftypefnx {} {@var{old_val} =} page_output_immediately (@var{new_val})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
670 @deftypefnx {} {} page_output_immediately (@var{new_val}, "local")
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
671 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
672 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
673
27579
f6417502613a doc: expand page_output_immediately doc string, mention page_screen_output
Mike Miller <mtmiller@octave.org>
parents: 26376
diff changeset
674 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
675 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
676
f6417502613a doc: expand page_output_immediately doc string, mention page_screen_output
Mike Miller <mtmiller@octave.org>
parents: 26376
diff changeset
677 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
678
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
679 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
680 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
681 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
682 @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
683 @end deftypefn */)
2097
19ba1a7dcfbb [project @ 1996-04-28 10:40:15 by jwe]
jwe
parents: 2093
diff changeset
684 {
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
685 octave::output_system& output_sys = interp.get_output_system ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
686
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
687 return output_sys.page_output_immediately (args, nargout);
2164
269db7306980 [project @ 1996-05-13 13:05:24 by jwe]
jwe
parents: 2146
diff changeset
688 }
269db7306980 [project @ 1996-05-13 13:05:24 by jwe]
jwe
parents: 2146
diff changeset
689
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
690 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
691 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
692 @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
693 @deftypefnx {} {@var{old_val} =} page_screen_output (@var{new_val})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
694 @deftypefnx {} {} page_screen_output (@var{new_val}, "local")
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
695 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
696 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
697 pager.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
698
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
699 This allows you to view one screenful at a time. Some pagers
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
700 (such as @code{less}---see @ref{Installation}) are also capable of moving
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
701 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
702
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
703 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
704 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
705 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
706 @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
707 @end deftypefn */)
2164
269db7306980 [project @ 1996-05-13 13:05:24 by jwe]
jwe
parents: 2146
diff changeset
708 {
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
709 octave::output_system& output_sys = interp.get_output_system ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
710
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
711 return output_sys.page_screen_output (args, nargout);
2164
269db7306980 [project @ 1996-05-13 13:05:24 by jwe]
jwe
parents: 2146
diff changeset
712 }
269db7306980 [project @ 1996-05-13 13:05:24 by jwe]
jwe
parents: 2146
diff changeset
713
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
714 DEFMETHOD (PAGER, interp, args, nargout,
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
715 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
716 @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
717 @deftypefnx {} {@var{old_val} =} PAGER (@var{new_val})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
718 @deftypefnx {} {} PAGER (@var{new_val}, "local")
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
719 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
720 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
721
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
722 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
723 @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
724 @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
725
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
726 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
727 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
728 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
729 @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
730 @end deftypefn */)
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5778
diff changeset
731 {
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
732 octave::output_system& output_sys = interp.get_output_system ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
733
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
734 return output_sys.PAGER (args, nargout);
2097
19ba1a7dcfbb [project @ 1996-04-28 10:40:15 by jwe]
jwe
parents: 2093
diff changeset
735 }
19ba1a7dcfbb [project @ 1996-04-28 10:40:15 by jwe]
jwe
parents: 2093
diff changeset
736
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
737 DEFMETHOD (PAGER_FLAGS, interp, args, nargout,
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
738 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
739 @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
740 @deftypefnx {} {@var{old_val} =} PAGER_FLAGS (@var{new_val})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
741 @deftypefnx {} {} PAGER_FLAGS (@var{new_val}, "local")
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
742 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
743 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
744
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
745 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
746 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
747 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
748 @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
749 @end deftypefn */)
6144
e8868fde0fc5 [project @ 2006-11-07 20:52:18 by jwe]
jwe
parents: 5823
diff changeset
750 {
25435
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
751 octave::output_system& output_sys = interp.get_output_system ();
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
752
a52e6fb674b1 eliminate some singletons and static & global variables
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
753 return output_sys.PAGER_FLAGS (args, nargout);
6144
e8868fde0fc5 [project @ 2006-11-07 20:52:18 by jwe]
jwe
parents: 5823
diff changeset
754 }