Mercurial > octave
annotate libinterp/corefcn/syminfo.h @ 33623:4517f929c59d bytecode-interpreter tip
maint: Merge default to bytecode-interpreter
author | Arun Giridhar <arungiridhar@gmail.com> |
---|---|
date | Fri, 24 May 2024 16:22:41 -0400 |
parents | 0b5f3219b650 |
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:
31771
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 //////////////////////////////////////////////////////////////////////// |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 #if ! defined (octave_syminfo_h) |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 #define octave_syminfo_h 1 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 #include "octave-config.h" |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 |
32936
0b5f3219b650
eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents:
32633
diff
changeset
|
31 #include <iosfwd> |
0b5f3219b650
eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents:
32633
diff
changeset
|
32 #include <list> |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 #include <string> |
26091
fb907736f335
* syminfo.h: Derive symbol_info_list from base_list<symbol_info>.
John W. Eaton <jwe@octave.org>
parents:
26088
diff
changeset
|
34 |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 #include "ov.h" |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 class octave_map; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
39 OCTAVE_BEGIN_NAMESPACE(octave) |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
40 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
41 struct whos_parameter |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
42 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
43 char command; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
44 char modifier; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
45 int parameter_length; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
46 int first_parameter_length; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
47 int balance; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
48 std::string text; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
49 std::string line; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
50 }; |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 |
32628
ae4e19c0a2b1
maint: Place class name and class keyword on one line.
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
52 class OCTINTERP_API symbol_info |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
53 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
54 public: |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
55 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
56 symbol_info (const std::string& name, const octave_value& value, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
57 bool is_formal, bool is_global, bool is_persistent) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
58 : m_name (name), m_value (value), m_is_complex (value.iscomplex ()), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
59 m_is_sparse (value.issparse ()), m_is_formal (is_formal), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
60 m_is_global (is_global), m_is_persistent (is_persistent) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
61 { } |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
62 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
63 std::string name () const { return m_name; } |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
64 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
65 octave_value value () const { return m_value; } |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
66 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
67 bool is_complex () const { return m_is_complex; } |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
68 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
69 bool is_sparse () const { return m_is_sparse; } |
29856
56b3e2af0298
Add 's'=sparse attribute for whos function (bug #60687)
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
70 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
71 bool is_formal () const { return m_is_formal; } |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
72 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
73 bool is_global () const { return m_is_global; } |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
74 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
75 bool is_persistent () const { return m_is_persistent; } |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
76 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
77 void display_line (std::ostream& os, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
78 const std::list<whos_parameter>& params) const; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
79 private: |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
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 std::string m_name; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
82 octave_value m_value; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
83 bool m_is_complex; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
84 bool m_is_sparse; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
85 bool m_is_formal; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
86 bool m_is_global; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
87 bool m_is_persistent; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
88 }; |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
89 |
32936
0b5f3219b650
eliminate all uses of base_list<T> template
John W. Eaton <jwe@octave.org>
parents:
32633
diff
changeset
|
90 class OCTINTERP_API symbol_info_list : public std::list<symbol_info> |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
91 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
92 public: |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
93 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
94 symbol_info_list () = default; |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
95 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
96 symbol_info_list (const symbol_info_list&) = default; |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
97 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
98 symbol_info_list& operator = (const symbol_info_list&) = default; |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
99 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
100 ~symbol_info_list () = default; |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
101 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
102 octave_value varval (const std::string& name) const; |
26117
a6df420457ac
use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents:
26091
diff
changeset
|
103 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
104 std::list<std::string> names () const; |
26657
be909a861e52
new symbol_info method to list names
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
105 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
106 octave_map map_value (const std::string& caller_function_name, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
107 int nesting_level) const; |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
108 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
109 // Print a line of information for a given symbol. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
110 void print_descriptor (std::ostream& os, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
111 const std::list<whos_parameter> params) const; |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
112 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
113 void display (std::ostream& os, const std::string& format) const; |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
114 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
115 // Parse FORMAT, and return a parameter list, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
116 // containing all information needed to print the given |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
117 // attributes of the symbols. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
118 std::list<whos_parameter> |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
119 parse_whos_line_format (const std::string& format) const; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
120 }; |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
121 |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
122 OCTAVE_END_NAMESPACE(octave) |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
123 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
124 #endif |