lib: drop snake_case from io/types/bufio/net/os exports

This commit is contained in:
2026-05-11 14:15:53 +09:00
parent 2c33228b7e
commit 2918013c1a
11 changed files with 37 additions and 37 deletions

View File

@@ -7,17 +7,17 @@
// revision will replace it with *io.stream once `use` resolves // revision will replace it with *io.stream once `use` resolves
// types from imported modules. // types from imported modules.
type stream_p = *void; type streamp = *void;
type buf = struct { type buf = struct {
s: stream_p, s: streamp,
data: *u8, data: *u8,
cap: i32, cap: i32,
r: i32, // read cursor r: i32, // read cursor
w: i32, // write cursor (for writers) 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.s = s;
b.data = data; b.data = data;
b.cap = cap; b.cap = cap;

View File

@@ -15,14 +15,14 @@ type stream = struct {
def eof: i32 = -1; def eof: i32 = -1;
def closed: i32 = -2; 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); 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); return s.write(s, buf);
}; };
export fn stream_close(s: *stream) i32 = { export fn close(s: *stream) i32 = {
return s.close(s); return s.close(s);
}; };

View File

@@ -16,9 +16,9 @@ def SYS_ACCEPT: i64 = 43;
def SYS_BIND: i64 = 49; def SYS_BIND: i64 = 49;
def SYS_LISTEN: i64 = 50; 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. // addr u32 (BE), padding 8B = 16B total. Caller fills it.
type sockaddr_in = struct { type sockaddrin = struct {
family: u16, family: u16,
port: u16, port: u16,
addr: u32, addr: u32,
@@ -30,11 +30,11 @@ export fn socket() i32 = {
IPPROTO_TCP: i64): 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; 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; return syscall3(SYS_BIND, fd: i64, sa: i64, 16): i32;
}; };

View File

@@ -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 // wait4(2): wait for `pid` (or any child if -1), store status in
// `*status_out`, return the pid that ended (or negative errno). // `*status`, return the pid that ended (or negative errno).
export fn wait4(pid: i32, status_out: *i32, options: i32, rusage: *void) i32 = { export fn wait4(pid: i32, status: *i32, options: i32, rusage: *void) i32 = {
return syscall4(SYS_WAIT4, pid: i64, status_out: i64, return syscall4(SYS_WAIT4, pid: i64, status: i64,
options: i64, rusage: i64): i32; options: i64, rusage: i64): i32;
}; };

View File

@@ -17,32 +17,32 @@ def U16_MAX: u16 = 65535;
def U32_MAX: u32 = 4294967295; def U32_MAX: u32 = 4294967295;
def U64_MAX: u64 = 18446744073709551615; 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; }; if (a < b) { return a; };
return b; return b;
}; };
export fn max_i32(a: i32, b: i32) i32 = { export fn maxi32(a: i32, b: i32) i32 = {
if (a > b) { return a; }; if (a > b) { return a; };
return b; return b;
}; };
export fn min_i64(a: i64, b: i64) i64 = { export fn mini64(a: i64, b: i64) i64 = {
if (a < b) { return a; }; if (a < b) { return a; };
return b; return b;
}; };
export fn max_i64(a: i64, b: i64) i64 = { export fn maxi64(a: i64, b: i64) i64 = {
if (a > b) { return a; }; if (a > b) { return a; };
return b; return b;
}; };
export fn abs_i32(x: i32) i32 = { export fn absi32(x: i32) i32 = {
if (x < 0) { return -x; }; if (x < 0) { return -x; };
return x; return x;
}; };
export fn abs_i64(x: i64) i64 = { export fn absi64(x: i64) i64 = {
if (x < 0) { return -x; }; if (x < 0) { return -x; };
return x; return x;
}; };

View File

@@ -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 // wait4(2): wait for `pid` (or any child if -1), store status in
// `*status_out`, return the pid that ended (or negative errno). // `*status`, return the pid that ended (or negative errno).
export fn wait4(pid: i32, status_out: *i32, options: i32, rusage: *void) i32 = { export fn wait4(pid: i32, status: *i32, options: i32, rusage: *void) i32 = {
return syscall4(SYS_WAIT4, pid: i64, status_out: i64, return syscall4(SYS_WAIT4, pid: i64, status: i64,
options: i64, rusage: i64): i32; options: i64, rusage: i64): i32;
}; };

View File

@@ -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 // wait4(2): wait for `pid` (or any child if -1), store status in
// `*status_out`, return the pid that ended (or negative errno). // `*status`, return the pid that ended (or negative errno).
export fn wait4(pid: i32, status_out: *i32, options: i32, rusage: *void) i32 = { export fn wait4(pid: i32, status: *i32, options: i32, rusage: *void) i32 = {
return syscall4(SYS_WAIT4, pid: i64, status_out: i64, return syscall4(SYS_WAIT4, pid: i64, status: i64,
options: i64, rusage: i64): i32; options: i64, rusage: i64): i32;
}; };

View File

@@ -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 // wait4(2): wait for `pid` (or any child if -1), store status in
// `*status_out`, return the pid that ended (or negative errno). // `*status`, return the pid that ended (or negative errno).
export fn wait4(pid: i32, status_out: *i32, options: i32, rusage: *void) i32 = { export fn wait4(pid: i32, status: *i32, options: i32, rusage: *void) i32 = {
return syscall4(SYS_WAIT4, pid: i64, status_out: i64, return syscall4(SYS_WAIT4, pid: i64, status: i64,
options: i64, rusage: i64): i32; options: i64, rusage: i64): i32;
}; };

View File

@@ -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 // wait4(2): wait for `pid` (or any child if -1), store status in
// `*status_out`, return the pid that ended (or negative errno). // `*status`, return the pid that ended (or negative errno).
export fn wait4(pid: i32, status_out: *i32, options: i32, rusage: *void) i32 = { export fn wait4(pid: i32, status: *i32, options: i32, rusage: *void) i32 = {
return syscall4(SYS_WAIT4, pid: i64, status_out: i64, return syscall4(SYS_WAIT4, pid: i64, status: i64,
options: i64, rusage: i64): i32; options: i64, rusage: i64): i32;
}; };

View File

@@ -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 // wait4(2): wait for `pid` (or any child if -1), store status in
// `*status_out`, return the pid that ended (or negative errno). // `*status`, return the pid that ended (or negative errno).
export fn wait4(pid: i32, status_out: *i32, options: i32, rusage: *void) i32 = { export fn wait4(pid: i32, status: *i32, options: i32, rusage: *void) i32 = {
return syscall4(SYS_WAIT4, pid: i64, status_out: i64, return syscall4(SYS_WAIT4, pid: i64, status: i64,
options: i64, rusage: i64): i32; options: i64, rusage: i64): i32;
}; };

View File

@@ -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 // wait4(2): wait for `pid` (or any child if -1), store status in
// `*status_out`, return the pid that ended (or negative errno). // `*status`, return the pid that ended (or negative errno).
export fn wait4(pid: i32, status_out: *i32, options: i32, rusage: *void) i32 = { export fn wait4(pid: i32, status: *i32, options: i32, rusage: *void) i32 = {
return syscall4(SYS_WAIT4, pid: i64, status_out: i64, return syscall4(SYS_WAIT4, pid: i64, status: i64,
options: i64, rusage: i64): i32; options: i64, rusage: i64): i32;
}; };