Mercurial > octave
annotate libinterp/corefcn/oct-hist.h @ 27919:1891570abac8
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2020.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 06 Jan 2020 22:29:51 -0500 |
parents | b442ec6dda5c |
children | bd51beb6205e |
rev | line source |
---|---|
1 | 1 /* |
2 | |
27919
1891570abac8
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27918
diff
changeset
|
3 Copyright (C) 1993-2020 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
4 |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
5 See the file COPYRIGHT.md in the top-level directory of this distribution |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
6 or <https://octave.org/COPYRIGHT.html/>. |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
7 |
1 | 8 |
9 This file is part of Octave. | |
10 | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
11 Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
12 under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
13 the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
14 (at your option) any later version. |
1 | 15 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
16 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
17 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
19 GNU General Public License for more details. |
1 | 20 |
21 You should have received a copy of the GNU General Public License | |
7016 | 22 along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
23 <https://www.gnu.org/licenses/>. |
1 | 24 |
25 */ | |
26 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
27 #if ! defined (octave_oct_hist_h) |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
28 #define octave_oct_hist_h 1 |
1 | 29 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
30 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
31 |
1755 | 32 #include <string> |
33 | |
1799 | 34 #include "cmd-hist.h" |
35 | |
26325
4877f77d5e1d
add necessary includes and forward decls in public header files (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
25994
diff
changeset
|
36 #include "ovl.h" |
4877f77d5e1d
add necessary includes and forward decls in public header files (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
25994
diff
changeset
|
37 |
25994
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
38 namespace octave |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
39 { |
26325
4877f77d5e1d
add necessary includes and forward decls in public header files (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
25994
diff
changeset
|
40 class interpreter; |
4877f77d5e1d
add necessary includes and forward decls in public header files (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
25994
diff
changeset
|
41 |
25994
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
42 class history_system |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
43 { |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
44 public: |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
45 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
46 history_system (interpreter& interp); |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
47 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
48 history_system (const history_system&) = delete; |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
49 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
50 history_system& operator = (const history_system&) = delete; |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
51 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
52 ~history_system (void) = default; |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
53 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
54 void initialize (bool read_history_file = false); |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
55 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
56 void write_timestamp (void); |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
57 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
58 octave_value input_from_tmp_file (const octave_value_list& args, |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
59 int nargout); |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
60 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
61 bool input_from_tmp_file (void) const |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
62 { |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
63 return m_input_from_tmp_file; |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
64 } |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
65 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
66 bool input_from_tmp_file (bool flag) |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
67 { |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
68 return set (m_input_from_tmp_file, flag); |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
69 } |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
70 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
71 octave_value timestamp_format_string (const octave_value_list& args, |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
72 int nargout); |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
73 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
74 std::string timestamp_format_string (void) const |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
75 { |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
76 return m_timestamp_format_string; |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
77 } |
5794 | 78 |
25994
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
79 std::string timestamp_format_string (const std::string& file) |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
80 { |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
81 return set (m_timestamp_format_string, file); |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
82 } |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
83 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
84 string_vector |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
85 do_history (const octave_value_list& args = octave_value_list (), |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
86 int nargout = 0); |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
87 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
88 void do_edit_history (const octave_value_list& args = octave_value_list ()); |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
89 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
90 void do_run_history (const octave_value_list& args = octave_value_list ()); |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
91 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
92 private: |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
93 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
94 interpreter& m_interpreter; |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
95 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
96 // TRUE means input is coming from temporary history file. |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
97 bool m_input_from_tmp_file; |
1799 | 98 |
25994
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
99 // The format of the timestamp marker written to the history file when |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
100 // Octave exits. |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
101 std::string m_timestamp_format_string; |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
102 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
103 static std::string default_file (void); |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
104 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
105 static int default_size (void); |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
106 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
107 static std::string default_timestamp_format (void); |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
108 |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
109 template <typename T> |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
110 T set (T& var, const T& new_val) |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
111 { |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
112 T old_val = var; |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
113 var = new_val; |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
114 return old_val; |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
115 } |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
116 }; |
f881d3e271d2
eliminate global and file-scope static variables in oct-hist.cc
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
117 } |
168 | 118 |
1 | 119 #endif |