Remove stack class
This commit is contained in:
parent
35cdd3927e
commit
232d06d837
@ -352,37 +352,4 @@ namespace ui_scripting
|
||||
{
|
||||
return this->call({});
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
* Stack
|
||||
**************************************************************/
|
||||
|
||||
stack::stack()
|
||||
{
|
||||
this->state = *game::hks::lua_state;
|
||||
}
|
||||
|
||||
void stack::save(int num_args)
|
||||
{
|
||||
this->num_args_ = num_args;
|
||||
this->num_calls_ = state->m_numberOfCCalls;
|
||||
this->base_bottom_ = state->m_apistack.base - state->m_apistack.bottom;
|
||||
this->top_bottom_ = state->m_apistack.top - state->m_apistack.bottom;
|
||||
this->callstack_ = state->m_callStack.m_current - state->m_callStack.m_records;
|
||||
}
|
||||
|
||||
void stack::fix()
|
||||
{
|
||||
this->state->m_numberOfCCalls = this->num_calls_;
|
||||
|
||||
game::hks::closePendingUpvalues(this->state, &this->state->m_apistack.bottom[this->top_bottom_ - this->num_args_]);
|
||||
this->state->m_callStack.m_current = &this->state->m_callStack.m_records[this->callstack_];
|
||||
|
||||
this->state->m_apistack.base = &this->state->m_apistack.bottom[this->base_bottom_];
|
||||
this->state->m_apistack.top = &this->state->m_apistack.bottom[this->top_bottom_ - static_cast<uint64_t>(this->num_args_ + 1)];
|
||||
|
||||
this->state->m_apistack.bottom[this->top_bottom_].t = this->state->m_apistack.top[-1].t;
|
||||
this->state->m_apistack.bottom[this->top_bottom_].v.ptr = this->state->m_apistack.top[-1].v.ptr;
|
||||
this->state->m_apistack.top = &this->state->m_apistack.bottom[this->top_bottom_ + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -137,28 +137,4 @@ namespace ui_scripting
|
||||
|
||||
int ref{};
|
||||
};
|
||||
|
||||
class stack final
|
||||
{
|
||||
public:
|
||||
stack();
|
||||
|
||||
void save(int num_args);
|
||||
void fix();
|
||||
|
||||
stack(stack&&) = delete;
|
||||
stack(const stack&) = delete;
|
||||
stack& operator=(stack&&) = delete;
|
||||
stack& operator=(const stack&) = delete;
|
||||
|
||||
private:
|
||||
game::hks::lua_State* state;
|
||||
|
||||
int num_args_;
|
||||
int num_calls_;
|
||||
|
||||
uint64_t base_bottom_;
|
||||
uint64_t top_bottom_;
|
||||
uint64_t callstack_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user