lib: fmt fprint family over io.handle; remove the fdsink workaround (#5)
Graduates the fmt fprint family (fprint/fprintf/fprintln/fprintfln + internal putbytes/writeone/format*) from io.stream to io.handle, so a file (fd) prints directly through io.write's file-arm (commit-1). Removes the fdsink placeholder -- the fake-stream-vtable-over-os.write shim that stood in for the missing handle. The 8 stdio wrappers route over os.STD{OUT,ERR}_FILENO (new i32 filenos in lib/os; os is the import floor, so it can't hold an io.file-typed handle like Hare's os::stdout_file -- consumers cast i32 to io.file). Migrates the fd-shim sentinel tests 777/780/781 to fprint-over-handle as their headers designed, cstage-only per the pre-existing #209 (fmt is wwstage-uncompilable). Regenerates the 6 os-embedding combined.ww.
This commit is contained in:
@@ -1696,7 +1696,7 @@ static const struct row rows[] = {
|
||||
"fn main() i32 = { return sumtag(1i64, \"hi\", true): i32; };", 42 },
|
||||
/* Variadic forwarding: `wrap(args...)` passes the local slice
|
||||
* directly to `sum`, no re-gather. Mirrors Hare's wrapper shape
|
||||
* (`fn println(args: formattable...) = fdprintln(os.stdout, args...)`). */
|
||||
* (`fn println(args: formattable...) = fprintln(os.stdout, args...)`). */
|
||||
{ "fn sum(args: i64...) i64 = {\n"
|
||||
" let s: i64 = 0i64;\n"
|
||||
" let i: i32 = 0;\n"
|
||||
@@ -1711,11 +1711,12 @@ static const struct row rows[] = {
|
||||
"};", 42 },
|
||||
/* lib/fmt user-side: `fmt.println(args: formattable...)` gathers
|
||||
* mixed-type args at the call site. End-to-end exercises the
|
||||
* lib/fmt graduation: the wrapper-chain `println → fdprintln →
|
||||
* fdprint` is itself variadic-forwarding, so this validates both
|
||||
* gather (at main) and `args...` forward (inside lib/fmt). println
|
||||
* returns Hare's `(size | io.error)` (#94 fold-eFinal); the size
|
||||
* arm carries bytes printed (`hello 7\n` = 8). */
|
||||
* lib/fmt graduation: the wrapper-chain `println → fprintln →
|
||||
* fprint` over an io.handle file arm is itself variadic-forwarding,
|
||||
* so this validates both gather (at main) and `args...` forward
|
||||
* (inside lib/fmt). println returns Hare's `(size | io.error)`
|
||||
* (#94 fold-eFinal); the size arm carries bytes printed
|
||||
* (`hello 7\n` = 8). */
|
||||
{ "import fmt;\n"
|
||||
"import io;\n"
|
||||
"fn main() i32 = {\n"
|
||||
|
||||
Reference in New Issue
Block a user