feat(runtime): add torb_file_system_path and its manifest row for systemPath #560
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/559-system-path-native"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #559
Step 2b of #68, commit 1 of 2 of the two-commit rule for a new native: teach the runtime and the manifest, nothing in
std/,compiler/ortools/calls it yet.What
runtime/file.c:torb_file_system_path(torb_text path), declared inruntime/include/torb.houtside the_WIN32block with a doc comment.runtime/platform.c(the only file with#ifdef _WIN32):torb_platform_system_path_text. POSIX answers the text itself (a path is bytes there, no copy of the bytes, only a counted reference). Windows builds the text oftorb_platform_system_path(backslashes,\\?\aboveMAX_PATH) and converts it back withtorb_platform_utf8.compiler/src/backend/c/natives.trb: rowfileSystemPath->torb_file_system_path; row in the audit recorddocs/design/NATIVES.md(keep 205, total 562).torb natives --headerwrites (no bootstrap in the agent's exec;compiler/tests/natives.test.trbcompares them with the generator):runtime/include/torb_natives.h(one prototype, sorted) andruntime/machine_natives.c(one thunk at index 98, the following thunks renumbered, table row, count 332).docs/design/PATH.md: one sentence in the status header (runtime half ofsystemPathin,std/fsfunction not; stays "partly implemented").Decisions
torb_file_system_path(torb_text path, torb_text *out). The private declarationnative fn fileSystemPath(path: String): Stringis a plainDirectnative (noOptional/Fallibleshape fits a call that cannot fail), so the runtime answers the text as the return value, liketorb_file_path:torb_text torb_file_system_path(torb_text path).torb_file_absolute_path_of; no file is touched.stddeclaration. Not built here (no bootstrap in the agent's exec); the row is only data, and the natives tests read the manifest. If the forge CI rejects an unused row, the diagnostic will be quoted below and the row moves to the next step.Tests
runtime/tests/file_test.cthe_system_form_of_a_path_on_posix_is_the_path_itself(empty text, root, relative,.., non-ASCII name, a backslash) - runs in the forge CI withsh runtime/build.sh.runtime/tests/platform_test.cunder#if defined(_WIN32):C:/a/b->C:\a\b, a share, a non-ASCII name, the empty text, a path aboveMAX_PATH->\\?\C:\..., a long share ->\\?\UNC\.... The forge CI cannot run these; the GitHub mirror'sportable.ymlbuilds them.Seed
New native: the published seed has to contain this commit before step 2c (the
std/fswrapper) is pushed. Publishing the seed stays with Torben and the nightly.systemPathruntime native (step 2b of #68, commit 1 of 2) #559Checklist for
f17e94f:runtime/tests/file_test.c(empty, root, relative,.., non-ASCII, backslash); Windows cases inplatform_test.cunder_WIN32(short, share, non-ASCII, empty, long\\?\, long UNC). CI green for this head (tier A/B, bootstrap, natives/conformance gates).torb_platform_system_path_textreuses the existingtorb_platform_system_path/torb_platform_utf8with matching signatures and frees (torb_raw_freewith the allocated capacity); falls back to a retained copy on conversion failure; POSIX returns a retained reference. Generatedtorb_natives.h/machine_natives.care consistent with the manifest row (sorted position, thunk 98, following thunks renumbered, count 332); the generator-comparison test is green.std/,compiler/logic ortools/calls it. The signature deviation from the issue (return value instead ofout) is explained in the PR body and fits the plainDirectnative shape.NATIVES.mdcounts (205 / 562) andPATH.mdstatus updated.Non-blocking: none.
Into<Path>signatures (PATH slice 2) #68