# LinuxCNC tooldata source map This map records the source basis and boundaries for LinuxCNC tooldata coverage in native, source-link, switchkins, and WASM-safe build paths. It is a source-link/shim guard only; it must not add CNC behavior and must not expand the temporary smoke parser. ## LinuxCNC Source Basis - `src/emc/tooldata/Submakefile` selects `tooldata_mmap.cc` or `tooldata_nml.cc`, and always includes `tooldata_common.cc`, `tooldata_db.cc`, and `tool_watch.cc`. - `src/emc/tooldata/tooldata_common.cc` provides tool table parsing, formatting, load/save, and database-mode entry points. - `src/emc/tooldata/tooldata_mmap.cc` provides native mmap tool table storage. - `src/emc/tooldata/tooldata_nml.cc` provides the NML tool table registration backend selected by `TOOL_NML_FLAG`. - `src/emc/tooldata/tooldata_db.cc` provides external database entry points. - `src/emc/tooldata/tool_mmap_read.cc` and `src/emc/tooldata/tool_watch.cc` are utility sources from the same LinuxCNC tooldata build metadata. - `src/emc/tooldata/tooldata.hh` declares the tooldata API used by RS274 and WASM-safe shims. ## Manifest And Shim Coverage | Coverage | Boundary | | --- | --- | | `linuxcnc-rs274-source-files.txt` | Tracks the full LinuxCNC `src/emc/tooldata` source directory and `tooldata.hh`. | | `linuxcnc-rs274-wasm-source-files.txt` | Links `tooldata_common.cc`, blocks native `tooldata_mmap.cc`, and records runtime shim source bases for `tooldata_db.cc` and `tooldata_nml.cc`. | | `linuxcnc-kinematics-source-files.txt` | Tracks 10 LinuxCNC `TOOL_TABLE` files referenced by covered M428/M429/M430 INI sources as `tooldata` source coverage only. | | `core/wasm_shims/tooldata/tooldata_mmap_backend.cc` | Adapts LinuxCNC `tooldata_mmap.cc` exports to WASM-safe in-memory storage. | | `core/wasm_shims/tooldata/tooldata_runtime_stubs.cc` | Adapts LinuxCNC `tooldata_nml.cc` and `tooldata_db.cc` runtime entry points without native services. | | `test-linuxcnc-wasm-tooldata-link.sh` | Links the wasm-safe tooldata shim against LinuxCNC tooldata runtime expectations. | | `test-linuxcnc-wasm-tooldata-common-link.sh` | Links LinuxCNC `tooldata_common.cc` through the wasm-safe standalone probe. | | `test-linuxcnc-wasm-tooldata-mmap-symbols.sh` | Compares wasm mmap backend exports with LinuxCNC `tooldata_mmap.cc`. | | `test-linuxcnc-wasm-tooldata-runtime-symbols.sh` | Compares runtime stub exports with LinuxCNC `tooldata_db.cc` and `tooldata_nml.cc`. | ## Boundaries - Tool table files referenced by switchkins INI files are source coverage only; they must not become browser API fields or generated switchkins aliases. - WASM-safe tooldata shims must preserve the LinuxCNC export surface checked by symbol probes. - Native and source-link paths must keep the full LinuxCNC `src/emc/tooldata` source directory tracked in the native RS274 manifest. - `build-wasm.sh` must run tooldata link and symbol probes before copying browser artifacts. ## Checks Run: ```bash ./check-linuxcnc-tooldata-source-map.sh ./test-native.sh ./test-linuxcnc-source-link.sh ``` `check-linuxcnc-tooldata-source-map.sh` keeps this document, LinuxCNC tooldata source anchors, manifest coverage, WASM shim/probe boundaries, and switchkins TOOL_TABLE source-only policy synchronized.