From ce0605d20d8237ff2e99bb59983800a3d9dcd5b9 Mon Sep 17 00:00:00 2001 From: cnc Date: Tue, 2 Jun 2026 13:58:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E6=8F=90=E7=A4=BA=E8=AF=8D=E7=BB=93?= =?UTF-8?q?=E8=AE=BA=E7=BB=9F=E4=B8=80=20wasm=20=E6=BA=90=E9=9B=86?= =?UTF-8?q?=E4=BE=9D=E6=8D=AE=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build-linuxcnc-wasm-probe-objects.sh | 18 +++++++----------- list-linuxcnc-wasm-safe-project-sources.sh | 4 ++++ list-linuxcnc-wasm-safe-shims.sh | 4 ++++ test-native.sh | 10 ++++++++++ 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/build-linuxcnc-wasm-probe-objects.sh b/build-linuxcnc-wasm-probe-objects.sh index b4528ad..394a369 100755 --- a/build-linuxcnc-wasm-probe-objects.sh +++ b/build-linuxcnc-wasm-probe-objects.sh @@ -6,8 +6,9 @@ cd "$(dirname "$0")" # LinuxCNC source basis: object probes compile the core entries selected from # linuxcnc-rs274-wasm-source-files.txt, including src/emc/rs274ngc, # src/emc/tooldata/tooldata_common.cc, src/emc/ini/inifile.cc, and -# src/emc/nml_intf/emcops.cc, together with wasm-safe shims that replace the -# manifest's blocked Python, dlopen, tooldata mmap, HAL, and runtime edges. +# src/emc/nml_intf/emcops.cc, together with CMake-listed wasm-safe project +# bridge sources and shims that replace the manifest's blocked Python, dlopen, +# tooldata mmap, HAL, and runtime edges. usage() { echo "usage: $0 --mode source-objects|rs274ngc-pre|runtime [manifest]" >&2 } @@ -99,6 +100,9 @@ case "$mode" in ;; esac +grep -F 'LinuxCNC source basis: wasm-safe project probe sources are the thin bridge' list-linuxcnc-wasm-safe-project-sources.sh >/dev/null +grep -F 'LinuxCNC source basis: wasm-safe shim probe sources are limited to the' list-linuxcnc-wasm-safe-shims.sh >/dev/null + sources=() shim_output=$(./list-linuxcnc-wasm-safe-shims.sh) mapfile -t shim_sources <<<"$shim_output" @@ -106,21 +110,13 @@ sources+=("${shim_sources[@]}") case "$mode" in source-objects) ;; - rs274ngc-pre) + rs274ngc-pre|runtime) project_source_output=$(./list-linuxcnc-wasm-safe-project-sources.sh) if [[ -n "$project_source_output" ]]; then mapfile -t project_sources <<<"$project_source_output" sources+=("${project_sources[@]}") fi ;; - runtime) - core_source_output=$(./list-cmake-set-sources.sh cnc_sim_core_sources core/) - mapfile -t core_sources <<<"$core_source_output" - sources+=("${core_sources[@]}") - backend_source_output=$(./list-cmake-set-sources.sh cnc_sim_linuxcnc_rs274_backend_sources core/) - mapfile -t backend_sources <<<"$backend_source_output" - sources+=("${backend_sources[@]}") - ;; esac source_output=$(CNC_SIM_PREFLIGHT_CACHE_DIR="$preflight_cache_dir" LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-wasm-manifest-sources.sh "$manifest" core full) mapfile -t linuxcnc_sources <<<"$source_output" diff --git a/list-linuxcnc-wasm-safe-project-sources.sh b/list-linuxcnc-wasm-safe-project-sources.sh index bcc7deb..747b9d1 100755 --- a/list-linuxcnc-wasm-safe-project-sources.sh +++ b/list-linuxcnc-wasm-safe-project-sources.sh @@ -3,6 +3,10 @@ set -euo pipefail cd "$(dirname "$0")" +# LinuxCNC source basis: wasm-safe project probe sources are the thin bridge +# and adapter sources listed in core/CMakeLists.txt, including the +# LinuxCNC-backed RS274 bridge that wraps rs274ngc_pre.cc, canon.hh, and +# tooldata.hh behavior without adding independent G-code semantics. filter=${1:-} { diff --git a/list-linuxcnc-wasm-safe-shims.sh b/list-linuxcnc-wasm-safe-shims.sh index 14950a5..aa11fc0 100755 --- a/list-linuxcnc-wasm-safe-shims.sh +++ b/list-linuxcnc-wasm-safe-shims.sh @@ -3,6 +3,10 @@ set -euo pipefail cd "$(dirname "$0")" +# LinuxCNC source basis: wasm-safe shim probe sources are limited to the +# linuxcnc_wasm_safe_probe_shims CMake set, whose files each carry nearby +# source-basis comments for the LinuxCNC Python, dlopen, HAL, tooldata, NML, +# RTAPI, and Boost.Python edges they replace for browser builds. filter=${1:-} ./list-cmake-set-sources.sh linuxcnc_wasm_safe_probe_shims | ./list-filtered-existing-paths.sh \ diff --git a/test-native.sh b/test-native.sh index 533dc14..8efc7c1 100755 --- a/test-native.sh +++ b/test-native.sh @@ -58,6 +58,16 @@ grep -F 'LinuxCNC source basis: src/emc/pythonplugin/python_plugin.cc and' test- grep -F 'LinuxCNC source basis: src/emc/rs274ngc/rs274ngc_pre.cc is compiled directly' test-linuxcnc-wasm-rs274ngc-pre-object.sh >/dev/null grep -F 'LinuxCNC source basis: src/emc/rs274ngc/rs274ngc_pre.cc provides the Interp' test-linuxcnc-wasm-rs274ngc-pre-link.sh >/dev/null grep -F 'LinuxCNC source basis: src/emc/rs274ngc/rs274ngc_pre.cc provides read()' test-linuxcnc-wasm-runtime-link.sh >/dev/null +grep -F 'LinuxCNC source basis: object probes compile the core entries selected from' build-linuxcnc-wasm-probe-objects.sh >/dev/null +grep -F 'LinuxCNC source basis: wasm-safe project probe sources are the thin bridge' list-linuxcnc-wasm-safe-project-sources.sh >/dev/null +grep -F 'LinuxCNC source basis: wasm-safe shim probe sources are limited to the' list-linuxcnc-wasm-safe-shims.sh >/dev/null +grep -F 'grep -F '\''LinuxCNC source basis: wasm-safe project probe sources are the thin bridge'\'' list-linuxcnc-wasm-safe-project-sources.sh >/dev/null' build-linuxcnc-wasm-probe-objects.sh >/dev/null +grep -F 'grep -F '\''LinuxCNC source basis: wasm-safe shim probe sources are limited to the'\'' list-linuxcnc-wasm-safe-shims.sh >/dev/null' build-linuxcnc-wasm-probe-objects.sh >/dev/null +grep -F 'rs274ngc-pre|runtime)' build-linuxcnc-wasm-probe-objects.sh >/dev/null +if grep -F 'list-cmake-set-sources.sh cnc_sim_core_sources core/' build-linuxcnc-wasm-probe-objects.sh >/dev/null; then + echo "wasm probe object builder must use the source-basis-checked project source lister" >&2 + exit 1 +fi grep -F 'LinuxCNC source basis: standalone probe modes either compile LinuxCNC' build-linuxcnc-wasm-standalone-probe.sh >/dev/null grep -F 'LinuxCNC source basis: link probe modes reuse wasm-safe objects built from' build-linuxcnc-wasm-link-probe.sh >/dev/null grep -F 'grep -F '\''LinuxCNC source basis: src/emc/rs274ngc/rs274ngc_pre.cc provides'\'' "$main_source" >/dev/null' build-linuxcnc-wasm-link-probe.sh >/dev/null