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:
@@ -131,19 +131,19 @@ export fn main() i32 = {
|
||||
|
||||
// Probe 5 — strconv round-trip via the real stdlib.
|
||||
let outbuf: [32]u8;
|
||||
let nb: i32 = strconv.i64toa(outbuf[0:32], 4242i64);
|
||||
let nb: i32 = strconv.i64tos(outbuf[0:32], 4242i64);
|
||||
if (nb != 4) { return 11; };
|
||||
if (outbuf[0] != 52u8) { return 12; }; // '4'
|
||||
if (outbuf[3] != 50u8) { return 13; }; // '2'
|
||||
|
||||
// Probe 6 — ascii classifications.
|
||||
if (!ascii.isdigit(53u8)) { return 14; }; // '5'
|
||||
if (ascii.isdigit(65u8)) { return 15; }; // 'A' is not a digit
|
||||
if (!ascii.isalpha(122u8)) { return 16; }; // 'z'
|
||||
if (!ascii.isidstart(95u8)) { return 17; }; // '_'
|
||||
if (!ascii.isidpart(48u8)) { return 18; }; // '0' is part
|
||||
if (ascii.digitval(70u8) != 15) { return 19; }; // 'F' = 15
|
||||
if (ascii.tolower(65u8) != 97u8) { return 20; }; // 'A' -> 'a'
|
||||
// Probe 6 — ascii classifications (rune-taking, Hare-shaped).
|
||||
if (!ascii.isdigit(53)) { return 14; }; // '5'
|
||||
if (ascii.isdigit(65)) { return 15; }; // 'A' is not a digit
|
||||
if (!ascii.isalpha(122)) { return 16; }; // 'z'
|
||||
if (!ascii.isidstart(95)) { return 17; }; // '_'
|
||||
if (!ascii.isidpart(48)) { return 18; }; // '0' is part
|
||||
if (ascii.digitval(70) != 15) { return 19; }; // 'F' = 15
|
||||
if (ascii.tolower(65) != 97) { return 20; }; // 'A' -> 'a'
|
||||
|
||||
// Probe 7 — file open/read via the new os APIs. /proc/self/cmdline
|
||||
// always exists on Linux, no write side, and is non-empty.
|
||||
@@ -155,7 +155,7 @@ export fn main() i32 = {
|
||||
case let e: str => return 21;
|
||||
};
|
||||
let rbuf: [128]u8;
|
||||
let n: i64 = os.readfull(fd, rbuf.ptr, 128u64);
|
||||
let n: i64 = os.readall(fd, rbuf.ptr, 128u64);
|
||||
os.close(fd);
|
||||
if (n <= 0i64) { return 22; };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user