Mercurial > octave
annotate libinterp/corefcn/syminfo.h @ 31235:b542b88ad3b6
maint: Use space between function name and '(' in sparse-xpow.cc.
* sparse-xpow.cc: Use space between function name and '(' in sparse-xpow.cc.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 20 Sep 2022 14:43:56 -0700 |
parents | 796f54d4ddbf |
children | e88a07dec498 |
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 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29856
diff
changeset
|
3 // Copyright (C) 2018-2022 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 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 #include <string> |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 #include <iosfwd> |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 |
26091
fb907736f335
* syminfo.h: Derive symbol_info_list from base_list<symbol_info>.
John W. Eaton <jwe@octave.org>
parents:
26088
diff
changeset
|
34 #include "base-list.h" |
fb907736f335
* syminfo.h: Derive symbol_info_list from base_list<symbol_info>.
John W. Eaton <jwe@octave.org>
parents:
26088
diff
changeset
|
35 |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 #include "ov.h" |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 class octave_map; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 namespace octave |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 { |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
42 struct whos_parameter |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
43 { |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
44 char command; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
45 char modifier; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
46 int parameter_length; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
47 int first_parameter_length; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 int balance; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 std::string text; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
50 std::string line; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 }; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 |
29233
665c9ed14c97
Set API tags in files in libinterp/corefcn (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
53 class |
665c9ed14c97
Set API tags in files in libinterp/corefcn (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
54 OCTINTERP_API |
665c9ed14c97
Set API tags in files in libinterp/corefcn (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
55 symbol_info |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
56 { |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
57 public: |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
58 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
59 symbol_info (const std::string& name, const octave_value& value, |
26659
8fbda39ca075
eliminate "automatic" type from symbol info class
John W. Eaton <jwe@octave.org>
parents:
26658
diff
changeset
|
60 bool is_formal, bool is_global, bool is_persistent) |
8fbda39ca075
eliminate "automatic" type from symbol info class
John W. Eaton <jwe@octave.org>
parents:
26658
diff
changeset
|
61 : m_name (name), m_value (value), m_is_complex (value.iscomplex ()), |
29856
56b3e2af0298
Add 's'=sparse attribute for whos function (bug #60687)
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
62 m_is_sparse (value.issparse ()), m_is_formal (is_formal), |
56b3e2af0298
Add 's'=sparse attribute for whos function (bug #60687)
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
63 m_is_global (is_global), m_is_persistent (is_persistent) |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
64 { } |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
65 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
66 std::string name (void) const { return m_name; } |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
67 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
68 octave_value value (void) const { return m_value; } |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
69 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
70 bool is_complex (void) const { return m_is_complex; } |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
71 |
29856
56b3e2af0298
Add 's'=sparse attribute for whos function (bug #60687)
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
72 bool is_sparse (void) const { return m_is_sparse; } |
56b3e2af0298
Add 's'=sparse attribute for whos function (bug #60687)
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
73 |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
74 bool is_formal (void) const { return m_is_formal; } |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
75 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
76 bool is_global (void) const { return m_is_global; } |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
77 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
78 bool is_persistent (void) const { return m_is_persistent; } |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
79 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
80 void display_line (std::ostream& os, |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
81 const std::list<whos_parameter>& params) const; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
82 private: |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
83 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
84 std::string m_name; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
85 octave_value m_value; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
86 bool m_is_complex; |
29856
56b3e2af0298
Add 's'=sparse attribute for whos function (bug #60687)
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
87 bool m_is_sparse; |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
88 bool m_is_formal; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
89 bool m_is_global; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
90 bool m_is_persistent; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
91 }; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
92 |
29233
665c9ed14c97
Set API tags in files in libinterp/corefcn (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
93 class |
665c9ed14c97
Set API tags in files in libinterp/corefcn (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
94 OCTINTERP_API |
665c9ed14c97
Set API tags in files in libinterp/corefcn (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
95 symbol_info_list : public base_list<symbol_info> |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
96 { |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
97 public: |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
98 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
99 symbol_info_list (void) = default; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
100 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
101 symbol_info_list (const symbol_info_list&) = default; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
102 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
103 symbol_info_list& operator = (const symbol_info_list&) = default; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
104 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
105 ~symbol_info_list (void) = default; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
106 |
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
|
107 octave_value varval (const std::string& name) const; |
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
|
108 |
26657
be909a861e52
new symbol_info method to list names
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
109 std::list<std::string> names (void) const; |
be909a861e52
new symbol_info method to list names
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
110 |
26088
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
111 octave_map map_value (const std::string& caller_function_name, |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
112 int nesting_level) const; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
113 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
114 // Print a line of information for a given symbol. |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
115 void print_descriptor (std::ostream& os, |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
116 const std::list<whos_parameter> params) const; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
117 |
26658
fc7d72df08fa
add const qualifiers to two symbol_info methods
John W. Eaton <jwe@octave.org>
parents:
26657
diff
changeset
|
118 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
|
119 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
120 // Parse FORMAT, and return a parameter list, |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
121 // containing all information needed to print the given |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
122 // attributes of the symbols. |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
123 std::list<whos_parameter> |
26658
fc7d72df08fa
add const qualifiers to two symbol_info methods
John W. Eaton <jwe@octave.org>
parents:
26657
diff
changeset
|
124 parse_whos_line_format (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
|
125 }; |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
126 } |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
127 |
2b92498c111e
move symbol_info and symbol_info_list classes to separate file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
128 #endif |