Mercurial > octave
annotate libinterp/corefcn/symtab.cc @ 33608:5fba13104493 bytecode-interpreter tip
maint: merge default to bytecode-interpreter.
author | Nicholas R. Jankowski <jankowski.nicholas@gmail.com> |
---|---|
date | Sat, 18 May 2024 22:40:00 -0400 |
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:
32589
diff
changeset
|
3 // Copyright (C) 1993-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 //////////////////////////////////////////////////////////////////////// |
1 | 25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21660
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21264
diff
changeset
|
27 # include "config.h" |
1 | 28 #endif |
29 | |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
30 #include <iostream> |
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
31 |
17870 | 32 #include <sstream> |
33 | |
7336 | 34 #include "oct-time.h" |
1755 | 35 |
23137
334119c390b3
move bp_table class to separate file
John W. Eaton <jwe@octave.org>
parents:
23127
diff
changeset
|
36 #include "bp-table.h" |
3308 | 37 #include "defun.h" |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24064
diff
changeset
|
38 #include "fcn-info.h" |
23438
d24d01273bd0
eliminate load-path singleton
John W. Eaton <jwe@octave.org>
parents:
23433
diff
changeset
|
39 #include "interpreter-private.h" |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23581
diff
changeset
|
40 #include "interpreter.h" |
7336 | 41 #include "load-path.h" |
16048
10142aad4b9f
Implement indirect method call: fun(obj, ...).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15467
diff
changeset
|
42 #include "ov-classdef.h" |
7336 | 43 #include "ov-fcn.h" |
8819
96d87674b818
also stash directory name for subfunctions
John W. Eaton <jwe@octave.org>
parents:
8785
diff
changeset
|
44 #include "ov-usr-fcn.h" |
7336 | 45 #include "pager.h" |
46 #include "parse.h" | |
20207
abf85f8cbd6c
Expand type() to work on command-line entered functions (bug #40462).
John W. Eaton <jwe@octave.org>
parents:
20172
diff
changeset
|
47 #include "pt-pr-code.h" |
24269
f494b87d2a93
rename scope to symbol_scope
John W. Eaton <jwe@octave.org>
parents:
24263
diff
changeset
|
48 #include "symscope.h" |
13983
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
13916
diff
changeset
|
49 #include "symtab.h" |
3355 | 50 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30888
diff
changeset
|
51 OCTAVE_BEGIN_NAMESPACE(octave) |
29960
939bef0b66e0
merge "namespace octave" and OCTAVE_NAMESPACE_BEGIN/END blocks
John W. Eaton <jwe@octave.org>
parents:
29958
diff
changeset
|
52 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
53 symbol_table::symbol_table (interpreter& interp) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
54 : m_interpreter (interp), m_fcn_table (), m_class_precedence_table (), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
55 m_parent_map () |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
56 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
57 install_builtins (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
58 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
59 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
60 symbol_scope |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
61 symbol_table::current_scope () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
62 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
63 tree_evaluator& tw = m_interpreter.get_evaluator (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
64 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
65 return tw.get_current_scope (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
66 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
67 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
68 bool |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
69 symbol_table::is_built_in_function_name (const std::string& name) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
70 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
71 octave_value val = find_built_in_function (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
72 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
73 return val.is_defined (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
74 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
75 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
76 octave_value |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
77 symbol_table::find_scoped_function (const std::string& name, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
78 const symbol_scope& search_scope) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
79 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
80 if (name.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
81 return octave_value (); |
28436
22e90bdcf47f
make find_scoped_function available in symbol_table class
John W. Eaton <jwe@octave.org>
parents:
28435
diff
changeset
|
82 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
83 fcn_table_const_iterator p = m_fcn_table.find (name); |
28436
22e90bdcf47f
make find_scoped_function available in symbol_table class
John W. Eaton <jwe@octave.org>
parents:
28435
diff
changeset
|
84 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
85 if (p != m_fcn_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
86 return p->second.find_scoped_function (search_scope); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
87 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
88 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
89 fcn_info finfo (name); |
28436
22e90bdcf47f
make find_scoped_function available in symbol_table class
John W. Eaton <jwe@octave.org>
parents:
28435
diff
changeset
|
90 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
91 octave_value fcn = finfo.find_scoped_function (search_scope); |
28436
22e90bdcf47f
make find_scoped_function available in symbol_table class
John W. Eaton <jwe@octave.org>
parents:
28435
diff
changeset
|
92 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
93 if (fcn.is_defined ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
94 m_fcn_table[name] = finfo; |
28436
22e90bdcf47f
make find_scoped_function available in symbol_table class
John W. Eaton <jwe@octave.org>
parents:
28435
diff
changeset
|
95 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
96 return fcn; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
97 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
98 } |
28436
22e90bdcf47f
make find_scoped_function available in symbol_table class
John W. Eaton <jwe@octave.org>
parents:
28435
diff
changeset
|
99 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
100 octave_value |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
101 symbol_table::find_private_function (const std::string& dir_name, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
102 const std::string& name) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
103 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
104 if (name.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
105 return octave_value (); |
28437
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28436
diff
changeset
|
106 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
107 fcn_table_const_iterator p = m_fcn_table.find (name); |
28437
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28436
diff
changeset
|
108 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
109 if (p != m_fcn_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
110 return p->second.find_private_function (dir_name); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
111 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
112 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
113 fcn_info finfo (name); |
28437
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28436
diff
changeset
|
114 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
115 octave_value fcn = finfo.find_private_function (dir_name); |
28437
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28436
diff
changeset
|
116 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
117 if (fcn.is_defined ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
118 m_fcn_table[name] = finfo; |
28437
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28436
diff
changeset
|
119 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
120 return fcn; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
121 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
122 } |
28437
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28436
diff
changeset
|
123 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
124 // FIXME: this function only finds legacy class methods, not |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
125 // classdef methods. |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
126 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
127 octave_value |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
128 symbol_table::find_method (const std::string& name, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
129 const std::string& dispatch_type) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
130 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
131 if (name.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
132 return octave_value (); |
26750
a89aa5b95a59
return early if searching for function or package with empty name
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
133 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
134 fcn_table_const_iterator p = m_fcn_table.find (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
135 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
136 if (p != m_fcn_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
137 return p->second.find_method (dispatch_type); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
138 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
139 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
140 fcn_info finfo (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
141 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
142 octave_value fcn = finfo.find_method (dispatch_type); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
143 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
144 if (fcn.is_defined ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
145 m_fcn_table[name] = finfo; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
146 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
147 return fcn; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
148 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
149 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
150 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
151 octave_value |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
152 symbol_table::find_built_in_function (const std::string& name) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
153 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
154 fcn_table_const_iterator p = m_fcn_table.find (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
155 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
156 if (p != m_fcn_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
157 return p->second.find_built_in_function (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
158 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
159 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
160 fcn_info finfo (name); |
28435
76a9f31540e3
try harder to find functions in some symbol_table find_* functions
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
161 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
162 octave_value fcn = finfo.find_built_in_function (); |
28435
76a9f31540e3
try harder to find functions in some symbol_table find_* functions
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
163 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
164 if (fcn.is_defined ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
165 m_fcn_table[name] = finfo; |
28435
76a9f31540e3
try harder to find functions in some symbol_table find_* functions
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
166 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
167 return fcn; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
168 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
169 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
170 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
171 octave_value |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
172 symbol_table::find_autoload (const std::string& name) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
173 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
174 if (name.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
175 return octave_value (); |
26750
a89aa5b95a59
return early if searching for function or package with empty name
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
176 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
177 auto p = m_fcn_table.find (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
178 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
179 if (p != m_fcn_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
180 return p->second.find_autoload (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
181 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
182 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
183 fcn_info finfo (name); |
28435
76a9f31540e3
try harder to find functions in some symbol_table find_* functions
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
184 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
185 octave_value fcn = finfo.find_autoload (); |
28435
76a9f31540e3
try harder to find functions in some symbol_table find_* functions
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
186 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
187 if (fcn.is_defined ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
188 m_fcn_table[name] = finfo; |
28435
76a9f31540e3
try harder to find functions in some symbol_table find_* functions
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
189 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
190 return fcn; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
191 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
192 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
193 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
194 octave_value |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
195 symbol_table::builtin_find (const std::string& name, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
196 const symbol_scope& search_scope_arg) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
197 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
198 if (name.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
199 return octave_value (); |
26750
a89aa5b95a59
return early if searching for function or package with empty name
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
200 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
201 fcn_table_iterator p = m_fcn_table.find (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
202 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
203 symbol_scope search_scope |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
204 = (search_scope_arg ? search_scope_arg : current_scope ()); |
26846
4ff25d9b1eec
set default scope in symbol_table find functions instead of fcn_info
John W. Eaton <jwe@octave.org>
parents:
26845
diff
changeset
|
205 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
206 if (p != m_fcn_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
207 return p->second.builtin_find (search_scope); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
208 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
209 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
210 fcn_info finfo (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
211 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
212 octave_value fcn = finfo.builtin_find (search_scope); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
213 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
214 if (fcn.is_defined ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
215 m_fcn_table[name] = finfo; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
216 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
217 return fcn; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
218 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
219 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
220 return octave_value (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
221 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
222 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
223 octave_value |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
224 symbol_table::fcn_table_find (const std::string& name, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
225 const octave_value_list& args, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
226 const symbol_scope& search_scope_arg) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
227 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
228 if (name.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
229 return octave_value (); |
26750
a89aa5b95a59
return early if searching for function or package with empty name
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
230 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
231 fcn_table_iterator p = m_fcn_table.find (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
232 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
233 symbol_scope search_scope |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
234 = (search_scope_arg ? search_scope_arg : current_scope ()); |
26846
4ff25d9b1eec
set default scope in symbol_table find functions instead of fcn_info
John W. Eaton <jwe@octave.org>
parents:
26845
diff
changeset
|
235 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
236 if (p != m_fcn_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
237 return p->second.find (search_scope, args); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
238 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
239 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
240 fcn_info finfo (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
241 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
242 octave_value fcn = finfo.find (search_scope, args); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
243 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
244 if (fcn.is_defined ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
245 m_fcn_table[name] = finfo; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
246 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
247 return fcn; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
248 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
249 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
250 return octave_value (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
251 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
252 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
253 octave_value |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
254 symbol_table::find_function (const std::string& name, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
255 const symbol_scope& search_scope_arg) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
256 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
257 if (name.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
258 return octave_value (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
259 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
260 if (name[0] == '@') |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
261 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
262 std::size_t pos = name.find_first_of ('/'); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
263 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
264 if (pos == std::string::npos) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
265 return octave_value (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
266 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
267 std::string method = name.substr (pos+1); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
268 std::string dispatch_type = name.substr (1, pos-1); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
269 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
270 return find_method (method, dispatch_type); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
271 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
272 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
273 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
274 symbol_scope search_scope |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
275 = (search_scope_arg ? search_scope_arg : current_scope ()); |
26846
4ff25d9b1eec
set default scope in symbol_table find functions instead of fcn_info
John W. Eaton <jwe@octave.org>
parents:
26845
diff
changeset
|
276 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
277 return find_function (name, ovl (), search_scope); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
278 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
279 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
280 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
281 octave_value |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
282 symbol_table::find_function (const std::string& name, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
283 const octave_value_list& args, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
284 const symbol_scope& search_scope) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
285 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
286 if (name.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
287 return octave_value (); |
26750
a89aa5b95a59
return early if searching for function or package with empty name
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
288 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
289 return fcn_table_find (name, args, search_scope); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
290 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
291 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
292 octave_value |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
293 symbol_table::find_user_function (const std::string& name) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
294 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
295 if (name.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
296 return octave_value (); |
26750
a89aa5b95a59
return early if searching for function or package with empty name
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
297 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
298 auto p = m_fcn_table.find (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
299 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
300 if (p != m_fcn_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
301 return p->second.find_user_function (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
302 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
303 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
304 fcn_info finfo (name); |
28435
76a9f31540e3
try harder to find functions in some symbol_table find_* functions
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
305 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
306 octave_value fcn = finfo.find_user_function (); |
28435
76a9f31540e3
try harder to find functions in some symbol_table find_* functions
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
307 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
308 if (fcn.is_defined ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
309 m_fcn_table[name] = finfo; |
28435
76a9f31540e3
try harder to find functions in some symbol_table find_* functions
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
310 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
311 return fcn; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
312 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
313 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
314 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
315 octave_value |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
316 symbol_table::find_cmdline_function (const std::string& name) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
317 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
318 if (name.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
319 return octave_value (); |
26750
a89aa5b95a59
return early if searching for function or package with empty name
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
320 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
321 auto p = m_fcn_table.find (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
322 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
323 if (p != m_fcn_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
324 return p->second.find_cmdline_function (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
325 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
326 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
327 fcn_info finfo (name); |
28435
76a9f31540e3
try harder to find functions in some symbol_table find_* functions
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
328 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
329 octave_value fcn = finfo.find_cmdline_function (); |
28435
76a9f31540e3
try harder to find functions in some symbol_table find_* functions
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
330 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
331 if (fcn.is_defined ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
332 m_fcn_table[name] = finfo; |
28435
76a9f31540e3
try harder to find functions in some symbol_table find_* functions
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
333 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
334 return fcn; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
335 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
336 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
337 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
338 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
339 symbol_table::install_cmdline_function (const std::string& name, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
340 const octave_value& fcn) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
341 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
342 auto p = m_fcn_table.find (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
343 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
344 if (p != m_fcn_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
345 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
346 fcn_info& finfo = p->second; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
347 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
348 finfo.install_cmdline_function (fcn); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
349 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
350 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
351 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
352 fcn_info finfo (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
353 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
354 finfo.install_cmdline_function (fcn); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
355 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
356 m_fcn_table[name] = finfo; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
357 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
358 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
359 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
360 // Install local function FCN named NAME. FILE_NAME is the name of |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
361 // the file containing the local function. |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
362 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
363 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
364 symbol_table::install_local_function (const std::string& name, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
365 const octave_value& fcn, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
366 const std::string& file_name) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
367 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
368 auto p = m_fcn_table.find (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
369 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
370 if (p != m_fcn_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
371 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
372 fcn_info& finfo = p->second; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
373 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
374 finfo.install_local_function (fcn, file_name); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
375 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
376 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
377 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
378 fcn_info finfo (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
379 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
380 finfo.install_local_function (fcn, file_name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
381 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
382 m_fcn_table[name] = finfo; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
383 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
384 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
385 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
386 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
387 symbol_table::install_user_function (const std::string& name, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
388 const octave_value& fcn) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
389 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
390 auto p = m_fcn_table.find (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
391 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
392 if (p != m_fcn_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
393 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
394 fcn_info& finfo = p->second; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
395 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
396 finfo.install_user_function (fcn); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
397 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
398 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
399 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
400 fcn_info finfo (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
401 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
402 finfo.install_user_function (fcn); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
403 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
404 m_fcn_table[name] = finfo; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
405 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
406 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
407 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
408 // FIXME: should we ensure that FCN really is a built-in function |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
409 // object? |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
410 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
411 symbol_table::install_built_in_function (const std::string& name, |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
412 const octave_value& fcn) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
413 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
414 auto p = m_fcn_table.find (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
415 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
416 if (p != m_fcn_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
417 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
418 fcn_info& finfo = p->second; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
419 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
420 finfo.install_built_in_function (fcn); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
421 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
422 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
423 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
424 fcn_info finfo (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
425 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
426 finfo.install_built_in_function (fcn); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
427 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
428 m_fcn_table[name] = finfo; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
429 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
430 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
431 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
432 // This is written as two separate functions instead of a single |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
433 // function with default values so that it will work properly with |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
434 // unwind_protect. |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
435 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
436 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
437 symbol_table::clear_functions (bool force) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
438 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
439 auto p = m_fcn_table.begin (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
440 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
441 while (p != m_fcn_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
442 (p++)->second.clear (force); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
443 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
444 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
445 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
446 symbol_table::clear_function (const std::string& name) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
447 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
448 clear_user_function (name); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
449 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
450 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
451 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
452 symbol_table::clear_function_pattern (const std::string& pat) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
453 { |
32572
e424a55bc9fb
Use own function for symbol name matching on Windows (bug #64975).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32426
diff
changeset
|
454 symbol_match pattern (pat); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
455 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
456 auto p = m_fcn_table.begin (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
457 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
458 while (p != m_fcn_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
459 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
460 if (pattern.match (p->first)) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
461 (p++)->second.clear_user_function (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
462 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
463 p++; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
464 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
465 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
466 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
467 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
468 symbol_table::clear_function_regexp (const std::string& pat) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
469 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
470 regexp pattern (pat); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
471 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
472 auto p = m_fcn_table.begin (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
473 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
474 while (p != m_fcn_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
475 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
476 if (pattern.is_match (p->first)) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
477 (p++)->second.clear_user_function (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
478 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
479 p++; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
480 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
481 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
482 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
483 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
484 symbol_table::clear_user_function (const std::string& name) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
485 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
486 auto p = m_fcn_table.find (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
487 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
488 if (p != m_fcn_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
489 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
490 fcn_info& finfo = p->second; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
491 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
492 finfo.clear_user_function (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
493 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
494 // FIXME: is this necessary, or even useful? |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
495 // else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
496 // error ("clear: no such function '%s'", name.c_str ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
497 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
498 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
499 // This clears oct and mex files, including autoloads. |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
500 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
501 symbol_table::clear_dld_function (const std::string& name) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
502 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
503 auto p = m_fcn_table.find (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
504 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
505 if (p != m_fcn_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
506 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
507 fcn_info& finfo = p->second; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
508 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
509 finfo.clear_autoload_function (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
510 finfo.clear_user_function (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
511 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
512 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
513 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
514 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
515 symbol_table::clear_mex_functions () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
516 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
517 auto p = m_fcn_table.begin (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
518 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
519 while (p != m_fcn_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
520 (p++)->second.clear_mex_function (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
521 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
522 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
523 // Insert INF_CLASS in the set of class names that are considered |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
524 // inferior to SUP_CLASS. Return FALSE if INF_CLASS is currently |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
525 // marked as superior to SUP_CLASS. |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
526 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
527 bool |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
528 symbol_table::set_class_relationship (const std::string& sup_class, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
529 const std::string& inf_class) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
530 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
531 if (is_superiorto (inf_class, sup_class)) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
532 return false; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
533 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
534 // If sup_class doesn't have an entry in the precedence table, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
535 // this will automatically create it, and associate to it a |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
536 // singleton set {inf_class} of inferior classes. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
537 m_class_precedence_table[sup_class].insert (inf_class); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
538 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
539 return true; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
540 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
541 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
542 // Has class A been marked as superior to class B? Also returns |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
543 // TRUE if B has been marked as inferior to A, since we only keep |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
544 // one table, and convert inferiorto information to a superiorto |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
545 // relationship. Two calls are required to determine whether there |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
546 // is no relationship between two classes: |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
547 // |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
548 // if (symbol_table::is_superiorto (a, b)) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
549 // // A is superior to B, or B has been marked inferior to A. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
550 // else if (symbol_table::is_superiorto (b, a)) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
551 // // B is superior to A, or A has been marked inferior to B. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
552 // else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
553 // // No relation. |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
554 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
555 bool |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
556 symbol_table::is_superiorto (const std::string& a, const std::string& b) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
557 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
558 class_precedence_table_const_iterator p = m_class_precedence_table.find (a); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
559 // If a has no entry in the precedence table, return false |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
560 if (p == m_class_precedence_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
561 return false; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
562 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
563 const std::set<std::string>& inferior_classes = p->second; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
564 std::set<std::string>::const_iterator q = inferior_classes.find (b); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
565 return (q != inferior_classes.end ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
566 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
567 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
568 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
569 symbol_table::alias_built_in_function (const std::string& alias, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
570 const std::string& name) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
571 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
572 octave_value fcn = find_built_in_function (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
573 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
574 if (fcn.is_defined ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
575 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
576 fcn_info finfo (alias); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
577 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
578 finfo.install_built_in_function (fcn); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
579 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
580 m_fcn_table[alias] = finfo; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
581 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
582 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
583 panic ("alias: '%s' is undefined", name.c_str ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
584 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
585 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
586 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
587 symbol_table::install_built_in_dispatch (const std::string& name, |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
588 const std::string& klass) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
589 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
590 auto p = m_fcn_table.find (name); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
591 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
592 if (p != m_fcn_table.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
593 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
594 fcn_info& finfo = p->second; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
595 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
596 finfo.install_built_in_dispatch (klass); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
597 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
598 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
599 error ("install_built_in_dispatch: '%s' is undefined", name.c_str ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
600 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
601 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
602 std::list<std::string> |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
603 symbol_table::user_function_names () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
604 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
605 std::list<std::string> retval; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
606 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
607 for (const auto& nm_finfo : m_fcn_table) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
608 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
609 if (nm_finfo.second.is_user_function_defined ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
610 retval.push_back (nm_finfo.first); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
611 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
612 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
613 if (! retval.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
614 retval.sort (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
615 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
616 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
617 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
618 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
619 std::list<std::string> |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
620 symbol_table::built_in_function_names () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
621 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
622 std::list<std::string> retval; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
623 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
624 for (const auto& nm_finfo : m_fcn_table) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
625 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
626 octave_value fcn = nm_finfo.second.find_built_in_function (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
627 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
628 if (fcn.is_defined ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
629 retval.push_back (nm_finfo.first); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
630 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
631 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
632 if (! retval.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
633 retval.sort (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
634 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
635 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
636 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
637 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
638 std::list<std::string> |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
639 symbol_table::cmdline_function_names () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
640 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
641 std::list<std::string> retval; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
642 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
643 for (const auto& nm_finfo : m_fcn_table) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
644 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
645 octave_value fcn = nm_finfo.second.find_cmdline_function (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
646 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
647 if (fcn.is_defined ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
648 retval.push_back (nm_finfo.first); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
649 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
650 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
651 if (! retval.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
652 retval.sort (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
653 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
654 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
655 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
656 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
657 template <template <typename, typename...> class C, typename V, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
658 typename... A> |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
659 static octave_value |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
660 dump_container_map (const std::map<std::string, C<V, A...>>& container_map) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
661 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
662 if (container_map.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
663 return octave_value (Matrix ()); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
664 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
665 std::map<std::string, octave_value> info_map; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
666 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
667 for (const auto& nm_container : container_map) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
668 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
669 std::string nm = nm_container.first; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
670 const C<V, A...>& container = nm_container.second; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
671 info_map[nm] = Cell (container); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
672 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
673 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
674 return octave_value (info_map); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
675 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
676 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
677 octave_value |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
678 symbol_table::dump () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
679 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
680 std::map<std::string, octave_value> m |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
681 = {{ "function_info", dump_fcn_table_map () }, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
682 { "precedence_table", dump_container_map (m_class_precedence_table) }, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
683 { "parent_classes", dump_container_map (m_parent_map) } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
684 }; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
685 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
686 return octave_value (m); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
687 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
688 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
689 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
690 symbol_table::add_to_parent_map (const std::string& classname, |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
691 const std::list<std::string>& parent_list) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
692 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
693 m_parent_map[classname] = parent_list; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
694 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
695 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
696 std::list<std::string> |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
697 symbol_table::parent_classes (const std::string& dispatch_type) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
698 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
699 std::list<std::string> retval; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
700 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
701 const_parent_map_iterator it = m_parent_map.find (dispatch_type); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
702 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
703 if (it != m_parent_map.end ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
704 retval = it->second; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
705 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
706 for (const auto& nm : retval) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
707 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
708 // Search for parents of parents and append them to the list. |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
709 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
710 // FIXME: should we worry about a circular inheritance graph? |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
711 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
712 std::list<std::string> parents = parent_classes (nm); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
713 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
714 if (! parents.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
715 retval.insert (retval.end (), parents.begin (), parents.end ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
716 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
717 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
718 return retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
719 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
720 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
721 void |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
722 symbol_table::cleanup () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
723 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
724 clear_functions (); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
725 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
726 m_fcn_table.clear (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
727 m_class_precedence_table.clear (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
728 m_parent_map.clear (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
729 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
730 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
731 fcn_info * |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
732 symbol_table::get_fcn_info (const std::string& name) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
733 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
734 auto p = m_fcn_table.find (name); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
735 return p != m_fcn_table.end () ? &p->second : nullptr; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
736 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
737 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
738 octave_value |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32572
diff
changeset
|
739 symbol_table::dump_fcn_table_map () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
740 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
741 if (m_fcn_table.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
742 return octave_value (Matrix ()); |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
743 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
744 std::map<std::string, octave_value> info_map; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
745 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
746 for (const auto& nm_finfo : m_fcn_table) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
747 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
748 std::string nm = nm_finfo.first; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
749 const fcn_info& finfo = nm_finfo.second; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
750 info_map[nm] = finfo.dump (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
751 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
752 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
753 return octave_value (info_map); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
754 } |
27594
e091e09d26f0
restore some symbol table functions for backward compatibility
John W. Eaton <jwe@octave.org>
parents:
27336
diff
changeset
|
755 |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23581
diff
changeset
|
756 DEFMETHOD (__dump_symtab_info__, interp, args, , |
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23581
diff
changeset
|
757 doc: /* -*- texinfo -*- |
30888
32d2b6604a9f
doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents:
30565
diff
changeset
|
758 @deftypefn {} {@var{S} =} __dump_symtab_info__ () |
32d2b6604a9f
doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents:
30565
diff
changeset
|
759 @deftypefnx {} {@var{S} =} __dump_symtab_info__ (@var{function}) |
32d2b6604a9f
doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents:
30565
diff
changeset
|
760 Return a structure with information from the symbol table. |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
761 @end deftypefn */) |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
762 { |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
763 int nargin = args.length (); |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
764 |
20799
c349d4c91ce2
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20716
diff
changeset
|
765 if (nargin > 1) |
c349d4c91ce2
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20716
diff
changeset
|
766 print_usage (); |
c349d4c91ce2
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20716
diff
changeset
|
767 |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
768 symbol_table& symtab = interp.get_symbol_table (); |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23581
diff
changeset
|
769 |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
770 if (nargin == 0) |
23680
ef71711f6d64
rework __dump_symbol_table__ function
John W. Eaton <jwe@octave.org>
parents:
23667
diff
changeset
|
771 return symtab.dump (); |
20799
c349d4c91ce2
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20716
diff
changeset
|
772 else |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
773 { |
31718
52a5bec0fc74
style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents:
31706
diff
changeset
|
774 std::string fname = args(0).xstring_value ("__dump_symtab_info__: argument must be a function name"); |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
775 |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
776 fcn_info *finfo = symtab.get_fcn_info (fname); |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
777 |
23680
ef71711f6d64
rework __dump_symbol_table__ function
John W. Eaton <jwe@octave.org>
parents:
23667
diff
changeset
|
778 if (finfo) |
ef71711f6d64
rework __dump_symbol_table__ function
John W. Eaton <jwe@octave.org>
parents:
23667
diff
changeset
|
779 return finfo->dump (); |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
780 } |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
781 |
23680
ef71711f6d64
rework __dump_symbol_table__ function
John W. Eaton <jwe@octave.org>
parents:
23667
diff
changeset
|
782 return ovl (); |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
783 } |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
784 |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23581
diff
changeset
|
785 DEFMETHOD (__get_cmdline_fcn_txt__, interp, args, , |
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23581
diff
changeset
|
786 doc: /* -*- texinfo -*- |
30888
32d2b6604a9f
doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents:
30565
diff
changeset
|
787 @deftypefn {} {@var{str} =} __get_cmdline_fcn_txt__ (@var{name}) |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
788 Undocumented internal function. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
789 @end deftypefn */) |
20207
abf85f8cbd6c
Expand type() to work on command-line entered functions (bug #40462).
John W. Eaton <jwe@octave.org>
parents:
20172
diff
changeset
|
790 { |
20799
c349d4c91ce2
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20716
diff
changeset
|
791 if (args.length () != 1) |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
792 print_usage (); |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
793 |
31718
52a5bec0fc74
style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents:
31706
diff
changeset
|
794 std::string name = args(0).xstring_value ("__get_cmdline_fcn_txt__: first argument must be function name"); |
20207
abf85f8cbd6c
Expand type() to work on command-line entered functions (bug #40462).
John W. Eaton <jwe@octave.org>
parents:
20172
diff
changeset
|
795 |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
796 symbol_table& symtab = interp.get_symbol_table (); |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23581
diff
changeset
|
797 |
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23581
diff
changeset
|
798 octave_value ov = symtab.find_cmdline_function (name); |
20799
c349d4c91ce2
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20716
diff
changeset
|
799 |
c349d4c91ce2
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20716
diff
changeset
|
800 octave_user_function *f = ov.user_function_value (); |
20207
abf85f8cbd6c
Expand type() to work on command-line entered functions (bug #40462).
John W. Eaton <jwe@octave.org>
parents:
20172
diff
changeset
|
801 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20874
diff
changeset
|
802 octave_value_list retval; |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20874
diff
changeset
|
803 |
20799
c349d4c91ce2
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20716
diff
changeset
|
804 if (f) |
c349d4c91ce2
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20716
diff
changeset
|
805 { |
c349d4c91ce2
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20716
diff
changeset
|
806 std::ostringstream buf; |
20207
abf85f8cbd6c
Expand type() to work on command-line entered functions (bug #40462).
John W. Eaton <jwe@octave.org>
parents:
20172
diff
changeset
|
807 |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
808 tree_print_code tpc (buf); |
20582
ba2b07c13913
use new string_value method to handle value extraction errors
John W. Eaton <jwe@octave.org>
parents:
20469
diff
changeset
|
809 |
20799
c349d4c91ce2
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20716
diff
changeset
|
810 f->accept (tpc); |
c349d4c91ce2
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20716
diff
changeset
|
811 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20874
diff
changeset
|
812 retval = ovl (buf.str ()); |
20207
abf85f8cbd6c
Expand type() to work on command-line entered functions (bug #40462).
John W. Eaton <jwe@octave.org>
parents:
20172
diff
changeset
|
813 } |
abf85f8cbd6c
Expand type() to work on command-line entered functions (bug #40462).
John W. Eaton <jwe@octave.org>
parents:
20172
diff
changeset
|
814 |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
815 return retval; |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
816 } |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7752
diff
changeset
|
817 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
818 // FIXME: should we have functions like this in Octave? |
21992
03c692adf563
maint: strip trailing whitespace from files.
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
819 // |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23581
diff
changeset
|
820 // DEFMETHOD (set_variable, interp, args, , "set_variable (NAME, VALUE)") |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
821 // { |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
822 // if (args.length () != 2) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
823 // print_usage (); |
21992
03c692adf563
maint: strip trailing whitespace from files.
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
824 // |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
825 // std::string name = args(0).xstring_value ("set_variable: variable NAME must be a string"); |
21992
03c692adf563
maint: strip trailing whitespace from files.
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
826 // |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
827 // symbol_table& symtab = interp.get_symbol_table (); |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23581
diff
changeset
|
828 // |
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23581
diff
changeset
|
829 // symtab.assign (name, args(1)); |
21992
03c692adf563
maint: strip trailing whitespace from files.
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
830 // |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
831 // return ovl (); |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
832 // } |
21992
03c692adf563
maint: strip trailing whitespace from files.
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
833 // |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23581
diff
changeset
|
834 // DEFMETHOD (variable_value, interp, args, , "VALUE = variable_value (NAME)") |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
835 // { |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
836 // if (args.length () != 1) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
837 // print_usage (); |
21992
03c692adf563
maint: strip trailing whitespace from files.
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
838 // |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
839 // octave_value retval; |
21992
03c692adf563
maint: strip trailing whitespace from files.
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
840 // |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
841 // std::string name = args(0).xstring_value ("variable_value: variable NAME must be a string"); |
21992
03c692adf563
maint: strip trailing whitespace from files.
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
842 // |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
843 // symbol_table& symtab = interp.get_symbol_table (); |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23581
diff
changeset
|
844 // |
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23581
diff
changeset
|
845 // retval = symtab.varval (name); |
21992
03c692adf563
maint: strip trailing whitespace from files.
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
846 // |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
847 // if (retval.is_undefined ()) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
848 // error ("variable_value: '%s' is not a variable in the current scope", |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
849 // name.c_str ()); |
21992
03c692adf563
maint: strip trailing whitespace from files.
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
850 // |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
851 // return retval; |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21751
diff
changeset
|
852 // } |
15003
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
853 |
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
854 /* |
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
855 bug #34497: 'clear -f' does not work for command line functions |
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
856 |
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
857 This test relies on bar being a core function that is implemented in an m-file. |
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
858 If the first assert fails, this is no longer the case and the tests need to be |
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
859 updated to use some other function. |
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
860 |
22489
93ea313301f9
test: Add bug ids (<#####>) to BIST tests.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
861 %!assert <34497> (! strcmp (which ("bar"), "")) |
15003
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
862 |
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
863 %!function x = bar () |
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
864 %! x = 5; |
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
865 %!endfunction |
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
866 %!test |
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
867 %! assert (bar == 5); |
23295
c1362a71fb0e
which.m: Return a non-empty string for built-in classes and command line fcns (bug #50541);
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
868 %! assert (strcmp (which ("bar"), "command-line function")); |
15003
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
869 %! clear -f bar; |
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
870 %! assert (! strcmp (which ("bar"), "")); |
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
871 |
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
872 %!function x = bar () |
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
873 %! x = 5; |
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
874 %!endfunction |
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
875 %!test |
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
876 %! assert (bar == 5); |
23295
c1362a71fb0e
which.m: Return a non-empty string for built-in classes and command line fcns (bug #50541);
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
877 %! assert (strcmp (which ("bar"), "command-line function")); |
15003
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
878 %! clear bar; |
1f5dbfc23fc2
'clear -f' does not work for command line functions (bug #34497)
Max Brister <max@2bass.com>
parents:
14861
diff
changeset
|
879 %! assert (! strcmp (which ("bar"), "")); |
20946 | 880 */ |
29958
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29954
diff
changeset
|
881 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30888
diff
changeset
|
882 OCTAVE_END_NAMESPACE(octave) |