1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-10 15:39:02 +00:00
OpenMW/components/interpreter/runtime.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

64 lines
1.4 KiB
C++
Raw Normal View History

2010-06-28 17:20:45 +00:00
#ifndef INTERPRETER_RUNTIME_H_INCLUDED
#define INTERPRETER_RUNTIME_H_INCLUDED
2022-05-21 08:48:32 +00:00
#include <string_view>
2010-06-28 19:49:48 +00:00
#include <vector>
2010-06-28 17:20:45 +00:00
#include "types.hpp"
namespace Interpreter
{
class Context;
/// Runtime data and engine interface
2010-06-28 17:20:45 +00:00
class Runtime
{
Context* mContext;
2010-06-28 18:46:15 +00:00
const Type_Code* mCode;
2010-06-28 17:20:45 +00:00
int mCodeSize;
2010-06-28 18:46:15 +00:00
int mPC;
std::vector<Data> mStack;
2022-09-22 18:26:05 +00:00
public:
Runtime();
2010-06-28 18:46:15 +00:00
int getPC() const;
///< return program counter.
2010-06-28 19:49:48 +00:00
int getIntegerLiteral(int index) const;
2010-06-28 19:49:48 +00:00
float getFloatLiteral(int index) const;
std::string_view getStringLiteral(int index) const;
void configure(const Type_Code* code, int codeSize, Context& context);
2010-06-28 17:20:45 +00:00
///< \a context and \a code must exist as least until either configure, clear or
/// the destructor is called. \a codeSize is given in 32-bit words.
2010-06-28 17:20:45 +00:00
void clear();
2010-06-28 18:46:15 +00:00
void setPC(int PC);
///< set program counter.
void push(const Data& data);
2010-06-28 19:49:48 +00:00
///< push data on stack
void push(Type_Integer value);
///< push integer data on stack.
void push(Type_Float value);
///< push float data on stack.
2010-06-28 19:49:48 +00:00
void pop();
///< pop stack
Data& operator[](int Index);
2010-06-28 19:49:48 +00:00
///< Access stack member, counted from the top.
2010-06-28 19:49:48 +00:00
Context& getContext();
2010-06-28 17:20:45 +00:00
};
}
#endif