📄 context.cpp
字号:
#include "StdAfx.h"
#include "Context.h"
CContext::CContext(void)
: m_SymbolTable(new CSymbolTable()),
m_FunctionTable(new CFunctionTable()),
m_DataQueue(new queue<float>()),
m_ReturnStack(new stack<int>()),
m_ForList(new stack<forloop_t *>()),
m_Code(new CCode()),
m_Running(false)
{
}
CContext::~CContext(void)
{
delete this->m_SymbolTable;
delete this->m_FunctionTable;
delete this->m_DataQueue;
delete this->m_ReturnStack;
while(!this->m_ForList->empty())
{
this->m_ForList->pop();
}
delete this->m_ForList;
delete this->m_Code;
}
// Set the symbol table for this current run
void CContext::SetSymbolTable(CSymbolTable * SymbolTable)
{
this->m_SymbolTable = SymbolTable;
}
// Get the current symbol table
CSymbolTable * CContext::GetSymbolTable(void)
{
return this->m_SymbolTable;
}
// Set the function table for this current run
void CContext::SetFunctionTable(CFunctionTable * FunctionTable)
{
this->m_FunctionTable = FunctionTable;
}
// Get the function table
CFunctionTable * CContext::GetFunctionTable(void)
{
return this->m_FunctionTable;
}
// Set the data stack for this current run
void CContext::SetDataQueue(queue<float> * DataQueue)
{
this->m_DataQueue = DataQueue;
}
// Get the current data stack
queue<float> * CContext::GetDataQueue(void)
{
return this->m_DataQueue;
}
// Set the return stack for this run
void CContext::SetReturnStack(stack<int> * ReturnStack)
{
this->m_ReturnStack = ReturnStack;
}
// Get the current return stack
stack<int> * CContext::GetReturnStack(void)
{
return this->m_ReturnStack;
}
// Set the list of variables in FOR loops
void CContext::SetForList(stack<forloop_t *> *ForList)
{
this->m_ForList = ForList;
}
// Get the current for list
stack<forloop_t *> * CContext::GetForList(void)
{
return this->m_ForList;
}
// Set the code list
void CContext::SetCode(CCode *Code)
{
this->m_Code = Code;
}
// Get the code list
CCode *CContext::GetCode()
{
return this->m_Code;
}
// Set the running state
void CContext::SetRunning(bool Value)
{
this->m_Running = Value;
}
// Get the running state
bool CContext::GetRunning()
{
return this->m_Running;
}
// Are we branching?
void CContext::SetBranching(bool Value)
{
this->m_Branching = Value;
}
// Are we branching?
bool CContext::GetBranching(void)
{
return this->m_Branching;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -