结论:接入 vendored LinuxCNC tooldata_common.cc 负责刀具表解析与保存,WASM/SDK/OPFS/UI 仅做运行时边界搬运;native、WASM、OPFS 和浏览器 smoke 验证已通过。
47 lines
1.3 KiB
Markdown
47 lines
1.3 KiB
Markdown
# LinuxCNC WASM SDK
|
|
|
|
This SDK exposes browser/Node JavaScript wrappers for standalone WASM modules
|
|
built from vendored LinuxCNC source.
|
|
|
|
## Boundary
|
|
|
|
The SDK is a host-boundary layer only. It may:
|
|
|
|
- load generated Emscripten modules;
|
|
- allocate and free C strings;
|
|
- write text files into the Emscripten filesystem;
|
|
- call exported C ABI functions;
|
|
- return LinuxCNC-produced text output to JavaScript callers.
|
|
|
|
The SDK must not implement G-code interpretation, canonical motion behavior,
|
|
tool semantics, parameter semantics, kinematics, or planner behavior. Those
|
|
behaviors must continue to come from vendored LinuxCNC source through the C ABI.
|
|
|
|
## Entrypoints
|
|
|
|
Use `src/index.js` for stable imports:
|
|
|
|
```js
|
|
import {
|
|
createLinuxCncIniSdk,
|
|
createLinuxCncInterpSdk,
|
|
} from "./src/index.js";
|
|
```
|
|
|
|
`createLinuxCncIniSdk()` wraps the INI parser module built from vendored
|
|
LinuxCNC `inifile.cc`.
|
|
|
|
`createLinuxCncInterpSdk()` wraps the interpreter-core module built from
|
|
vendored LinuxCNC RS274NGC sources and exposes:
|
|
|
|
- `runProgram(programText)`
|
|
- `runProgramWithIni(programText, iniPath)`
|
|
- `runFile(path)`
|
|
- `runFileWithIni(path, iniPath)`
|
|
- `restoreParameters(path)`
|
|
- `saveParameters(path, values)`
|
|
- `loadToolTable(path)`
|
|
- `saveToolTable(path)`
|
|
- `writeTextFile(path, text)`
|
|
- `readTextFile(path)`
|