blob: 14d1d14ac3a4931aa5c3f65020122b9341330685 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#ifndef FRAMES_HPP
#define FRAMES_HPP
#include <stack>
#include "types.hpp"
namespace SpasmImpl
{
//! Class representing the stack frame for a function
/*!
** The class is implemented as a simple stack of frames while each frame
** is built up by a number of data_t objects
*/
class FrameStack
{
public:
FrameStack();
FrameStack(const FrameStack&);
~FrameStack();
FrameStack& operator=(const FrameStack&);
const data_t& operator[](size_t) const;
data_t& operator[](size_t);
void pop_frame();
void new_frame(size_t);
bool empty() const;
private:
//! pointer to the base of the stack
data_t* base_ptr;
//! pointer to the beginning of the current frame
data_t* frame_ptr;
//! size of the whole stack in data_t objects
size_t g_size;
//! size of the current frame in data_t objects
size_t c_size;
//! stack of the offsets between frames in the stack.
std::stack<size_t> fstack;
void copy_fstack(const FrameStack&);
void delete_fstack();
};
} // namespace SpasmImpl
#endif // #ifndef FRAMES_HPP
|