执行 AGENTS align-linuxcnc 加速规则

结论:补齐 WASM NML status shim 并增加可执行 runtime 探针,依据 LinuxCNC src/libnml/nml/nmlmsg.cc 和 stat_msg.cc 中 RCS_GENERIC_STATUS/RCS_STAT_MSG 构造初始化。验证通过:./test-linuxcnc-wasm-runtime-link.sh、./test-native.sh、./test-linuxcnc-source-link.sh。
This commit is contained in:
cnc
2026-06-05 10:44:31 +08:00
parent a301965452
commit 2892f2ca9d
2 changed files with 23 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
#include "cnc_sim_api.h"
#include "hal.h"
#include "libnml/nml/stat_msg.hh"
#include <cmath>
#include <cstdlib>
@@ -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<long>(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<CncSimEvent> events;
CncSimHandle *sim = cnc_sim_create();

View File

@@ -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 *) {
}