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:
@@ -279,13 +279,13 @@ fn emitline(s: str) void = { os.write(1, s.ptr, s.len: u64); };
|
||||
|
||||
fn emitint(v: i64) void = {
|
||||
let buf: [32]u8;
|
||||
let n: i32 = strconv.i64toa(buf[0:32], v);
|
||||
let n: i32 = strconv.i64tos(buf[0:32], v);
|
||||
os.write(1, buf.ptr, n: u64);
|
||||
};
|
||||
|
||||
fn emituint(v: u64) void = {
|
||||
let buf: [32]u8;
|
||||
let n: i32 = strconv.u64toa(buf[0:32], v);
|
||||
let n: i32 = strconv.u64tos(buf[0:32], v);
|
||||
os.write(1, buf.ptr, n: u64);
|
||||
};
|
||||
|
||||
@@ -323,7 +323,7 @@ fn mklabel(c: *cgen, base: str) str = {
|
||||
i += 1; j += 1;
|
||||
};
|
||||
buf[i] = 95u8; i += 1; // '_'
|
||||
let n: i32 = strconv.i64toa(buf[i:128], c.labelseq: i64);
|
||||
let n: i32 = strconv.i64tos(buf[i:128], c.labelseq: i64);
|
||||
c.labelseq += 1;
|
||||
let total: i32 = i + n;
|
||||
let p: *u8 = amalloc(c.a, (total: u64) + 1u64): *u8;
|
||||
@@ -362,7 +362,7 @@ fn internstrlit(c: *cgen, bytes: str) str = {
|
||||
// New label "_S_<seq>".
|
||||
let buf: [32]u8;
|
||||
buf[0] = 95u8; buf[1] = 83u8; buf[2] = 95u8; // "_S_"
|
||||
let n: i32 = strconv.i64toa(buf[3:32], c.strlitseq: i64);
|
||||
let n: i32 = strconv.i64tos(buf[3:32], c.strlitseq: i64);
|
||||
c.strlitseq += 1;
|
||||
let total: i32 = 3 + n;
|
||||
let p: *u8 = amalloc(c.a, (total: u64) + 1u64): *u8;
|
||||
|
||||
@@ -16,7 +16,7 @@ let nerrors: i32 = 0;
|
||||
let nwarnings: i32 = 0;
|
||||
|
||||
export fn fatal(msg: str) void = {
|
||||
fmt.errln(msg);
|
||||
fmt.errorln(msg);
|
||||
os.exit(1);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user