尽快推进:收紧EMC状态shim源码锚点

This commit is contained in:
cnc
2026-06-05 09:19:23 +08:00
parent 035b25862a
commit a89c107676
2 changed files with 13 additions and 1 deletions

View File

@@ -47,6 +47,7 @@ grep -F 'int hal_get_pin_value_by_name(' "$linuxcnc_root/src/hal/hal_lib.c" >/de
grep -F 'int hal_get_signal_value_by_name(' "$linuxcnc_root/src/hal/hal_lib.c" >/dev/null grep -F 'int hal_get_signal_value_by_name(' "$linuxcnc_root/src/hal/hal_lib.c" >/dev/null
grep -F 'int hal_get_param_value_by_name(' "$linuxcnc_root/src/hal/hal_lib.c" >/dev/null grep -F 'int hal_get_param_value_by_name(' "$linuxcnc_root/src/hal/hal_lib.c" >/dev/null
grep -F 'wordexp(basename, &exp_result, 0);' "$linuxcnc_root/src/emc/rs274ngc/rs274ngc_pre.cc" >/dev/null grep -F 'wordexp(basename, &exp_result, 0);' "$linuxcnc_root/src/emc/rs274ngc/rs274ngc_pre.cc" >/dev/null
grep -F '#include "nml_intf/emc_nml.hh"' "$linuxcnc_root/src/emc/sai/dummyemcstat.cc" >/dev/null
grep -F 'EMC_STAT *emcStatus = new EMC_STAT;' "$linuxcnc_root/src/emc/sai/dummyemcstat.cc" >/dev/null grep -F 'EMC_STAT *emcStatus = new EMC_STAT;' "$linuxcnc_root/src/emc/sai/dummyemcstat.cc" >/dev/null
grep -F 'int NMLmsg::automatically_clear = 1;' \ grep -F 'int NMLmsg::automatically_clear = 1;' \
"$linuxcnc_root/src/libnml/nml/nmlmsg.cc" >/dev/null "$linuxcnc_root/src/libnml/nml/nmlmsg.cc" >/dev/null
@@ -180,6 +181,7 @@ runtime_shim = Path("core/wasm_shims/linuxcnc_runtime_shim.cc").read_text(encodi
runtime_probe = Path("core/wasm_shims/cnc_sim_wasm_runtime_probe_main.cc").read_text(encoding="utf-8") runtime_probe = Path("core/wasm_shims/cnc_sim_wasm_runtime_probe_main.cc").read_text(encoding="utf-8")
dlfcn_shim = Path("core/wasm_shims/dlfcn.cc").read_text(encoding="utf-8") dlfcn_shim = Path("core/wasm_shims/dlfcn.cc").read_text(encoding="utf-8")
dlfcn_header = Path("core/wasm_shims/dlfcn.h").read_text(encoding="utf-8") dlfcn_header = Path("core/wasm_shims/dlfcn.h").read_text(encoding="utf-8")
emc_status_shim = Path("core/wasm_shims/emc_status_shim.cc").read_text(encoding="utf-8")
gettext_shim = Path("core/wasm_shims/gettext_shim.cc").read_text(encoding="utf-8") gettext_shim = Path("core/wasm_shims/gettext_shim.cc").read_text(encoding="utf-8")
for needle in [ for needle in [
"#define RTLD_GLOBAL 0x00100", "#define RTLD_GLOBAL 0x00100",
@@ -203,6 +205,12 @@ for needle in [
]: ]:
if needle not in dlfcn_shim: if needle not in dlfcn_shim:
raise SystemExit(f"dlfcn shim missing unavailable-loader boundary: {needle}") raise SystemExit(f"dlfcn shim missing unavailable-loader boundary: {needle}")
for needle in [
'#include "nml_intf/emc_nml.hh"',
"EMC_STAT *emcStatus = new EMC_STAT;",
]:
if needle not in emc_status_shim:
raise SystemExit(f"EMC status shim missing detached LinuxCNC status singleton: {needle}")
for needle in [ for needle in [
"extern \"C\" char *gettext(const char *msgid)", "extern \"C\" char *gettext(const char *msgid)",
"return const_cast<char *>(msgid ? msgid : \"\");", "return const_cast<char *>(msgid ? msgid : \"\");",
@@ -306,6 +314,7 @@ for phrase in [
"browser-safe LinuxCNC adaptations", "browser-safe LinuxCNC adaptations",
"LinuxCNC `interp_base.cc` dynamic loader calls", "LinuxCNC `interp_base.cc` dynamic loader calls",
"unavailable-loader returns", "unavailable-loader returns",
"detached LinuxCNC `EMC_STAT` singleton",
"LinuxCNC `_()` diagnostic call sites", "LinuxCNC `_()` diagnostic call sites",
"browser gettext catalogs unavailable", "browser gettext catalogs unavailable",
"LinuxCNC NML status constructors", "LinuxCNC NML status constructors",

View File

@@ -15,7 +15,7 @@ only; it must not add CNC behavior and must not expand the temporary smoke parse
| Shim | LinuxCNC source basis | Boundary | | Shim | LinuxCNC source basis | Boundary |
| --- | --- | --- | | --- | --- | --- |
| `core/wasm_shims/dlfcn.cc` | `src/emc/rs274ngc/interp_base.cc` | Satisfies LinuxCNC `interp_base.cc` dynamic loader calls and RTLD flags for browser-safe probes while keeping dynamic loading unavailable. | | `core/wasm_shims/dlfcn.cc` | `src/emc/rs274ngc/interp_base.cc` | Satisfies LinuxCNC `interp_base.cc` dynamic loader calls and RTLD flags for browser-safe probes while keeping dynamic loading unavailable. |
| `core/wasm_shims/emc_status_shim.cc` | `src/emc/sai/dummyemcstat.cc` | Provides the source-backed `emcStatus` singleton shape without task/NML startup. | | `core/wasm_shims/emc_status_shim.cc` | `src/emc/sai/dummyemcstat.cc` | Provides the detached LinuxCNC `EMC_STAT` singleton shape without task/NML startup. |
| `core/wasm_shims/gettext_shim.cc` | `src/emc/rs274ngc/interp_internal.hh` | Preserves LinuxCNC `_()` diagnostic call sites by satisfying `gettext()` while leaving browser gettext catalogs unavailable. | | `core/wasm_shims/gettext_shim.cc` | `src/emc/rs274ngc/interp_internal.hh` | Preserves LinuxCNC `_()` diagnostic call sites by satisfying `gettext()` while leaving browser gettext catalogs unavailable. |
| `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/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 LinuxCNC NML status constructors, clear behavior, and `RCS_STAT_MSG` default status fields needed by source-linked EMC status objects. | | `core/wasm_shims/nml_status_shim.cc` | `src/libnml/nml/nmlmsg.cc`, `src/libnml/nml/stat_msg.cc` | Provides LinuxCNC NML status constructors, clear behavior, and `RCS_STAT_MSG` default status fields needed by source-linked EMC status objects. |
@@ -33,6 +33,9 @@ only; it must not add CNC behavior and must not expand the temporary smoke parse
`dlerror()`, `RTLD_GLOBAL`, and `RTLD_NOW`; their unavailable-loader returns `dlerror()`, `RTLD_GLOBAL`, and `RTLD_NOW`; their unavailable-loader returns
must keep handles and symbols null, keep `dlerror()` diagnostic text stable, must keep handles and symbols null, keep `dlerror()` diagnostic text stable,
and leave `dlclose()` side-effect free. and leave `dlclose()` side-effect free.
- `core/wasm_shims/emc_status_shim.cc` must stay limited to the detached
LinuxCNC `EMC_STAT` singleton from `src/emc/sai/dummyemcstat.cc`; it must not
pull in task startup, NML channels, or operator callback behavior.
- `core/wasm_shims/linuxcnc_runtime_shim.cc` must keep `_task=0` for preview, - `core/wasm_shims/linuxcnc_runtime_shim.cc` must keep `_task=0` for preview,
matching `src/emc/rs274ngc/gcodemodule.cc`; it must not switch browser-safe probes into task mode. matching `src/emc/rs274ngc/gcodemodule.cc`; it must not switch browser-safe probes into task mode.
- The HAL lookup shim covers `hal_get_pin_value_by_name()`, - The HAL lookup shim covers `hal_get_pin_value_by_name()`,