按规划继续工作
结论:接入 LinuxCNC iniFindBool 到 INI WASM/SDK,并让 machine-session bridge 通过 vendored INI 解析 [EMCIO]RANDOM_TOOLCHANGER 后透传给 tooldata;native、WASM、OPFS 和浏览器 smoke 验证已通过。
This commit is contained in:
@@ -74,8 +74,9 @@ The native validation script runs these checks in order:
|
|||||||
|
|
||||||
The WASM INI smoke script builds `runtime/ui/ini-panel/linuxcnc_ini.js` and
|
The WASM INI smoke script builds `runtime/ui/ini-panel/linuxcnc_ini.js` and
|
||||||
`linuxcnc_ini.wasm` from vendored LinuxCNC `inifile.cc`, then loads that
|
`linuxcnc_ini.wasm` from vendored LinuxCNC `inifile.cc`, then loads that
|
||||||
module through `runtime/sdk/src/index.js` in Node and verifies INI
|
module through `runtime/sdk/src/index.js` in Node and verifies INI string and
|
||||||
queries against a file written to the Emscripten filesystem.
|
boolean queries against a file written to the Emscripten filesystem. Boolean
|
||||||
|
conversion is validated through vendored LinuxCNC `iniFindBool()`.
|
||||||
|
|
||||||
The WASM interpreter-core smoke script builds
|
The WASM interpreter-core smoke script builds
|
||||||
`build/wasm/core/linuxcnc_interp.js` and `linuxcnc_interp.wasm` from the same
|
`build/wasm/core/linuxcnc_interp.js` and `linuxcnc_interp.wasm` from the same
|
||||||
@@ -252,10 +253,11 @@ smoke harness, the INI panel UI's machine-session load and G-code run buttons,
|
|||||||
the raw canonical-event display fed directly by LinuxCNC interpreter WASM
|
the raw canonical-event display fed directly by LinuxCNC interpreter WASM
|
||||||
output, the Node parameter/tool-table bridges that copy OPFS text through the
|
output, the Node parameter/tool-table bridges that copy OPFS text through the
|
||||||
SDK into vendored LinuxCNC file APIs, the Node machine-session bridge that
|
SDK into vendored LinuxCNC file APIs, the Node machine-session bridge that
|
||||||
groups INI, parameter, and tool-table loading, the random-toolchanger flag as
|
groups INI, parameter, and tool-table loading, the random-toolchanger flag
|
||||||
a host boundary passed through to the LinuxCNC-backed tool-table ABI, and a
|
derived from vendored LinuxCNC INI boolean parsing and passed through to the
|
||||||
browser interpreter smoke that uses the same session bridge before saving
|
LinuxCNC-backed tool-table ABI, and a browser interpreter smoke that uses the
|
||||||
OPFS-backed parameter and tool-table text through vendored LinuxCNC file APIs.
|
same session bridge before saving OPFS-backed parameter and tool-table text
|
||||||
|
through vendored LinuxCNC file APIs.
|
||||||
Full browser coverage, full SDK coverage, and richer machine-state validation
|
Full browser coverage, full SDK coverage, and richer machine-state validation
|
||||||
remain future work.
|
remain future work.
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ semantic rewrites:
|
|||||||
| --- | --- |
|
| --- | --- |
|
||||||
| RTAPI | Minimal compatibility shim in `runtime/core/shims/rtapi.h`. |
|
| RTAPI | Minimal compatibility shim in `runtime/core/shims/rtapi.h`. |
|
||||||
| HAL lookup | Standalone HAL adapter for `_hal[...]` named parameter reads. |
|
| HAL lookup | Standalone HAL adapter for `_hal[...]` named parameter reads. |
|
||||||
| INI lookup | Standalone INI adapter around vendored LinuxCNC INI parser behavior. |
|
| INI lookup | Standalone INI adapter around vendored LinuxCNC INI parser behavior, including boolean conversion through LinuxCNC `iniFindBool()`. |
|
||||||
| Canonical output | Canonical calls are captured as test events instead of driving hardware. |
|
| Canonical output | Canonical calls are captured as test events instead of driving hardware. |
|
||||||
| Feed-rate state | `SET_FEED_RATE` updates standalone canonical runtime state so vendored `convert_length_units()` can read it back through `GET_EXTERNAL_FEED_RATE()` during G20/G21 changes. |
|
| Feed-rate state | `SET_FEED_RATE` updates standalone canonical runtime state so vendored `convert_length_units()` can read it back through `GET_EXTERNAL_FEED_RATE()` during G20/G21 changes. |
|
||||||
| Tool-data reload | LinuxCNC `RELOAD_TOOLDATA` is captured as a canonical test event; browser/native tool-table reload plumbing remains a future host/runtime adapter. |
|
| Tool-data reload | LinuxCNC `RELOAD_TOOLDATA` is captured as a canonical test event; browser/native tool-table reload plumbing remains a future host/runtime adapter. |
|
||||||
@@ -44,7 +44,7 @@ semantic rewrites:
|
|||||||
| Kinematics component lifecycle | Kinematics modules are initialized through LinuxCNC module entry points where native runtime probes exist, while HAL component init/ready/exit, HAL pin allocation, and RTAPI module metadata are handled by standalone shims. |
|
| Kinematics component lifecycle | Kinematics modules are initialized through LinuxCNC module entry points where native runtime probes exist, while HAL component init/ready/exit, HAL pin allocation, and RTAPI module metadata are handled by standalone shims. |
|
||||||
| Go math C/C++ linkage | `genserkins` runtime probing compiles vendored `gomath.c` through a narrow C++ wrapper so LinuxCNC `genserfuncs.c` can link to the upstream Go math symbols without editing vendored source. |
|
| Go math C/C++ linkage | `genserkins` runtime probing compiles vendored `gomath.c` through a narrow C++ wrapper so LinuxCNC `genserfuncs.c` can link to the upstream Go math symbols without editing vendored source. |
|
||||||
| Switchkins iterative forward | `genhexkins` runtime probing follows LinuxCNC switchkins iterative-forward behavior, including the first-call warmup path before asserting roundtrip convergence. |
|
| Switchkins iterative forward | `genhexkins` runtime probing follows LinuxCNC switchkins iterative-forward behavior, including the first-call warmup path before asserting roundtrip convergence. |
|
||||||
| Browser storage | OPFS remains outside the native core; `runtime/opfs/file-service.js` owns browser text-file persistence, `runtime/opfs/path-model.js` owns host-side storage paths for INI, tool table, parameter, G-code, preview-cache, and session-snapshot content, `runtime/opfs/snapshot-store.js` owns generic JSON session snapshot persistence, `runtime/opfs/machine-file-store.js` owns pure-text machine-file and G-code persistence, `runtime/opfs/linuxcnc-parameter-bridge.js` only copies parameter files between OPFS text storage and the LinuxCNC-backed WASM parameter-file ABI, `runtime/opfs/linuxcnc-tool-table-bridge.js` only copies tool tables between OPFS text storage and the LinuxCNC-backed WASM tool-table ABI, and `runtime/opfs/linuxcnc-machine-session-bridge.js` groups INI, parameter, and tool-table loading without interpreting their CNC semantics. |
|
| Browser storage | OPFS remains outside the native core; `runtime/opfs/file-service.js` owns browser text-file persistence, `runtime/opfs/path-model.js` owns host-side storage paths for INI, tool table, parameter, G-code, preview-cache, and session-snapshot content, `runtime/opfs/snapshot-store.js` owns generic JSON session snapshot persistence, `runtime/opfs/machine-file-store.js` owns pure-text machine-file and G-code persistence, `runtime/opfs/linuxcnc-parameter-bridge.js` only copies parameter files between OPFS text storage and the LinuxCNC-backed WASM parameter-file ABI, `runtime/opfs/linuxcnc-tool-table-bridge.js` only copies tool tables between OPFS text storage and the LinuxCNC-backed WASM tool-table ABI, and `runtime/opfs/linuxcnc-machine-session-bridge.js` groups INI, parameter, and tool-table loading while using the LinuxCNC-backed INI SDK for `[EMCIO]RANDOM_TOOLCHANGER` when available. |
|
||||||
|
|
||||||
## Enforced Non-Drift Rules
|
## Enforced Non-Drift Rules
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ Current validation is intentionally mechanical:
|
|||||||
|
|
||||||
| Capability | LinuxCNC source files | Port classification | Standalone boundary | Current validation |
|
| Capability | LinuxCNC source files | Port classification | Standalone boundary | Current validation |
|
||||||
| --- | --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- |
|
||||||
| INI parsing | `src/emc/ini/inifile.cc`, `inifile.h`, `inifile.hh` | Copy unchanged | Native file IO remains LinuxCNC-style in the vendored parser; browser OPFS integration remains outside this layer; `runtime/sdk/src/index.js` exports the INI SDK wrapper around the generated WASM C ABI | Vendor byte sync, `linuxcnc_ini_probe`, `linuxcnc_inifile_source_probe`, `tests/wasm/node/verify_ini_wasm.sh`, `tests/browser/verify_ini_panel_browser.sh`, `tests/host/verify_host_smokes.sh` |
|
| INI parsing | `src/emc/ini/inifile.cc`, `inifile.h`, `inifile.hh` | Copy unchanged | Native file IO remains LinuxCNC-style in the vendored parser; browser OPFS integration remains outside this layer; `runtime/sdk/src/index.js` exports the INI SDK wrapper around the generated WASM C ABI, including LinuxCNC `iniFindBool()` for machine-session flags | Vendor byte sync, `linuxcnc_ini_probe`, `linuxcnc_inifile_source_probe`, `tests/wasm/node/verify_ini_wasm.sh`, `tests/browser/verify_ini_panel_browser.sh`, `tests/host/verify_host_smokes.sh` |
|
||||||
| RTAPI compatibility headers | `src/rtapi/rtapi_*.h` in the manifest | Copy unchanged plus standalone shim include path | `runtime/core/shims/rtapi.h` supplies the minimal standalone RTAPI surface needed by vendored code | Vendor byte sync, compile coverage through dependent source probes |
|
| RTAPI compatibility headers | `src/rtapi/rtapi_*.h` in the manifest | Copy unchanged plus standalone shim include path | `runtime/core/shims/rtapi.h` supplies the minimal standalone RTAPI surface needed by vendored code | Vendor byte sync, compile coverage through dependent source probes |
|
||||||
| Canon/NML-facing interpreter types | `src/emc/nml_intf/canon*.hh`, `emctool.h`, `interp_return.hh`, `motion_types.h`, `emcpose.*`, `emcpos.h`, `debugflags.h`, `src/emc/linuxcnc.h` | Copy unchanged plus narrow standalone status shim | NML transport is not ported; `runtime/core/shims/nml_intf/emc.hh` exposes only the `emcStatus` machine-units status edge currently needed by vendored interpreter conversion and initialization code | Vendor byte sync, dependent source probes, `linuxcnc_emc_status_probe`, `linuxcnc_tp_api_probe`, interpreter harnesses |
|
| Canon/NML-facing interpreter types | `src/emc/nml_intf/canon*.hh`, `emctool.h`, `interp_return.hh`, `motion_types.h`, `emcpose.*`, `emcpos.h`, `debugflags.h`, `src/emc/linuxcnc.h` | Copy unchanged plus narrow standalone status shim | NML transport is not ported; `runtime/core/shims/nml_intf/emc.hh` exposes only the `emcStatus` machine-units status edge currently needed by vendored interpreter conversion and initialization code | Vendor byte sync, dependent source probes, `linuxcnc_emc_status_probe`, `linuxcnc_tp_api_probe`, interpreter harnesses |
|
||||||
| Motion state headers | `src/emc/motion/state_tag.h`, `emcmotcfg.h`, `simple_tp.h`, `motion.h`, `mot_priv.h`, `axis.h` | Copy unchanged | Realtime motion process is not ported; standalone probes seed the small motion status/config state required by TP calls | Vendor byte sync, `linuxcnc_tp_api_probe` |
|
| Motion state headers | `src/emc/motion/state_tag.h`, `emcmotcfg.h`, `simple_tp.h`, `motion.h`, `mot_priv.h`, `axis.h` | Copy unchanged | Realtime motion process is not ported; standalone probes seed the small motion status/config state required by TP calls | Vendor byte sync, `linuxcnc_tp_api_probe` |
|
||||||
@@ -92,6 +92,8 @@ Current validation is intentionally mechanical:
|
|||||||
copies OPFS-backed tool tables into the interpreter SDK filesystem and writes
|
copies OPFS-backed tool tables into the interpreter SDK filesystem and writes
|
||||||
back the LinuxCNC-saved tool table.
|
back the LinuxCNC-saved tool table.
|
||||||
`runtime/opfs/linuxcnc-machine-session-bridge.js` groups INI, parameter, and
|
`runtime/opfs/linuxcnc-machine-session-bridge.js` groups INI, parameter, and
|
||||||
tool-table loading into one host-side session load boundary. Full
|
tool-table loading into one host-side session load boundary and can derive
|
||||||
machine-state restoration remains future work.
|
the random-toolchanger tooldata mode from `[EMCIO]RANDOM_TOOLCHANGER` through
|
||||||
|
the LinuxCNC-backed INI SDK. Full machine-state restoration remains future
|
||||||
|
work.
|
||||||
- Native LinuxCNC GUI code remains out of scope for implementation.
|
- Native LinuxCNC GUI code remains out of scope for implementation.
|
||||||
|
|||||||
@@ -13,6 +13,19 @@ int lcini_get_string(const char *inipath,
|
|||||||
return iniFindString(inipath, tag, section, buf, static_cast<size_t>(bufsize));
|
return iniFindString(inipath, tag, section, buf, static_cast<size_t>(bufsize));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE
|
||||||
|
int lcini_get_bool(const char *inipath,
|
||||||
|
const char *section,
|
||||||
|
const char *tag,
|
||||||
|
int *result) {
|
||||||
|
bool value = false;
|
||||||
|
const int rc = iniFindBool(inipath, tag, section, &value);
|
||||||
|
if (rc == 0 && result) {
|
||||||
|
*result = value ? 1 : 0;
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE
|
EMSCRIPTEN_KEEPALIVE
|
||||||
int lcini_tilde_expand(const char *path, char *buf, int bufsize) {
|
int lcini_tilde_expand(const char *path, char *buf, int bufsize) {
|
||||||
return TildeExpansion(path, buf, static_cast<size_t>(bufsize));
|
return TildeExpansion(path, buf, static_cast<size_t>(bufsize));
|
||||||
|
|||||||
@@ -17,6 +17,17 @@ function requireSessionSdk(interp) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function requireIniSdk(iniSdk) {
|
||||||
|
if (!iniSdk) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (const method of ["writeTextFile", "getBool"]) {
|
||||||
|
if (typeof iniSdk[method] !== "function") {
|
||||||
|
throw new Error(`INI SDK is missing ${method}().`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function resolveSessionPaths(machineId, options = {}) {
|
function resolveSessionPaths(machineId, options = {}) {
|
||||||
return {
|
return {
|
||||||
iniOpfsPath: options.iniOpfsPath ?? machineIniPath(machineId, options.iniFilename),
|
iniOpfsPath: options.iniOpfsPath ?? machineIniPath(machineId, options.iniFilename),
|
||||||
@@ -30,11 +41,25 @@ function resolveSessionPaths(machineId, options = {}) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function randomToolChangerFromIni(iniSdk, iniWasmPath, iniText) {
|
||||||
|
if (!iniSdk) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
iniSdk.writeTextFile(iniWasmPath, iniText);
|
||||||
|
return iniSdk.getBool(iniWasmPath, "EMCIO", "RANDOM_TOOLCHANGER") === true;
|
||||||
|
}
|
||||||
|
|
||||||
export async function loadMachineSessionFromOpfs(interp, machineId, options = {}) {
|
export async function loadMachineSessionFromOpfs(interp, machineId, options = {}) {
|
||||||
requireSessionSdk(interp);
|
requireSessionSdk(interp);
|
||||||
|
requireIniSdk(options.iniSdk);
|
||||||
const paths = resolveSessionPaths(machineId, options);
|
const paths = resolveSessionPaths(machineId, options);
|
||||||
const iniText = await loadTextFile(paths.iniOpfsPath, options.storage);
|
const iniText = await loadTextFile(paths.iniOpfsPath, options.storage);
|
||||||
interp.writeTextFile(paths.iniWasmPath, iniText);
|
interp.writeTextFile(paths.iniWasmPath, iniText);
|
||||||
|
const randomToolChanger =
|
||||||
|
typeof options.randomToolChanger === "boolean"
|
||||||
|
? options.randomToolChanger
|
||||||
|
: randomToolChangerFromIni(options.iniSdk, paths.iniWasmPath, iniText);
|
||||||
|
|
||||||
const parameters = await restoreMachineParametersFromOpfs(interp, machineId, {
|
const parameters = await restoreMachineParametersFromOpfs(interp, machineId, {
|
||||||
storage: options.storage,
|
storage: options.storage,
|
||||||
@@ -45,7 +70,7 @@ export async function loadMachineSessionFromOpfs(interp, machineId, options = {}
|
|||||||
storage: options.storage,
|
storage: options.storage,
|
||||||
opfsPath: paths.toolTableOpfsPath,
|
opfsPath: paths.toolTableOpfsPath,
|
||||||
wasmPath: paths.toolTableWasmPath,
|
wasmPath: paths.toolTableWasmPath,
|
||||||
randomToolChanger: options.randomToolChanger === true,
|
randomToolChanger,
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ import {
|
|||||||
```
|
```
|
||||||
|
|
||||||
`createLinuxCncIniSdk()` wraps the INI parser module built from vendored
|
`createLinuxCncIniSdk()` wraps the INI parser module built from vendored
|
||||||
LinuxCNC `inifile.cc`.
|
LinuxCNC `inifile.cc` and exposes `getString()` plus `getBool()`. Boolean
|
||||||
|
conversion is performed by vendored LinuxCNC `iniFindBool()`.
|
||||||
|
|
||||||
`createLinuxCncInterpSdk()` wraps the interpreter-core module built from
|
`createLinuxCncInterpSdk()` wraps the interpreter-core module built from
|
||||||
vendored LinuxCNC RS274NGC sources and exposes:
|
vendored LinuxCNC RS274NGC sources and exposes:
|
||||||
|
|||||||
@@ -55,6 +55,23 @@ export async function createLinuxCncIniSdk(moduleOptions = {}) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getBool(path, section, tag) {
|
||||||
|
const pathPtr = allocCString(mod, path);
|
||||||
|
const sectionPtr = allocCString(mod, section);
|
||||||
|
const tagPtr = allocCString(mod, tag);
|
||||||
|
const outPtr = mod._malloc(4);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const rc = mod._lcini_get_bool(pathPtr, sectionPtr, tagPtr, outPtr);
|
||||||
|
return rc === 0 ? mod.HEAP32[outPtr >> 2] !== 0 : null;
|
||||||
|
} finally {
|
||||||
|
mod._free(pathPtr);
|
||||||
|
mod._free(sectionPtr);
|
||||||
|
mod._free(tagPtr);
|
||||||
|
mod._free(outPtr);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
getFields(path, fields) {
|
getFields(path, fields) {
|
||||||
return Object.fromEntries(
|
return Object.fromEntries(
|
||||||
Object.entries(fields).map(([name, query]) => [
|
Object.entries(fields).map(([name, query]) => [
|
||||||
|
|||||||
@@ -204,7 +204,10 @@ document.getElementById("load-session").addEventListener("click", async () => {
|
|||||||
loadedSession = await loadMachineSessionFromOpfs(
|
loadedSession = await loadMachineSessionFromOpfs(
|
||||||
requireInterpSdk(),
|
requireInterpSdk(),
|
||||||
MACHINE_ID,
|
MACHINE_ID,
|
||||||
SESSION_WASM_FILES,
|
{
|
||||||
|
...SESSION_WASM_FILES,
|
||||||
|
iniSdk: requireIniSdk(),
|
||||||
|
},
|
||||||
);
|
);
|
||||||
setField("sessionIni", loadedSession.ini.wasmPath);
|
setField("sessionIni", loadedSession.ini.wasmPath);
|
||||||
setField("sessionParameters", loadedSession.parameters.wasmPath);
|
setField("sessionParameters", loadedSession.parameters.wasmPath);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -7,7 +7,10 @@
|
|||||||
<body>
|
<body>
|
||||||
<pre id="status">running</pre>
|
<pre id="status">running</pre>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import { createLinuxCncInterpSdk } from "../../runtime/sdk/src/index.js";
|
import {
|
||||||
|
createLinuxCncIniSdk,
|
||||||
|
createLinuxCncInterpSdk,
|
||||||
|
} from "../../runtime/sdk/src/index.js";
|
||||||
import {
|
import {
|
||||||
saveMachineParametersToOpfs,
|
saveMachineParametersToOpfs,
|
||||||
} from "../../runtime/opfs/linuxcnc-parameter-bridge.js";
|
} from "../../runtime/opfs/linuxcnc-parameter-bridge.js";
|
||||||
@@ -68,6 +71,18 @@
|
|||||||
console.error(message);
|
console.error(message);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const ini = await createLinuxCncIniSdk({
|
||||||
|
locateFile(path) {
|
||||||
|
if (path === "linuxcnc_ini.wasm") {
|
||||||
|
return "../../runtime/ui/ini-panel/linuxcnc_ini.wasm";
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
},
|
||||||
|
print() {},
|
||||||
|
printErr(message) {
|
||||||
|
console.error(message);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
for (const fixtureName of INTERP_BROWSER_MDI_FIXTURES) {
|
for (const fixtureName of INTERP_BROWSER_MDI_FIXTURES) {
|
||||||
const programText = await fetchText(`../fixtures/gcode/${fixtureName}.ngc`);
|
const programText = await fetchText(`../fixtures/gcode/${fixtureName}.ngc`);
|
||||||
@@ -236,7 +251,14 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
await saveMachineTextFiles("browser-random-toolchanger", {
|
await saveMachineTextFiles("browser-random-toolchanger", {
|
||||||
ini: "[EMC]\nMACHINE = browser-random-toolchanger\n",
|
ini: [
|
||||||
|
"[EMC]",
|
||||||
|
"MACHINE = browser-random-toolchanger",
|
||||||
|
"",
|
||||||
|
"[EMCIO]",
|
||||||
|
"RANDOM_TOOLCHANGER = yes",
|
||||||
|
"",
|
||||||
|
].join("\n"),
|
||||||
toolTable: [
|
toolTable: [
|
||||||
"T2 P7 Z3.125 D1.5 I12 J34 Q4 ;browser random finish tool",
|
"T2 P7 Z3.125 D1.5 I12 J34 Q4 ;browser random finish tool",
|
||||||
"T5 P9 X1 Y2 Z3 ;browser random rough tool",
|
"T5 P9 X1 Y2 Z3 ;browser random rough tool",
|
||||||
@@ -255,10 +277,10 @@
|
|||||||
interp,
|
interp,
|
||||||
"browser-random-toolchanger",
|
"browser-random-toolchanger",
|
||||||
{
|
{
|
||||||
|
iniSdk: ini,
|
||||||
iniWasmPath: "/work/browser-random-machine.ini",
|
iniWasmPath: "/work/browser-random-machine.ini",
|
||||||
parameterWasmPath: "/work/browser-random-linuxcnc.var",
|
parameterWasmPath: "/work/browser-random-linuxcnc.var",
|
||||||
toolTableWasmPath: "/work/browser-random-tool.tbl",
|
toolTableWasmPath: "/work/browser-random-tool.tbl",
|
||||||
randomToolChanger: true,
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
verifyExpectedOutput(
|
verifyExpectedOutput(
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ fi
|
|||||||
if [[ "${SKIP_INTERP_BUILD:-0}" != "1" ]]; then
|
if [[ "${SKIP_INTERP_BUILD:-0}" != "1" ]]; then
|
||||||
"$ROOT_DIR/tools/build_wasm_core.sh"
|
"$ROOT_DIR/tools/build_wasm_core.sh"
|
||||||
fi
|
fi
|
||||||
|
if [[ "${SKIP_INI_BUILD:-0}" != "1" ]]; then
|
||||||
|
"$ROOT_DIR/tools/build_ini_panel.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
TMP_DIR="$(mktemp -d)"
|
TMP_DIR="$(mktemp -d)"
|
||||||
PORT_FILE="$TMP_DIR/port"
|
PORT_FILE="$TMP_DIR/port"
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ SKIP_INI_BUILD=1 "$ROOT_DIR/tests/wasm/node/verify_ini_wasm.sh"
|
|||||||
SKIP_INTERP_BUILD=1 "$ROOT_DIR/tests/wasm/node/verify_interp_wasm.sh"
|
SKIP_INTERP_BUILD=1 "$ROOT_DIR/tests/wasm/node/verify_interp_wasm.sh"
|
||||||
"$ROOT_DIR/tests/opfs/node/verify_file_service.sh"
|
"$ROOT_DIR/tests/opfs/node/verify_file_service.sh"
|
||||||
SKIP_INI_BUILD=1 SKIP_INTERP_BUILD=1 "$ROOT_DIR/tests/browser/verify_ini_panel_browser.sh"
|
SKIP_INI_BUILD=1 SKIP_INTERP_BUILD=1 "$ROOT_DIR/tests/browser/verify_ini_panel_browser.sh"
|
||||||
SKIP_INTERP_BUILD=1 "$ROOT_DIR/tests/browser/verify_interp_browser.sh"
|
SKIP_INI_BUILD=1 SKIP_INTERP_BUILD=1 "$ROOT_DIR/tests/browser/verify_interp_browser.sh"
|
||||||
|
|
||||||
echo "host_wasm_opfs_browser_smokes=ok"
|
echo "host_wasm_opfs_browser_smokes=ok"
|
||||||
|
|||||||
@@ -197,6 +197,22 @@ const bridgeInterp = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const bridgeIniSdk = {
|
||||||
|
writeTextFile(path, text) {
|
||||||
|
bridgeFiles.set(`ini:${path}`, text);
|
||||||
|
},
|
||||||
|
getBool(path, section, tag) {
|
||||||
|
if (
|
||||||
|
path === "/work/ini-derived-session.ini" &&
|
||||||
|
section === "EMCIO" &&
|
||||||
|
tag === "RANDOM_TOOLCHANGER"
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const restoredParameters = await restoreMachineParametersFromOpfs(
|
const restoredParameters = await restoreMachineParametersFromOpfs(
|
||||||
bridgeInterp,
|
bridgeInterp,
|
||||||
"xyzab-tdr",
|
"xyzab-tdr",
|
||||||
@@ -314,6 +330,26 @@ assert.equal(
|
|||||||
"tooldata_load=0\nload_tool_path=/work/random-session-tool.tbl\nrandom_toolchanger=1\n",
|
"tooldata_load=0\nload_tool_path=/work/random-session-tool.tbl\nrandom_toolchanger=1\n",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const loadedIniDerivedRandomSession = await loadMachineSessionFromOpfs(
|
||||||
|
bridgeInterp,
|
||||||
|
"xyzab-tdr",
|
||||||
|
{
|
||||||
|
storage,
|
||||||
|
iniSdk: bridgeIniSdk,
|
||||||
|
iniWasmPath: "/work/ini-derived-session.ini",
|
||||||
|
parameterWasmPath: "/work/ini-derived-session.var",
|
||||||
|
toolTableWasmPath: "/work/ini-derived-session-tool.tbl",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
bridgeFiles.get("ini:/work/ini-derived-session.ini"),
|
||||||
|
"[EMC]\nMACHINE = xyzab-tdr\n",
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
loadedIniDerivedRandomSession.toolTable.result,
|
||||||
|
"tooldata_load=0\nload_tool_path=/work/ini-derived-session-tool.tbl\nrandom_toolchanger=1\n",
|
||||||
|
);
|
||||||
|
|
||||||
await assert.rejects(
|
await assert.rejects(
|
||||||
() => loadTextFile("linuxcnc/machines/missing.ini", storage),
|
() => loadTextFile("linuxcnc/machines/missing.ini", storage),
|
||||||
/missing file/,
|
/missing file/,
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ COORDINATES = X Y Z A B
|
|||||||
[KINS]
|
[KINS]
|
||||||
KINEMATICS = xyzbc-trt-kins
|
KINEMATICS = xyzbc-trt-kins
|
||||||
JOINTS = 5
|
JOINTS = 5
|
||||||
|
|
||||||
|
[EMCIO]
|
||||||
|
RANDOM_TOOLCHANGER = ON
|
||||||
|
NON_RANDOM_TOOLCHANGER = no
|
||||||
`,
|
`,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -43,6 +47,9 @@ assert.equal(
|
|||||||
"xyzbc-trt-kins",
|
"xyzbc-trt-kins",
|
||||||
);
|
);
|
||||||
assert.equal(ini.getString("/work/node-smoke.ini", "TRAJ", "MISSING"), null);
|
assert.equal(ini.getString("/work/node-smoke.ini", "TRAJ", "MISSING"), null);
|
||||||
|
assert.equal(ini.getBool("/work/node-smoke.ini", "EMCIO", "RANDOM_TOOLCHANGER"), true);
|
||||||
|
assert.equal(ini.getBool("/work/node-smoke.ini", "EMCIO", "NON_RANDOM_TOOLCHANGER"), false);
|
||||||
|
assert.equal(ini.getBool("/work/node-smoke.ini", "EMCIO", "MISSING"), null);
|
||||||
|
|
||||||
assert.deepEqual(ini.getFields("/work/node-smoke.ini", {
|
assert.deepEqual(ini.getFields("/work/node-smoke.ini", {
|
||||||
machine: { section: "EMC", tag: "MACHINE" },
|
machine: { section: "EMC", tag: "MACHINE" },
|
||||||
|
|||||||
@@ -47,5 +47,5 @@ link_wasm_module \
|
|||||||
-s ALLOW_MEMORY_GROWTH=1 \
|
-s ALLOW_MEMORY_GROWTH=1 \
|
||||||
-s NO_EXIT_RUNTIME=1 \
|
-s NO_EXIT_RUNTIME=1 \
|
||||||
-s FORCE_FILESYSTEM=1 \
|
-s FORCE_FILESYSTEM=1 \
|
||||||
-s EXPORTED_FUNCTIONS='["_malloc","_free","_lcini_get_string","_lcini_tilde_expand"]' \
|
-s EXPORTED_FUNCTIONS='["_malloc","_free","_lcini_get_string","_lcini_get_bool","_lcini_tilde_expand"]' \
|
||||||
-s EXPORTED_RUNTIME_METHODS='["FS","UTF8ToString","stringToUTF8","lengthBytesUTF8"]'
|
-s EXPORTED_RUNTIME_METHODS='["FS","UTF8ToString","stringToUTF8","lengthBytesUTF8"]'
|
||||||
|
|||||||
Reference in New Issue
Block a user