hare

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

platform_abort.ha (932B)


      1 // SPDX-License-Identifier: MPL-2.0
      2 // (c) Hare authors <https://harelang.org>
      3 
      4 fn platform_abort(path: *str, line: u64, col: u64, msg: str) never = {
      5 	const prefix = "Abort: ";
      6 	const sep = ":";
      7 	const sepspace = ": ";
      8 	const linefeed = "\n";
      9 	write(STDERR_FILENO, *(&prefix: **opaque): *const u8, len(prefix)): void;
     10 	write(STDERR_FILENO, *(path: **opaque): *const u8, len(path)): void;
     11 	write(STDERR_FILENO, *(&sep: **opaque): *const u8, len(sep)): void;
     12 	let (line, z) = u64tos(line);
     13 	write(STDERR_FILENO, line, z): void;
     14 	write(STDERR_FILENO, *(&sep: **opaque): *const u8, len(sep)): void;
     15 	let (col, z) = u64tos(col);
     16 	write(STDERR_FILENO, col, z): void;
     17 	write(STDERR_FILENO, *(&sepspace: **opaque): *const u8,
     18 		len(sepspace)): void;
     19 	write(STDERR_FILENO, *(&msg: **opaque): *const u8, len(msg)): void;
     20 	write(STDERR_FILENO, *(&linefeed: **opaque): *const u8, 1): void;
     21 	kill(getpid(), SIGABRT): void;
     22 	for (true) void;
     23 };