29 lines
634 B
C++
29 lines
634 B
C++
#include "cs_thread.hh"
|
|
|
|
#include "cs_gen.hh"
|
|
|
|
namespace cubescript {
|
|
|
|
thread_state::thread_state(internal_state *cs):
|
|
vmstack{cs}, idstack{cs}, astacks{cs}, errbuf{cs}
|
|
{
|
|
vmstack.reserve(32);
|
|
idstack.reserve(MAX_ARGUMENTS);
|
|
}
|
|
|
|
hook_func thread_state::set_hook(hook_func f) {
|
|
auto hk = std::move(call_hook);
|
|
call_hook = std::move(f);
|
|
return hk;
|
|
}
|
|
|
|
alias_stack &thread_state::get_astack(alias *a) {
|
|
auto it = astacks.try_emplace(a->get_index());
|
|
if (it.second) {
|
|
it.first->second.node = &static_cast<alias_impl *>(a)->p_initial;
|
|
}
|
|
return it.first->second;
|
|
}
|
|
|
|
} /* namespace cubescript */
|