diff --git a/wasm-port/docs/compatibility-validation.md b/wasm-port/docs/compatibility-validation.md index 640d756..98c5552 100644 --- a/wasm-port/docs/compatibility-validation.md +++ b/wasm-port/docs/compatibility-validation.md @@ -522,13 +522,13 @@ parser/conversion, arc geometry, offsets, feed-control and feed-state readback, comment/logging, numbered-parameter, local named-parameter plus `_ini[...]` lookup through `rs274 -i`, probing, spindle-orient, file-open reset, file-finish, -tool-reload, tool select/change/length-offset, canned-cycle, state-tag motion, -tool-table setup, and O-word subroutine fixtures, plus threading/rigid tap, -NURBS dispatch boundaries, and the comparable canonical runtime edge and -program-end cleanup calls. The same upstream baseline also validates the -current negative fixture error text and absent canonical-event constraints. -Fixtures that depend on standalone-only runtime -adapters, HAL/tool-change state, upstream `rs274` output gaps such as +tool-reload, tool select/change/length-offset, M61 current-tool-number update, +canned-cycle, state-tag motion, tool-table setup, and O-word subroutine +fixtures, plus threading/rigid tap, NURBS dispatch boundaries, and the +comparable canonical runtime edge and program-end cleanup calls. The same +upstream baseline also validates the current negative fixture error text and +absent canonical-event constraints. Fixtures that depend on standalone-only runtime +adapters, HAL state, upstream `rs274` output gaps such as `WAIT` or hidden NURBS control-point detail, or richer machine session state still need dedicated native LinuxCNC baselines. @@ -539,10 +539,9 @@ while `namedparam_ini_semantics` now covers the local named-parameter and LinuxCNC `_ini[...]` subset against upstream `rs274 -i`. `state_tag_motion` now compares its motion events with upstream `rs274`, while `UPDATE_TAG` events remain a standalone state-tag capture boundary. `tool_semantics` now -compares T/M6/G43/G49 canonical events with upstream `rs274`; M61 -current-pocket host-state behavior remains covered by the standalone fixture -expectation, and `Interp::synch()` current/selected tool slot reads are -covered by the native init harness. +compares T/M6/G43/G49 and M61 canonical/current-pocket readback with upstream +`rs274 -t -i`; `Interp::synch()` current/selected tool slot reads are covered +by the native init harness. The kinematics probes currently cover LinuxCNC identity/trivial kinematics, the switchable `5axiskins` XYZBCW bridge-mill model, TRT `xyzac`/`xyzbc` diff --git a/wasm-port/docs/drift-report.md b/wasm-port/docs/drift-report.md index 76fb9fd..115e807 100644 --- a/wasm-port/docs/drift-report.md +++ b/wasm-port/docs/drift-report.md @@ -93,10 +93,10 @@ semantic rewrites: arc geometry, offsets, feed-control, comment/logging, numbered-parameter, local named-parameter plus `_ini[...]` lookup through `rs274 -i`, probing, spindle-orient, file-open reset, file-finish, tool-reload, and tool - select/change/length-offset, canned-cycle, state-tag motion, tool-table - setup, and O-word subroutine fixtures; it also covers threading/rigid tap, - NURBS dispatch boundaries, and comparable canonical runtime edge and - program-end cleanup calls. It now also checks the negative fixture set + select/change/length-offset plus M61 current-tool-number update, + canned-cycle, state-tag motion, tool-table setup, and O-word subroutine + fixtures; it also covers threading/rigid tap, NURBS dispatch boundaries, and + comparable canonical runtime edge and program-end cleanup calls. It now also checks the negative fixture set against upstream `rs274 -g` for expected error text and absent canonical event constraints. HAL-backed adapter-heavy fixtures, standalone modal-state assertions, and upstream @@ -107,9 +107,9 @@ semantic rewrites: default `G73/G83` peck-clearance values for millimeter units. - `tool_table_setup` is now in the upstream `rs274` side-by-side baseline using a dedicated `rs274 -t` tool table and `-i` millimeter-unit INI boundary. -- `tool_semantics` now compares its T/M6/G43/G49 canonical subset with - upstream `rs274 -t -i`; M61 current-pocket host-state behavior remains a - standalone fixture expectation. +- `tool_semantics` now compares T/M6/G43/G49 plus M61 + `CHANGE_TOOL_NUMBER` and current-pocket readback with upstream + `rs274 -t -i`. - `namedparam_ini_semantics` now compares local named-parameter behavior and `_ini[...]` lookup with upstream `rs274 -i`; the broader `namedparam_semantics` fixture still keeps `_hal[...]` lookup on the diff --git a/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_tool_adapter.cpp b/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_tool_adapter.cpp index 79c9e75..f09c38f 100644 --- a/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_tool_adapter.cpp +++ b/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_tool_adapter.cpp @@ -88,11 +88,14 @@ int find_tool_index_for_tool(int toolno) } const auto &tools = tool_table(); - for (int index = 0; index < CANON_POCKETS_MAX; ++index) { + for (int index = 1; index < CANON_POCKETS_MAX; ++index) { if (tools[index].toolno == toolno) { return index; } } + if (tools[0].toolno == toolno) { + return 0; + } return -1; } diff --git a/wasm-port/tests/fixtures/canon/tool_semantics.events b/wasm-port/tests/fixtures/canon/tool_semantics.events index af52a59..369a00b 100644 --- a/wasm-port/tests/fixtures/canon/tool_semantics.events +++ b/wasm-port/tests/fixtures/canon/tool_semantics.events @@ -7,5 +7,5 @@ canon_event=USE_TOOL_LENGTH_OFFSET x=0 y=0 z=1.25 a=0 b=0 c=0 u=0 v=0 w=0 canon_event=MESSAGE: tool g43 offset=1 x=0.0000 y=0.0000 z=1.2500 canon_event=USE_TOOL_LENGTH_OFFSET x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0 canon_event=MESSAGE: tool g49 offset=0 x=0.0000 y=0.0000 z=0.0000 -canon_event=CHANGE_TOOL_NUMBER pocket=0 -canon_event=MESSAGE: tool after_m61 current_pocket=0 current_tool=2 +canon_event=CHANGE_TOOL_NUMBER pocket=2 +canon_event=MESSAGE: tool after_m61 current_pocket=2 current_tool=2 diff --git a/wasm-port/tools/verify_native_linuxcnc_fixture_baseline.sh b/wasm-port/tools/verify_native_linuxcnc_fixture_baseline.sh index 2a7e9f2..57b6708 100755 --- a/wasm-port/tools/verify_native_linuxcnc_fixture_baseline.sh +++ b/wasm-port/tools/verify_native_linuxcnc_fixture_baseline.sh @@ -871,12 +871,6 @@ for name in "${FIXTURES[@]}"; do mv "$TMP_DIR/$name.rs274.no-comments" "$native_norm" mv "$TMP_DIR/$name.expected.no-comments" "$expected_norm" fi - if [[ "$name" == "tool_semantics" ]]; then - grep -Ev '^(CHANGE_TOOL_NUMBER|MESSAGE\| tool after_m61)' "$native_norm" > "$TMP_DIR/$name.rs274.tool-subset" - grep -Ev '^(CHANGE_TOOL_NUMBER|MESSAGE\| tool after_m61)' "$expected_norm" > "$TMP_DIR/$name.expected.tool-subset" - mv "$TMP_DIR/$name.rs274.tool-subset" "$native_norm" - mv "$TMP_DIR/$name.expected.tool-subset" "$expected_norm" - fi if grep -Eq '^STRAIGHT_(TRAVERSE|FEED)$' "$expected_norm"; then sparse_ops_file="$TMP_DIR/$name.sparse_ops" grep -E '^STRAIGHT_(TRAVERSE|FEED)$' "$expected_norm" > "$sparse_ops_file"