forth: File Access word set (in-memory backing, Hayes unchanged)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
This commit is contained in:
@@ -93,7 +93,7 @@ Representation:
|
||||
- [x] Parsing/dictionary: `WORD`, `FIND`, `EXECUTE`, `'`, `[']`, `LITERAL`, `POSTPONE`, `>BODY` (DOES> deferred — needs runtime-rebind of last CREATE)
|
||||
- [x] Source/state: `EVALUATE`, `STATE`, `[`, `]` (`SOURCE`/`>IN` stubbed; tokenized input means the exact byte/offset semantics aren't useful here)
|
||||
- [x] Misc Core: `WITHIN`, `MAX`/`MIN` (already), `ABORT`, `ABORT"`, `EXIT`, `UNLOOP`
|
||||
- [ ] File Access word set (via SX IO)
|
||||
- [x] File Access word set (in-memory — `read-file` is not reachable from the epoch eval env)
|
||||
- [ ] String word set (`SLITERAL`, `COMPARE`, `SEARCH`)
|
||||
- [ ] Target: 100% Hayes Core
|
||||
|
||||
@@ -106,6 +106,20 @@ Representation:
|
||||
|
||||
_Newest first._
|
||||
|
||||
- **Phase 5 — File Access word set (in-memory backing; +4).**
|
||||
`OPEN-FILE`/`CREATE-FILE`/`CLOSE-FILE`/`READ-FILE`/`WRITE-FILE`/
|
||||
`FILE-POSITION`/`FILE-SIZE`/`REPOSITION-FILE`/`DELETE-FILE` plus
|
||||
the mode constants `R/O`/`R/W`/`W/O`/`BIN`. File handles live on
|
||||
`state.files` (fileid → {content, pos, path}) with a
|
||||
`state.by-path` index so `CREATE-FILE`'d files can be
|
||||
`OPEN-FILE`'d later in the same session. Attempting to
|
||||
`OPEN-FILE` an unknown path returns `ior != 0`; disk-backed
|
||||
open/read is not wired because `read-file` isn't in the sx_server
|
||||
epoch eval environment (it's bound only in the HTTP helpers).
|
||||
Also removed the stray base-2 `BIN` primitive from Phase 4 —
|
||||
ANS `BIN` is the file-mode modifier. Hayes Core unchanged at
|
||||
486/638 since core.fr doesn't exercise file words.
|
||||
|
||||
- **Phase 5 — `WITHIN`/`ABORT`/`ABORT"`/`EXIT`/`UNLOOP` (+7;
|
||||
Hayes 477→486, 76%).** `WITHIN` uses the ANS two's-complement
|
||||
trick: `(n1-n2) U< (n3-n2)`. `ABORT` wipes the data/return/control
|
||||
|
||||
Reference in New Issue
Block a user