From 2918013c1af5eb82e6f3a788d636c6cb0e87b0cd Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Mon, 11 May 2026 14:15:53 +0900 Subject: [PATCH] lib: drop snake_case from io/types/bufio/net/os exports --- lib/bufio/bufio.ww | 6 +++--- lib/io/stream.ww | 6 +++--- lib/net/net.ww | 8 ++++---- lib/os/os.ww | 6 +++--- lib/types/types.ww | 12 ++++++------ selfhost/cmd/w6a/main.combined.ww | 6 +++--- selfhost/cmd/w6c/main.combined.ww | 6 +++--- selfhost/cmd/w6l/main.combined.ww | 6 +++--- selfhost/cmd/ww/main.combined.ww | 6 +++--- selfhost/cmd/wwdump/main.combined.ww | 6 +++--- selfhost/test/smoke.combined.ww | 6 +++--- 11 files changed, 37 insertions(+), 37 deletions(-) diff --git a/lib/bufio/bufio.ww b/lib/bufio/bufio.ww index bf31b084..5c745c16 100644 --- a/lib/bufio/bufio.ww +++ b/lib/bufio/bufio.ww @@ -7,17 +7,17 @@ // revision will replace it with *io.stream once `use` resolves // types from imported modules. -type stream_p = *void; +type streamp = *void; type buf = struct { - s: stream_p, + s: streamp, data: *u8, cap: i32, r: i32, // read cursor w: i32, // write cursor (for writers) }; -export fn rinit(b: *buf, s: stream_p, data: *u8, cap: i32) void = { +export fn rinit(b: *buf, s: streamp, data: *u8, cap: i32) void = { b.s = s; b.data = data; b.cap = cap; diff --git a/lib/io/stream.ww b/lib/io/stream.ww index 9b6d7092..b45bc3c3 100644 --- a/lib/io/stream.ww +++ b/lib/io/stream.ww @@ -15,14 +15,14 @@ type stream = struct { def eof: i32 = -1; def closed: i32 = -2; -export fn stream_read(s: *stream, buf: []u8) i32 = { +export fn read(s: *stream, buf: []u8) i32 = { return s.read(s, buf); }; -export fn stream_write(s: *stream, buf: []u8) i32 = { +export fn write(s: *stream, buf: []u8) i32 = { return s.write(s, buf); }; -export fn stream_close(s: *stream) i32 = { +export fn close(s: *stream) i32 = { return s.close(s); }; diff --git a/lib/net/net.ww b/lib/net/net.ww index 8db6c7e6..fd4ae060 100644 --- a/lib/net/net.ww +++ b/lib/net/net.ww @@ -16,9 +16,9 @@ def SYS_ACCEPT: i64 = 43; def SYS_BIND: i64 = 49; def SYS_LISTEN: i64 = 50; -// sockaddr_in is laid out by the kernel: family u16, port u16 (BE), +// sockaddrin is laid out by the kernel: family u16, port u16 (BE), // addr u32 (BE), padding 8B = 16B total. Caller fills it. -type sockaddr_in = struct { +type sockaddrin = struct { family: u16, port: u16, addr: u32, @@ -30,11 +30,11 @@ export fn socket() i32 = { IPPROTO_TCP: i64): i32; }; -export fn connect(fd: i32, sa: *sockaddr_in) i32 = { +export fn connect(fd: i32, sa: *sockaddrin) i32 = { return syscall3(SYS_CONNECT, fd: i64, sa: i64, 16): i32; }; -export fn bind(fd: i32, sa: *sockaddr_in) i32 = { +export fn bind(fd: i32, sa: *sockaddrin) i32 = { return syscall3(SYS_BIND, fd: i64, sa: i64, 16): i32; }; diff --git a/lib/os/os.ww b/lib/os/os.ww index 46874c5e..fc10c4c6 100644 --- a/lib/os/os.ww +++ b/lib/os/os.ww @@ -175,9 +175,9 @@ export fn execve(path: *u8, argv: **u8, envp: **u8) i32 = { }; // wait4(2): wait for `pid` (or any child if -1), store status in -// `*status_out`, return the pid that ended (or negative errno). -export fn wait4(pid: i32, status_out: *i32, options: i32, rusage: *void) i32 = { - return syscall4(SYS_WAIT4, pid: i64, status_out: i64, +// `*status`, return the pid that ended (or negative errno). +export fn wait4(pid: i32, status: *i32, options: i32, rusage: *void) i32 = { + return syscall4(SYS_WAIT4, pid: i64, status: i64, options: i64, rusage: i64): i32; }; diff --git a/lib/types/types.ww b/lib/types/types.ww index 2d2c6c0d..2ae5c120 100644 --- a/lib/types/types.ww +++ b/lib/types/types.ww @@ -17,32 +17,32 @@ def U16_MAX: u16 = 65535; def U32_MAX: u32 = 4294967295; def U64_MAX: u64 = 18446744073709551615; -export fn min_i32(a: i32, b: i32) i32 = { +export fn mini32(a: i32, b: i32) i32 = { if (a < b) { return a; }; return b; }; -export fn max_i32(a: i32, b: i32) i32 = { +export fn maxi32(a: i32, b: i32) i32 = { if (a > b) { return a; }; return b; }; -export fn min_i64(a: i64, b: i64) i64 = { +export fn mini64(a: i64, b: i64) i64 = { if (a < b) { return a; }; return b; }; -export fn max_i64(a: i64, b: i64) i64 = { +export fn maxi64(a: i64, b: i64) i64 = { if (a > b) { return a; }; return b; }; -export fn abs_i32(x: i32) i32 = { +export fn absi32(x: i32) i32 = { if (x < 0) { return -x; }; return x; }; -export fn abs_i64(x: i64) i64 = { +export fn absi64(x: i64) i64 = { if (x < 0) { return -x; }; return x; }; diff --git a/selfhost/cmd/w6a/main.combined.ww b/selfhost/cmd/w6a/main.combined.ww index 08755cbf..5c296b25 100644 --- a/selfhost/cmd/w6a/main.combined.ww +++ b/selfhost/cmd/w6a/main.combined.ww @@ -175,9 +175,9 @@ export fn execve(path: *u8, argv: **u8, envp: **u8) i32 = { }; // wait4(2): wait for `pid` (or any child if -1), store status in -// `*status_out`, return the pid that ended (or negative errno). -export fn wait4(pid: i32, status_out: *i32, options: i32, rusage: *void) i32 = { - return syscall4(SYS_WAIT4, pid: i64, status_out: i64, +// `*status`, return the pid that ended (or negative errno). +export fn wait4(pid: i32, status: *i32, options: i32, rusage: *void) i32 = { + return syscall4(SYS_WAIT4, pid: i64, status: i64, options: i64, rusage: i64): i32; }; diff --git a/selfhost/cmd/w6c/main.combined.ww b/selfhost/cmd/w6c/main.combined.ww index a4f36648..8af9b120 100644 --- a/selfhost/cmd/w6c/main.combined.ww +++ b/selfhost/cmd/w6c/main.combined.ww @@ -175,9 +175,9 @@ export fn execve(path: *u8, argv: **u8, envp: **u8) i32 = { }; // wait4(2): wait for `pid` (or any child if -1), store status in -// `*status_out`, return the pid that ended (or negative errno). -export fn wait4(pid: i32, status_out: *i32, options: i32, rusage: *void) i32 = { - return syscall4(SYS_WAIT4, pid: i64, status_out: i64, +// `*status`, return the pid that ended (or negative errno). +export fn wait4(pid: i32, status: *i32, options: i32, rusage: *void) i32 = { + return syscall4(SYS_WAIT4, pid: i64, status: i64, options: i64, rusage: i64): i32; }; diff --git a/selfhost/cmd/w6l/main.combined.ww b/selfhost/cmd/w6l/main.combined.ww index f1acb258..c7edadc9 100644 --- a/selfhost/cmd/w6l/main.combined.ww +++ b/selfhost/cmd/w6l/main.combined.ww @@ -175,9 +175,9 @@ export fn execve(path: *u8, argv: **u8, envp: **u8) i32 = { }; // wait4(2): wait for `pid` (or any child if -1), store status in -// `*status_out`, return the pid that ended (or negative errno). -export fn wait4(pid: i32, status_out: *i32, options: i32, rusage: *void) i32 = { - return syscall4(SYS_WAIT4, pid: i64, status_out: i64, +// `*status`, return the pid that ended (or negative errno). +export fn wait4(pid: i32, status: *i32, options: i32, rusage: *void) i32 = { + return syscall4(SYS_WAIT4, pid: i64, status: i64, options: i64, rusage: i64): i32; }; diff --git a/selfhost/cmd/ww/main.combined.ww b/selfhost/cmd/ww/main.combined.ww index 0c286508..2029f257 100644 --- a/selfhost/cmd/ww/main.combined.ww +++ b/selfhost/cmd/ww/main.combined.ww @@ -175,9 +175,9 @@ export fn execve(path: *u8, argv: **u8, envp: **u8) i32 = { }; // wait4(2): wait for `pid` (or any child if -1), store status in -// `*status_out`, return the pid that ended (or negative errno). -export fn wait4(pid: i32, status_out: *i32, options: i32, rusage: *void) i32 = { - return syscall4(SYS_WAIT4, pid: i64, status_out: i64, +// `*status`, return the pid that ended (or negative errno). +export fn wait4(pid: i32, status: *i32, options: i32, rusage: *void) i32 = { + return syscall4(SYS_WAIT4, pid: i64, status: i64, options: i64, rusage: i64): i32; }; diff --git a/selfhost/cmd/wwdump/main.combined.ww b/selfhost/cmd/wwdump/main.combined.ww index 657890f4..4397bf37 100644 --- a/selfhost/cmd/wwdump/main.combined.ww +++ b/selfhost/cmd/wwdump/main.combined.ww @@ -175,9 +175,9 @@ export fn execve(path: *u8, argv: **u8, envp: **u8) i32 = { }; // wait4(2): wait for `pid` (or any child if -1), store status in -// `*status_out`, return the pid that ended (or negative errno). -export fn wait4(pid: i32, status_out: *i32, options: i32, rusage: *void) i32 = { - return syscall4(SYS_WAIT4, pid: i64, status_out: i64, +// `*status`, return the pid that ended (or negative errno). +export fn wait4(pid: i32, status: *i32, options: i32, rusage: *void) i32 = { + return syscall4(SYS_WAIT4, pid: i64, status: i64, options: i64, rusage: i64): i32; }; diff --git a/selfhost/test/smoke.combined.ww b/selfhost/test/smoke.combined.ww index 5e5ab5a4..5aa82d0e 100644 --- a/selfhost/test/smoke.combined.ww +++ b/selfhost/test/smoke.combined.ww @@ -175,9 +175,9 @@ export fn execve(path: *u8, argv: **u8, envp: **u8) i32 = { }; // wait4(2): wait for `pid` (or any child if -1), store status in -// `*status_out`, return the pid that ended (or negative errno). -export fn wait4(pid: i32, status_out: *i32, options: i32, rusage: *void) i32 = { - return syscall4(SYS_WAIT4, pid: i64, status_out: i64, +// `*status`, return the pid that ended (or negative errno). +export fn wait4(pid: i32, status: *i32, options: i32, rusage: *void) i32 = { + return syscall4(SYS_WAIT4, pid: i64, status: i64, options: i64, rusage: i64): i32; };