annotate libinterp/corefcn/stack-frame.h @ 31227:0dec459a4064

sparse-xpow.cc: Performance tweak for threshold selection
author Arun Giridhar <arungiridhar@gmail.com>
date Wed, 14 Sep 2022 09:59:31 -0400
parents 796f54d4ddbf
children e88a07dec498
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 30390
diff changeset
3 // Copyright (C) 1993-2022 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 #if ! defined (octave_stack_frame_h)
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 #define octave_stack_frame_h 1
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29 #include "octave-config.h"
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31 #include <deque>
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32 #include <iosfwd>
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 #include <list>
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 #include <map>
28426
9a3deb17b4ea use shared_ptr for stack frames in call stack and for accesss and static links
John W. Eaton <jwe@octave.org>
parents: 28425
diff changeset
35 #include <memory>
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36 #include <string>
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 class octave_value;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39 class octave_value_list;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
40
27130
396d17dcfb9f don't include error.h in ov-base.h
John W. Eaton <jwe@octave.org>
parents: 27037
diff changeset
41 #include "error.h"
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
42 #include "ov-fcn.h"
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43 #include "ov-usr-fcn.h"
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44 #include "syminfo.h"
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45 #include "symscope.h"
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 // Variable values are stored in the stack_frame objects that make up
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48 // the call_stack. There are four separate stack_frame objects
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49 // corresponding to the following language elements:
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50 //
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51 // * user-defined functions
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
52 //
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53 // These are .m files. They have local variables.
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54 //
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55 // * scripts
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56 //
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57 // These are .m files, but not functions. They access variables,
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
58 // but do not store any values directly. All values are stored in
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59 // the stack frame corresponding to the scope in which they are
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60 // executed.
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61 //
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62 // * scopes that do not correspond to functions
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63 //
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64 // This is primarily used by the top-level scope but the
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65 // interpreter may also create temporary scopes in which to
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66 // evaluate functions or scripts.
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
67 //
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68 // * compiled functions
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69 //
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70 // These are built-in functions and dynamically-loaded compiled
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71 // functions (.mex and .oct files) and do not contain variable
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72 // values of their own. They are skipped when Octave displays a
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73 // stack trace.
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
74 //
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75 // All stack frames also contain the following data:
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
76 //
27211
8c27802a76c4 store reference to evaluator instead of call stack in stack frame
John W. Eaton <jwe@octave.org>
parents: 27130
diff changeset
77 // * a reference to the evaluator that contains the frame
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
78 //
27211
8c27802a76c4 store reference to evaluator instead of call stack in stack frame
John W. Eaton <jwe@octave.org>
parents: 27130
diff changeset
79 // Global variables are now stored in the evaluator and this link
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
80 // gives us immediate access to them.
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
81 //
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
82 // * line and column in the source file where the stack frame was created
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
83 //
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
84 // These values are used to print stack traces.
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
85 //
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
86 // * A pointer to the nearest parent frame that contains variable
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
87 // info (the "static" link)
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
88 //
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
89 // A frame that contains variable info may be a user-defined
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
90 // function, script, or scope frame. This pointer should never
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
91 // point to a compiled function stack frame.
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
92 //
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
93 // * A pointer to the nearest lexical parent frame (the "access" link)
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
94 //
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
95 // Used to access non-local variables for nested and anonymous
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
96 // functions or as a link to the parent frame in which a script is
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
97 // executed. This pointer should only point to a parent function
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
98 // stack frame.
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
99
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
100 namespace octave
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
101 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
102 class tree_evaluator;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
103 class symbol_info_list;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
104 class unwind_protect;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
105
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
106 class stack_frame_walker;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
107
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
108 class stack_frame
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
109 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
110 public:
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
111
28430
5bfa8e018704 store local init vars for anonymous functions in handle, not function object
John W. Eaton <jwe@octave.org>
parents: 28429
diff changeset
112 typedef std::map<std::string, octave_value> local_vars_map;
5bfa8e018704 store local init vars for anonymous functions in handle, not function object
John W. Eaton <jwe@octave.org>
parents: 28429
diff changeset
113
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
114 // Markers indicating the type of a variable. Values for local
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
115 // variables are stored in the stack frame. Values for
27211
8c27802a76c4 store reference to evaluator instead of call stack in stack frame
John W. Eaton <jwe@octave.org>
parents: 27130
diff changeset
116 // global variables are stored in the tree_evaluator object that
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
117 // contains the stack frame. Values for persistent variables are
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
118 // stored in the function scope corresponding to the stack frame.
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
119
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
120 enum scope_flags
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29655
diff changeset
121 {
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29655
diff changeset
122 LOCAL,
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29655
diff changeset
123 GLOBAL,
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29655
diff changeset
124 PERSISTENT
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29655
diff changeset
125 };
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
126
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
127 // Index into the list of automatic variables for user-defined
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
128 // function stack frames.
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
129
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
130 enum auto_var_type
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29655
diff changeset
131 {
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29655
diff changeset
132 ARG_NAMES,
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29655
diff changeset
133 IGNORED,
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29655
diff changeset
134 NARGIN,
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29655
diff changeset
135 NARGOUT,
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29655
diff changeset
136 SAVED_WARNING_STATES,
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29655
diff changeset
137 NUM_AUTO_VARS
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29655
diff changeset
138 };
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
139
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
140 stack_frame (void) = delete;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
141
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29477
diff changeset
142 stack_frame (tree_evaluator& tw, std::size_t index,
28793
c5953e65c6aa track direct caller in stack frames
John W. Eaton <jwe@octave.org>
parents: 28439
diff changeset
143 const std::shared_ptr<stack_frame>& parent_link,
28426
9a3deb17b4ea use shared_ptr for stack frames in call stack and for accesss and static links
John W. Eaton <jwe@octave.org>
parents: 28425
diff changeset
144 const std::shared_ptr<stack_frame>& static_link,
9a3deb17b4ea use shared_ptr for stack frames in call stack and for accesss and static links
John W. Eaton <jwe@octave.org>
parents: 28425
diff changeset
145 const std::shared_ptr<stack_frame>& access_link)
29476
c74ff452e2bb avoid memory leaks when returning handles to nested functions
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
146 : m_evaluator (tw), m_is_closure_context (false),
c74ff452e2bb avoid memory leaks when returning handles to nested functions
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
147 m_line (-1), m_column (-1), m_index (index),
28793
c5953e65c6aa track direct caller in stack frames
John W. Eaton <jwe@octave.org>
parents: 28439
diff changeset
148 m_parent_link (parent_link), m_static_link (static_link),
c5953e65c6aa track direct caller in stack frames
John W. Eaton <jwe@octave.org>
parents: 28439
diff changeset
149 m_access_link (access_link), m_dispatch_class ()
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
150 { }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
151
28425
a5be4fc661d6 hide specific stack frame and stack frame walker classes
John W. Eaton <jwe@octave.org>
parents: 28329
diff changeset
152 // Compiled function.
a5be4fc661d6 hide specific stack frame and stack frame walker classes
John W. Eaton <jwe@octave.org>
parents: 28329
diff changeset
153 static stack_frame *
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29477
diff changeset
154 create (tree_evaluator& tw, octave_function *fcn, std::size_t index,
28793
c5953e65c6aa track direct caller in stack frames
John W. Eaton <jwe@octave.org>
parents: 28439
diff changeset
155 const std::shared_ptr<stack_frame>& parent_link,
28426
9a3deb17b4ea use shared_ptr for stack frames in call stack and for accesss and static links
John W. Eaton <jwe@octave.org>
parents: 28425
diff changeset
156 const std::shared_ptr<stack_frame>& static_link);
28425
a5be4fc661d6 hide specific stack frame and stack frame walker classes
John W. Eaton <jwe@octave.org>
parents: 28329
diff changeset
157
a5be4fc661d6 hide specific stack frame and stack frame walker classes
John W. Eaton <jwe@octave.org>
parents: 28329
diff changeset
158 // Script.
a5be4fc661d6 hide specific stack frame and stack frame walker classes
John W. Eaton <jwe@octave.org>
parents: 28329
diff changeset
159 static stack_frame *
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29477
diff changeset
160 create (tree_evaluator& tw, octave_user_script *script, std::size_t index,
28793
c5953e65c6aa track direct caller in stack frames
John W. Eaton <jwe@octave.org>
parents: 28439
diff changeset
161 const std::shared_ptr<stack_frame>& parent_link,
28426
9a3deb17b4ea use shared_ptr for stack frames in call stack and for accesss and static links
John W. Eaton <jwe@octave.org>
parents: 28425
diff changeset
162 const std::shared_ptr<stack_frame>& static_link);
28425
a5be4fc661d6 hide specific stack frame and stack frame walker classes
John W. Eaton <jwe@octave.org>
parents: 28329
diff changeset
163
a5be4fc661d6 hide specific stack frame and stack frame walker classes
John W. Eaton <jwe@octave.org>
parents: 28329
diff changeset
164 // User-defined function.
a5be4fc661d6 hide specific stack frame and stack frame walker classes
John W. Eaton <jwe@octave.org>
parents: 28329
diff changeset
165 static stack_frame *
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29477
diff changeset
166 create (tree_evaluator& tw, octave_user_function *fcn, std::size_t index,
28793
c5953e65c6aa track direct caller in stack frames
John W. Eaton <jwe@octave.org>
parents: 28439
diff changeset
167 const std::shared_ptr<stack_frame>& parent_link,
28426
9a3deb17b4ea use shared_ptr for stack frames in call stack and for accesss and static links
John W. Eaton <jwe@octave.org>
parents: 28425
diff changeset
168 const std::shared_ptr<stack_frame>& static_link,
9a3deb17b4ea use shared_ptr for stack frames in call stack and for accesss and static links
John W. Eaton <jwe@octave.org>
parents: 28425
diff changeset
169 const std::shared_ptr<stack_frame>& access_link = std::shared_ptr<stack_frame> ());
28425
a5be4fc661d6 hide specific stack frame and stack frame walker classes
John W. Eaton <jwe@octave.org>
parents: 28329
diff changeset
170
28430
5bfa8e018704 store local init vars for anonymous functions in handle, not function object
John W. Eaton <jwe@octave.org>
parents: 28429
diff changeset
171 // Anonymous user-defined function with init vars.
5bfa8e018704 store local init vars for anonymous functions in handle, not function object
John W. Eaton <jwe@octave.org>
parents: 28429
diff changeset
172 static stack_frame *
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29477
diff changeset
173 create (tree_evaluator& tw, octave_user_function *fcn, std::size_t index,
28793
c5953e65c6aa track direct caller in stack frames
John W. Eaton <jwe@octave.org>
parents: 28439
diff changeset
174 const std::shared_ptr<stack_frame>& parent_link,
28430
5bfa8e018704 store local init vars for anonymous functions in handle, not function object
John W. Eaton <jwe@octave.org>
parents: 28429
diff changeset
175 const std::shared_ptr<stack_frame>& static_link,
29477
34d06c73b48d hold references to closure frames in anon functions if needed (bug #60237)
John W. Eaton <jwe@octave.org>
parents: 29476
diff changeset
176 const local_vars_map& local_vars,
34d06c73b48d hold references to closure frames in anon functions if needed (bug #60237)
John W. Eaton <jwe@octave.org>
parents: 29476
diff changeset
177 const std::shared_ptr<stack_frame>& access_link = std::shared_ptr<stack_frame> ());
28430
5bfa8e018704 store local init vars for anonymous functions in handle, not function object
John W. Eaton <jwe@octave.org>
parents: 28429
diff changeset
178
28425
a5be4fc661d6 hide specific stack frame and stack frame walker classes
John W. Eaton <jwe@octave.org>
parents: 28329
diff changeset
179 // Scope.
a5be4fc661d6 hide specific stack frame and stack frame walker classes
John W. Eaton <jwe@octave.org>
parents: 28329
diff changeset
180 static stack_frame *
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29477
diff changeset
181 create (tree_evaluator& tw, const symbol_scope& scope, std::size_t index,
28793
c5953e65c6aa track direct caller in stack frames
John W. Eaton <jwe@octave.org>
parents: 28439
diff changeset
182 const std::shared_ptr<stack_frame>& parent_link,
28426
9a3deb17b4ea use shared_ptr for stack frames in call stack and for accesss and static links
John W. Eaton <jwe@octave.org>
parents: 28425
diff changeset
183 const std::shared_ptr<stack_frame>& static_link);
28425
a5be4fc661d6 hide specific stack frame and stack frame walker classes
John W. Eaton <jwe@octave.org>
parents: 28329
diff changeset
184
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
185 stack_frame (const stack_frame& elt) = default;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
186
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
187 stack_frame& operator = (const stack_frame& elt) = delete;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
188
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
189 virtual ~stack_frame (void) = default;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
190
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
191 // FIXME: It would be nice to eliminate these but there are a few
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
192 // places where we still need to know the specific type of the
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
193 // stack frame that we are handling.
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
194
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
195 virtual bool is_compiled_fcn_frame (void) const { return false; }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
196 virtual bool is_user_script_frame (void) const { return false; }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
197 virtual bool is_user_fcn_frame (void) const { return false; }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
198 virtual bool is_scope_frame (void) const { return false; }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
199
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
200 virtual void clear_values (void);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
201
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29477
diff changeset
202 std::size_t index (void) const { return m_index; }
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
203
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
204 void line (int l) { m_line = l; }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
205 int line (void) const { return m_line; }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
206
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
207 void column (int c) { m_column = c; }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
208 int column (void) const { return m_column; }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
209
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
210 std::string fcn_file_name (void) const
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
211 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
212 octave_function *fcn = function ();
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
213
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
214 return fcn ? fcn->fcn_file_name () : "";
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
215 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
216
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
217 std::string fcn_name (bool print_subfn = true) const
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
218 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
219 std::string retval;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
220
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
221 octave_function *fcn = function ();
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
222
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
223 if (fcn)
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
224 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
225 std::string parent_fcn_name = fcn->parent_fcn_name ();
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
226
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
227 if (print_subfn && ! parent_fcn_name.empty ())
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
228 retval = parent_fcn_name + '>';
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
229
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
230 if (fcn->is_anonymous_function ())
28430
5bfa8e018704 store local init vars for anonymous functions in handle, not function object
John W. Eaton <jwe@octave.org>
parents: 28429
diff changeset
231 retval += "@<anonymous>";
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
232 else
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
233 retval += fcn->name ();
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
234 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
235 else
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
236 retval = "<unknown>";
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
237
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
238 return retval;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
239 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
240
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
241 virtual symbol_scope get_scope (void) const = 0;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
242
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
243 virtual octave_function * function (void) const { return nullptr; }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
244
28429
8eb8ba8aff9a refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents: 28426
diff changeset
245 virtual unwind_protect * unwind_protect_frame (void) { return nullptr; }
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
246
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
247 symbol_info_list
28329
6349915869f2 move function definition from header to source file
John W. Eaton <jwe@octave.org>
parents: 28328
diff changeset
248 make_symbol_info_list (const std::list<symbol_record>& symrec_list) const;
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
249
28425
a5be4fc661d6 hide specific stack frame and stack frame walker classes
John W. Eaton <jwe@octave.org>
parents: 28329
diff changeset
250 octave_value who (const string_vector& patterns, bool have_regexp,
a5be4fc661d6 hide specific stack frame and stack frame walker classes
John W. Eaton <jwe@octave.org>
parents: 28329
diff changeset
251 bool return_list, bool verbose,
a5be4fc661d6 hide specific stack frame and stack frame walker classes
John W. Eaton <jwe@octave.org>
parents: 28329
diff changeset
252 const std::string& whos_line_fmt,
a5be4fc661d6 hide specific stack frame and stack frame walker classes
John W. Eaton <jwe@octave.org>
parents: 28329
diff changeset
253 const std::string& msg);
a5be4fc661d6 hide specific stack frame and stack frame walker classes
John W. Eaton <jwe@octave.org>
parents: 28329
diff changeset
254
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
255 symbol_info_list all_variables (void);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
256
28426
9a3deb17b4ea use shared_ptr for stack frames in call stack and for accesss and static links
John W. Eaton <jwe@octave.org>
parents: 28425
diff changeset
257 octave_value workspace (void);
9a3deb17b4ea use shared_ptr for stack frames in call stack and for accesss and static links
John W. Eaton <jwe@octave.org>
parents: 28425
diff changeset
258
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
259 std::list<std::string> variable_names (void) const;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
260
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
261 // Look for named symbol visible from current scope. Don't
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
262 // attempt to insert if missing.
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
263 virtual symbol_record lookup_symbol (const std::string&) const = 0;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
264
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
265 // Look for named symbol visible from current scope. Attempt to
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
266 // insert if missing.
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
267 virtual symbol_record insert_symbol (const std::string&) = 0;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
268
28327
8db2d4c9a64f correctly find all symbols in script when saving values (bug #58382)
John W. Eaton <jwe@octave.org>
parents: 27932
diff changeset
269 symbol_info_list glob_symbol_info (const std::string& pattern);
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
270
28327
8db2d4c9a64f correctly find all symbols in script when saving values (bug #58382)
John W. Eaton <jwe@octave.org>
parents: 27932
diff changeset
271 symbol_info_list regexp_symbol_info (const std::string& pattern);
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
272
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
273 symbol_info_list get_symbol_info (void)
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
274 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
275 return all_variables ();
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
276 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
277
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
278 void make_persistent (const symbol_record& sym)
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
279 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
280 if (sym.is_formal ())
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
281 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
282 std::string nm = sym.name ();
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
283 error ("can't make function parameter %s persistent", nm.c_str ());
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
284 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
285
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
286 if (is_global (sym))
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
287 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
288 std::string nm = sym.name ();
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
289 error ("can't make global variable '%s' persistent", nm.c_str ());
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
290 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
291
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
292 install_variable (sym, octave_value (), false);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
293
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
294 mark_persistent (sym);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
295 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
296
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
297 void make_global (const symbol_record& sym)
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
298 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
299 if (is_persistent (sym))
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
300 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
301 std::string nm = sym.name ();
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
302 error ("can't make persistent variable '%s' global", nm.c_str ());
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
303 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
304
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
305 install_variable (sym, octave_value (), true);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
306
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
307 mark_global (sym);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
308 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
309
28426
9a3deb17b4ea use shared_ptr for stack frames in call stack and for accesss and static links
John W. Eaton <jwe@octave.org>
parents: 28425
diff changeset
310 std::shared_ptr<stack_frame>
28793
c5953e65c6aa track direct caller in stack frames
John W. Eaton <jwe@octave.org>
parents: 28439
diff changeset
311 parent_link (void) const {return m_parent_link; }
c5953e65c6aa track direct caller in stack frames
John W. Eaton <jwe@octave.org>
parents: 28439
diff changeset
312
c5953e65c6aa track direct caller in stack frames
John W. Eaton <jwe@octave.org>
parents: 28439
diff changeset
313 std::shared_ptr<stack_frame>
28426
9a3deb17b4ea use shared_ptr for stack frames in call stack and for accesss and static links
John W. Eaton <jwe@octave.org>
parents: 28425
diff changeset
314 static_link (void) const {return m_static_link; }
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
315
28426
9a3deb17b4ea use shared_ptr for stack frames in call stack and for accesss and static links
John W. Eaton <jwe@octave.org>
parents: 28425
diff changeset
316 std::shared_ptr<stack_frame>
9a3deb17b4ea use shared_ptr for stack frames in call stack and for accesss and static links
John W. Eaton <jwe@octave.org>
parents: 28425
diff changeset
317 access_link (void) const {return m_access_link; }
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
318
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29477
diff changeset
319 virtual std::size_t size (void) const;
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
320
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29477
diff changeset
321 virtual void resize (std::size_t);
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
322
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
323 void mark_global (const symbol_record& sym)
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
324 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
325 mark_scope (sym, GLOBAL);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
326 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
327
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
328 void unmark_global (const symbol_record& sym)
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
329 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
330 mark_scope (sym, LOCAL);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
331 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
332
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
333 void mark_persistent (const symbol_record& sym)
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
334 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
335 mark_scope (sym, PERSISTENT);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
336 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
337
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
338 void unmark_persistent (const symbol_record& sym)
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
339 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
340 mark_scope (sym, LOCAL);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
341 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
342
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
343 bool is_defined (const symbol_record& sym) const
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
344 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
345 octave_value val = varval (sym);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
346
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
347 return val.is_defined ();
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
348 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
349
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
350 bool is_variable (const symbol_record& sym) const
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
351 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
352 octave_value val = varval (sym);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
353
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
354 return val.is_defined ();
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
355 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
356
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
357 bool is_variable (const std::string& name) const
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
358 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
359 symbol_record sym = lookup_symbol (name);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
360
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
361 return sym ? is_variable (sym) : false;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
362 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
363
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
364 bool is_local_variable (const std::string& name) const
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
365 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
366 symbol_record sym = lookup_symbol (name);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
367
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
368 return sym ? (is_variable (sym) && ! is_global (sym)) : false;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
369 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
370
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
371 bool is_object (const symbol_record& sym) const
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
372 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
373 octave_value val = varval (sym);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
374
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
375 return val.isobject ();
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
376 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
377
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
378 bool is_object (const std::string& name) const
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
379 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
380 symbol_record sym = lookup_symbol (name);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
381
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
382 return sym ? is_object (sym) : false;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
383 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
384
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
385 virtual scope_flags scope_flag (const symbol_record&) const = 0;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
386
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29477
diff changeset
387 virtual scope_flags get_scope_flag (std::size_t) const;
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
388
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29477
diff changeset
389 virtual void set_scope_flag (std::size_t, scope_flags);
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
390
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
391 bool is_global (const symbol_record& sym) const
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
392 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
393 return scope_flag (sym) == GLOBAL;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
394 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
395
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
396 bool is_global (const std::string& name) const
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
397 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
398 symbol_record sym = lookup_symbol (name);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
399
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
400 return sym ? is_global (sym) : false;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
401 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
402
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
403 bool is_persistent (const symbol_record& sym) const
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
404 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
405 return scope_flag (sym) == PERSISTENT;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
406 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
407
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
408 bool is_persistent (const std::string& name) const
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
409 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
410 symbol_record sym = lookup_symbol (name);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
411
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
412 return sym ? is_persistent (sym) : false;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
413 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
414
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
415 void install_variable (const symbol_record& sym,
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
416 const octave_value& value, bool global);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
417
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
418 void install_variable (const std::string& name,
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
419 const octave_value& value, bool global)
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
420 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
421 symbol_record sym = insert_symbol (name);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
422
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
423 install_variable (sym, value, global);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
424 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
425
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
426 virtual octave_value get_auto_fcn_var (auto_var_type) const = 0;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
427
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
428 virtual void set_auto_fcn_var (auto_var_type, const octave_value&) = 0;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
429
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
430 virtual octave_value varval (const symbol_record& sym) const = 0;;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
431
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29477
diff changeset
432 virtual octave_value varval (std::size_t data_offset) const;
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
433
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
434 octave_value varval (const std::string& name) const
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
435 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
436 symbol_record sym = lookup_symbol (name);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
437
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
438 return sym ? varval (sym) : octave_value ();
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
439 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
440
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
441 virtual octave_value& varref (const symbol_record& sym) = 0;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
442
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29477
diff changeset
443 virtual octave_value& varref (std::size_t data_offset);
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
444
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
445 void assign (const symbol_record& sym, const octave_value& val)
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
446 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
447 octave_value& lhs = varref (sym);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
448
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
449 if (lhs.get_count () == 1)
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
450 lhs.call_object_destructor ();
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
451
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
452 // Regularize a null matrix if stored into a variable.
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
453 lhs = val.storable_value ();
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
454 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
455
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
456 void assign (const std::string& name, const octave_value& val)
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
457 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
458 symbol_record sym = insert_symbol (name);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
459
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
460 assign (sym, val);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
461 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
462
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
463 void assign (octave_value::assign_op op, const symbol_record& sym,
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
464 const std::string& type,
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
465 const std::list<octave_value_list>& idx,
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
466 const octave_value& rhs)
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
467 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
468 if (idx.empty ())
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
469 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
470 if (op == octave_value::op_asn_eq)
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
471 assign (sym, rhs);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
472 else
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
473 varref (sym).assign (op, rhs);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
474 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
475 else
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
476 varref (sym).assign (op, type, idx, rhs);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
477 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
478
28631
70cdf8de553d move non-member octave_value operator functions to octave namespace
John W. Eaton <jwe@octave.org>
parents: 28439
diff changeset
479 void non_const_unary_op (octave_value::unary_op op,
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29655
diff changeset
480 const symbol_record& sym,
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29655
diff changeset
481 const std::string& type,
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29655
diff changeset
482 const std::list<octave_value_list>& idx)
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
483 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
484 if (idx.empty ())
28631
70cdf8de553d move non-member octave_value operator functions to octave namespace
John W. Eaton <jwe@octave.org>
parents: 28439
diff changeset
485 varref (sym).non_const_unary_op (op);
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
486 else
28631
70cdf8de553d move non-member octave_value operator functions to octave namespace
John W. Eaton <jwe@octave.org>
parents: 28439
diff changeset
487 varref (sym).non_const_unary_op (op, type, idx);
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
488 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
489
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
490 octave_value value (const symbol_record& sym, const std::string& type,
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
491 const std::list<octave_value_list>& idx) const
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
492 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
493 octave_value retval = varval (sym);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
494
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
495 if (! idx.empty ())
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
496 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
497 if (retval.is_constant ())
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
498 retval = retval.subsref (type, idx);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
499 else
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
500 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
501 octave_value_list t = retval.subsref (type, idx, 1);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
502
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
503 retval = t.length () > 0 ? t(0) : octave_value ();
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
504 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
505 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
506
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
507 return retval;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
508 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
509
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
510 octave_value find_subfunction (const std::string& name) const
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
511 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
512 symbol_scope scope = get_scope ();
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
513
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
514 return scope.find_subfunction (name);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
515 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
516
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
517 void clear (const symbol_record& sym)
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
518 {
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
519 if (is_global (sym))
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
520 unmark_global (sym);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
521
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
522 assign (sym, octave_value ());
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
523
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
524 if (is_persistent (sym))
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
525 unmark_persistent (sym);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
526 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
527
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
528 void clear_objects (void);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
529
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
530 void clear_variable (const std::string& name);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
531
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
532 void clear_variable_pattern (const std::string& pattern);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
533 void clear_variable_pattern (const string_vector& patterns);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
534
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
535 void clear_variable_regexp (const std::string& pattern);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
536 void clear_variable_regexp (const string_vector& patterns);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
537
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
538 void clear_variables (void);
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
539
26965
be5c2a1bad93 allow dispatch class to be stored in stack frame (bug #45351)
John W. Eaton <jwe@octave.org>
parents: 26912
diff changeset
540 std::string get_dispatch_class (void) const { return m_dispatch_class; }
be5c2a1bad93 allow dispatch class to be stored in stack frame (bug #45351)
John W. Eaton <jwe@octave.org>
parents: 26912
diff changeset
541
be5c2a1bad93 allow dispatch class to be stored in stack frame (bug #45351)
John W. Eaton <jwe@octave.org>
parents: 26912
diff changeset
542 void set_dispatch_class (const std::string& class_name)
be5c2a1bad93 allow dispatch class to be stored in stack frame (bug #45351)
John W. Eaton <jwe@octave.org>
parents: 26912
diff changeset
543 {
be5c2a1bad93 allow dispatch class to be stored in stack frame (bug #45351)
John W. Eaton <jwe@octave.org>
parents: 26912
diff changeset
544 m_dispatch_class = class_name;
be5c2a1bad93 allow dispatch class to be stored in stack frame (bug #45351)
John W. Eaton <jwe@octave.org>
parents: 26912
diff changeset
545 }
be5c2a1bad93 allow dispatch class to be stored in stack frame (bug #45351)
John W. Eaton <jwe@octave.org>
parents: 26912
diff changeset
546
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26965
diff changeset
547 void display_stopped_in_message (std::ostream& os) const;
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26965
diff changeset
548
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
549 virtual void mark_scope (const symbol_record&, scope_flags) = 0;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
550
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
551 virtual void display (bool follow = true) const;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
552
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
553 virtual void accept (stack_frame_walker& sfw) = 0;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
554
29476
c74ff452e2bb avoid memory leaks when returning handles to nested functions
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
555 virtual void break_closure_cycles (const std::shared_ptr<stack_frame>&) { }
c74ff452e2bb avoid memory leaks when returning handles to nested functions
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
556
c74ff452e2bb avoid memory leaks when returning handles to nested functions
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
557 void mark_closure_context (void) { m_is_closure_context = true; }
c74ff452e2bb avoid memory leaks when returning handles to nested functions
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
558 bool is_closure_context (void) const { return m_is_closure_context; }
c74ff452e2bb avoid memory leaks when returning handles to nested functions
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
559
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
560 protected:
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
561
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
562 // Reference to the call stack that contains this frame. Global
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
563 // variables are stored in the call stack. This link gives us
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
564 // immediate access to them.
27211
8c27802a76c4 store reference to evaluator instead of call stack in stack frame
John W. Eaton <jwe@octave.org>
parents: 27130
diff changeset
565 tree_evaluator& m_evaluator;
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
566
29476
c74ff452e2bb avoid memory leaks when returning handles to nested functions
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
567 // TRUE if this stack frame is saved with a handle to a nested
c74ff452e2bb avoid memory leaks when returning handles to nested functions
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
568 // function (closure).
c74ff452e2bb avoid memory leaks when returning handles to nested functions
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
569 bool m_is_closure_context;
c74ff452e2bb avoid memory leaks when returning handles to nested functions
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
570
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
571 // The line and column of the source file where this stack frame
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
572 // was created. Used to print stack traces.
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
573 int m_line;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
574 int m_column;
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
575
27037
8408acb7ca4f make dbup/dbdown work again (bug #56020)
John W. Eaton <jwe@octave.org>
parents: 26965
diff changeset
576 // Index in call stack.
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29477
diff changeset
577 std::size_t m_index;
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
578
28793
c5953e65c6aa track direct caller in stack frames
John W. Eaton <jwe@octave.org>
parents: 28439
diff changeset
579 // Pointer to the nearest parent frame. May include compiled
c5953e65c6aa track direct caller in stack frames
John W. Eaton <jwe@octave.org>
parents: 28439
diff changeset
580 // functions.
c5953e65c6aa track direct caller in stack frames
John W. Eaton <jwe@octave.org>
parents: 28439
diff changeset
581 std::shared_ptr<stack_frame> m_parent_link;
c5953e65c6aa track direct caller in stack frames
John W. Eaton <jwe@octave.org>
parents: 28439
diff changeset
582
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
583 // Pointer to the nearest parent frame that contains variable
28793
c5953e65c6aa track direct caller in stack frames
John W. Eaton <jwe@octave.org>
parents: 28439
diff changeset
584 // information (script, function, or scope). This link skips over
c5953e65c6aa track direct caller in stack frames
John W. Eaton <jwe@octave.org>
parents: 28439
diff changeset
585 // compiled function parent frames.
28426
9a3deb17b4ea use shared_ptr for stack frames in call stack and for accesss and static links
John W. Eaton <jwe@octave.org>
parents: 28425
diff changeset
586 std::shared_ptr<stack_frame> m_static_link;
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
587
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
588 // Pointer to the nearest lexical parent frame. Used to access
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
589 // non-local variables for nested and anonymous functions or as a
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
590 // link to the parent frame in which a script is executed.
28426
9a3deb17b4ea use shared_ptr for stack frames in call stack and for accesss and static links
John W. Eaton <jwe@octave.org>
parents: 28425
diff changeset
591 std::shared_ptr<stack_frame> m_access_link;
26965
be5c2a1bad93 allow dispatch class to be stored in stack frame (bug #45351)
John W. Eaton <jwe@octave.org>
parents: 26912
diff changeset
592
be5c2a1bad93 allow dispatch class to be stored in stack frame (bug #45351)
John W. Eaton <jwe@octave.org>
parents: 26912
diff changeset
593 // Allow function handles to temporarily store their dispatch class
be5c2a1bad93 allow dispatch class to be stored in stack frame (bug #45351)
John W. Eaton <jwe@octave.org>
parents: 26912
diff changeset
594 // in the call stack.
be5c2a1bad93 allow dispatch class to be stored in stack frame (bug #45351)
John W. Eaton <jwe@octave.org>
parents: 26912
diff changeset
595 std::string m_dispatch_class;
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
596 };
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
597 }
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
598
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
599 #endif