From 111cb5f9b970d21d4d6ed38105d86364dcc71f59 Mon Sep 17 00:00:00 2001 From: cnc Date: Fri, 5 Jun 2026 08:54:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=BD=E5=BF=AB=E6=8E=A8=E8=BF=9B=EF=BC=9A?= =?UTF-8?q?=E6=94=B6=E7=B4=A7RCS=E6=89=93=E5=8D=B0shim=E6=BA=90=E7=A0=81?= =?UTF-8?q?=E9=94=9A=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- check-linuxcnc-wasm-shims-source-map.sh | 26 ++++++++++++++++++++++++- docs/linuxcnc-wasm-shims-source-map.md | 2 +- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/check-linuxcnc-wasm-shims-source-map.sh b/check-linuxcnc-wasm-shims-source-map.sh index 1154969..50aff26 100755 --- a/check-linuxcnc-wasm-shims-source-map.sh +++ b/check-linuxcnc-wasm-shims-source-map.sh @@ -46,7 +46,17 @@ grep -F 'wordexp(basename, &exp_result, 0);' "$linuxcnc_root/src/emc/rs274ngc/rs grep -F 'EMC_STAT *emcStatus = new EMC_STAT;' "$linuxcnc_root/src/emc/sai/dummyemcstat.cc" >/dev/null grep -F 'NMLmsg::NMLmsg' "$linuxcnc_root/src/libnml/nml/nmlmsg.cc" >/dev/null grep -F 'RCS_STAT_MSG::RCS_STAT_MSG' "$linuxcnc_root/src/libnml/nml/stat_msg.cc" >/dev/null +grep -F 'extern int set_print_rcs_error_info(const char *file, int line);' \ + "$linuxcnc_root/src/libnml/rcs/rcs_print.hh" >/dev/null +grep -F 'extern int print_rcs_error_new(const char *_fmt, ...)' \ + "$linuxcnc_root/src/libnml/rcs/rcs_print.hh" >/dev/null +grep -F '#define rcs_print_error set_print_rcs_error_info( __FILE__, __LINE__); print_rcs_error_new' \ + "$linuxcnc_root/src/libnml/rcs/rcs_print.hh" >/dev/null +grep -F 'int set_print_rcs_error_info(const char *file, int line)' \ + "$linuxcnc_root/src/libnml/rcs/rcs_print.cc" >/dev/null grep -F 'print_rcs_error_new' "$linuxcnc_root/src/libnml/rcs/rcs_print.cc" >/dev/null +grep -F 'retval = rcs_vprint(_fmt, args, 1);' \ + "$linuxcnc_root/src/libnml/rcs/rcs_print.cc" >/dev/null grep -F 'rtapi_snprintf' "$linuxcnc_root/src/rtapi/uspace_common.h" >/dev/null grep -F 'class PythonPlugin' "$linuxcnc_root/src/emc/pythonplugin/python_plugin.hh" >/dev/null grep -F 'PLUGIN_PYTHON_NOT_INITIALIZED = -12,' "$linuxcnc_root/src/emc/pythonplugin/python_plugin.hh" >/dev/null @@ -107,7 +117,10 @@ expected_shims = { "src/emc/rs274ngc/gcodemodule.cc", "src/emc/pythonplugin/python_plugin.cc", ], - "core/wasm_shims/rcs_print_shim.cc": ["src/libnml/rcs/rcs_print.cc"], + "core/wasm_shims/rcs_print_shim.cc": [ + "src/libnml/rcs/rcs_print.cc", + "src/libnml/rcs/rcs_print.hh", + ], "core/wasm_shims/rtapi_compat.cc": [ "src/rtapi/uspace_common.h", "src/rtapi/rtapi.h", @@ -201,6 +214,15 @@ for needle in [ if needle not in python_c_api_shim: raise SystemExit(f"Python C API shim missing symbol boundary: {needle}") +rcs_print_shim = Path("core/wasm_shims/rcs_print_shim.cc").read_text(encoding="utf-8") +for needle in [ + "set_print_rcs_error_info", + "print_rcs_error_new", + "std::vfprintf(stderr, format, args)", +]: + if needle not in rcs_print_shim: + raise SystemExit(f"RCS print shim missing split print-error boundary: {needle}") + for phrase in [ "must not add CNC behavior", "must not expand the temporary smoke parser", @@ -217,6 +239,8 @@ for phrase in [ "must not execute `bp::exec`, `bp::exec_file`, or", "inactive-DB return values", "negative-status short-circuit behavior", + "LinuxCNC `rcs_print_error` split entry points", + "without native print routing", "./check-linuxcnc-wasm-shims-source-map.sh", "does not interpret G-code", ]: diff --git a/docs/linuxcnc-wasm-shims-source-map.md b/docs/linuxcnc-wasm-shims-source-map.md index dc74061..3126901 100644 --- a/docs/linuxcnc-wasm-shims-source-map.md +++ b/docs/linuxcnc-wasm-shims-source-map.md @@ -20,7 +20,7 @@ only; it must not add CNC behavior and must not expand the temporary smoke parse | `core/wasm_shims/linuxcnc_runtime_shim.cc` | `src/emc/rs274ngc/gcodemodule.cc`, `src/emc/task/emctaskmain.cc`, `src/emc/task/taskclass.cc`, `src/emc/rs274ngc/interp_namedparams.cc`, `include/hal.h`, `src/hal/hal_lib.c`, `src/emc/rs274ngc/rs274ngc_pre.cc` | Keeps preview/task, builtin Python module, unavailable HAL lookup, and `wordexp()` edges compile-safe. | | `core/wasm_shims/nml_status_shim.cc` | `src/libnml/nml/nmlmsg.cc`, `src/libnml/nml/stat_msg.cc` | Provides NML status constructors needed by source-linked EMC status objects. | | `core/wasm_shims/python_c_api_shim.cc` | `src/emc/rs274ngc/interp_python.cc`, `src/emc/rs274ngc/interp_namedparams.cc`, `src/emc/rs274ngc/gcodemodule.cc`, `src/emc/pythonplugin/python_plugin.cc` | Satisfies Python C API symbols while Python/Boost.Python remap paths remain tracked blockers. | -| `core/wasm_shims/rcs_print_shim.cc` | `src/libnml/rcs/rcs_print.cc` | Provides LinuxCNC RCS print diagnostics used by NML validation. | +| `core/wasm_shims/rcs_print_shim.cc` | `src/libnml/rcs/rcs_print.cc`, `src/libnml/rcs/rcs_print.hh` | Provides the LinuxCNC `rcs_print_error` split entry points used by NML validation without native print routing. | | `core/wasm_shims/rtapi_compat.cc` | `src/rtapi/uspace_common.h`, `src/rtapi/rtapi.h` | Provides userspace RTAPI formatting declarations used by RS274/NML code. | | `core/wasm_shims/tooldata/tooldata_mmap_backend.cc` | `src/emc/tooldata/tooldata_mmap.cc` | Replaces native mmap storage with an in-memory WASM-safe backend for probes. | | `core/wasm_shims/tooldata/tooldata_runtime_stubs.cc` | `src/emc/tooldata/tooldata_nml.cc`, `src/emc/tooldata/tooldata_db.cc` | Satisfies NML and external tool database entry points without native services, preserving inactive-DB return values. |