hare

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

commit 9ab7a86aee1b253eb09e7a7431473cd3cd983d58
parent 40146fe5a011ba4fed42c867d67b2a2f975466b5
Author: Joe Finney <me@spxtr.net>
Date:   Mon,  9 Oct 2023 15:32:29 -0700

Alphebatize imports across the board.

My apologies.

Signed-off-by: Joe Finney <me@spxtr.net>

Diffstat:
Mcmd/harec/context.ha | 2+-
Mcmd/harec/qbe.ha | 2+-
Mcrypto/aes/cbc+test.ha | 2+-
Mcrypto/aes/ct64+test.ha | 2+-
Mcrypto/aes/rt+test.ha | 2+-
Mcrypto/aes/xts/xts.ha | 2+-
Mcrypto/bcrypt/+test.ha | 2+-
Mcrypto/bcrypt/bcrypt.ha | 2+-
Mcrypto/cipher/stream.ha | 2+-
Mcrypto/curve25519/+test.ha | 4++--
Mcrypto/keyderiv.ha | 2+-
Mcrypto/random/+freebsd.ha | 2+-
Mcrypto/random/+linux.ha | 2+-
Mcrypto/rsa/core.ha | 2+-
Mcrypto/rsa/pkcs1.ha | 2+-
Mcrypto/sha1/+test.ha | 2+-
Mcrypto/sha1/sha1.ha | 4++--
Mcrypto/sha256/+test.ha | 2+-
Mcrypto/sha256/sha256.ha | 2+-
Mcrypto/sha512/+test.ha | 2+-
Mcrypto/x25519/+test.ha | 2+-
Mencoding/pem/+test.ha | 2+-
Mhare/module/format.ha | 2+-
Mhare/parse/+test/roundtrip.ha | 2+-
Mhare/parse/decl.ha | 2+-
Mhare/parse/expr.ha | 4++--
Mhare/parse/ident.ha | 2+-
Mhare/parse/import.ha | 4++--
Mhare/parse/parse.ha | 2+-
Mhare/types/hash.ha | 2+-
Mhare/unit/scope.ha | 2+-
Mhare/unparse/decl.ha | 2+-
Mhare/unparse/expr.ha | 4++--
Mhare/unparse/import.ha | 2+-
Mhare/unparse/type.ha | 2+-
Mhare/unparse/unit.ha | 2+-
Mhare/unparse/util.ha | 2+-
Mhash/hash.ha | 2+-
Mlinux/+linux/start+libc.ha | 2+-
Mlinux/+linux/start.ha | 2+-
Mlinux/timerfd/+linux/timerfd.ha | 4++--
Mnet/dns/query.ha | 2+-
Mnet/ip/+freebsd.ha | 2+-
Mnet/ip/+linux.ha | 2+-
Mnet/ip/test+test.ha | 2+-
Mnet/msg.ha | 2+-
Mnet/tcp/+freebsd.ha | 2+-
Mnet/tcp/+linux.ha | 2+-
Mnet/udp/+freebsd.ha | 2+-
Mnet/udp/+linux.ha | 2+-
Mnet/unix/cmsg.ha | 2+-
Mnet/unix/dial.ha | 2+-
Mos/+freebsd/dirfdfs.ha | 2+-
Mos/+linux/dirfdfs.ha | 2+-
Mos/exec/exec+freebsd.ha | 2+-
Msort/sort.ha | 2+-
Mstrconv/itos.ha | 2+-
Mstrconv/stoi.ha | 2+-
Mstrconv/stou.ha | 4++--
Mtime/+linux/functions.ha | 2+-
Munix/tty/+freebsd/isatty.ha | 2+-
Munix/tty/+freebsd/termios.ha | 2+-
Munix/tty/+linux/isatty.ha | 2+-
Munix/tty/+linux/termios.ha | 2+-
64 files changed, 71 insertions(+), 71 deletions(-)

diff --git a/cmd/harec/context.ha b/cmd/harec/context.ha @@ -1,9 +1,9 @@ // SPDX-License-Identifier: GPL-3.0-only // (c) Hare authors <https://harelang.org> -use io; use hare::types; use hare::unit; +use io; use memio; type context = struct { diff --git a/cmd/harec/qbe.ha b/cmd/harec/qbe.ha @@ -2,9 +2,9 @@ // (c) Hare authors <https://harelang.org> use fmt; -use io; use hare::types; use hare::types::{builtin}; +use io; type global = str; type temporary = str; diff --git a/crypto/aes/cbc+test.ha b/crypto/aes/cbc+test.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use crypto::cipher; use bytes; +use crypto::cipher; @test fn cbc_encrypt_decrypt() void = { const key: [_]u8 = [ diff --git a/crypto/aes/ct64+test.ha b/crypto/aes/ct64+test.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use crypto::cipher; use bytes; +use crypto::cipher; @test fn test_encrypt_128() void = { const key: [16]u8 = [ diff --git a/crypto/aes/rt+test.ha b/crypto/aes/rt+test.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use crypto::cipher; use bytes; +use crypto::cipher; @test fn rt_finish() void = { const key: [16]u8 = [ diff --git a/crypto/aes/xts/xts.ha b/crypto/aes/xts/xts.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use crypto::aes; use bytes; +use crypto::aes; use crypto::cipher; export type block = struct { diff --git a/crypto/bcrypt/+test.ha b/crypto/bcrypt/+test.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use strings; use fmt; +use strings; @test fn bcrypt() void = { const pass = strings::toutf8("hare is cool"); diff --git a/crypto/bcrypt/bcrypt.ha b/crypto/bcrypt/bcrypt.ha @@ -6,10 +6,10 @@ // // TODO: Move me into the extlib (hare-x-crypto?) use bytes; +use crypto; use crypto::blowfish; use crypto::cipher; use crypto::random; -use crypto; use errors; use fmt; use io; diff --git a/crypto/cipher/stream.ha b/crypto/cipher/stream.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use io; use crypto::math::{xor}; +use io; // An abstract interface for implementing streams that encrypt or decrypt by // producing a key stream that is xored with the data. The stream field should diff --git a/crypto/curve25519/+test.ha b/crypto/curve25519/+test.ha @@ -2,10 +2,10 @@ // (c) Hare authors <https://harelang.org> use bytes; +use crypto::random; +use encoding::hex; use fmt; use io; -use encoding::hex; -use crypto::random; @test fn unpack25519() void = { let in: [SCALARSZ]u8 = [1u8...]; diff --git a/crypto/keyderiv.ha b/crypto/keyderiv.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use errors; use crypto::argon2; +use errors; // Given a password, derive a key. Given the same password, salt, memory, and // passes, this function will always produce the same key. This function is diff --git a/crypto/random/+freebsd.ha b/crypto/random/+freebsd.ha @@ -2,8 +2,8 @@ // (c) Hare authors <https://harelang.org> use errors; -use rt; use io; +use rt; // Fills the given buffer with cryptographically random data. If the system is // unable to provide random data, abort. If you need to handle errors or want to diff --git a/crypto/random/+linux.ha b/crypto/random/+linux.ha @@ -2,8 +2,8 @@ // (c) Hare authors <https://harelang.org> use errors; -use rt; use io; +use rt; // Fills the given buffer with cryptographically random data. If the system is // unable to provide random data, abort. If you need to handle errors or want to diff --git a/crypto/rsa/core.ha b/crypto/rsa/core.ha @@ -25,8 +25,8 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. use bytes; -use crypto::math::{divu32}; use crypto::bigint::*; +use crypto::math::{divu32}; use errors; use types; diff --git a/crypto/rsa/pkcs1.ha b/crypto/rsa/pkcs1.ha @@ -2,10 +2,10 @@ // (c) Hare authors <https://harelang.org> use bufio; +use crypto::math; use crypto::sha1; use crypto::sha256; use crypto::sha512; -use crypto::math; use errors; use hash; use io; diff --git a/crypto/sha1/+test.ha b/crypto/sha1/+test.ha @@ -1,10 +1,10 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> +use encoding::hex; use fmt; use hash; use strings; -use encoding::hex; @test fn sha1() void = { let sha = sha1(); diff --git a/crypto/sha1/sha1.ha b/crypto/sha1/sha1.ha @@ -1,11 +1,11 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use hash; -use io; use bytes; use crypto::math; use endian; +use hash; +use io; // The size, in bytes, of a SHA-1 digest. export def SZ: size = 20; diff --git a/crypto/sha256/+test.ha b/crypto/sha256/+test.ha @@ -1,10 +1,10 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> +use encoding::hex; use fmt; use hash; use strings; -use encoding::hex; @test fn sha256() void = { let sha = sha256(); diff --git a/crypto/sha256/sha256.ha b/crypto/sha256/sha256.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use crypto::math; use bytes; +use crypto::math; use endian; use hash; use io; diff --git a/crypto/sha512/+test.ha b/crypto/sha512/+test.ha @@ -1,10 +1,10 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> +use encoding::hex; use fmt; use hash; use strings; -use encoding::hex; @test fn sha512() void = { let sha = sha512(); diff --git a/crypto/x25519/+test.ha b/crypto/x25519/+test.ha @@ -2,8 +2,8 @@ // (c) Hare authors <https://harelang.org> use bytes; -use encoding::hex; use crypto::random; +use encoding::hex; @test fn sample() void = { let seed: [32]u8 = [0xff...]; diff --git a/encoding/pem/+test.ha b/encoding/pem/+test.ha @@ -2,8 +2,8 @@ // (c) Hare authors <https://harelang.org> use bytes; -use io; use fmt; +use io; use memio; use strings; diff --git a/hare/module/format.ha b/hare/module/format.ha @@ -1,11 +1,11 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use time::date; use fmt; use hare::unparse; use io; use time::chrono; +use time::date; // Formats a set of tags to an [[io::handle]] in "+tag1-tag2" format. export fn format_tags( diff --git a/hare/parse/+test/roundtrip.ha b/hare/parse/+test/roundtrip.ha @@ -5,8 +5,8 @@ use fmt; use hare::ast; use hare::lex; use hare::unparse; -use io::{mode}; use io; +use io::{mode}; use memio; use strings; diff --git a/hare/parse/decl.ha b/hare/parse/decl.ha @@ -3,8 +3,8 @@ use ascii; use hare::ast; -use hare::lex::{ltok}; use hare::lex; +use hare::lex::{ltok}; use strings; fn attr_symbol(lexer: *lex::lexer) (str | error) = { diff --git a/hare/parse/expr.ha b/hare/parse/expr.ha @@ -2,11 +2,11 @@ // (c) Hare authors <https://harelang.org> use hare::ast; -use hare::lex::{ltok}; use hare::lex; +use hare::lex::{ltok}; use math; -use types; use strings; +use types; // Parses an expression. export fn expr(lexer: *lex::lexer) (ast::expr | error) = { diff --git a/hare/parse/ident.ha b/hare/parse/ident.ha @@ -2,8 +2,8 @@ // (c) Hare authors <https://harelang.org> use hare::ast; -use hare::lex::{ltok}; use hare::lex; +use hare::lex::{ltok}; use memio; use strings; diff --git a/hare/parse/import.ha b/hare/parse/import.ha @@ -1,11 +1,11 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> +use fmt; use hare::ast; use hare::lex; -use hare::lex::{ltok}; -use fmt; +use hare::lex::{ltok}; fn name_list(lexer: *lex::lexer) ([]((str | void), str) | error) = { let names: []((str | void), str) = []; diff --git a/hare/parse/parse.ha b/hare/parse/parse.ha @@ -2,8 +2,8 @@ // (c) Hare authors <https://harelang.org> use fmt; -use hare::lex::{ltok}; use hare::lex; +use hare::lex::{ltok}; use io; use memio; diff --git a/hare/types/hash.ha b/hare/types/hash.ha @@ -2,8 +2,8 @@ // (c) Hare authors <https://harelang.org> use endian; -use hash::fnv; use hash; +use hash::fnv; use strings; // Keep ordered with respect to bootstrap harec:include/types.h diff --git a/hare/unit/scope.ha b/hare/unit/scope.ha @@ -3,8 +3,8 @@ use hare::ast; use hare::types; -use hash::fnv; use hash; +use hash::fnv; use strings; // What sort of [[object]] is represented. diff --git a/hare/unparse/decl.ha b/hare/unparse/decl.ha @@ -1,10 +1,10 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use io; use fmt; use hare::ast; use hare::lex; +use io; use memio; use strings; diff --git a/hare/unparse/expr.ha b/hare/unparse/expr.ha @@ -1,12 +1,12 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use io; use fmt; use hare::ast; use hare::ast::{binarithm_op}; -use hare::lex::{ltok}; use hare::lex; +use hare::lex::{ltok}; +use io; use strings; // Unparses a [[hare::ast::expr]]. diff --git a/hare/unparse/import.ha b/hare/unparse/import.ha @@ -2,8 +2,8 @@ // (c) Hare authors <https://harelang.org> use fmt; -use io; use hare::ast; +use io; use memio; // Unparses a [[hare::ast::import]]. diff --git a/hare/unparse/type.ha b/hare/unparse/type.ha @@ -2,10 +2,10 @@ // (c) Hare authors <https://harelang.org> use fmt; -use io; use hare::ast; use hare::ast::{variadism}; use hare::lex; +use io; use memio; use strings; diff --git a/hare/unparse/unit.ha b/hare/unparse/unit.ha @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use io; use fmt; use hare::ast; +use io; // Unparses a [[hare::ast::subunit]]. export fn subunit( diff --git a/hare/unparse/util.ha b/hare/unparse/util.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use io; use fmt; +use io; fn newline(ctx: *context) (size | io::error) = { let n = 0z; diff --git a/hash/hash.ha b/hash/hash.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use io; use fmt; +use io; // TODO: Use a vtable-based approach for this like io::stream // The general purpose interface for a hashing function. diff --git a/linux/+linux/start+libc.ha b/linux/+linux/start+libc.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use rt; use format::elf; +use rt; @init fn init_linux() void = { let i = 0; diff --git a/linux/+linux/start.ha b/linux/+linux/start.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use rt; use format::elf; +use rt; @init fn init_linux() void = { let i = 0; diff --git a/linux/timerfd/+linux/timerfd.ha b/linux/timerfd/+linux/timerfd.ha @@ -1,11 +1,11 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> +use endian; use errors; +use io; use rt; use time; -use io; -use endian; // The timer will trigger only once, after the set duration and never after. export type oneshot = time::duration; diff --git a/net/dns/query.ha b/net/dns/query.ha @@ -6,8 +6,8 @@ use errors; use io; use net; use net::ip; -use net::udp; use net::tcp; +use net::udp; use time; use types; use unix::poll; diff --git a/net/ip/+freebsd.ha b/net/ip/+freebsd.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use rt; use endian; +use rt; export fn to_native(a: addr, port: u16) rt::sockaddr = { match (a) { diff --git a/net/ip/+linux.ha b/net/ip/+linux.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use rt; use endian; +use rt; export fn to_native(a: addr, port: u16) rt::sockaddr = { match (a) { diff --git a/net/ip/test+test.ha b/net/ip/test+test.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use strings; use fmt; +use strings; fn ip_test(s: str, expected: (addr|invalid)) void = { let pr = parse(s); diff --git a/net/msg.ha b/net/msg.ha @@ -4,8 +4,8 @@ // TODO: // - Set name field // - Figure out the portability mess that is this interface -use rt; use fmt; +use rt; export type msghdr = struct { native: rt::msghdr, diff --git a/net/tcp/+freebsd.ha b/net/tcp/+freebsd.ha @@ -3,8 +3,8 @@ use errors; use io; -use net::ip; use net; +use net::ip; use os; use rt; diff --git a/net/tcp/+linux.ha b/net/tcp/+linux.ha @@ -3,8 +3,8 @@ use errors; use io; -use net::ip; use net; +use net::ip; use os; use rt; diff --git a/net/udp/+freebsd.ha b/net/udp/+freebsd.ha @@ -3,8 +3,8 @@ use errors; use io; -use net::ip; use net; +use net::ip; use os; use rt; diff --git a/net/udp/+linux.ha b/net/udp/+linux.ha @@ -3,8 +3,8 @@ use errors; use io; -use net::ip; use net; +use net::ip; use os; use rt; diff --git a/net/unix/cmsg.ha b/net/unix/cmsg.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use net; use io; +use net; use rt; // Adds a list of file descriptors to the ancillary data for a sendmsg diff --git a/net/unix/dial.ha b/net/unix/dial.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use net::dial; use net; +use net::dial; fn dial_unix(addr: str, service: str) (net::socket | dial::error) = { match (connect(addr)) { diff --git a/os/+freebsd/dirfdfs.ha b/os/+freebsd/dirfdfs.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use errors; use encoding::utf8; +use errors; use fs; use io; use path; diff --git a/os/+linux/dirfdfs.ha b/os/+linux/dirfdfs.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use errors; use encoding::utf8; +use errors; use fs; use io; use path; diff --git a/os/exec/exec+freebsd.ha b/os/exec/exec+freebsd.ha @@ -3,8 +3,8 @@ use errors; use io; -use rt; use os; +use rt; use types::c; use unix; diff --git a/sort/sort.ha b/sort/sort.ha @@ -2,8 +2,8 @@ // (c) Hare authors <https://harelang.org> use math; -use types; use rt; +use types; // Sorts a slice of items in place. This function provides a stable sort - // relative order of equal elements is preserved. diff --git a/strconv/itos.ha b/strconv/itos.ha @@ -2,8 +2,8 @@ // (c) Hare authors <https://harelang.org> use bytes; -use types; use strings; +use types; // Converts an i64 to a string in the given base. The return value is statically // allocated and will be overwritten on subsequent calls; see [[strings::dup]] to diff --git a/strconv/stoi.ha b/strconv/stoi.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use types; use strings; +use types; // Converts a string to an i64 in the given base. If the string contains any // non-numeric characters, except '-' or '+' at the start, or if it's empty, diff --git a/strconv/stou.ha b/strconv/stou.ha @@ -1,10 +1,10 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use strings; -use types; use ascii; use encoding::utf8; +use strings; +use types; fn rune_to_integer(r: rune) (u64 | void) = { if (ascii::isdigit(r)) diff --git a/time/+linux/functions.ha b/time/+linux/functions.ha @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use rt; use linux::vdso; +use rt; // Converts a [[duration]] to an [[rt::timespec]]. This function is // non-portable. diff --git a/unix/tty/+freebsd/isatty.ha b/unix/tty/+freebsd/isatty.ha @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use rt; use io; use os; +use rt; // Returns whether the given stream is connected to a terminal. export fn isatty(fd: io::file) bool = { diff --git a/unix/tty/+freebsd/termios.ha b/unix/tty/+freebsd/termios.ha @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> +use errors; use io; use rt; -use errors; export type termios = struct { file: io::file, diff --git a/unix/tty/+linux/isatty.ha b/unix/tty/+linux/isatty.ha @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MPL-2.0 // (c) Hare authors <https://harelang.org> -use rt; use io; use os; +use rt; // Returns whether the given stream is connected to a terminal. export fn isatty(fd: io::file) bool = { diff --git a/unix/tty/+linux/termios.ha b/unix/tty/+linux/termios.ha @@ -2,9 +2,9 @@ // (c) Hare authors <https://harelang.org> // TODO: Not in love with this interface +use errors; use io; use rt; -use errors; export type termios = struct { file: io::file,