Mercurial > octave
annotate libinterp/corefcn/symscope.h @ 33617:ec2635a02328 bytecode-interpreter tip
maint: Merge default to bytecode-interpreter.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Tue, 21 May 2024 18:29:03 +0200 |
parents | 66a5438cc405 |
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:
32120
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 //////////////////////////////////////////////////////////////////////// |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 |
24269
f494b87d2a93
rename scope to symbol_scope
John W. Eaton <jwe@octave.org>
parents:
24263
diff
changeset
|
26 #if ! defined (octave_symscope_h) |
f494b87d2a93
rename scope to symbol_scope
John W. Eaton <jwe@octave.org>
parents:
24263
diff
changeset
|
27 #define octave_symscope_h 1 |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 #include "octave-config.h" |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 #include <deque> |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 #include <list> |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 #include <map> |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
34 #include <memory> |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 #include <set> |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 #include <string> |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 #include "glob-match.h" |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 #include "lo-regexp.h" |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 #include "oct-refcount.h" |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
42 class tree_argument_list; |
28026
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
43 class octave_user_code; |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
44 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
45 #include "ov.h" |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
46 #include "ovl.h" |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
47 #include "symrec.h" |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
49 OCTAVE_BEGIN_NAMESPACE(octave) |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
50 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
51 class OCTINTERP_API symbol_scope |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
52 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
53 private: |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
54 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
55 class symbol_scope_rep |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
56 : public std::enable_shared_from_this<symbol_scope_rep> |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
57 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
58 public: |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
59 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
60 typedef std::map<std::string, symbol_record>::const_iterator |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
61 table_const_iterator; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
62 typedef std::map<std::string, symbol_record>::iterator |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
63 table_iterator; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
64 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
65 typedef std::map<std::string, octave_value>::const_iterator |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
66 subfunctions_const_iterator; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
67 typedef std::map<std::string, octave_value>::iterator |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
68 subfunctions_iterator; |
24940
7edf1fb1d4b2
doc: Add Doxygen documentation.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
24706
diff
changeset
|
69 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
70 symbol_scope_rep (const std::string& name = "", bool add_ans = true) |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
71 : m_name (name), m_symbols (), m_subfunctions (), |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
72 m_persistent_values (), m_code (nullptr), m_fcn_name (), |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
73 m_fcn_file_name (), m_dir_name (), m_parent (), |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
74 m_primary_parent (), m_children (), m_nesting_depth (0), |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
75 m_is_static (false), m_is_primary_fcn_scope (false) |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
76 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
77 // Most scopes have ans as the first symbol, initially undefined. |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
78 if (add_ans) |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
79 insert_local ("ans"); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
80 } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
81 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
82 OCTAVE_DISABLE_COPY_MOVE (symbol_scope_rep) |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
83 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
84 ~symbol_scope_rep () = default; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
85 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
86 std::size_t num_symbols () const { return m_symbols.size (); } |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
87 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
88 // Simply inserts symbol. No non-local searching. |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
89 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
90 symbol_record insert_local (const std::string& name); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
91 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
92 void insert_symbol_record (symbol_record& sr); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
93 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
94 bool is_nested () const { return m_nesting_depth > 0; } |
24940
7edf1fb1d4b2
doc: Add Doxygen documentation.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
24706
diff
changeset
|
95 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
96 std::size_t nesting_depth () const { return m_nesting_depth; } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
97 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
98 void set_nesting_depth (std::size_t depth) { m_nesting_depth = depth; } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
99 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
100 bool is_parent () const { return ! m_children.empty (); } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
101 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
102 bool is_static () const { return m_is_static; } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
103 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
104 void mark_static () { m_is_static = true; } |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
105 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
106 std::shared_ptr<symbol_scope_rep> parent_scope_rep () const |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
107 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
108 return m_parent.lock (); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
109 } |
24940
7edf1fb1d4b2
doc: Add Doxygen documentation.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
24706
diff
changeset
|
110 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
111 std::shared_ptr<symbol_scope_rep> primary_parent_scope_rep () const |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
112 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
113 return m_primary_parent.lock (); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
114 } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
115 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
116 std::shared_ptr<symbol_scope_rep> dup () const |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
117 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
118 std::shared_ptr<symbol_scope_rep> new_sid |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
119 = std::shared_ptr<symbol_scope_rep> (new symbol_scope_rep (m_name)); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
120 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
121 for (const auto& nm_sr : m_symbols) |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
122 new_sid->m_symbols[nm_sr.first] = nm_sr.second.dup (); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
123 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
124 new_sid->m_subfunctions = m_subfunctions; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
125 new_sid->m_persistent_values = m_persistent_values; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
126 new_sid->m_subfunction_names = m_subfunction_names; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
127 new_sid->m_code = m_code; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
128 new_sid->m_fcn_name = m_fcn_name; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
129 new_sid->m_fcn_file_name = m_fcn_file_name; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
130 new_sid->m_dir_name = m_dir_name; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
131 new_sid->m_parent = m_parent; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
132 new_sid->m_primary_parent = m_primary_parent; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
133 new_sid->m_children = m_children; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
134 new_sid->m_nesting_depth = m_nesting_depth; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
135 new_sid->m_is_static = m_is_static; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
136 new_sid->m_is_primary_fcn_scope = m_is_primary_fcn_scope; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
137 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
138 return new_sid; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
139 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
140 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
141 octave_value& persistent_varref (std::size_t data_offset) |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
142 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
143 return m_persistent_values[data_offset]; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
144 } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
145 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
146 octave_value persistent_varval (std::size_t data_offset) const |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
147 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
148 auto p = m_persistent_values.find (data_offset); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
149 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
150 return p == m_persistent_values.end () ? octave_value () : p->second; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
151 } |
24940
7edf1fb1d4b2
doc: Add Doxygen documentation.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
24706
diff
changeset
|
152 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
153 symbol_record find_symbol (const std::string& name) |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
154 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
155 auto p = m_symbols.find (name); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
156 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
157 if (p == m_symbols.end ()) |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
158 return insert (name); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
159 else |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
160 return p->second; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
161 } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
162 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
163 symbol_record lookup_symbol (const std::string& name) const |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
164 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
165 auto p = m_symbols.find (name); |
24285
d22d2936f580
store subfunction names in scope instead of function object
John W. Eaton <jwe@octave.org>
parents:
24272
diff
changeset
|
166 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
167 return p == m_symbols.end () ? symbol_record () : p->second; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
168 } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
169 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
170 symbol_record insert (const std::string& name); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
171 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
172 void rename (const std::string& old_name, const std::string& new_name) |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
173 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
174 auto p = m_symbols.find (old_name); |
24940
7edf1fb1d4b2
doc: Add Doxygen documentation.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
24706
diff
changeset
|
175 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
176 if (p != m_symbols.end ()) |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
177 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
178 symbol_record sr = p->second; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
179 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
180 sr.rename (new_name); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
181 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
182 m_symbols.erase (p); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
183 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
184 m_symbols[new_name] = sr; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
185 } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
186 } |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
187 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
188 void install_subfunction (const std::string& name, |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
189 const octave_value& fval) |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
190 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
191 m_subfunctions[name] = fval; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
192 } |
28432
71c34141cc2d
refactor handling of parent functions and localfunctions
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
193 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
194 void install_nestfunction (const std::string& name, |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
195 const octave_value& fval, |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
196 const symbol_scope& fcn_scope) |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
197 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
198 m_subfunctions[name] = fval; |
28432
71c34141cc2d
refactor handling of parent functions and localfunctions
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
199 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
200 m_children.push_back (fcn_scope); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
201 } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
202 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
203 octave_value find_subfunction (const std::string& name) const; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
204 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
205 void lock_subfunctions () |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
206 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
207 for (auto& nm_sf : m_subfunctions) |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
208 nm_sf.second.lock (); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
209 } |
28026
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
210 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
211 void unlock_subfunctions () |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
212 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
213 for (auto& nm_sf : m_subfunctions) |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
214 nm_sf.second.unlock (); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
215 } |
28026
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
216 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
217 // Pairs of name, function objects. |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
218 std::map<std::string, octave_value> subfunctions () const |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
219 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
220 return m_subfunctions; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
221 } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
222 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
223 void erase_subfunctions () |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
224 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
225 m_subfunctions.clear (); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
226 } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
227 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
228 void mark_subfunctions_in_scope_as_private (const std::string& class_name); |
28026
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
229 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
230 bool has_subfunctions () const |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
231 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
232 return ! m_subfunction_names.empty (); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
233 } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
234 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
235 void stash_subfunction_names (const std::list<std::string>& names) |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
236 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
237 m_subfunction_names = names; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
238 } |
28026
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
239 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
240 std::list<std::string> subfunction_names () const |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
241 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
242 return m_subfunction_names; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
243 } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
244 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
245 std::list<octave_value> localfunctions () const; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
246 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
247 octave_value dump () const; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
248 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
249 std::string name () const { return m_name; } |
24940
7edf1fb1d4b2
doc: Add Doxygen documentation.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
24706
diff
changeset
|
250 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
251 void cache_name (const std::string& name) { m_name = name; } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
252 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
253 std::string fcn_name () const { return m_fcn_name; } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
254 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
255 void cache_fcn_name (const std::string& name) { m_fcn_name = name; } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
256 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
257 std::list<std::string> parent_fcn_names () const; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
258 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
259 octave_user_code * user_code () const { return m_code; } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
260 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
261 void set_user_code (octave_user_code *code) { m_code = code; } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
262 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
263 void set_parent (const std::shared_ptr<symbol_scope_rep>& parent); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
264 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
265 void set_primary_parent (const std::shared_ptr<symbol_scope_rep>& parent); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
266 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
267 void cache_fcn_file_name (const std::string& name) |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
268 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
269 m_fcn_file_name = name; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
270 } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
271 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
272 std::string fcn_file_name () const { return m_fcn_file_name; } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
273 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
274 void cache_dir_name (const std::string& name); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
275 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
276 std::string dir_name () const { return m_dir_name; } |
26060
edcb09d4b1f5
store nesting depth and primary parent info in nested function scopes
John W. Eaton <jwe@octave.org>
parents:
26040
diff
changeset
|
277 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
278 void mark_primary_fcn_scope () { m_is_primary_fcn_scope = true; } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
279 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
280 bool is_primary_fcn_scope () const { return m_is_primary_fcn_scope; } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
281 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
282 bool is_relative (const std::shared_ptr<symbol_scope_rep>& scope) const; |
26060
edcb09d4b1f5
store nesting depth and primary parent info in nested function scopes
John W. Eaton <jwe@octave.org>
parents:
26040
diff
changeset
|
283 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
284 void mark_as_variable (const std::string& nm); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
285 void mark_as_variables (const std::list<std::string>& lst); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
286 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
287 bool is_variable (const std::string& nm) const; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
288 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
289 void update_nest (); |
24940
7edf1fb1d4b2
doc: Add Doxygen documentation.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
24706
diff
changeset
|
290 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
291 bool look_nonlocal (const std::string& name, std::size_t offset, |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
292 symbol_record& result); |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
293 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
294 octave_value dump_symbols_map () const; |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
295 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
296 const std::map<std::string, symbol_record>& symbols () const |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
297 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
298 return m_symbols; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
299 } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
300 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
301 std::map<std::string, symbol_record>& symbols () |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
302 { |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
303 return m_symbols; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
304 } |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
305 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
306 std::list<symbol_record> symbol_list () const; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
307 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
308 private: |
24940
7edf1fb1d4b2
doc: Add Doxygen documentation.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
24706
diff
changeset
|
309 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
310 //! Name for this scope (usually the corresponding filename of the |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
311 //! function corresponding to the scope). |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
312 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
313 std::string m_name; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
314 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
315 //! Map from symbol names to symbol info. |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
316 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
317 std::map<std::string, symbol_record> m_symbols; |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
318 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
319 //! Map from symbol names to subfunctions. |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
320 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
321 std::map<std::string, octave_value> m_subfunctions; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
322 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
323 //! Map from data offset to persistent values in this scope. |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
324 std::map<std::size_t, octave_value> m_persistent_values; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
325 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
326 //! The list of subfunctions (if any) in the order they appear in |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
327 //! the function file. |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
328 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
329 std::list<std::string> m_subfunction_names; |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
330 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
331 //! The associated user code (may be null). |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
332 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
333 octave_user_code *m_code; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
334 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
335 //! Simple name of the function corresponding to this scope. |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
336 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
337 std::string m_fcn_name; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
338 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
339 //! The file name associated with m_code. |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
340 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
341 std::string m_fcn_file_name; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
342 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
343 //! The directory associated with m_code. |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
344 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
345 std::string m_dir_name; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
346 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
347 //! Parent of nested function (may be null). |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
348 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
349 std::weak_ptr<symbol_scope_rep> m_parent; |
28432
71c34141cc2d
refactor handling of parent functions and localfunctions
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
350 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
351 //! Primary (top) parent of nested function (may be null). Used |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
352 //! to determine whether two nested functions are related. |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
353 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
354 std::weak_ptr<symbol_scope_rep> m_primary_parent; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
355 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
356 //! Child nested functions. |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
357 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
358 std::vector<symbol_scope> m_children; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
359 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
360 //! If true, then this scope belongs to a nested function. |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
361 |
33333
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
362 std::size_t m_nesting_depth; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
363 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
364 //! If true then no variables can be added. |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
365 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
366 bool m_is_static; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
367 |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
368 //! If true, this is the scope of a primary function. |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
369 bool m_is_primary_fcn_scope; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
370 }; |
66a5438cc405
Make "symbol_scope_rep" a sub-class of "symbol_scope".
Markus Mützel <markus.muetzel@gmx.de>
parents:
32847
diff
changeset
|
371 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
372 public: |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
373 |
32847
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
374 symbol_scope () = delete; |
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
375 |
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
376 // Create a valid but possibly anonymous scope. If NAME is empty, the |
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
377 // scope is anonymous, but it is better to state that intent clearly |
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
378 // by using the symbol_scope::anonymous function instead. |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
379 symbol_scope (const std::string& name) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
380 : m_rep (new symbol_scope_rep (name)) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
381 { } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
382 |
32847
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
383 // FIXME: is there a way to make the following constructor private and |
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
384 // not expose the symbol_scope_rep object in the interface (see the |
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
385 // parent_scope, primary_parent_scope, and get_rep functions)? |
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
386 |
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
387 // If NEW_REP is nullptr, the scope is invalid. But if you wish to |
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
388 // create an invalid scope, it is probably better to state that intent |
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
389 // clearly by using the symbol_scope::invalid function instead. |
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
390 symbol_scope (const std::shared_ptr<symbol_scope_rep> new_rep) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
391 : m_rep (new_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
392 { } |
24377
ea3458c1d884
improve handling of invalid symbol_scope objects (bug #52607)
John W. Eaton <jwe@octave.org>
parents:
24362
diff
changeset
|
393 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
394 symbol_scope (const symbol_scope&) = default; |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
395 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
396 symbol_scope& operator = (const symbol_scope&) = default; |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
397 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
398 ~symbol_scope () = default; |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
399 |
32847
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
400 static symbol_scope invalid () |
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
401 { |
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
402 return symbol_scope (std::shared_ptr<symbol_scope_rep> (nullptr)); |
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
403 } |
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
404 |
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
405 static symbol_scope anonymous () |
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
406 { |
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
407 return symbol_scope (""); |
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
408 } |
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
409 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
410 bool is_valid () const { return bool (m_rep); } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
411 |
32847
cb3163ba60c1
be more explicit about creation of invalid vs anonymous symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
32632
diff
changeset
|
412 explicit operator bool () const { return is_valid (); } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
413 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
414 std::size_t num_symbols () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
415 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
416 return m_rep ? m_rep->num_symbols () : 0; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
417 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
418 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
419 symbol_record insert_local (const std::string& name) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
420 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
421 return m_rep ? m_rep->insert_local (name) : symbol_record (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
422 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
423 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
424 void insert_symbol_record (symbol_record& sr) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
425 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
426 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
427 m_rep->insert_symbol_record (sr); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
428 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
429 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
430 bool is_nested () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
431 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
432 return m_rep ? m_rep->is_nested () : false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
433 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
434 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
435 bool is_parent () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
436 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
437 return m_rep ? m_rep->is_parent () : false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
438 } |
26825
6e9034836239
allow handles to nested functions to work (bug #39257)
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
439 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
440 void set_nesting_depth (std::size_t depth) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
441 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
442 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
443 m_rep->set_nesting_depth (depth); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
444 } |
26060
edcb09d4b1f5
store nesting depth and primary parent info in nested function scopes
John W. Eaton <jwe@octave.org>
parents:
26040
diff
changeset
|
445 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
446 std::size_t nesting_depth () const |
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 return m_rep ? m_rep->nesting_depth () : 0; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
449 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
450 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
451 bool is_static () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
452 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
453 return m_rep ? m_rep->is_static () : false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
454 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
455 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
456 void mark_static () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
457 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
458 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
459 m_rep->mark_static (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
460 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
461 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
462 std::shared_ptr<symbol_scope_rep> parent_scope () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
463 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
464 return m_rep ? m_rep->parent_scope_rep () : nullptr; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
465 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
466 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
467 std::shared_ptr<symbol_scope_rep> primary_parent_scope () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
468 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
469 return m_rep ? m_rep->primary_parent_scope_rep () : nullptr; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
470 } |
26060
edcb09d4b1f5
store nesting depth and primary parent info in nested function scopes
John W. Eaton <jwe@octave.org>
parents:
26040
diff
changeset
|
471 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
472 symbol_scope dup () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
473 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
474 return symbol_scope (m_rep ? m_rep->dup () : nullptr); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
475 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
476 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
477 octave_value& persistent_varref (std::size_t data_offset) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
478 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
479 static octave_value dummy_value; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
480 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
481 return m_rep ? m_rep->persistent_varref (data_offset) : dummy_value; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
482 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
483 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
484 octave_value persistent_varval (std::size_t data_offset) const |
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 return m_rep ? m_rep->persistent_varval (data_offset) : octave_value (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
487 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
488 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
489 symbol_record find_symbol (const std::string& name) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
490 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
491 return m_rep ? m_rep->find_symbol (name) : symbol_record (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
492 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
493 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
494 // Like find_symbol, but does not insert. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
495 symbol_record lookup_symbol (const std::string& name) const |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
496 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
497 return m_rep ? m_rep->lookup_symbol (name) : symbol_record (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
498 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
499 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
500 symbol_record insert (const std::string& name) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
501 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
502 return m_rep ? m_rep->insert (name) : symbol_record (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
503 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
504 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
505 void rename (const std::string& old_name, const std::string& new_name) |
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 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
508 m_rep->rename (old_name, new_name); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
509 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
510 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
511 void install_subfunction (const std::string& name, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
512 const octave_value& fval) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
513 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
514 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
515 m_rep->install_subfunction (name, fval); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
516 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
517 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
518 void install_nestfunction (const std::string& name, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
519 const octave_value& fval, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
520 const symbol_scope& fcn_scope) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
521 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
522 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
523 m_rep->install_nestfunction (name, fval, fcn_scope); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
524 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
525 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
526 octave_value find_subfunction (const std::string& name) const |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
527 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
528 return m_rep ? m_rep->find_subfunction (name) : octave_value (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
529 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
530 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
531 void lock_subfunctions () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
532 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
533 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
534 m_rep->lock_subfunctions (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
535 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
536 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
537 void unlock_subfunctions () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
538 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
539 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
540 m_rep->unlock_subfunctions (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
541 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
542 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
543 std::map<std::string, octave_value> subfunctions () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
544 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
545 return (m_rep |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
546 ? m_rep->subfunctions () |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
547 : std::map<std::string, octave_value> ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
548 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
549 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
550 void erase_subfunctions () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
551 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
552 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
553 m_rep->erase_subfunctions (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
554 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
555 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
556 void mark_subfunctions_in_scope_as_private (const std::string& class_name) |
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 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
559 m_rep->mark_subfunctions_in_scope_as_private (class_name); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
560 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
561 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
562 bool has_subfunctions () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
563 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
564 return m_rep ? m_rep->has_subfunctions () : false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
565 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
566 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
567 void stash_subfunction_names (const std::list<std::string>& names) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
568 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
569 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
570 m_rep->stash_subfunction_names (names); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
571 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
572 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
573 std::list<std::string> subfunction_names () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
574 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
575 return m_rep ? m_rep->subfunction_names () : std::list<std::string> (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
576 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
577 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
578 // List of function handle objects. |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
579 std::list<octave_value> localfunctions () const; |
28432
71c34141cc2d
refactor handling of parent functions and localfunctions
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
580 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
581 octave_value dump () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
582 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
583 return m_rep ? m_rep->dump () : octave_value (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
584 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
585 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
586 std::string name () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
587 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
588 return m_rep ? m_rep->name () : ""; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
589 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
590 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
591 void cache_name (const std::string& name) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
592 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
593 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
594 m_rep->cache_name (name); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
595 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
596 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
597 std::string fcn_name () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
598 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
599 return m_rep ? m_rep->fcn_name () : ""; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
600 } |
28432
71c34141cc2d
refactor handling of parent functions and localfunctions
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
601 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
602 void cache_fcn_name (const std::string& name) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
603 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
604 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
605 m_rep->cache_fcn_name (name); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
606 } |
28432
71c34141cc2d
refactor handling of parent functions and localfunctions
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
607 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
608 std::list<std::string> parent_fcn_names () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
609 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
610 return m_rep ? m_rep->parent_fcn_names () : std::list<std::string> (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
611 } |
28432
71c34141cc2d
refactor handling of parent functions and localfunctions
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
612 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
613 octave_user_code * user_code () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
614 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
615 return m_rep ? m_rep->user_code () : nullptr; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
616 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
617 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
618 void set_user_code (octave_user_code *code) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
619 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
620 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
621 m_rep->set_user_code (code); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
622 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
623 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
624 void set_parent (const symbol_scope& p) |
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 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
627 m_rep->set_parent (p.get_rep ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
628 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
629 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
630 void set_primary_parent (const symbol_scope& p) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
631 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
632 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
633 m_rep->set_primary_parent (p.get_rep ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
634 } |
26060
edcb09d4b1f5
store nesting depth and primary parent info in nested function scopes
John W. Eaton <jwe@octave.org>
parents:
26040
diff
changeset
|
635 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
636 void cache_fcn_file_name (const std::string& name) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
637 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
638 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
639 m_rep->cache_fcn_file_name (name); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
640 } |
28026
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
641 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
642 void cache_dir_name (const std::string& name) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
643 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
644 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
645 m_rep->cache_dir_name (name); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
646 } |
28026
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
647 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
648 std::string fcn_file_name () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
649 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
650 return m_rep ? m_rep->fcn_file_name () : ""; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
651 } |
28026
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
652 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
653 std::string dir_name () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
654 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
655 return m_rep ? m_rep->dir_name () : ""; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
656 } |
28026
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
657 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
658 void mark_primary_fcn_scope () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
659 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
660 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
661 m_rep->mark_primary_fcn_scope (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
662 } |
28432
71c34141cc2d
refactor handling of parent functions and localfunctions
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
663 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
664 bool is_primary_fcn_scope () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
665 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
666 return m_rep ? m_rep->is_primary_fcn_scope () : false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
667 } |
28432
71c34141cc2d
refactor handling of parent functions and localfunctions
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
668 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
669 bool is_relative (const symbol_scope& scope) const |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
670 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
671 return m_rep ? m_rep->is_relative (scope.get_rep ()) : false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
672 } |
26060
edcb09d4b1f5
store nesting depth and primary parent info in nested function scopes
John W. Eaton <jwe@octave.org>
parents:
26040
diff
changeset
|
673 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
674 void mark_as_variable (const std::string& nm) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
675 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
676 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
677 m_rep->mark_as_variable (nm); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
678 } |
29864
e2e493712818
improve previous change for command syntax parsing (bug #60882)
John W. Eaton <jwe@octave.org>
parents:
29572
diff
changeset
|
679 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
680 void mark_as_variables (const std::list<std::string>& lst) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
681 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
682 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
683 m_rep->mark_as_variables (lst); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
684 } |
29864
e2e493712818
improve previous change for command syntax parsing (bug #60882)
John W. Eaton <jwe@octave.org>
parents:
29572
diff
changeset
|
685 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
686 bool is_variable (const std::string& nm) const |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
687 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
688 return m_rep ? m_rep->is_variable (nm) : false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
689 } |
29864
e2e493712818
improve previous change for command syntax parsing (bug #60882)
John W. Eaton <jwe@octave.org>
parents:
29572
diff
changeset
|
690 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
691 void update_nest () |
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 if (m_rep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
694 m_rep->update_nest (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
695 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
696 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
697 bool look_nonlocal (const std::string& name, std::size_t offset, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
698 symbol_record& result) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
699 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
700 return m_rep ? m_rep->look_nonlocal (name, offset, result) : false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
701 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
702 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
703 std::shared_ptr<symbol_scope_rep> get_rep () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
704 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
705 return m_rep; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
706 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
707 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
708 friend bool operator == (const symbol_scope& a, const symbol_scope& b) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
709 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
710 return a.m_rep == b.m_rep; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
711 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
712 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
713 friend bool operator != (const symbol_scope& a, const symbol_scope& b) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
714 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
715 return a.m_rep != b.m_rep; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
716 } |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
717 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
718 const std::map<std::string, symbol_record>& symbols () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
719 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
720 static const std::map<std::string, symbol_record> empty_map; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
721 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
722 return m_rep ? m_rep->symbols () : empty_map; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
723 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
724 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
725 std::map<std::string, symbol_record>& symbols () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
726 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
727 static std::map<std::string, symbol_record> empty_map; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
728 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
729 return m_rep ? m_rep->symbols () : empty_map; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
730 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
731 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
732 std::list<symbol_record> symbol_list () const |
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 static const std::list<symbol_record> empty_list; |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
735 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
736 return m_rep ? m_rep->symbol_list () : empty_list; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
737 } |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
738 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
739 private: |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
740 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
741 std::shared_ptr<symbol_scope_rep> m_rep; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
742 }; |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
743 |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
744 OCTAVE_END_NAMESPACE(octave) |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
745 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
746 #endif |