Files
wasm-simulator/docs/linuxcnc-browser-app-source-map.md

2.5 KiB

LinuxCNC browser app source map

This map records the source basis and boundaries for the browser application entry point. It is an app/bridge guard only; it must not add CNC behavior and must not expand the temporary smoke parser.

LinuxCNC Source Basis

  • src/emc/rs274ngc/interp_internal.hh defines RS274NGC_PARAMETER_FILE_NAME_DEFAULT as rs274ngc.var.
  • src/emc/rs274ngc/interp_internal.hh defines RS274NGC_PARAMETER_FILE_BACKUP_SUFFIX as .bak.
  • src/emc/rs274ngc/rs274ngc_pre.cc restores parameter files through Interp::restore_parameters().
  • src/emc/rs274ngc/rs274ngc_pre.cc saves parameter files through Interp::save_parameters(), including filename + ".new" and filename + ".bak" behavior.
  • src/emc/rs274ngc/rs274ngc_pre.cc orders parameter saves as backup unlink, backup link, then temporary-file rename.
  • src/emc/rs274ngc/rs274ngc_pre.cc reads program blocks through read_text() after the browser bridge mirrors the OPFS program into the WASM filesystem.

App Coverage

Entry Boundary
web/index.html Loads the browser app module and exposes only the LinuxCNC backend selector.
web/src/app.js Creates a required OPFS-backed simulator workspace and parses browser programs with a LinuxCNC parameter file.
web/test-browser-wasm-smoke-app-sections.js Verifies app-level OPFS program save, parameter save, parameter backup, and reload behavior.

Boundaries

  • The app must use the existing createWasmSimulator() OPFS API; it must not add browser filesystem persistence outside OPFS.
  • The app must persist the current program at programs/current.ngc.
  • The app must persist LinuxCNC parameter state at parameters/rs274ngc.var.
  • The app must require OPFS for browser program parsing and call parseFileWithParameterFile(programPath, parameterPath, "linuxcnc", ...).
  • The visible backend selector must stay limited to the LinuxCNC RS274 backend.
  • test-native.sh, test-linuxcnc-source-link.sh, and build-wasm.sh must run ./check-linuxcnc-browser-app-source-map.sh before consuming app-backed browser artifacts or source-linked LinuxCNC objects.
  • The browser app source-map guard validates LinuxCNC source-backed bridge routing and OPFS policy only; it does not interpret G-code.

Checks

Run:

./check-linuxcnc-browser-app-source-map.sh
./test-native.sh
./test-linuxcnc-source-link.sh
./build-wasm.sh

check-linuxcnc-browser-app-source-map.sh keeps this document, LinuxCNC source anchors, app OPFS paths, app parse routing, and app smoke coverage synchronized.