diff --git a/core/wasm_shims/cnc_sim_wasm_runtime_probe_main.cc b/core/wasm_shims/cnc_sim_wasm_runtime_probe_main.cc index 03a3e26..6aa9b65 100644 --- a/core/wasm_shims/cnc_sim_wasm_runtime_probe_main.cc +++ b/core/wasm_shims/cnc_sim_wasm_runtime_probe_main.cc @@ -1,5 +1,6 @@ #include "cnc_sim_api.h" #include "hal.h" +#include "libnml/nml/stat_msg.hh" #include #include @@ -116,6 +117,18 @@ bool hal_lookup_is_unavailable() { return true; } +bool nml_status_constructors_match_linuxcnc() { + // LinuxCNC source basis: src/libnml/nml/nmlmsg.cc and stat_msg.cc + // initialize RCS status messages before EMC status objects use them. + RCS_GENERIC_STATUS status; + return status._type == RCS_GENERIC_STATUS_TYPE && + status.size == static_cast(sizeof(RCS_GENERIC_STATUS)) && + status.command_type == -1 && + status.echo_serial_number == -1 && + status.status == RCS_STATUS::UNINITIALIZED && + status._state == -1; +} + } // namespace int main() { @@ -131,6 +144,9 @@ int main() { if (!hal_lookup_is_unavailable()) { return 7; } + if (!nml_status_constructors_match_linuxcnc()) { + return 9; + } std::vector events; CncSimHandle *sim = cnc_sim_create(); diff --git a/core/wasm_shims/nml_status_shim.cc b/core/wasm_shims/nml_status_shim.cc index 6f45c8f..7f94f27 100644 --- a/core/wasm_shims/nml_status_shim.cc +++ b/core/wasm_shims/nml_status_shim.cc @@ -71,3 +71,10 @@ RCS_STAT_MSG::RCS_STAT_MSG(NMLTYPE t, size_t sz) : NMLmsg(t, sz) { status = RCS_STATUS::UNINITIALIZED; _state = -1; } + +RCS_GENERIC_STATUS::RCS_GENERIC_STATUS() + : RCS_STAT_MSG(RCS_GENERIC_STATUS_TYPE, sizeof(RCS_GENERIC_STATUS)) { +} + +void RCS_GENERIC_STATUS::update(CMS *) { +}