Standard escape codes are prefixed with Escape
:
- Ctrl-Key:
^[
- Octal:
\033
- Unicode:
\u001b
- Hexadecimal:
\x1B
- Decimal:
27
#!/usr/bin/env sh | |
git clone --depth=1 https://github.com/DragonFlyBSD/DragonFlyBSD | |
git clone --depth=1 https://github.com/freebsd/freebsd-src | |
git clone --depth=1 https://fuchsia.googlesource.com/fuchsia | |
git clone --depth=1 https://github.com/haiku/haiku | |
git clone --depth=1 https://github.com/hermitcore/rusty-hermit | |
git clone --depth=1 https://github.com/Stichting-MINIX-Research-Foundation/minix/ | |
git clone --depth=1 https://github.com/NetBSD/src | |
git clone --depth=1 https://github.com/openbsd/src |
fn openAndRead(alloc: std.mem.Allocator, in_file: []const u8) !void { | |
var f = std.fs.cwd().openFile(in_file, .{}) catch |err| { | |
fatal("unable to open file '{s}': {s}\n", .{ in_file, @errorName(err) }); | |
}; | |
defer f.close(); | |
const stat = try f.stat(); | |
if (stat.size > std.math.maxInt(u32)) | |
return error.FileTooBig; | |
const source = try alloc.allocSentinel(u8, @intCast(usize, stat.size), 0); | |
errdefer alloc.free(source); |
diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig | |
index 8004f94d7f..22996939a3 100644 | |
--- a/lib/std/Thread.zig | |
+++ b/lib/std/Thread.zig | |
@@ -275,6 +275,14 @@ pub fn getCurrentId() Id { | |
return Impl.getCurrentId(); | |
} | |
+pub fn getStatus() c_int { | |
+ // https://stackoverflow.com/questions/9577231/how-to-check-the-state-of-linux-threads |
-- Simplified version only taking into account idenically sized splits | |
-- along a full rectangle: | |
-- Windows can be grouped by following the direction of window numbers. | |
-- 1. 2. 3. | |
-- 1 | 2 | | |1 |2 | | | 6 | 1 | 2 | 3 | 4| | |
-- ---|---| 5 | |-----| 4 | 5 |---- |--------------| | |
-- 3 | 4 | | | 3 | | | 7 | 5 | | |
-- 1. allowed, because even though 5 has no split, it has full height | |
-- 2. not allowed, because 3 has no vsplit | |
-- 4. not allowed, because splits in 1,2 are not identical in 3. |
Segmentation fault at address 0x3e800033cc6 | |
/home/user/dev/git/zi/zig/master/build/stage3/lib/zig/std/os/linux/x86_64.zig:36:5: 0x22d97c in syscall2 | |
(stacking_panics) | |
return asm volatile ("syscall" | |
^ | |
/home/user/dev/git/zi/zig/master/build/stage3/lib/zig/std/os/linux.zig:991:49: 0x20f19f in nanosleep (sta | |
cking_panics) | |
return syscall2(.nanosleep, @ptrToInt(req), @ptrToInt(rem)); | |
^ | |
/home/user/dev/git/zi/zig/master/build/stage3/lib/zig/std/os.zig:5253:39: 0x20b681 in nanosleep (stacking |
/* aeabi.h - declares the ARM run-time helper-function ABI for programs written in C. | |
* | |
* This is free and unencumbered software released into the public domain. | |
* | |
* Anyone is free to copy, modify, publish, use, compile, sell, or | |
* distribute this software, either in source code form or as a compiled | |
* binary, for any purpose, commercial or non-commercial, and by any | |
* means. | |
* In jurisdictions that recognize copyright laws, the author or authors |
#!/usr/bin/env sh | |
# Building zig in debug mode | |
cd zigrepo | |
mkdir -p build/ && cd build/ && cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH="$HOME/dev/git/bootstrap/zig-bootstrap/musl/out/host/" -GNinja && /usr/bin/time -v ninja install && cd .. | |
# add zig stages 3 to PATH | |
zig test --debug-log compilation -freference-trace --test-filter fubar arenas.zig | |
zig test --debug-log sema -freference-trace thread.zig |
const std = @import("std"); | |
fn t1init(alloc: std.mem.Allocator, path1: []const u8) ![]const u8 { | |
const stdout_wr = std.io.getStdOut().writer(); | |
try stdout_wr.writeAll("t1init"); // prevent compiler to optimize away this fn | |
return try alloc.dupe(u8, path1); | |
} | |
fn t2init(alloc: std.mem.Allocator, path2: []const u8) ![]const u8 { | |
_ = path2; |
128bit | |
(ins)[misterspoon@pc tryzig]$ hyperfine ./addo_crt ./addo_cstruct | |
Benchmark 1: ./addo_crt | |
Time (mean ± σ): 1.083 s ± 0.006 s [User: 1.082 s, System: 0.001 s] | |
Range (min … max): 1.072 s … 1.094 s 10 runs | |
Benchmark 2: ./addo_cstruct | |
Time (mean ± σ): 1.077 s ± 0.003 s [User: 1.075 s, System: 0.001 s] | |
Range (min … max): 1.073 s … 1.082 s 10 runs | |