Every // ---- section banner dies (132 -> 0): names carry the WHAT. Narration deleted (filename restatements, run-with lines, what-the- next-line-does); every ref/hare cite, task cite, divergence, ABI/ layout contract, and ownership qualifier kept (borrowed-view lines restored where the sweep over-cut). Comment-only proven: all 442 walk-workdir .s and 32 import-probe .s byte-identical before/after; libbyteid 56-roster all-ID.
22 lines
983 B
Plaintext
22 lines
983 B
Plaintext
// io — stream interface (Plan 9 Bio / Hare io::stream shape).
|
|
//
|
|
// No closures, no methods. A `stream` is a pointer to a `vtable` of
|
|
// function pointers (lib/io/stream.ww); read/write/close dispatch
|
|
// through it. The error channel is the return value — Hare-shaped
|
|
// tagged unions instead of errno-style integer sentinels.
|
|
//
|
|
// #94 fold-eFinal collapsed the pre-vtable `stream` struct + `closed`
|
|
// tag into the single vtable surface; the dispatchers are read/write/
|
|
// close (over `stream`), final over `handle` at io fold-2 (#5).
|
|
package io;
|
|
|
|
// Hare uses the `done` singleton for EOF; ww doesn't have `done` yet
|
|
// so we ship a named-void variant tag. Lifts to `done` with #93.
|
|
export type eof = void;
|
|
|
|
// underread — an I/O handle hit eof partway through a fixed-size
|
|
// read. Payload is the byte count actually delivered. Mirrors
|
|
// Hare's `io::underread = !size`; ww uses i32 because the
|
|
// underlying buffer-length type is i32 today.
|
|
export type underread = !i32;
|