hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 4c293843e6eab23e2bf9f43d34136839e652a940
parent e02a0a89745f49a8512f21a4de554e728e0facbb
Author: Sebastian <sebastian@sebsite.pw>
Date:   Wed, 10 May 2023 17:04:31 -0400

unix: pluralize flag in type names

This is more consistent with the name of other flags types, such as
fs::flags.

Signed-off-by: Sebastian <sebastian@sebsite.pw>

Diffstat:
Munix/+freebsd/pipe.ha | 8++++----
Munix/+linux/pipe.ha | 8++++----
Munix/signal/+linux.ha | 8++++----
3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/unix/+freebsd/pipe.ha b/unix/+freebsd/pipe.ha @@ -7,7 +7,7 @@ use rt; // Flags to use for the [[io::file]]s returned by [[pipe]]. // Only NOCLOEXEC and NONBLOCK are guaranteed to be available. -export type pipe_flag = enum { +export type pipe_flags = enum { NOCLOEXEC = rt::O_CLOEXEC, DIRECT = rt::O_DIRECT, NONBLOCK = rt::O_NONBLOCK, @@ -15,13 +15,13 @@ export type pipe_flag = enum { // Create a pair of two linked [[io::file]]s, such that any data written to the // second [[io::file]] may be read from the first. -export fn pipe(flags: pipe_flag...) ((io::file, io::file) | errors::error) = { +export fn pipe(flags: pipe_flags...) ((io::file, io::file) | errors::error) = { let fds: [2]int = [0...]; - let flag: pipe_flag = 0; + let flag: pipe_flags = 0; for (let i = 0z; i < len(flags); i += 1) { flag |= flags[i]; }; - flag ^= pipe_flag::NOCLOEXEC; // invert CLOEXEC + flag ^= pipe_flags::NOCLOEXEC; // invert CLOEXEC match (rt::pipe2(&fds, flag)) { case void => void; case let e: rt::errno => diff --git a/unix/+linux/pipe.ha b/unix/+linux/pipe.ha @@ -6,7 +6,7 @@ use rt; // Flags to use for the [[io::file]]s returned by [[pipe]]. // Only NOCLOEXEC and NONBLOCK are guaranteed to be available. -export type pipe_flag = enum { +export type pipe_flags = enum { NOCLOEXEC = rt::O_CLOEXEC, DIRECT = rt::O_DIRECT, NONBLOCK = rt::O_NONBLOCK, @@ -14,13 +14,13 @@ export type pipe_flag = enum { // Create a pair of two linked [[io::file]]s, such that any data written to the // second [[io::file]] may be read from the first. -export fn pipe(flags: pipe_flag...) ((io::file, io::file) | errors::error) = { +export fn pipe(flags: pipe_flags...) ((io::file, io::file) | errors::error) = { let fds: [2]int = [0...]; - let flag: pipe_flag = 0; + let flag: pipe_flags = 0; for (let i = 0z; i < len(flags); i += 1) { flag |= flags[i]; }; - flag ^= pipe_flag::NOCLOEXEC; // invert CLOEXEC + flag ^= pipe_flags::NOCLOEXEC; // invert CLOEXEC match (rt::pipe2(&fds, flag)) { case void => void; case let e: rt::errno => diff --git a/unix/signal/+linux.ha b/unix/signal/+linux.ha @@ -7,20 +7,20 @@ use rt; // Configures a new signal handler, returning the old details (which can be // passed to [[restore]] to restore its behavior). // -// The variadic parameters specify either [[flag]] to enable or a signal mask +// The variadic parameters specify either [[flags]] to enable or a signal mask // to use via [[sigset]]; if the latter is provided no more than one may be // used. export fn handle( signum: signal, handler: *handler, - opt: (flag | sigset)... + opt: (flags | sigset)... ) sigaction = { let sa_mask = newsigset(); let sa_flags = 0u64, nmask = 0; for (let i = 0z; i < len(opt); i += 1) { match (opt[i]) { - case let flag: flag => + case let flag: flags => sa_flags |= flag: u64; case let mask: sigset => assert(nmask == 0, "Multiple signal masks provided to signal::handle"); @@ -267,7 +267,7 @@ export type code = enum int { }; // Flags used to configure the behavior of a signal handler. -export type flag = enum int { +export type flags = enum int { // For use with [[SIGCHLD]]. Prevents notifications when child processes // stop (e.g. via [[SIGSTOP]]) or resume (i.e. [[SIGCONT]]). NOCLDSTOP = rt::SA_NOCLDSTOP: int,