annotate libinterp/corefcn/symrec.h @ 25203:72ea868ca63a stable

allow function parameters to be global (bug #53579) * symrec.h (symbol_record::unbind_global_rep): New function. * symscope.h (symbol_scope::refresh): Use it to also unbind global symbols. * test/bug-53579.tst: New file. * test/module.mk: Update.
author John W. Eaton <jwe@octave.org>
date Wed, 11 Apr 2018 00:07:06 -0400
parents d12271fe1504
children 00f796120a6d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1 /*
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2
25054
6652d3823428 maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents: 24991
diff changeset
3 Copyright (C) 1993-2018 John W. Eaton
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4 Copyright (C) 2009 VZLU Prague
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6 This file is part of Octave.
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24519
diff changeset
8 Octave is free software: you can redistribute it and/or modify it
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24519
diff changeset
10 the Free Software Foundation, either version 3 of the License, or
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
11 (at your option) any later version.
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
13 Octave is distributed in the hope that it will be useful, but
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 WITHOUT ANY WARRANTY; without even the implied warranty of
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16 GNU General Public License for more details.
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24519
diff changeset
20 <https://www.gnu.org/licenses/>.
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22 */
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
23
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
24 #if ! defined (octave_symrec_h)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25 #define octave_symrec_h 1
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 #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
28
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29 #include <deque>
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30 #include <list>
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
31 #include <memory>
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32 #include <string>
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 class octave_user_function;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36 #include "ov.h"
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37 #include "ovl.h"
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39 namespace octave
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
40 {
24361
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24356
diff changeset
41 class symbol_scope_rep;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
42
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43 class symbol_record
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 public:
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 typedef size_t context_id;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49 // generic variable
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50 static const unsigned int local = 1;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
52 // varargin, argn, .nargin., .nargout.
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53 // (FIXME: is this really used now?)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54 static const unsigned int automatic = 2;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56 // formal parameter
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57 static const unsigned int formal = 4;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
58
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59 // not listed or cleared (.nargin., .nargout.)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60 static const unsigned int hidden = 8;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62 // inherited from parent scope; not cleared at function exit
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63 static const unsigned int inherited = 16;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65 // global (redirects to global scope)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66 static const unsigned int global = 32;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
67
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68 // not cleared at function exit
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69 static const unsigned int persistent = 64;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71 // this symbol may NOT become a variable.
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72 // (symbol added to a static workspace)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73 static const unsigned int added_static = 128;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
74
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75 private:
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
76
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
77 class symbol_record_rep
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
78 {
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
79 public:
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
80
24361
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24356
diff changeset
81 symbol_record_rep (const std::string& nm, const octave_value& v,
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24356
diff changeset
82 unsigned int sc)
24706
30e1d0bf7ade use weak_ptr for symbol_scope_rep and symbol_record_rep pointers (bug #53092)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
83 : m_storage_class (sc), m_name (nm), m_fwd_scope (),
24386
a164fd6e7e7b eliminate unused symbol_record member variable and related functions
John W. Eaton <jwe@octave.org>
parents: 24378
diff changeset
84 m_fwd_rep (), m_value_stack ()
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
85 {
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
86 m_value_stack.push_back (v);
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
87 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
88
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
89 // No copying!
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
90
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
91 symbol_record_rep (const symbol_record_rep& ov) = delete;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
92
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
93 symbol_record_rep& operator = (const symbol_record_rep&) = delete;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
94
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
95 ~symbol_record_rep (void) = default;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
96
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
97 void assign (const octave_value& value, context_id context)
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
98 {
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
99 varref(context) = value;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
100 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
101
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
102 void assign (octave_value::assign_op op,
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
103 const std::string& type,
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
104 const std::list<octave_value_list>& idx,
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
105 const octave_value& value, context_id context)
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
106 {
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
107 varref(context).assign (op, type, idx, value);
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
108 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
109
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
110 void assign (octave_value::assign_op op, const octave_value& value,
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
111 context_id context)
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
112 {
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
113 varref(context).assign (op, value);
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
114 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
115
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
116 void do_non_const_unary_op (octave_value::unary_op op,
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
117 context_id context)
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
118 {
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
119 varref(context).do_non_const_unary_op (op);
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
120 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
121
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
122 void do_non_const_unary_op (octave_value::unary_op op,
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
123 const std::string& type,
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
124 const std::list<octave_value_list>& idx,
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
125 context_id context)
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
126 {
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
127 varref(context).do_non_const_unary_op (op, type, idx);
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
128 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
129
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
130 context_id get_fwd_scope_context (void) const;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
131
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
132 octave_value& varref (context_id context)
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
133 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
134 if (auto t_fwd_rep = m_fwd_rep.lock ())
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
135 return t_fwd_rep->varref (get_fwd_scope_context ());
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
136
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
137 if (is_persistent ())
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
138 context = 0;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
139
24325
bc65aa8a5ff1 don't store persistent variables separately in scope object
John W. Eaton <jwe@octave.org>
parents: 24324
diff changeset
140 context_id n = m_value_stack.size ();
bc65aa8a5ff1 don't store persistent variables separately in scope object
John W. Eaton <jwe@octave.org>
parents: 24324
diff changeset
141 while (n++ <= context)
bc65aa8a5ff1 don't store persistent variables separately in scope object
John W. Eaton <jwe@octave.org>
parents: 24324
diff changeset
142 m_value_stack.push_back (octave_value ());
bc65aa8a5ff1 don't store persistent variables separately in scope object
John W. Eaton <jwe@octave.org>
parents: 24324
diff changeset
143
bc65aa8a5ff1 don't store persistent variables separately in scope object
John W. Eaton <jwe@octave.org>
parents: 24324
diff changeset
144 return m_value_stack[context];
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
145 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
146
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
147 octave_value varval (context_id context) const
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
148 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
149 if (auto t_fwd_rep = m_fwd_rep.lock ())
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
150 return t_fwd_rep->varval (get_fwd_scope_context ());
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
151
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
152 if (is_persistent ())
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
153 context = 0;
24325
bc65aa8a5ff1 don't store persistent variables separately in scope object
John W. Eaton <jwe@octave.org>
parents: 24324
diff changeset
154
bc65aa8a5ff1 don't store persistent variables separately in scope object
John W. Eaton <jwe@octave.org>
parents: 24324
diff changeset
155 if (context < m_value_stack.size ())
bc65aa8a5ff1 don't store persistent variables separately in scope object
John W. Eaton <jwe@octave.org>
parents: 24324
diff changeset
156 return m_value_stack[context];
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
157 else
24325
bc65aa8a5ff1 don't store persistent variables separately in scope object
John W. Eaton <jwe@octave.org>
parents: 24324
diff changeset
158 return octave_value ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
159 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
160
24348
64691264dd21 eliminate some uses of decl_scope in symbol_record class
John W. Eaton <jwe@octave.org>
parents: 24325
diff changeset
161 void push_context (void)
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
162 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
163 if (auto t_fwd_rep = m_fwd_rep.lock ())
24348
64691264dd21 eliminate some uses of decl_scope in symbol_record class
John W. Eaton <jwe@octave.org>
parents: 24325
diff changeset
164 return;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
165
24348
64691264dd21 eliminate some uses of decl_scope in symbol_record class
John W. Eaton <jwe@octave.org>
parents: 24325
diff changeset
166 if (! (is_persistent () || is_global ()))
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
167 m_value_stack.push_back (octave_value ());
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
168 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
169
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
170 // If pop_context returns 0, we are out of values and this element
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
171 // of the symbol table should be deleted. This can happen for
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
172 // functions like
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
173 //
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
174 // function foo (n)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
175 // if (n > 0)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
176 // foo (n-1);
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
177 // else
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
178 // eval ("x = 1");
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
179 // endif
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
180 // endfunction
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
181 //
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
182 // Here, X should only exist in the final stack frame.
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
183
24969
0cd310ac0d77 * libinterp/corefcn/symrec.h: consistent use of context_id.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 24706
diff changeset
184 context_id pop_context (void)
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
185 {
24969
0cd310ac0d77 * libinterp/corefcn/symrec.h: consistent use of context_id.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 24706
diff changeset
186 context_id retval = 1;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
187
24348
64691264dd21 eliminate some uses of decl_scope in symbol_record class
John W. Eaton <jwe@octave.org>
parents: 24325
diff changeset
188 if (auto t_fwd_rep = m_fwd_rep.lock ())
64691264dd21 eliminate some uses of decl_scope in symbol_record class
John W. Eaton <jwe@octave.org>
parents: 24325
diff changeset
189 return retval;
64691264dd21 eliminate some uses of decl_scope in symbol_record class
John W. Eaton <jwe@octave.org>
parents: 24325
diff changeset
190
64691264dd21 eliminate some uses of decl_scope in symbol_record class
John W. Eaton <jwe@octave.org>
parents: 24325
diff changeset
191 if (! (is_persistent () || is_global ()))
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
192 {
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
193 m_value_stack.pop_back ();
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
194 retval = m_value_stack.size ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
195 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
196
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
197 return retval;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
198 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
199
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
200 void clear (context_id context)
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
201 {
24977
2b040946dc69 improve handling of clear for globals, forwarded symbols (bug #53027)
John W. Eaton <jwe@octave.org>
parents: 24969
diff changeset
202 // For globals, break the link to the global value first, then
2b040946dc69 improve handling of clear for globals, forwarded symbols (bug #53027)
John W. Eaton <jwe@octave.org>
parents: 24969
diff changeset
203 // clear the local value.
24348
64691264dd21 eliminate some uses of decl_scope in symbol_record class
John W. Eaton <jwe@octave.org>
parents: 24325
diff changeset
204
24456
2706adccf4e9 fix binding for global variables in script files (bug #52722)
John W. Eaton <jwe@octave.org>
parents: 24386
diff changeset
205 if (is_global ())
25201
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
206 unbind_global_rep ();
24348
64691264dd21 eliminate some uses of decl_scope in symbol_record class
John W. Eaton <jwe@octave.org>
parents: 24325
diff changeset
207
64691264dd21 eliminate some uses of decl_scope in symbol_record class
John W. Eaton <jwe@octave.org>
parents: 24325
diff changeset
208 if (! (is_hidden () || is_inherited ()))
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
209 {
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
210 assign (octave_value (), context);
24348
64691264dd21 eliminate some uses of decl_scope in symbol_record class
John W. Eaton <jwe@octave.org>
parents: 24325
diff changeset
211
24977
2b040946dc69 improve handling of clear for globals, forwarded symbols (bug #53027)
John W. Eaton <jwe@octave.org>
parents: 24969
diff changeset
212 // For persistent values, we clear the value then unmark so
2b040946dc69 improve handling of clear for globals, forwarded symbols (bug #53027)
John W. Eaton <jwe@octave.org>
parents: 24969
diff changeset
213 // that we clear the first element of the value stack.
2b040946dc69 improve handling of clear for globals, forwarded symbols (bug #53027)
John W. Eaton <jwe@octave.org>
parents: 24969
diff changeset
214
24348
64691264dd21 eliminate some uses of decl_scope in symbol_record class
John W. Eaton <jwe@octave.org>
parents: 24325
diff changeset
215 if (is_persistent ())
64691264dd21 eliminate some uses of decl_scope in symbol_record class
John W. Eaton <jwe@octave.org>
parents: 24325
diff changeset
216 unmark_persistent ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
217 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
218 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
219
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
220 bool is_defined (context_id context) const
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
221 {
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
222 return varval (context).is_defined ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
223 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
224
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
225 bool is_variable (context_id context) const
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
226 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
227 if (auto t_fwd_rep = m_fwd_rep.lock ())
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
228 return t_fwd_rep->is_variable (context);
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
229
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
230 return (! is_local () || is_defined (context));
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
231 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
232
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
233 bool is_local (void) const
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
234 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
235 if (auto t_fwd_rep = m_fwd_rep.lock ())
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
236 return t_fwd_rep->is_local ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
237
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
238 return m_storage_class & local;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
239 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
240
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
241 bool is_automatic (void) const
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
242 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
243 if (auto t_fwd_rep = m_fwd_rep.lock ())
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
244 return t_fwd_rep->is_automatic ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
245
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
246 return m_storage_class & automatic;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
247 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
248
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
249 bool is_formal (void) const
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
250 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
251 if (auto t_fwd_rep = m_fwd_rep.lock ())
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
252 return t_fwd_rep->is_formal ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
253
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
254 return m_storage_class & formal;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
255 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
256
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
257 bool is_hidden (void) const
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
258 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
259 if (auto t_fwd_rep = m_fwd_rep.lock ())
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
260 return t_fwd_rep->is_hidden ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
261
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
262 return m_storage_class & hidden;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
263 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
264
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
265 bool is_inherited (void) const
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
266 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
267 if (auto t_fwd_rep = m_fwd_rep.lock ())
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
268 return t_fwd_rep->is_inherited ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
269
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
270 return m_storage_class & inherited;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
271 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
272
24977
2b040946dc69 improve handling of clear for globals, forwarded symbols (bug #53027)
John W. Eaton <jwe@octave.org>
parents: 24969
diff changeset
273 bool is_forwarded (void) const
2b040946dc69 improve handling of clear for globals, forwarded symbols (bug #53027)
John W. Eaton <jwe@octave.org>
parents: 24969
diff changeset
274 {
2b040946dc69 improve handling of clear for globals, forwarded symbols (bug #53027)
John W. Eaton <jwe@octave.org>
parents: 24969
diff changeset
275 return ! m_fwd_rep.expired ();
2b040946dc69 improve handling of clear for globals, forwarded symbols (bug #53027)
John W. Eaton <jwe@octave.org>
parents: 24969
diff changeset
276 }
2b040946dc69 improve handling of clear for globals, forwarded symbols (bug #53027)
John W. Eaton <jwe@octave.org>
parents: 24969
diff changeset
277
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
278 bool is_global (void) const
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
279 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
280 if (auto t_fwd_rep = m_fwd_rep.lock ())
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
281 return t_fwd_rep->is_global ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
282
25201
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
283 return is_marked_global ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
284 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
285
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
286 bool is_persistent (void) const
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
287 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
288 if (auto t_fwd_rep = m_fwd_rep.lock ())
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
289 return t_fwd_rep->is_persistent ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
290
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
291 return m_storage_class & persistent;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
292 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
293
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
294 bool is_added_static (void) const
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
295 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
296 if (auto t_fwd_rep = m_fwd_rep.lock ())
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
297 return t_fwd_rep->is_added_static ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
298
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
299 return m_storage_class & added_static;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
300 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
301
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
302 void mark_local (void)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
303 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
304 if (auto t_fwd_rep = m_fwd_rep.lock ())
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
305 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
306 t_fwd_rep->mark_local ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
307 return;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
308 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
309
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
310 m_storage_class |= local;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
311 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
312
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
313 void mark_automatic (void)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
314 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
315 if (auto t_fwd_rep = m_fwd_rep.lock ())
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
316 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
317 t_fwd_rep->mark_automatic ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
318 return;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
319 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
320
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
321 m_storage_class |= automatic;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
322 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
323
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
324 void mark_formal (void)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
325 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
326 if (auto t_fwd_rep = m_fwd_rep.lock ())
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
327 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
328 t_fwd_rep->mark_formal ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
329 return;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
330 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
331
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
332 m_storage_class |= formal;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
333 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
334
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
335 void mark_hidden (void)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
336 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
337 if (auto t_fwd_rep = m_fwd_rep.lock ())
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
338 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
339 t_fwd_rep->mark_hidden ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
340 return;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
341 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
342
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
343 m_storage_class |= hidden;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
344 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
345
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
346 void mark_inherited (void)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
347 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
348 if (auto t_fwd_rep = m_fwd_rep.lock ())
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
349 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
350 t_fwd_rep->mark_inherited ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
351 return;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
352 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
353
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
354 m_storage_class |= inherited;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
355 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
356
24352
bff8e3884a88 restructure global variable handling in symbol table
John W. Eaton <jwe@octave.org>
parents: 24351
diff changeset
357 // This flag should only be set for a symbol record that is
bff8e3884a88 restructure global variable handling in symbol table
John W. Eaton <jwe@octave.org>
parents: 24351
diff changeset
358 // actually in the global symbol_scope, and that should only
bff8e3884a88 restructure global variable handling in symbol table
John W. Eaton <jwe@octave.org>
parents: 24351
diff changeset
359 // happen when it is added to the global symbol_scope.
bff8e3884a88 restructure global variable handling in symbol table
John W. Eaton <jwe@octave.org>
parents: 24351
diff changeset
360
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
361 void mark_global (void)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
362 {
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
363 m_storage_class |= global;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
364 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
365
25201
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
366 bool is_marked_global (void) const
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
367 {
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
368 return m_storage_class & global;
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
369 }
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
370
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
371 void mark_persistent (void)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
372 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
373 if (auto t_fwd_rep = m_fwd_rep.lock ())
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
374 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
375 t_fwd_rep->mark_persistent ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
376 return;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
377 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
378
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
379 if (is_global ())
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
380 error ("can't make global variable %s persistent", m_name.c_str ());
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
381
24458
516437d2194d don't allow function parameters (in or out) to be persistent
John W. Eaton <jwe@octave.org>
parents: 24456
diff changeset
382 if (is_formal ())
516437d2194d don't allow function parameters (in or out) to be persistent
John W. Eaton <jwe@octave.org>
parents: 24456
diff changeset
383 error ("can't make function parameter %s persistent", m_name.c_str ());
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
384 m_storage_class |= persistent;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
385 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
386
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
387 void mark_added_static (void)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
388 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
389 if (auto t_fwd_rep = m_fwd_rep.lock ())
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
390 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
391 t_fwd_rep->mark_added_static ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
392 return;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
393 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
394
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
395 m_storage_class |= added_static;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
396 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
397
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
398 void unmark_local (void)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
399 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
400 if (auto t_fwd_rep = m_fwd_rep.lock ())
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
401 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
402 t_fwd_rep->unmark_local ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
403 return;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
404 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
405
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
406 m_storage_class &= ~local;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
407 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
408
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
409 void unmark_automatic (void)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
410 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
411 if (auto t_fwd_rep = m_fwd_rep.lock ())
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
412 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
413 t_fwd_rep->unmark_automatic ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
414 return;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
415 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
416
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
417 m_storage_class &= ~automatic;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
418 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
419
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
420 void unmark_formal (void)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
421 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
422 if (auto t_fwd_rep = m_fwd_rep.lock ())
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
423 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
424 t_fwd_rep->unmark_formal ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
425 return;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
426 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
427
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
428 m_storage_class &= ~formal;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
429 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
430
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
431 void unmark_hidden (void)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
432 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
433 if (auto t_fwd_rep = m_fwd_rep.lock ())
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
434 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
435 t_fwd_rep->unmark_hidden ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
436 return;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
437 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
438
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
439 m_storage_class &= ~hidden;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
440 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
441
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
442 void unmark_inherited (void)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
443 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
444 if (auto t_fwd_rep = m_fwd_rep.lock ())
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
445 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
446 t_fwd_rep->unmark_inherited ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
447 return;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
448 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
449
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
450 m_storage_class &= ~inherited;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
451 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
452
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
453 void unmark_persistent (void)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
454 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
455 if (auto t_fwd_rep = m_fwd_rep.lock ())
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
456 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
457 t_fwd_rep->unmark_persistent ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
458 return;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
459 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
460
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
461 m_storage_class &= ~persistent;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
462 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
463
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
464 void unmark_added_static (void)
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
465 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
466 if (auto t_fwd_rep = m_fwd_rep.lock ())
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
467 {
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
468 t_fwd_rep->unmark_added_static ();
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
469 return;
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
470 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
471
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
472 m_storage_class &= ~added_static;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
473 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
474
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
475 unsigned int storage_class (void) const { return m_storage_class; }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
476
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
477 void init_persistent (void);
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
478
24706
30e1d0bf7ade use weak_ptr for symbol_scope_rep and symbol_record_rep pointers (bug #53092)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
479 void bind_fwd_rep (const std::shared_ptr<symbol_scope_rep>& fwd_scope,
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
480 const std::shared_ptr<symbol_record_rep>& fwd_rep)
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
481 {
24456
2706adccf4e9 fix binding for global variables in script files (bug #52722)
John W. Eaton <jwe@octave.org>
parents: 24386
diff changeset
482 // If this object is already bound to another scope (for
2706adccf4e9 fix binding for global variables in script files (bug #52722)
John W. Eaton <jwe@octave.org>
parents: 24386
diff changeset
483 // example, a variable in a script or nested function is bound
2706adccf4e9 fix binding for global variables in script files (bug #52722)
John W. Eaton <jwe@octave.org>
parents: 24386
diff changeset
484 // to the enclosing scope), then bind that object to the next
2706adccf4e9 fix binding for global variables in script files (bug #52722)
John W. Eaton <jwe@octave.org>
parents: 24386
diff changeset
485 // scope. FIXME: can this happen for any other reason than we
2706adccf4e9 fix binding for global variables in script files (bug #52722)
John W. Eaton <jwe@octave.org>
parents: 24386
diff changeset
486 // are making a variable in a script global?
2706adccf4e9 fix binding for global variables in script files (bug #52722)
John W. Eaton <jwe@octave.org>
parents: 24386
diff changeset
487
2706adccf4e9 fix binding for global variables in script files (bug #52722)
John W. Eaton <jwe@octave.org>
parents: 24386
diff changeset
488 if (auto t_fwd_rep = m_fwd_rep.lock ())
2706adccf4e9 fix binding for global variables in script files (bug #52722)
John W. Eaton <jwe@octave.org>
parents: 24386
diff changeset
489 {
25201
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
490 // If this is the symbol in the global scope, then don't
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
491 // forward again!
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
492
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
493 if (t_fwd_rep->is_marked_global ())
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
494 return;
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
495
24456
2706adccf4e9 fix binding for global variables in script files (bug #52722)
John W. Eaton <jwe@octave.org>
parents: 24386
diff changeset
496 t_fwd_rep->bind_fwd_rep (fwd_scope, fwd_rep);
2706adccf4e9 fix binding for global variables in script files (bug #52722)
John W. Eaton <jwe@octave.org>
parents: 24386
diff changeset
497 }
2706adccf4e9 fix binding for global variables in script files (bug #52722)
John W. Eaton <jwe@octave.org>
parents: 24386
diff changeset
498
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
499 m_fwd_scope = fwd_scope;
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
500 m_fwd_rep = fwd_rep;
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
501 }
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
502
25201
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
503 void unbind_fwd_rep (void)
24352
bff8e3884a88 restructure global variable handling in symbol table
John W. Eaton <jwe@octave.org>
parents: 24351
diff changeset
504 {
25201
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
505 // When unbinding variables in a script scope, we only break
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
506 // the immediate link. By doing that, we ensure that any
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
507 // variables that are made global in a script remain linked as
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
508 // globals in the enclosing scope.
24456
2706adccf4e9 fix binding for global variables in script files (bug #52722)
John W. Eaton <jwe@octave.org>
parents: 24386
diff changeset
509
24706
30e1d0bf7ade use weak_ptr for symbol_scope_rep and symbol_record_rep pointers (bug #53092)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
510 m_fwd_scope = std::weak_ptr<symbol_scope_rep> ();
24352
bff8e3884a88 restructure global variable handling in symbol table
John W. Eaton <jwe@octave.org>
parents: 24351
diff changeset
511 m_fwd_rep.reset ();
bff8e3884a88 restructure global variable handling in symbol table
John W. Eaton <jwe@octave.org>
parents: 24351
diff changeset
512 }
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
513
25201
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
514 void unbind_global_rep (void)
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
515 {
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
516 // Break the link to the global symbol_record_rep. These must
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
517 // forwarded, so we don't do anything unless the forward rep
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
518 // points to something.
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
519
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
520 if (auto t_fwd_rep = m_fwd_rep.lock ())
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
521 {
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
522 if (t_fwd_rep->is_marked_global ())
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
523 {
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
524 // The rep this object points to is in the global
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
525 // scope, so delete the link to it.
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
526
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
527 m_fwd_scope = std::weak_ptr<symbol_scope_rep> ();
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
528 m_fwd_rep.reset ();
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
529 }
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
530 else
25202
d12271fe1504 fix cut/paste error in previous change (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25201
diff changeset
531 t_fwd_rep->unbind_global_rep ();
25201
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
532 }
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
533 }
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
534
24706
30e1d0bf7ade use weak_ptr for symbol_scope_rep and symbol_record_rep pointers (bug #53092)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
535 std::shared_ptr<symbol_record_rep>
30e1d0bf7ade use weak_ptr for symbol_scope_rep and symbol_record_rep pointers (bug #53092)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
536 dup (const std::shared_ptr<symbol_scope_rep>& new_scope) const;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
537
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
538 octave_value dump (context_id context) const;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
539
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
540 std::string name (void) const { return m_name; }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
541
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
542 void rename (const std::string& new_name) { m_name = new_name; }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
543
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
544 private:
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
545
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
546 unsigned int m_storage_class;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
547
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
548 std::string m_name;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
549
24706
30e1d0bf7ade use weak_ptr for symbol_scope_rep and symbol_record_rep pointers (bug #53092)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
550 std::weak_ptr<symbol_scope_rep> m_fwd_scope;
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
551
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
552 std::weak_ptr<symbol_record_rep> m_fwd_rep;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
553
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
554 std::deque<octave_value> m_value_stack;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
555 };
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
556
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
557 public:
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
558
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
559 symbol_record (const std::string& nm = "",
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
560 const octave_value& v = octave_value (),
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
561 unsigned int sc = local)
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
562 : m_rep (new symbol_record_rep (nm, v, sc))
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
563 { }
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
564
24991
831389905438 omit argument name from default copy ctors and assignment operators
John W. Eaton <jwe@octave.org>
parents: 24982
diff changeset
565 symbol_record (const symbol_record&) = default;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
566
24991
831389905438 omit argument name from default copy ctors and assignment operators
John W. Eaton <jwe@octave.org>
parents: 24982
diff changeset
567 symbol_record& operator = (const symbol_record&) = default;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
568
24271
0dd6c909baa2 use shared_ptr and weak_ptr to manage symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24269
diff changeset
569 ~symbol_record (void) = default;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
570
24706
30e1d0bf7ade use weak_ptr for symbol_scope_rep and symbol_record_rep pointers (bug #53092)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
571 symbol_record dup (const std::shared_ptr<symbol_scope_rep>& sid) const
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
572 {
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
573 return symbol_record (m_rep->dup (sid));
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
574 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
575
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
576 std::string name (void) const { return m_rep->name (); }
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
577
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
578 void rename (const std::string& new_name) { m_rep->rename (new_name); }
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
579
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
580 octave_value
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
581 find (context_id context,
24519
6c31b0376908 move part of symbol_record::find to header file to allow inlining
John W. Eaton <jwe@octave.org>
parents: 24458
diff changeset
582 const octave_value_list& args = octave_value_list ()) const
6c31b0376908 move part of symbol_record::find to header file to allow inlining
John W. Eaton <jwe@octave.org>
parents: 24458
diff changeset
583 {
6c31b0376908 move part of symbol_record::find to header file to allow inlining
John W. Eaton <jwe@octave.org>
parents: 24458
diff changeset
584 octave_value retval = varval (context);
6c31b0376908 move part of symbol_record::find to header file to allow inlining
John W. Eaton <jwe@octave.org>
parents: 24458
diff changeset
585
6c31b0376908 move part of symbol_record::find to header file to allow inlining
John W. Eaton <jwe@octave.org>
parents: 24458
diff changeset
586 if (retval.is_undefined ())
6c31b0376908 move part of symbol_record::find to header file to allow inlining
John W. Eaton <jwe@octave.org>
parents: 24458
diff changeset
587 return find_function (name (), args);
6c31b0376908 move part of symbol_record::find to header file to allow inlining
John W. Eaton <jwe@octave.org>
parents: 24458
diff changeset
588
6c31b0376908 move part of symbol_record::find to header file to allow inlining
John W. Eaton <jwe@octave.org>
parents: 24458
diff changeset
589 return retval;
6c31b0376908 move part of symbol_record::find to header file to allow inlining
John W. Eaton <jwe@octave.org>
parents: 24458
diff changeset
590 }
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
591
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
592 void assign (const octave_value& value, context_id context)
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
593 {
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
594 m_rep->assign (value, context);
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
595 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
596
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
597 void assign (octave_value::assign_op op,
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
598 const std::string& type,
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
599 const std::list<octave_value_list>& idx,
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
600 const octave_value& value, context_id context)
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
601 {
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
602 m_rep->assign (op, type, idx, value, context);
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
603 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
604
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
605 void assign (octave_value::assign_op op, const octave_value& value,
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
606 context_id context)
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
607 {
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
608 m_rep->assign (op, value, context);
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
609 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
610
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
611 void do_non_const_unary_op (octave_value::unary_op op, context_id context)
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
612 {
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
613 m_rep->do_non_const_unary_op (op, context);
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
614 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
615
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
616 void do_non_const_unary_op (octave_value::unary_op op,
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
617 const std::string& type,
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
618 const std::list<octave_value_list>& idx,
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
619 context_id context)
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
620 {
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
621 m_rep->do_non_const_unary_op (op, type, idx, context);
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
622 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
623
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
624 octave_value varval (context_id context) const
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
625 {
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
626 return m_rep->varval (context);
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
627 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
628
24348
64691264dd21 eliminate some uses of decl_scope in symbol_record class
John W. Eaton <jwe@octave.org>
parents: 24325
diff changeset
629 void push_context (void) { m_rep->push_context (); }
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
630
24969
0cd310ac0d77 * libinterp/corefcn/symrec.h: consistent use of context_id.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 24706
diff changeset
631 context_id pop_context (void) { return m_rep->pop_context (); }
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
632
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
633 void clear (context_id context) { m_rep->clear (context); }
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
634
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
635 bool is_defined (context_id context) const
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
636 {
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
637 return m_rep->is_defined (context);
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
638 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
639
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
640 bool is_undefined (context_id context) const
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
641 {
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
642 return ! m_rep->is_defined (context);
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
643 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
644
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
645 bool is_variable (context_id context) const
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
646 {
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
647 return m_rep->is_variable (context);
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
648 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
649
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
650 bool is_local (void) const { return m_rep->is_local (); }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
651 bool is_automatic (void) const { return m_rep->is_automatic (); }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
652 bool is_formal (void) const { return m_rep->is_formal (); }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
653 bool is_global (void) const { return m_rep->is_global (); }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
654 bool is_hidden (void) const { return m_rep->is_hidden (); }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
655 bool is_inherited (void) const { return m_rep->is_inherited (); }
24977
2b040946dc69 improve handling of clear for globals, forwarded symbols (bug #53027)
John W. Eaton <jwe@octave.org>
parents: 24969
diff changeset
656 bool is_forwarded (void) const { return m_rep->is_forwarded (); }
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
657 bool is_persistent (void) const { return m_rep->is_persistent (); }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
658 bool is_added_static (void) const { return m_rep->is_added_static (); }
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
659
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
660 void mark_local (void) { m_rep->mark_local (); }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
661 void mark_automatic (void) { m_rep->mark_automatic (); }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
662 void mark_formal (void) { m_rep->mark_formal (); }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
663 void mark_hidden (void) { m_rep->mark_hidden (); }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
664 void mark_inherited (void) { m_rep->mark_inherited (); }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
665 void mark_persistent (void) { m_rep->mark_persistent (); }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
666 void mark_added_static (void) { m_rep->mark_added_static (); }
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
667
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
668 void unmark_local (void) { m_rep->unmark_local (); }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
669 void unmark_automatic (void) { m_rep->unmark_automatic (); }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
670 void unmark_formal (void) { m_rep->unmark_formal (); }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
671 void unmark_hidden (void) { m_rep->unmark_hidden (); }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
672 void unmark_inherited (void) { m_rep->unmark_inherited (); }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
673 void unmark_persistent (void) { m_rep->unmark_persistent (); }
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
674 void unmark_added_static (void) { m_rep->unmark_added_static (); }
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
675
25201
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
676 bool is_marked_global (void) const { return m_rep->is_marked_global (); }
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
677 void mark_global (void) { m_rep->mark_global (); }
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
678
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
679 void init_persistent (void) { m_rep->init_persistent (); }
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
680
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
681 unsigned int storage_class (void) const { return m_rep->storage_class (); }
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
682
24706
30e1d0bf7ade use weak_ptr for symbol_scope_rep and symbol_record_rep pointers (bug #53092)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
683 void bind_fwd_rep (const std::shared_ptr<symbol_scope_rep>& fwd_scope,
30e1d0bf7ade use weak_ptr for symbol_scope_rep and symbol_record_rep pointers (bug #53092)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
684 const symbol_record& sr)
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
685 {
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
686 m_rep->bind_fwd_rep (fwd_scope, sr.m_rep);
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
687 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
688
25203
72ea868ca63a allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents: 25202
diff changeset
689 void unbind_global_rep (void) { m_rep->unbind_global_rep (); }
72ea868ca63a allow function parameters to be global (bug #53579)
John W. Eaton <jwe@octave.org>
parents: 25202
diff changeset
690
25201
c80323fe4938 improve handling of global symbols (bug #53599)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
691 void unbind_fwd_rep (void) { m_rep->unbind_fwd_rep (); }
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
692
24356
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
693 octave_value dump (context_id context) const
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
694 {
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
695 return m_rep->dump (context);
8b14ba8296af refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents: 24352
diff changeset
696 }
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
697
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
698 private:
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
699
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
700 std::shared_ptr<symbol_record_rep> m_rep;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
701
24272
dd810f9d26e7 use m_ prefix for symbol_record class data members
John W. Eaton <jwe@octave.org>
parents: 24271
diff changeset
702 // NEW_REP must be dynamically allocated or nullptr.
24706
30e1d0bf7ade use weak_ptr for symbol_scope_rep and symbol_record_rep pointers (bug #53092)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
703 symbol_record (const std::shared_ptr<symbol_record_rep>& new_rep)
30e1d0bf7ade use weak_ptr for symbol_scope_rep and symbol_record_rep pointers (bug #53092)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
704 : m_rep (new_rep)
30e1d0bf7ade use weak_ptr for symbol_scope_rep and symbol_record_rep pointers (bug #53092)
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
705 { }
24519
6c31b0376908 move part of symbol_record::find to header file to allow inlining
John W. Eaton <jwe@octave.org>
parents: 24458
diff changeset
706
6c31b0376908 move part of symbol_record::find to header file to allow inlining
John W. Eaton <jwe@octave.org>
parents: 24458
diff changeset
707 octave_value find_function (const std::string& name,
6c31b0376908 move part of symbol_record::find to header file to allow inlining
John W. Eaton <jwe@octave.org>
parents: 24458
diff changeset
708 const octave_value_list& args) const;
6c31b0376908 move part of symbol_record::find to header file to allow inlining
John W. Eaton <jwe@octave.org>
parents: 24458
diff changeset
709
6c31b0376908 move part of symbol_record::find to header file to allow inlining
John W. Eaton <jwe@octave.org>
parents: 24458
diff changeset
710 static octave_value dummy_octave_value;
24263
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
711 };
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
712 }
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
713
3b302b2890d7 disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff changeset
714 #endif