lib: rename stdlib surface to Hare names; add endian/math

Sweeping rename so the lib/ surface mirrors Hare's stdlib spellings.
- ascii: rune-taking predicates; ishex -> isxdigit
- bufio: rinit -> init; take1/takeline -> readbyte/readline
- bytes: indexsub -> index
- encoding/utf8: runelen -> runesz
- errors: eEOF/eShortRead/... -> eof/underread/...
- fmt: errln -> errorln; println/fprintln return i64
- os: readfull/writefull -> readall/writeall; unlink -> remove
- path: isabs -> abs; drop lastindex (now strings.rbyteindex)
- strconv: u64toa/i64toa -> u64tos/i64tos; parse64/parseu64 -> stoi64/stou64
- strings: drop len/isempty; equal -> compare; indexbyte -> byteindex; +rbyteindex
- types: drop numeric helpers (moved to math)
- new lib/endian (htonu16/ntohu16), lib/math (absi32/absi64)
- net: drop htons (use endian.htonu16)

Callers in selfhost/, lib/ww/, cmd/w6c/cgen.c, and test/wcc/700_e2e.c
updated to match.
This commit is contained in:
2026-05-12 00:45:18 +09:00
parent 35421f2561
commit 1ac1d985f6
37 changed files with 597 additions and 568 deletions

View File

@@ -123,13 +123,13 @@ fn dbasename(p: *u8) *u8 = {
// ---- file slurp --------------------------------------------------------
fn readallso(path: *u8) (*u8, u64) = {
fn slurpso(path: *u8) (*u8, u64) = {
let fd: i32 = os.open(path, os.O_RDONLY, 0i32);
if (fd < 0) { return nil, 0u64; };
let n: i64 = os.filesize(fd);
if (n < 0i64) { os.close(fd); return nil, 0u64; };
let buf: *u8 = os.alloc(n: u64): *u8;
let got: i64 = os.readfull(fd, buf, n: u64);
let got: i64 = os.readall(fd, buf, n: u64);
os.close(fd);
if (got != n) { return nil, 0u64; };
return buf, n: u64;
@@ -165,7 +165,7 @@ fn vdnameat(buf: *u8, verdefoff: u64, verdefsize: u64,
export fn loadso(l: *lnk, path: *u8) i32 = {
let buf: *u8;
let blen: u64;
buf, blen = readallso(path);
buf, blen = slurpso(path);
if (buf == nil) {
os.write(2, "w6l: cannot read .so\n".ptr, 20u64);
return -1;