Mercurial > octave
annotate libinterp/corefcn/settings.h @ 33617:ec2635a02328 bytecode-interpreter tip
maint: Merge default to bytecode-interpreter.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Tue, 21 May 2024 18:29:03 +0200 |
parents | 2e484f9f1f18 |
children |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
31837
diff
changeset
|
3 // Copyright (C) 2018-2024 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
25443
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 |
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 #if ! defined (octave_settings_h) |
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 #define octave_settings_h 1 |
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 |
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 #include "octave-config.h" |
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 |
26325
4877f77d5e1d
add necessary includes and forward decls in public header files (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
25443
diff
changeset
|
31 #include <cstddef> |
4877f77d5e1d
add necessary includes and forward decls in public header files (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
25443
diff
changeset
|
32 |
4877f77d5e1d
add necessary includes and forward decls in public header files (bug #55277)
Mike Miller <mtmiller@octave.org>
parents:
25443
diff
changeset
|
33 class octave_value; |
25443
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 class octave_value_list; |
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
36 OCTAVE_BEGIN_NAMESPACE(octave) |
29960
939bef0b66e0
merge "namespace octave" and OCTAVE_NAMESPACE_BEGIN/END blocks
John W. Eaton <jwe@octave.org>
parents:
29572
diff
changeset
|
37 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
38 // Most settings for the interpreter are stored in the classes which |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
39 // they affect (intput_system, output_system, load_path, etc. Some |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
40 // don't really fit anywhere else. For example, there is no single |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
41 // lexer or parser object, so we store settings for those things |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
42 // here. |
25443
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
43 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
44 class settings |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
45 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
46 public: |
25443
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
47 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
48 settings (); |
25443
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 |
31837
febd82d1a8de
use new macros to consistently delete copy and move member functions
John W. Eaton <jwe@octave.org>
parents:
31771
diff
changeset
|
50 OCTAVE_DISABLE_COPY_MOVE (settings) |
25443
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
52 ~settings () = default; |
25443
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
53 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
54 octave_value display_tokens (const octave_value_list& args, int nargout); |
25443
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
55 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
56 bool display_tokens () const { return m_display_tokens; } |
25443
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
57 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
58 bool display_tokens (bool flag) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
59 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
60 bool val = m_display_tokens; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
61 m_display_tokens = flag; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
62 return val; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
63 } |
25443
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
64 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
65 // Read only. |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
66 std::size_t token_count () const { return m_token_count; } |
25443
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
67 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
68 void increment_token_count () { ++m_token_count; } |
25443
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
69 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
70 octave_value lexer_debug_flag (const octave_value_list& args, int nargout); |
25443
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
71 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
72 bool lexer_debug_flag () const { return m_lexer_debug_flag; } |
25443
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
73 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
74 bool lexer_debug_flag (bool flag) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
75 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
76 bool val = m_lexer_debug_flag; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
77 m_lexer_debug_flag = flag; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
78 return val; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
79 } |
25443
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
80 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
81 private: |
25443
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
82 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
83 // Display tokens as they are processed, for debugging. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
84 bool m_display_tokens = false; |
25443
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
85 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
86 // Number of tokens processed since interpreter startup. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
87 std::size_t m_token_count = 0; |
25443
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
88 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
89 // Internal variable for lexer debugging state. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
90 bool m_lexer_debug_flag = false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
91 }; |
29960
939bef0b66e0
merge "namespace octave" and OCTAVE_NAMESPACE_BEGIN/END blocks
John W. Eaton <jwe@octave.org>
parents:
29572
diff
changeset
|
92 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
93 OCTAVE_END_NAMESPACE(octave) |
25443
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
94 |
2fa7cd178c4a
new class for miscellaneous interpreter settings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
95 #endif |