按规划持续工作

This commit is contained in:
2026-06-09 06:13:28 +08:00
parent 902c6ecaea
commit 2658ee3b72
255 changed files with 12487 additions and 150 deletions

View File

@@ -39,7 +39,11 @@ vendored LinuxCNC RS274NGC sources and exposes:
- `runProgramWithIni(programText, iniPath)`
- `runFile(path)`
- `runFileWithIni(path, iniPath)`
- `runFileWithIniContinueOnError(path, iniPath)`
- `runSimConfigProgram({ iniPath, programPath, files, executionMode })`
- `runFiveAxisRemapFile(path, iniPath)`
- `runRemapFile(path, iniPath)`
- `runRemapIoMdiSequence(iniPath)`
- `restoreParameters(path)`
- `saveParameters(path, values)`
- `loadToolTable(path, options)`
@@ -55,3 +59,33 @@ LinuxCNC random-toolchanger branch before calling vendored
sample-machine remap validation. Callers provide INI/remap/demo files in the
WASM filesystem; the C ABI runs vendored LinuxCNC `REMAP`, O-word, file
execution, and HAL adapter paths.
`runRemapFile()` is the generic remap-test equivalent for vendored LinuxCNC
tests such as `tests/remap/duplicate-o-word`. It reads LinuxCNC INI
`SUBROUTINE_PATH` and `REMAP` entries, then calls vendored LinuxCNC
`Interp::parse_remap()`, `open()`, `read()`, and `execute()`.
`runRemapIoMdiSequence()` is a narrow regression boundary for the NGC-only
branch of vendored LinuxCNC `tests/remap/remap-io/test-ngc.ini`. The C ABI
reads LinuxCNC `REMAP` entries, then feeds the upstream test driver's MDI
command sequence into vendored `Interp::execute()`. JavaScript only copies the
vendored INI/subroutine files into the WASM filesystem and forwards the INI
path; it does not implement M62-M68, M66 input, or remap semantics.
`runFileWithIni()` is the plain interpreter-file equivalent for upstream tests
that need LinuxCNC INI search paths, such as
`tests/interp/sub-call-from-sub`. The C ABI reads LinuxCNC
`SUBROUTINE_PATH` and then calls vendored `Interp::open()`, `read()`, and
`execute()`; the SDK only copies files and forwards paths.
`runSimConfigProgram()` is a convenience host boundary for representative
LinuxCNC `configs/sim` programs. Callers provide `{ path, text, executable }`
file entries, an INI path, and a program path. The SDK writes those text files
into the Emscripten filesystem, applies executable bits for user M-code files,
then forwards to `runFileWithIni()` by default or to `runFiveAxisRemapFile()`
when `executionMode: "fiveAxisRemap"` is explicitly requested.
`runFileWithIniContinueOnError()` uses the same LinuxCNC-backed file execution
path but keeps the runner loop going after LinuxCNC reports an error, matching
upstream `rs274 -n 0` regression tests such as `tests/interp/oword-unwind`.
It does not implement or reinterpret LinuxCNC error semantics.

View File

@@ -58,6 +58,34 @@ export async function createLinuxCncInterpSdk(moduleOptions = {}) {
return mod.FS.readFile(path, { encoding: "utf8" });
},
runSimConfigProgram({
iniPath,
programPath,
files = [],
executionMode = "fileWithIni",
}) {
for (const file of files) {
ensureParentPath(mod, file.path);
mod.FS.writeFile(file.path, file.text, { encoding: "utf8" });
if (file.executable) {
mod.FS.chmod(file.path, 0o755);
}
}
if (executionMode === "fiveAxisRemap") {
return callStringResult(
mod,
"lcinterp_run_fiveaxis_remap_file",
programPath,
iniPath,
);
}
if (executionMode === "fileWithIni") {
return callStringResult(mod, "lcinterp_run_file_with_ini", programPath, iniPath);
}
throw new Error(`unsupported sim config execution mode: ${executionMode}`);
},
runProgram(programText) {
return callStringResult(mod, "lcinterp_run_program", programText);
},
@@ -74,10 +102,31 @@ export async function createLinuxCncInterpSdk(moduleOptions = {}) {
return callStringResult(mod, "lcinterp_run_file_with_ini", path, iniPath);
},
runFileWithIniContinueOnError(path, iniPath) {
return callStringResult(
mod,
"lcinterp_run_file_with_ini_continue_on_error",
path,
iniPath,
);
},
runFiveAxisRemapFile(path, iniPath) {
return callStringResult(mod, "lcinterp_run_fiveaxis_remap_file", path, iniPath);
},
runRemapFile(path, iniPath) {
return callStringResult(mod, "lcinterp_run_remap_file", path, iniPath);
},
runRemapFileContinueOnError(path, iniPath) {
return callStringResult(mod, "lcinterp_run_remap_file_continue_on_error", path, iniPath);
},
runRemapIoMdiSequence(iniPath) {
return callStringResult(mod, "lcinterp_run_remap_io_mdi_sequence", iniPath);
},
restoreParameters(path) {
return callStringResult(mod, "lcinterp_restore_parameters", path);
},