Gnash
0.8.11dev
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
libcore
vm
CallStack.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3
// Free Software Foundation, Inc
4
//
5
// This program is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation; either version 3 of the License, or
8
// (at your option) any later version.
9
//
10
// This program is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU General Public License for more details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with this program; if not, write to the Free Software
17
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19
#ifndef GNASH_VM_CALL_STACK_H
20
#define GNASH_VM_CALL_STACK_H
21
22
#include <vector>
23
24
#include "
as_value.h
"
25
26
// Forward declarations
27
namespace
gnash {
28
class
as_object;
29
struct
ObjectURI;
30
class
UserFunction;
31
}
32
33
namespace
gnash {
34
36
//
39
//
43
class
CallFrame
44
{
45
public
:
46
47
typedef
std::vector<as_value>
Registers
;
48
50
//
54
CallFrame
(
UserFunction
* func);
55
57
CallFrame
(
const
CallFrame
& other)
58
:
59
_locals(other._locals),
60
_func(other._func),
61
_registers(other._registers)
62
{}
63
65
CallFrame
&
operator=
(
const
CallFrame
& other) {
66
_locals = other._locals;
67
_func = other._func;
68
_registers = other._registers;
69
return
*
this
;
70
}
71
73
as_object
&
locals
() {
74
return
*_locals;
75
}
76
78
UserFunction
&
function
() {
79
return
*_func;
80
}
81
83
//
87
const
as_value
*
getLocalRegister
(
size_t
i
)
const
{
88
if
(i >= _registers.size())
return
0;
89
return
&_registers[
i
];
90
}
91
93
//
95
//
98
void
setLocalRegister
(
size_t
i
,
const
as_value
& val);
99
101
//
104
bool
hasRegisters
()
const
{
105
return
!_registers.empty();
106
}
107
109
//
112
void
markReachableResources
()
const
;
113
114
115
private
:
116
117
friend
std::ostream&
operator<<
(std::ostream&,
const
CallFrame
&);
118
120
as_object
* _locals;
121
122
UserFunction
* _func;
123
125
Registers
_registers;
126
127
};
128
130
//
132
//
135
void
declareLocal
(CallFrame&
c
,
const
ObjectURI&
name
);
136
138
//
140
//
144
void
setLocal
(CallFrame&
c
,
const
ObjectURI&
name
,
const
as_value& val);
145
146
typedef
std::vector<CallFrame>
CallStack
;
147
148
std::ostream&
operator<<
(std::ostream&
o
,
const
CallFrame
& fr);
149
150
}
// namespace gnash
151
152
#endif // GNASH_VM_CALL_STACK_H
Generated on Wed Mar 2 2016 01:37:24 for Gnash by
1.8.4