| author | |
| committer | |
| log | 3a6e15449b887481a0ed24fc948157c222f0072a |
| tree | fcc688ff1a7ce513afc46703bfd2765adcdc3ebb |
| parent | ffcbd48a1220ce6d652ee762001d88baa385de49 |
and add futex to the vtable. A future commit may make the other sync
primitives based on futexes.2 files changed, 9 insertions(+), 5 deletions(-)
lib/std/Io/File/Writer.zig+4-4| ... | ... | @@ -52,14 +52,14 @@ pub const Mode = union(enum) { |
| 52 | 52 | return switch (m) { |
| 53 | 53 | .positional, .positional_simple => .positional_simple, |
| 54 | 54 | .streaming, .streaming_simple => .streaming_simple, |
| 55 | inline else => |x| x, | |
| 55 | inline else => |_, x| x, | |
| 56 | 56 | }; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | pub fn toUnescaped(m: @This()) @This() { |
| 60 | 60 | return switch (m) { |
| 61 | 61 | .terminal_escaped => .streaming_simple, |
| 62 | inline else => |x| x, | |
| 62 | inline else => |_, x| x, | |
| 63 | 63 | }; |
| 64 | 64 | } |
| 65 | 65 | |
| ... | ... | @@ -469,13 +469,13 @@ pub fn restoreEscape(w: *Writer, mode: Mode) void { |
| 469 | 469 | w.mode = mode; |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | pub fn writeAllUnescaped(w: *Writer, bytes: []const u8) Io.Error!void { | |
| 472 | pub fn writeAllUnescaped(w: *Writer, bytes: []const u8) Io.Writer.Error!void { | |
| 473 | 473 | const prev_mode = w.disableEscape(); |
| 474 | 474 | defer w.restoreEscape(prev_mode); |
| 475 | 475 | return w.interface.writeAll(bytes); |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | pub fn printUnescaped(w: *Writer, comptime fmt: []const u8, args: anytype) Io.Error!void { | |
| 478 | pub fn printUnescaped(w: *Writer, comptime fmt: []const u8, args: anytype) Io.Writer.Error!void { | |
| 479 | 479 | const prev_mode = w.disableEscape(); |
| 480 | 480 | defer w.restoreEscape(prev_mode); |
| 481 | 481 | return w.interface.print(fmt, args); |
lib/std/Progress.zig+5-1| ... | ... | @@ -52,6 +52,8 @@ node_freelist: Freelist, |
| 52 | 52 | /// value may at times temporarily exceed the node count. |
| 53 | 53 | node_end_index: u32, |
| 54 | 54 | |
| 55 | start_failure: StartFailure, | |
| 56 | ||
| 55 | 57 | pub const Status = enum { |
| 56 | 58 | /// Indicates the application is progressing towards completion of a task. |
| 57 | 59 | /// Unless the application is interactive, this is the only status the |
| ... | ... | @@ -448,6 +450,8 @@ const noop_impl = builtin.single_threaded or switch (builtin.os.tag) { |
| 448 | 450 | /// Asserts there is only one global Progress instance. |
| 449 | 451 | /// |
| 450 | 452 | /// Call `Node.end` when done. |
| 453 | /// | |
| 454 | /// If an error occurs, `start_failure` will be populated. | |
| 451 | 455 | pub fn start(options: Options, io: Io) Node { |
| 452 | 456 | // Ensure there is only 1 global Progress object. |
| 453 | 457 | if (global_progress.node_end_index != 0) { |
| ... | ... | @@ -757,7 +761,7 @@ fn appendTreeSymbol(symbol: TreeSymbol, buf: []u8, start_i: usize) usize { |
| 757 | 761 | |
| 758 | 762 | pub fn clearWrittenWithEscapeCodes(file_writer: *Io.File.Writer) anyerror!void { |
| 759 | 763 | if (noop_impl or !global_progress.need_clear) return; |
| 760 | try file_writer.interface.writeAllUnescaped(clear ++ progress_remove); | |
| 764 | try file_writer.writeAllUnescaped(clear ++ progress_remove); | |
| 761 | 765 | global_progress.need_clear = false; |
| 762 | 766 | } |
| 763 | 767 |