xo-interpreter2 stack: refactor + bugfix operator expr
This commit is contained in:
parent
c8bc13cb2e
commit
6c7216ed7d
7 changed files with 195 additions and 200 deletions
49
src/procedure2/PrimitiveRegistry.cpp
Normal file
49
src/procedure2/PrimitiveRegistry.cpp
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/** @file PrimitiveRegistry.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Mar 2026
|
||||
**/
|
||||
|
||||
#include "PrimitiveRegistry.hpp"
|
||||
#include <xo/indentlog/scope.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
PrimitiveRegistry &
|
||||
PrimitiveRegistry::instance()
|
||||
{
|
||||
static PrimitiveRegistry s_instance;
|
||||
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
void
|
||||
PrimitiveRegistry::register_primitives(InstallSource factory)
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
init_seq_v_.push_back(factory);
|
||||
}
|
||||
|
||||
bool
|
||||
PrimitiveRegistry::install_primitives(obj<AAllocator> mm,
|
||||
InstallSink sink,
|
||||
InstallFlags flags)
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
bool ok = true;
|
||||
|
||||
size_t i = 0;
|
||||
size_t n = init_seq_v_.size();
|
||||
log && log("run n init steps", xtag("n", n));
|
||||
|
||||
for (const auto & fn : init_seq_v_) {
|
||||
log && log("do install fn (", i+1, "/", n, ")");
|
||||
|
||||
ok = ok & fn(mm, sink, flags);
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
} /*namespace xo*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue