hare

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

commit 23304dac06dd28ee4a6c277b7839cbb42aaed174
parent 85dffc59ec778ec9011514f0ed98ee69f03e553d
Author: wackbyte <wackbyte@protonmail.com>
Date:   Sat,  9 Mar 2024 22:02:36 +0000

fix mixed indentation

Replace indentation using spaces with tabs and fix some stray spaces mixed with
tabs.

Diffstat:
Mencoding/hex/hex.ha | 6+++---
Mio/+openbsd/dup.ha | 47+++++++++++++++++++++++------------------------
Mos/+openbsd/dirfdfs.ha | 50+++++++++++++++++++++++++-------------------------
Mrt/+openbsd/start.s | 2+-
Mrt/+x86_64/setjmp.s | 2+-
Msort/cmp/cmp.ha | 6+++---
6 files changed, 56 insertions(+), 57 deletions(-)

diff --git a/encoding/hex/hex.ha b/encoding/hex/hex.ha @@ -37,7 +37,7 @@ fn encode_writer(s: *io::stream, in: const []u8) (size | io::error) = { const s = s: *encoder; match(s.err) { case let err: io::error => - return err; + return err; case void => void; }; let z = 0z; @@ -172,9 +172,9 @@ export fn decodestr(s: str) ([]u8 | io::error) = { const out = memio::dynamic(); match(io::copy(&out, &decoder)) { case size => - return memio::buffer(&out); + return memio::buffer(&out); case let err: io::error => - return err; + return err; }; }; diff --git a/io/+openbsd/dup.ha b/io/+openbsd/dup.ha @@ -6,39 +6,39 @@ use rt; // Flags for [[dup]] and [[dup2]] operations. export type dupflag = enum { - NONE = 0, + NONE = 0, - // Causes [[dup]] and [[dup2]] not to set the CLOEXEC flag on the - // duplicated file descriptor. By default, CLOEXEC is set. - NOCLOEXEC = rt::FD_CLOEXEC, + // Causes [[dup]] and [[dup2]] not to set the CLOEXEC flag on the + // duplicated file descriptor. By default, CLOEXEC is set. + NOCLOEXEC = rt::FD_CLOEXEC, }; // Duplicates a file descriptor. export fn dup(old: file, flags: dupflag) (file | error) = { - flags ^= dupflag::NOCLOEXEC; // Invert CLOEXEC + flags ^= dupflag::NOCLOEXEC; // Invert CLOEXEC - match (rt::dup2(old, -1)) { - case let fd: int => - const fl = rt::fcntl(fd, rt::F_GETFD, 0)!; - rt::fcntl(fd, rt::F_SETFD, fl | rt::FD_CLOEXEC)!; - return fd; - case let e: rt::errno => - return errors::errno(e); - }; + match (rt::dup2(old, -1)) { + case let fd: int => + const fl = rt::fcntl(fd, rt::F_GETFD, 0)!; + rt::fcntl(fd, rt::F_SETFD, fl | rt::FD_CLOEXEC)!; + return fd; + case let e: rt::errno => + return errors::errno(e); + }; }; // Duplicates a file descriptor and stores the new file at a specific file // descriptor number. If the file indicated by "new" already refers to an open // file, this file will be closed before the file descriptor is reused. export fn dup2(old: file, new: file, flags: dupflag) (file | error) = { - flags ^= dupflag::NOCLOEXEC; // Invert CLOEXEC + flags ^= dupflag::NOCLOEXEC; // Invert CLOEXEC - match (rt::dup2(old, new)) { - case let fd: int => - const fl = rt::fcntl(fd, rt::F_GETFD, 0)!; - rt::fcntl(fd, rt::F_SETFD, fl | flags)!; - return fd; - case let e: rt::errno => - return errors::errno(e); - }; -}; -\ No newline at end of file + match (rt::dup2(old, new)) { + case let fd: int => + const fl = rt::fcntl(fd, rt::F_GETFD, 0)!; + rt::fcntl(fd, rt::F_SETFD, fl | flags)!; + return fd; + case let e: rt::errno => + return errors::errno(e); + }; +}; diff --git a/os/+openbsd/dirfdfs.ha b/os/+openbsd/dirfdfs.ha @@ -394,31 +394,31 @@ export fn dirfdopen(fd: io::file) *fs::fs = { }; fn static_dirfdopen(fd: io::file, filesystem: *os_filesystem) *fs::fs = { - *filesystem = os_filesystem { - fs = fs::fs { - open = &fs_open, - openfile = &fs_open_file, - create = &fs_create, - createfile = &fs_create_file, - remove = &fs_remove, - rename = &fs_rename, - iter = &fs_iter, - stat = &fs_stat, - readlink = &fs_readlink, - mkdir = &fs_mkdir, - rmdir = &fs_rmdir, - chmod = &fs_chmod, - chown = &fs_chown, - resolve = &fs_resolve, - link = &fs_link, - symlink = &fs_symlink, - ... - }, - dirfd = fd, - getdents_bufsz = 32768, // 32 KiB - ... - }; - return &filesystem.fs; + *filesystem = os_filesystem { + fs = fs::fs { + open = &fs_open, + openfile = &fs_open_file, + create = &fs_create, + createfile = &fs_create_file, + remove = &fs_remove, + rename = &fs_rename, + iter = &fs_iter, + stat = &fs_stat, + readlink = &fs_readlink, + mkdir = &fs_mkdir, + rmdir = &fs_rmdir, + chmod = &fs_chmod, + chown = &fs_chown, + resolve = &fs_resolve, + link = &fs_link, + symlink = &fs_symlink, + ... + }, + dirfd = fd, + getdents_bufsz = 32768, // 32 KiB + ... + }; + return &filesystem.fs; }; // Sets the buffer size to use with the getdents(2) system call, for use with diff --git a/rt/+openbsd/start.s b/rt/+openbsd/start.s @@ -1,4 +1,4 @@ .section ".preinit_array" .balign 8 .init.initfunc.0: - .quad preinit_hare+0 + .quad preinit_hare+0 diff --git a/rt/+x86_64/setjmp.s b/rt/+x86_64/setjmp.s @@ -6,7 +6,7 @@ rt.setjmp: /* no endbr64 here to avoid exploitation - this function cannot be the * result of an indirect branch. - */ + */ mov %rbx,(%rdi) /* rdi is jmp_buf, move registers onto it */ mov %rbp,8(%rdi) mov %r12,16(%rdi) diff --git a/sort/cmp/cmp.ha b/sort/cmp/cmp.ha @@ -89,9 +89,9 @@ export fn strs(a: const *opaque, b: const *opaque) int = { let ln = if (len(a) < len(b)) (len(a), -1) else (len(b), 1); for (let i = 0z; i < ln.0; i += 1) { - if (a[i] != b[i]) { - return a[i]: int - b[i]: int; - }; + if (a[i] != b[i]) { + return a[i]: int - b[i]: int; + }; }; return if (len(a) == len(b)) 0 else ln.1; };