From 78592d4b0f3d7597aa3b90e03fa52988688e72a4 Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Sun, 18 Oct 2026 22:47:19 -0700 Subject: [PATCH] M3: add sims/registry.tcl --- core/src/economy/sims/registry.tcl | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 core/src/economy/sims/registry.tcl diff --git a/core/src/economy/sims/registry.tcl b/core/src/economy/sims/registry.tcl new file mode 100644 index 0000000..ecc5945 --- /dev/null +++ b/core/src/economy/sims/registry.tcl @@ -0,0 +1,30 @@ +namespace eval ::stomach {} + +oo::class create ::stomach::EngineRegistry { + variable root engines + constructor {root_dir} { + set root [file normalize $root_dir] + set engines [dict create statistical [dict create lang r runtime Rscript source statistical/engine.R test statistical/tests.R] sociological [dict create lang eclipse_prolog runtime eclipse source sociological/engine.ecl test sociological/test.ecl] amm_liquidity [dict create lang solidity runtime forge source amm/src/AMMSim.sol test amm/test/AMMSim.t.sol] mev_adversarial [dict create lang fortran runtime gfortran source mev/src/mev_engine.f90 test mev/test/test_mev.f90] tokenomics_macro [dict create lang fortran runtime gfortran source tokenomics/src/tokenomics_engine.f90 test tokenomics/test/test_tokenomics.f90] consensus_staking [dict create lang eclipse_prolog runtime eclipse source consensus/engine.ecl test consensus/test.ecl] market_microstructure [dict create lang fortran runtime gfortran source microstructure/src/microstructure_engine.f90 test microstructure/test/test_microstructure.f90]] + } + method names {} { return [dict keys $engines] } + method descriptor {name} { + if {![dict exists $engines $name]} { error "unknown_engine" } + set d [dict get $engines $name] + dict set d source [file join $root [dict get $d source]] + dict set d test [file join $root [dict get $d test]] + return $d + } + method source_present {name} { return [file exists [dict get [my descriptor $name] source]] } + method runtime_available {name} { + set cmd [dict get [my descriptor $name] runtime] + expr {[auto_execok $cmd] ne ""} + } + method status {} { + set out {} + foreach name [my names] { + set d [my descriptor $name] + dict set out $name [dict create lang [dict get $d lang] source_present [my source_present $name] runtime_available [my runtime_available $name]] + } + return $out + } +}