Files
cnc_wams/wasm-port/runtime/sdk/README.md
wangdequan 706fd1e775 按规划继续工作
结论:解释器 WASM、SDK 统一入口、浏览器解释器 smoke 与兼容性文档已闭环,native 和 host/WASM/browser 验证全部通过。
2026-06-08 07:24:06 +08:00

1.1 KiB

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:

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)
  • writeTextFile(path, text)