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

51 lines
2.1 KiB
Markdown

# 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` 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.
## Checks
Run:
```bash
./check-linuxcnc-browser-app-source-map.sh
./test-native.sh
./test-linuxcnc-source-link.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.