尽快推进:收紧runtime shim源码锚点
This commit is contained in:
@@ -31,6 +31,8 @@ grep -F 'Cannot use polar coordinate on a machine lacking X or Y axes' \
|
|||||||
"$linuxcnc_root/src/emc/rs274ngc/interp_internal.cc" >/dev/null
|
"$linuxcnc_root/src/emc/rs274ngc/interp_internal.cc" >/dev/null
|
||||||
grep -F 'int _task = 0;' "$linuxcnc_root/src/emc/rs274ngc/gcodemodule.cc" >/dev/null
|
grep -F 'int _task = 0;' "$linuxcnc_root/src/emc/rs274ngc/gcodemodule.cc" >/dev/null
|
||||||
grep -F 'int _task = 1;' "$linuxcnc_root/src/emc/task/emctaskmain.cc" >/dev/null
|
grep -F 'int _task = 1;' "$linuxcnc_root/src/emc/task/emctaskmain.cc" >/dev/null
|
||||||
|
grep -F '{ "interpreter", PyInit_interpreter },' "$linuxcnc_root/src/emc/rs274ngc/gcodemodule.cc" >/dev/null
|
||||||
|
grep -F '{ "emccanon", PyInit_emccanon },' "$linuxcnc_root/src/emc/rs274ngc/gcodemodule.cc" >/dev/null
|
||||||
grep -F 'struct _inittab builtin_modules[]' "$linuxcnc_root/src/emc/task/taskclass.cc" >/dev/null
|
grep -F 'struct _inittab builtin_modules[]' "$linuxcnc_root/src/emc/task/taskclass.cc" >/dev/null
|
||||||
grep -F 'int Interp::fetch_hal_param(' "$linuxcnc_root/src/emc/rs274ngc/interp_namedparams.cc" >/dev/null
|
grep -F 'int Interp::fetch_hal_param(' "$linuxcnc_root/src/emc/rs274ngc/interp_namedparams.cc" >/dev/null
|
||||||
grep -F 'hal_get_pin_value_by_name(hal_name, &type, &ptr, &conn)' \
|
grep -F 'hal_get_pin_value_by_name(hal_name, &type, &ptr, &conn)' \
|
||||||
@@ -47,6 +49,11 @@ 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 'wordexp(settings->program_prefix, &exp_result, 0);' \
|
||||||
|
"$linuxcnc_root/src/emc/rs274ngc/rs274ngc_pre.cc" >/dev/null
|
||||||
|
grep -F 'wordexp(settings->subroutines[dct], &exp_result, 0);' \
|
||||||
|
"$linuxcnc_root/src/emc/rs274ngc/rs274ngc_pre.cc" >/dev/null
|
||||||
|
grep -F 'wordfree(&exp_result);' "$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 '#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;' \
|
||||||
@@ -229,6 +236,32 @@ for needle in [
|
|||||||
]:
|
]:
|
||||||
if needle not in nml_status_shim:
|
if needle not in nml_status_shim:
|
||||||
raise SystemExit(f"NML status shim missing LinuxCNC constructor boundary: {needle}")
|
raise SystemExit(f"NML status shim missing LinuxCNC constructor boundary: {needle}")
|
||||||
|
for needle in [
|
||||||
|
"int _task = 0;",
|
||||||
|
'extern "C" PyObject *PyInit_interpreter(void)',
|
||||||
|
'extern "C" PyObject *PyInit_emccanon(void)',
|
||||||
|
'extern "C" PyObject *PyInit_gcode(void)',
|
||||||
|
"return nullptr;",
|
||||||
|
'struct _inittab builtin_modules[] = {',
|
||||||
|
'{"interpreter", PyInit_interpreter}',
|
||||||
|
'{"emccanon", PyInit_emccanon}',
|
||||||
|
]:
|
||||||
|
if needle not in runtime_shim:
|
||||||
|
raise SystemExit(f"linuxcnc runtime shim missing preview/builtin module boundary: {needle}")
|
||||||
|
for needle in [
|
||||||
|
"std::string expand_home_directory(const char *words)",
|
||||||
|
"std::string expand_environment_variables(const std::string &words)",
|
||||||
|
"extern \"C\" int wordexp(const char *words, wordexp_t *pwordexp, int)",
|
||||||
|
"return WRDE_BADVAL;",
|
||||||
|
"return WRDE_NOSPACE;",
|
||||||
|
"pwordexp->we_wordc = 1;",
|
||||||
|
"pwordexp->we_offs = 0;",
|
||||||
|
"extern \"C\" void wordfree(wordexp_t *pwordexp)",
|
||||||
|
"pwordexp->we_wordc = 0;",
|
||||||
|
"pwordexp->we_wordv = nullptr;",
|
||||||
|
]:
|
||||||
|
if needle not in runtime_shim:
|
||||||
|
raise SystemExit(f"linuxcnc runtime shim missing limited wordexp boundary: {needle}")
|
||||||
for needle in [
|
for needle in [
|
||||||
'extern "C" int hal_get_pin_value_by_name',
|
'extern "C" int hal_get_pin_value_by_name',
|
||||||
'extern "C" int hal_get_signal_value_by_name',
|
'extern "C" int hal_get_signal_value_by_name',
|
||||||
@@ -322,7 +355,11 @@ for phrase in [
|
|||||||
"dynamic loading unavailable",
|
"dynamic loading unavailable",
|
||||||
"unavailable HAL lookup",
|
"unavailable HAL lookup",
|
||||||
"must leave HAL values unavailable",
|
"must leave HAL values unavailable",
|
||||||
|
"preview `_task=0`",
|
||||||
|
"builtin module stubs",
|
||||||
"must not switch browser-safe probes into task mode",
|
"must not switch browser-safe probes into task mode",
|
||||||
|
"single-word `wordexp()` path expansion",
|
||||||
|
"`wordfree()` cleanup",
|
||||||
"must not become a shell expansion feature",
|
"must not become a shell expansion feature",
|
||||||
"must not become Python execution",
|
"must not become Python execution",
|
||||||
"keeping Python execution disabled",
|
"keeping Python execution disabled",
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ only; it must not add CNC behavior and must not expand the temporary smoke parse
|
|||||||
| `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 detached LinuxCNC `EMC_STAT` 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 module stubs, 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. |
|
||||||
| `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/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`, `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/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. |
|
||||||
@@ -36,15 +36,20 @@ only; it must not add CNC behavior and must not expand the temporary smoke parse
|
|||||||
- `core/wasm_shims/emc_status_shim.cc` must stay limited to the detached
|
- `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
|
LinuxCNC `EMC_STAT` singleton from `src/emc/sai/dummyemcstat.cc`; it must not
|
||||||
pull in task startup, NML channels, or operator callback behavior.
|
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 preview `_task=0`,
|
||||||
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 runtime shim's builtin module stubs must match LinuxCNC's
|
||||||
|
`interpreter`/`emccanon` inittab shape from `gcodemodule.cc` and
|
||||||
|
`taskclass.cc` while returning null module pointers; they must not become
|
||||||
|
Python execution.
|
||||||
- The HAL lookup shim covers `hal_get_pin_value_by_name()`,
|
- The HAL lookup shim covers `hal_get_pin_value_by_name()`,
|
||||||
`hal_get_signal_value_by_name()`, and `hal_get_param_value_by_name()` from
|
`hal_get_signal_value_by_name()`, and `hal_get_param_value_by_name()` from
|
||||||
`src/emc/rs274ngc/interp_namedparams.cc`, `include/hal.h`, and
|
`src/emc/rs274ngc/interp_namedparams.cc`, `include/hal.h`, and
|
||||||
`src/hal/hal_lib.c`; it must leave HAL values unavailable by returning `-1`,
|
`src/hal/hal_lib.c`; it must leave HAL values unavailable by returning `-1`,
|
||||||
`HAL_TYPE_UNINITIALIZED`, and null data pointers.
|
`HAL_TYPE_UNINITIALIZED`, and null data pointers.
|
||||||
- `wordexp()` support is limited to the browser-safe path expansion needed by
|
- `wordexp()` support is limited to the single-word `wordexp()` path expansion
|
||||||
`src/emc/rs274ngc/rs274ngc_pre.cc`; it must not become a shell expansion feature.
|
and `wordfree()` cleanup needed by `src/emc/rs274ngc/rs274ngc_pre.cc` for
|
||||||
|
basename, program prefix, and subroutine-directory lookups; it must not become a shell expansion feature.
|
||||||
|
|
||||||
## Python Shim Boundaries
|
## Python Shim Boundaries
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user