| author | |
| committer | |
| log | 2bff0dda795cd84e4da59652736b7cfa7e1c964c |
| tree | 4b3bc5f10fefd1c3e4fedccc872ed99d9d87a6e7 |
| parent | 9abee660dce3b43b9ac3b8260fbf269532d6c7f5 |
| signature |
11 files changed, 103 insertions(+), 128 deletions(-)
doc/docgen.zig+44-51| ... | ... | @@ -40,12 +40,9 @@ pub fn main() !void { |
| 40 | 40 | var out_file = try fs.cwd().createFile(out_file_name, .{}); |
| 41 | 41 | defer out_file.close(); |
| 42 | 42 | |
| 43 | var file_in_stream = in_file.inStream(); | |
| 43 | const input_file_bytes = try in_file.inStream().readAllAlloc(allocator, max_doc_file_size); | |
| 44 | 44 | |
| 45 | const input_file_bytes = try file_in_stream.stream.readAllAlloc(allocator, max_doc_file_size); | |
| 46 | ||
| 47 | var file_out_stream = out_file.outStream(); | |
| 48 | var buffered_out_stream = io.BufferedOutStream(fs.File.WriteError).init(&file_out_stream.stream); | |
| 45 | var buffered_out_stream = io.bufferedOutStream(out_file.outStream()); | |
| 49 | 46 | |
| 50 | 47 | var tokenizer = Tokenizer.init(in_file_name, input_file_bytes); |
| 51 | 48 | var toc = try genToc(allocator, &tokenizer); |
| ... | ... | @@ -53,7 +50,7 @@ pub fn main() !void { |
| 53 | 50 | try fs.cwd().makePath(tmp_dir_name); |
| 54 | 51 | defer fs.deleteTree(tmp_dir_name) catch {}; |
| 55 | 52 | |
| 56 | try genHtml(allocator, &tokenizer, &toc, &buffered_out_stream.stream, zig_exe); | |
| 53 | try genHtml(allocator, &tokenizer, &toc, buffered_out_stream.outStream(), zig_exe); | |
| 57 | 54 | try buffered_out_stream.flush(); |
| 58 | 55 | } |
| 59 | 56 | |
| ... | ... | @@ -327,8 +324,7 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc { |
| 327 | 324 | var toc_buf = try std.Buffer.initSize(allocator, 0); |
| 328 | 325 | defer toc_buf.deinit(); |
| 329 | 326 | |
| 330 | var toc_buf_adapter = io.BufferOutStream.init(&toc_buf); | |
| 331 | var toc = &toc_buf_adapter.stream; | |
| 327 | var toc = toc_buf.outStream(); | |
| 332 | 328 | |
| 333 | 329 | var nodes = std.ArrayList(Node).init(allocator); |
| 334 | 330 | defer nodes.deinit(); |
| ... | ... | @@ -342,7 +338,7 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc { |
| 342 | 338 | if (header_stack_size != 0) { |
| 343 | 339 | return parseError(tokenizer, token, "unbalanced headers", .{}); |
| 344 | 340 | } |
| 345 | try toc.write(" </ul>\n"); | |
| 341 | try toc.writeAll(" </ul>\n"); | |
| 346 | 342 | break; |
| 347 | 343 | }, |
| 348 | 344 | Token.Id.Content => { |
| ... | ... | @@ -407,7 +403,7 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc { |
| 407 | 403 | if (last_columns) |n| { |
| 408 | 404 | try toc.print("<ul style=\"columns: {}\">\n", .{n}); |
| 409 | 405 | } else { |
| 410 | try toc.write("<ul>\n"); | |
| 406 | try toc.writeAll("<ul>\n"); | |
| 411 | 407 | } |
| 412 | 408 | } else { |
| 413 | 409 | last_action = Action.Open; |
| ... | ... | @@ -424,9 +420,9 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc { |
| 424 | 420 | |
| 425 | 421 | if (last_action == Action.Close) { |
| 426 | 422 | try toc.writeByteNTimes(' ', 8 + header_stack_size * 4); |
| 427 | try toc.write("</ul></li>\n"); | |
| 423 | try toc.writeAll("</ul></li>\n"); | |
| 428 | 424 | } else { |
| 429 | try toc.write("</li>\n"); | |
| 425 | try toc.writeAll("</li>\n"); | |
| 430 | 426 | last_action = Action.Close; |
| 431 | 427 | } |
| 432 | 428 | } else if (mem.eql(u8, tag_name, "see_also")) { |
| ... | ... | @@ -614,8 +610,7 @@ fn urlize(allocator: *mem.Allocator, input: []const u8) ![]u8 { |
| 614 | 610 | var buf = try std.Buffer.initSize(allocator, 0); |
| 615 | 611 | defer buf.deinit(); |
| 616 | 612 | |
| 617 | var buf_adapter = io.BufferOutStream.init(&buf); | |
| 618 | var out = &buf_adapter.stream; | |
| 613 | const out = buf.outStream(); | |
| 619 | 614 | for (input) |c| { |
| 620 | 615 | switch (c) { |
| 621 | 616 | 'a'...'z', 'A'...'Z', '_', '-', '0'...'9' => { |
| ... | ... | @@ -634,8 +629,7 @@ fn escapeHtml(allocator: *mem.Allocator, input: []const u8) ![]u8 { |
| 634 | 629 | var buf = try std.Buffer.initSize(allocator, 0); |
| 635 | 630 | defer buf.deinit(); |
| 636 | 631 | |
| 637 | var buf_adapter = io.BufferOutStream.init(&buf); | |
| 638 | var out = &buf_adapter.stream; | |
| 632 | const out = buf.outStream(); | |
| 639 | 633 | try writeEscaped(out, input); |
| 640 | 634 | return buf.toOwnedSlice(); |
| 641 | 635 | } |
| ... | ... | @@ -643,10 +637,10 @@ fn escapeHtml(allocator: *mem.Allocator, input: []const u8) ![]u8 { |
| 643 | 637 | fn writeEscaped(out: var, input: []const u8) !void { |
| 644 | 638 | for (input) |c| { |
| 645 | 639 | try switch (c) { |
| 646 | '&' => out.write("&amp;"), | |
| 647 | '<' => out.write("&lt;"), | |
| 648 | '>' => out.write("&gt;"), | |
| 649 | '"' => out.write("&quot;"), | |
| 640 | '&' => out.writeAll("&amp;"), | |
| 641 | '<' => out.writeAll("&lt;"), | |
| 642 | '>' => out.writeAll("&gt;"), | |
| 643 | '"' => out.writeAll("&quot;"), | |
| 650 | 644 | else => out.writeByte(c), |
| 651 | 645 | }; |
| 652 | 646 | } |
| ... | ... | @@ -681,8 +675,7 @@ fn termColor(allocator: *mem.Allocator, input: []const u8) ![]u8 { |
| 681 | 675 | var buf = try std.Buffer.initSize(allocator, 0); |
| 682 | 676 | defer buf.deinit(); |
| 683 | 677 | |
| 684 | var buf_adapter = io.BufferOutStream.init(&buf); | |
| 685 | var out = &buf_adapter.stream; | |
| 678 | var out = buf.outStream(); | |
| 686 | 679 | var number_start_index: usize = undefined; |
| 687 | 680 | var first_number: usize = undefined; |
| 688 | 681 | var second_number: usize = undefined; |
| ... | ... | @@ -743,7 +736,7 @@ fn termColor(allocator: *mem.Allocator, input: []const u8) ![]u8 { |
| 743 | 736 | 'm' => { |
| 744 | 737 | state = TermState.Start; |
| 745 | 738 | while (open_span_count != 0) : (open_span_count -= 1) { |
| 746 | try out.write("</span>"); | |
| 739 | try out.writeAll("</span>"); | |
| 747 | 740 | } |
| 748 | 741 | if (first_number != 0 or second_number != 0) { |
| 749 | 742 | try out.print("<span class=\"t{}_{}\">", .{ first_number, second_number }); |
| ... | ... | @@ -774,7 +767,7 @@ fn isType(name: []const u8) bool { |
| 774 | 767 | |
| 775 | 768 | fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Token, raw_src: []const u8) !void { |
| 776 | 769 | const src = mem.trim(u8, raw_src, " \n"); |
| 777 | try out.write("<code class=\"zig\">"); | |
| 770 | try out.writeAll("<code class=\"zig\">"); | |
| 778 | 771 | var tokenizer = std.zig.Tokenizer.init(src); |
| 779 | 772 | var index: usize = 0; |
| 780 | 773 | var next_tok_is_fn = false; |
| ... | ... | @@ -835,15 +828,15 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Tok |
| 835 | 828 | .Keyword_allowzero, |
| 836 | 829 | .Keyword_while, |
| 837 | 830 | => { |
| 838 | try out.write("<span class=\"tok-kw\">"); | |
| 831 | try out.writeAll("<span class=\"tok-kw\">"); | |
| 839 | 832 | try writeEscaped(out, src[token.start..token.end]); |
| 840 | try out.write("</span>"); | |
| 833 | try out.writeAll("</span>"); | |
| 841 | 834 | }, |
| 842 | 835 | |
| 843 | 836 | .Keyword_fn => { |
| 844 | try out.write("<span class=\"tok-kw\">"); | |
| 837 | try out.writeAll("<span class=\"tok-kw\">"); | |
| 845 | 838 | try writeEscaped(out, src[token.start..token.end]); |
| 846 | try out.write("</span>"); | |
| 839 | try out.writeAll("</span>"); | |
| 847 | 840 | next_tok_is_fn = true; |
| 848 | 841 | }, |
| 849 | 842 | |
| ... | ... | @@ -852,24 +845,24 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Tok |
| 852 | 845 | .Keyword_true, |
| 853 | 846 | .Keyword_false, |
| 854 | 847 | => { |
| 855 | try out.write("<span class=\"tok-null\">"); | |
| 848 | try out.writeAll("<span class=\"tok-null\">"); | |
| 856 | 849 | try writeEscaped(out, src[token.start..token.end]); |
| 857 | try out.write("</span>"); | |
| 850 | try out.writeAll("</span>"); | |
| 858 | 851 | }, |
| 859 | 852 | |
| 860 | 853 | .StringLiteral, |
| 861 | 854 | .MultilineStringLiteralLine, |
| 862 | 855 | .CharLiteral, |
| 863 | 856 | => { |
| 864 | try out.write("<span class=\"tok-str\">"); | |
| 857 | try out.writeAll("<span class=\"tok-str\">"); | |
| 865 | 858 | try writeEscaped(out, src[token.start..token.end]); |
| 866 | try out.write("</span>"); | |
| 859 | try out.writeAll("</span>"); | |
| 867 | 860 | }, |
| 868 | 861 | |
| 869 | 862 | .Builtin => { |
| 870 | try out.write("<span class=\"tok-builtin\">"); | |
| 863 | try out.writeAll("<span class=\"tok-builtin\">"); | |
| 871 | 864 | try writeEscaped(out, src[token.start..token.end]); |
| 872 | try out.write("</span>"); | |
| 865 | try out.writeAll("</span>"); | |
| 873 | 866 | }, |
| 874 | 867 | |
| 875 | 868 | .LineComment, |
| ... | ... | @@ -877,16 +870,16 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Tok |
| 877 | 870 | .ContainerDocComment, |
| 878 | 871 | .ShebangLine, |
| 879 | 872 | => { |
| 880 | try out.write("<span class=\"tok-comment\">"); | |
| 873 | try out.writeAll("<span class=\"tok-comment\">"); | |
| 881 | 874 | try writeEscaped(out, src[token.start..token.end]); |
| 882 | try out.write("</span>"); | |
| 875 | try out.writeAll("</span>"); | |
| 883 | 876 | }, |
| 884 | 877 | |
| 885 | 878 | .Identifier => { |
| 886 | 879 | if (prev_tok_was_fn) { |
| 887 | try out.write("<span class=\"tok-fn\">"); | |
| 880 | try out.writeAll("<span class=\"tok-fn\">"); | |
| 888 | 881 | try writeEscaped(out, src[token.start..token.end]); |
| 889 | try out.write("</span>"); | |
| 882 | try out.writeAll("</span>"); | |
| 890 | 883 | } else { |
| 891 | 884 | const is_int = blk: { |
| 892 | 885 | if (src[token.start] != 'i' and src[token.start] != 'u') |
| ... | ... | @@ -901,9 +894,9 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Tok |
| 901 | 894 | break :blk true; |
| 902 | 895 | }; |
| 903 | 896 | if (is_int or isType(src[token.start..token.end])) { |
| 904 | try out.write("<span class=\"tok-type\">"); | |
| 897 | try out.writeAll("<span class=\"tok-type\">"); | |
| 905 | 898 | try writeEscaped(out, src[token.start..token.end]); |
| 906 | try out.write("</span>"); | |
| 899 | try out.writeAll("</span>"); | |
| 907 | 900 | } else { |
| 908 | 901 | try writeEscaped(out, src[token.start..token.end]); |
| 909 | 902 | } |
| ... | ... | @@ -913,9 +906,9 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Tok |
| 913 | 906 | .IntegerLiteral, |
| 914 | 907 | .FloatLiteral, |
| 915 | 908 | => { |
| 916 | try out.write("<span class=\"tok-number\">"); | |
| 909 | try out.writeAll("<span class=\"tok-number\">"); | |
| 917 | 910 | try writeEscaped(out, src[token.start..token.end]); |
| 918 | try out.write("</span>"); | |
| 911 | try out.writeAll("</span>"); | |
| 919 | 912 | }, |
| 920 | 913 | |
| 921 | 914 | .Bang, |
| ... | ... | @@ -983,7 +976,7 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Tok |
| 983 | 976 | } |
| 984 | 977 | index = token.end; |
| 985 | 978 | } |
| 986 | try out.write("</code>"); | |
| 979 | try out.writeAll("</code>"); | |
| 987 | 980 | } |
| 988 | 981 | |
| 989 | 982 | fn tokenizeAndPrint(docgen_tokenizer: *Tokenizer, out: var, source_token: Token) !void { |
| ... | ... | @@ -1002,7 +995,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var |
| 1002 | 995 | for (toc.nodes) |node| { |
| 1003 | 996 | switch (node) { |
| 1004 | 997 | .Content => |data| { |
| 1005 | try out.write(data); | |
| 998 | try out.writeAll(data); | |
| 1006 | 999 | }, |
| 1007 | 1000 | .Link => |info| { |
| 1008 | 1001 | if (!toc.urls.contains(info.url)) { |
| ... | ... | @@ -1011,12 +1004,12 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var |
| 1011 | 1004 | try out.print("<a href=\"#{}\">{}</a>", .{ info.url, info.name }); |
| 1012 | 1005 | }, |
| 1013 | 1006 | .Nav => { |
| 1014 | try out.write(toc.toc); | |
| 1007 | try out.writeAll(toc.toc); | |
| 1015 | 1008 | }, |
| 1016 | 1009 | .Builtin => |tok| { |
| 1017 | try out.write("<pre>"); | |
| 1010 | try out.writeAll("<pre>"); | |
| 1018 | 1011 | try tokenizeAndPrintRaw(tokenizer, out, tok, builtin_code); |
| 1019 | try out.write("</pre>"); | |
| 1012 | try out.writeAll("</pre>"); | |
| 1020 | 1013 | }, |
| 1021 | 1014 | .HeaderOpen => |info| { |
| 1022 | 1015 | try out.print( |
| ... | ... | @@ -1025,7 +1018,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var |
| 1025 | 1018 | ); |
| 1026 | 1019 | }, |
| 1027 | 1020 | .SeeAlso => |items| { |
| 1028 | try out.write("<p>See also:</p><ul>\n"); | |
| 1021 | try out.writeAll("<p>See also:</p><ul>\n"); | |
| 1029 | 1022 | for (items) |item| { |
| 1030 | 1023 | const url = try urlize(allocator, item.name); |
| 1031 | 1024 | if (!toc.urls.contains(url)) { |
| ... | ... | @@ -1033,7 +1026,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var |
| 1033 | 1026 | } |
| 1034 | 1027 | try out.print("<li><a href=\"#{}\">{}</a></li>\n", .{ url, item.name }); |
| 1035 | 1028 | } |
| 1036 | try out.write("</ul>\n"); | |
| 1029 | try out.writeAll("</ul>\n"); | |
| 1037 | 1030 | }, |
| 1038 | 1031 | .Syntax => |content_tok| { |
| 1039 | 1032 | try tokenizeAndPrint(tokenizer, out, content_tok); |
| ... | ... | @@ -1047,9 +1040,9 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var |
| 1047 | 1040 | if (!code.is_inline) { |
| 1048 | 1041 | try out.print("<p class=\"file\">{}.zig</p>", .{code.name}); |
| 1049 | 1042 | } |
| 1050 | try out.write("<pre>"); | |
| 1043 | try out.writeAll("<pre>"); | |
| 1051 | 1044 | try tokenizeAndPrint(tokenizer, out, code.source_token); |
| 1052 | try out.write("</pre>"); | |
| 1045 | try out.writeAll("</pre>"); | |
| 1053 | 1046 | const name_plus_ext = try std.fmt.allocPrint(allocator, "{}.zig", .{code.name}); |
| 1054 | 1047 | const tmp_source_file_name = try fs.path.join( |
| 1055 | 1048 | allocator, |
doc/langref.html.in+1-1| ... | ... | @@ -230,7 +230,7 @@ |
| 230 | 230 | const std = @import("std"); |
| 231 | 231 | |
| 232 | 232 | pub fn main() !void { |
| 233 | const stdout = &std.io.getStdOut().outStream().stream; | |
| 233 | const stdout = std.io.getStdOut().outStream(); | |
| 234 | 234 | try stdout.print("Hello, {}!\n", .{"world"}); |
| 235 | 235 | } |
| 236 | 236 | {#code_end#} |
lib/std/build.zig+1-2| ... | ... | @@ -926,8 +926,7 @@ pub const Builder = struct { |
| 926 | 926 | |
| 927 | 927 | try child.spawn(); |
| 928 | 928 | |
| 929 | var stdout_file_in_stream = child.stdout.?.inStream(); | |
| 930 | const stdout = try stdout_file_in_stream.stream.readAllAlloc(self.allocator, max_output_size); | |
| 929 | const stdout = try child.stdout.?.inStream().readAllAlloc(self.allocator, max_output_size); | |
| 931 | 930 | errdefer self.allocator.free(stdout); |
| 932 | 931 | |
| 933 | 932 | const term = try child.wait(); |
lib/std/build/run.zig+2-4| ... | ... | @@ -175,8 +175,7 @@ pub const RunStep = struct { |
| 175 | 175 | |
| 176 | 176 | switch (self.stdout_action) { |
| 177 | 177 | .expect_exact, .expect_matches => { |
| 178 | var stdout_file_in_stream = child.stdout.?.inStream(); | |
| 179 | stdout = stdout_file_in_stream.stream.readAllAlloc(self.builder.allocator, max_stdout_size) catch unreachable; | |
| 178 | stdout = child.stdout.?.inStream().readAllAlloc(self.builder.allocator, max_stdout_size) catch unreachable; | |
| 180 | 179 | }, |
| 181 | 180 | .inherit, .ignore => {}, |
| 182 | 181 | } |
| ... | ... | @@ -186,8 +185,7 @@ pub const RunStep = struct { |
| 186 | 185 | |
| 187 | 186 | switch (self.stderr_action) { |
| 188 | 187 | .expect_exact, .expect_matches => { |
| 189 | var stderr_file_in_stream = child.stderr.?.inStream(); | |
| 190 | stderr = stderr_file_in_stream.stream.readAllAlloc(self.builder.allocator, max_stdout_size) catch unreachable; | |
| 188 | stderr = child.stderr.?.inStream().readAllAlloc(self.builder.allocator, max_stdout_size) catch unreachable; | |
| 191 | 189 | }, |
| 192 | 190 | .inherit, .ignore => {}, |
| 193 | 191 | } |
lib/std/coff.zig+6-9| ... | ... | @@ -56,8 +56,7 @@ pub const Coff = struct { |
| 56 | 56 | pub fn loadHeader(self: *Coff) !void { |
| 57 | 57 | const pe_pointer_offset = 0x3C; |
| 58 | 58 | |
| 59 | var file_stream = self.in_file.inStream(); | |
| 60 | const in = &file_stream.stream; | |
| 59 | const in = self.in_file.inStream(); | |
| 61 | 60 | |
| 62 | 61 | var magic: [2]u8 = undefined; |
| 63 | 62 | try in.readNoEof(magic[0..]); |
| ... | ... | @@ -89,11 +88,11 @@ pub const Coff = struct { |
| 89 | 88 | else => return error.InvalidMachine, |
| 90 | 89 | } |
| 91 | 90 | |
| 92 | try self.loadOptionalHeader(&file_stream); | |
| 91 | try self.loadOptionalHeader(); | |
| 93 | 92 | } |
| 94 | 93 | |
| 95 | fn loadOptionalHeader(self: *Coff, file_stream: *File.InStream) !void { | |
| 96 | const in = &file_stream.stream; | |
| 94 | fn loadOptionalHeader(self: *Coff) !void { | |
| 95 | const in = self.in_file.inStream(); | |
| 97 | 96 | self.pe_header.magic = try in.readIntLittle(u16); |
| 98 | 97 | // For now we're only interested in finding the reference to the .pdb, |
| 99 | 98 | // so we'll skip most of this header, which size is different in 32 |
| ... | ... | @@ -136,8 +135,7 @@ pub const Coff = struct { |
| 136 | 135 | const debug_dir = &self.pe_header.data_directory[DEBUG_DIRECTORY]; |
| 137 | 136 | const file_offset = debug_dir.virtual_address - header.virtual_address + header.pointer_to_raw_data; |
| 138 | 137 | |
| 139 | var file_stream = self.in_file.inStream(); | |
| 140 | const in = &file_stream.stream; | |
| 138 | const in = self.in_file.inStream(); | |
| 141 | 139 | try self.in_file.seekTo(file_offset); |
| 142 | 140 | |
| 143 | 141 | // Find the correct DebugDirectoryEntry, and where its data is stored. |
| ... | ... | @@ -188,8 +186,7 @@ pub const Coff = struct { |
| 188 | 186 | |
| 189 | 187 | try self.sections.ensureCapacity(self.coff_header.number_of_sections); |
| 190 | 188 | |
| 191 | var file_stream = self.in_file.inStream(); | |
| 192 | const in = &file_stream.stream; | |
| 189 | const in = self.in_file.inStream(); | |
| 193 | 190 | |
| 194 | 191 | var name: [8]u8 = undefined; |
| 195 | 192 |
lib/std/debug.zig+19-19| ... | ... | @@ -475,15 +475,15 @@ fn populateModule(di: *ModuleDebugInfo, mod: *Module) !void { |
| 475 | 475 | |
| 476 | 476 | const modi = di.pdb.getStreamById(mod.mod_info.ModuleSymStream) orelse return error.MissingDebugInfo; |
| 477 | 477 | |
| 478 | const signature = try modi.stream.readIntLittle(u32); | |
| 478 | const signature = try modi.inStream().readIntLittle(u32); | |
| 479 | 479 | if (signature != 4) |
| 480 | 480 | return error.InvalidDebugInfo; |
| 481 | 481 | |
| 482 | 482 | mod.symbols = try allocator.alloc(u8, mod.mod_info.SymByteSize - 4); |
| 483 | try modi.stream.readNoEof(mod.symbols); | |
| 483 | try modi.inStream().readNoEof(mod.symbols); | |
| 484 | 484 | |
| 485 | 485 | mod.subsect_info = try allocator.alloc(u8, mod.mod_info.C13ByteSize); |
| 486 | try modi.stream.readNoEof(mod.subsect_info); | |
| 486 | try modi.inStream().readNoEof(mod.subsect_info); | |
| 487 | 487 | |
| 488 | 488 | var sect_offset: usize = 0; |
| 489 | 489 | var skip_len: usize = undefined; |
| ... | ... | @@ -656,11 +656,11 @@ fn openCoffDebugInfo(allocator: *mem.Allocator, coff_file_path: [:0]const u16) ! |
| 656 | 656 | try di.pdb.openFile(di.coff, path); |
| 657 | 657 | |
| 658 | 658 | var pdb_stream = di.pdb.getStream(pdb.StreamType.Pdb) orelse return error.InvalidDebugInfo; |
| 659 | const version = try pdb_stream.stream.readIntLittle(u32); | |
| 660 | const signature = try pdb_stream.stream.readIntLittle(u32); | |
| 661 | const age = try pdb_stream.stream.readIntLittle(u32); | |
| 659 | const version = try pdb_stream.inStream().readIntLittle(u32); | |
| 660 | const signature = try pdb_stream.inStream().readIntLittle(u32); | |
| 661 | const age = try pdb_stream.inStream().readIntLittle(u32); | |
| 662 | 662 | var guid: [16]u8 = undefined; |
| 663 | try pdb_stream.stream.readNoEof(&guid); | |
| 663 | try pdb_stream.inStream().readNoEof(&guid); | |
| 664 | 664 | if (version != 20000404) // VC70, only value observed by LLVM team |
| 665 | 665 | return error.UnknownPDBVersion; |
| 666 | 666 | if (!mem.eql(u8, &di.coff.guid, &guid) or di.coff.age != age) |
| ... | ... | @@ -668,9 +668,9 @@ fn openCoffDebugInfo(allocator: *mem.Allocator, coff_file_path: [:0]const u16) ! |
| 668 | 668 | // We validated the executable and pdb match. |
| 669 | 669 | |
| 670 | 670 | const string_table_index = str_tab_index: { |
| 671 | const name_bytes_len = try pdb_stream.stream.readIntLittle(u32); | |
| 671 | const name_bytes_len = try pdb_stream.inStream().readIntLittle(u32); | |
| 672 | 672 | const name_bytes = try allocator.alloc(u8, name_bytes_len); |
| 673 | try pdb_stream.stream.readNoEof(name_bytes); | |
| 673 | try pdb_stream.inStream().readNoEof(name_bytes); | |
| 674 | 674 | |
| 675 | 675 | const HashTableHeader = packed struct { |
| 676 | 676 | Size: u32, |
| ... | ... | @@ -680,17 +680,17 @@ fn openCoffDebugInfo(allocator: *mem.Allocator, coff_file_path: [:0]const u16) ! |
| 680 | 680 | return cap * 2 / 3 + 1; |
| 681 | 681 | } |
| 682 | 682 | }; |
| 683 | const hash_tbl_hdr = try pdb_stream.stream.readStruct(HashTableHeader); | |
| 683 | const hash_tbl_hdr = try pdb_stream.inStream().readStruct(HashTableHeader); | |
| 684 | 684 | if (hash_tbl_hdr.Capacity == 0) |
| 685 | 685 | return error.InvalidDebugInfo; |
| 686 | 686 | |
| 687 | 687 | if (hash_tbl_hdr.Size > HashTableHeader.maxLoad(hash_tbl_hdr.Capacity)) |
| 688 | 688 | return error.InvalidDebugInfo; |
| 689 | 689 | |
| 690 | const present = try readSparseBitVector(&pdb_stream.stream, allocator); | |
| 690 | const present = try readSparseBitVector(&pdb_stream.inStream(), allocator); | |
| 691 | 691 | if (present.len != hash_tbl_hdr.Size) |
| 692 | 692 | return error.InvalidDebugInfo; |
| 693 | const deleted = try readSparseBitVector(&pdb_stream.stream, allocator); | |
| 693 | const deleted = try readSparseBitVector(&pdb_stream.inStream(), allocator); | |
| 694 | 694 | |
| 695 | 695 | const Bucket = struct { |
| 696 | 696 | first: u32, |
| ... | ... | @@ -698,8 +698,8 @@ fn openCoffDebugInfo(allocator: *mem.Allocator, coff_file_path: [:0]const u16) ! |
| 698 | 698 | }; |
| 699 | 699 | const bucket_list = try allocator.alloc(Bucket, present.len); |
| 700 | 700 | for (present) |_| { |
| 701 | const name_offset = try pdb_stream.stream.readIntLittle(u32); | |
| 702 | const name_index = try pdb_stream.stream.readIntLittle(u32); | |
| 701 | const name_offset = try pdb_stream.inStream().readIntLittle(u32); | |
| 702 | const name_index = try pdb_stream.inStream().readIntLittle(u32); | |
| 703 | 703 | const name = mem.toSlice(u8, @ptrCast([*:0]u8, name_bytes.ptr + name_offset)); |
| 704 | 704 | if (mem.eql(u8, name, "/names")) { |
| 705 | 705 | break :str_tab_index name_index; |
| ... | ... | @@ -714,7 +714,7 @@ fn openCoffDebugInfo(allocator: *mem.Allocator, coff_file_path: [:0]const u16) ! |
| 714 | 714 | const dbi = di.pdb.dbi; |
| 715 | 715 | |
| 716 | 716 | // Dbi Header |
| 717 | const dbi_stream_header = try dbi.stream.readStruct(pdb.DbiStreamHeader); | |
| 717 | const dbi_stream_header = try dbi.inStream().readStruct(pdb.DbiStreamHeader); | |
| 718 | 718 | if (dbi_stream_header.VersionHeader != 19990903) // V70, only value observed by LLVM team |
| 719 | 719 | return error.UnknownPDBVersion; |
| 720 | 720 | if (dbi_stream_header.Age != age) |
| ... | ... | @@ -728,7 +728,7 @@ fn openCoffDebugInfo(allocator: *mem.Allocator, coff_file_path: [:0]const u16) ! |
| 728 | 728 | // Module Info Substream |
| 729 | 729 | var mod_info_offset: usize = 0; |
| 730 | 730 | while (mod_info_offset != mod_info_size) { |
| 731 | const mod_info = try dbi.stream.readStruct(pdb.ModInfo); | |
| 731 | const mod_info = try dbi.inStream().readStruct(pdb.ModInfo); | |
| 732 | 732 | var this_record_len: usize = @sizeOf(pdb.ModInfo); |
| 733 | 733 | |
| 734 | 734 | const module_name = try dbi.readNullTermString(allocator); |
| ... | ... | @@ -766,14 +766,14 @@ fn openCoffDebugInfo(allocator: *mem.Allocator, coff_file_path: [:0]const u16) ! |
| 766 | 766 | var sect_contribs = ArrayList(pdb.SectionContribEntry).init(allocator); |
| 767 | 767 | var sect_cont_offset: usize = 0; |
| 768 | 768 | if (section_contrib_size != 0) { |
| 769 | const ver = @intToEnum(pdb.SectionContrSubstreamVersion, try dbi.stream.readIntLittle(u32)); | |
| 769 | const ver = @intToEnum(pdb.SectionContrSubstreamVersion, try dbi.inStream().readIntLittle(u32)); | |
| 770 | 770 | if (ver != pdb.SectionContrSubstreamVersion.Ver60) |
| 771 | 771 | return error.InvalidDebugInfo; |
| 772 | 772 | sect_cont_offset += @sizeOf(u32); |
| 773 | 773 | } |
| 774 | 774 | while (sect_cont_offset != section_contrib_size) { |
| 775 | 775 | const entry = try sect_contribs.addOne(); |
| 776 | entry.* = try dbi.stream.readStruct(pdb.SectionContribEntry); | |
| 776 | entry.* = try dbi.inStream().readStruct(pdb.SectionContribEntry); | |
| 777 | 777 | sect_cont_offset += @sizeOf(pdb.SectionContribEntry); |
| 778 | 778 | |
| 779 | 779 | if (sect_cont_offset > section_contrib_size) |
| ... | ... | @@ -827,7 +827,7 @@ pub fn openElfDebugInfo(allocator: *mem.Allocator, elf_file_path: []const u8) !M |
| 827 | 827 | const str_section_off = shoff + @as(u64, hdr.e_shentsize) * @as(u64, hdr.e_shstrndx); |
| 828 | 828 | const str_shdr = @ptrCast( |
| 829 | 829 | *const elf.Shdr, |
| 830 | @alignCast(@alignOf(elf.Shdr), &mapped_mem[str_section_off]), | |
| 830 | @alignCast(@alignOf(elf.Shdr), &mapped_mem[try math.cast(usize, str_section_off)]), | |
| 831 | 831 | ); |
| 832 | 832 | const header_strings = mapped_mem[str_shdr.sh_offset .. str_shdr.sh_offset + str_shdr.sh_size]; |
| 833 | 833 | const shdrs = @ptrCast( |
lib/std/pdb.zig+6-8| ... | ... | @@ -495,8 +495,7 @@ const Msf = struct { |
| 495 | 495 | streams: []MsfStream, |
| 496 | 496 | |
| 497 | 497 | fn openFile(self: *Msf, allocator: *mem.Allocator, file: File) !void { |
| 498 | var file_stream = file.inStream(); | |
| 499 | const in = &file_stream.stream; | |
| 498 | const in = file.inStream(); | |
| 500 | 499 | |
| 501 | 500 | const superblock = try in.readStruct(SuperBlock); |
| 502 | 501 | |
| ... | ... | @@ -529,7 +528,7 @@ const Msf = struct { |
| 529 | 528 | ); |
| 530 | 529 | |
| 531 | 530 | const begin = self.directory.pos; |
| 532 | const stream_count = try self.directory.stream.readIntLittle(u32); | |
| 531 | const stream_count = try self.directory.inStream().readIntLittle(u32); | |
| 533 | 532 | const stream_sizes = try allocator.alloc(u32, stream_count); |
| 534 | 533 | defer allocator.free(stream_sizes); |
| 535 | 534 | |
| ... | ... | @@ -538,7 +537,7 @@ const Msf = struct { |
| 538 | 537 | // and must be taken into account when resolving stream indices. |
| 539 | 538 | const Nil = 0xFFFFFFFF; |
| 540 | 539 | for (stream_sizes) |*s, i| { |
| 541 | const size = try self.directory.stream.readIntLittle(u32); | |
| 540 | const size = try self.directory.inStream().readIntLittle(u32); | |
| 542 | 541 | s.* = if (size == Nil) 0 else blockCountFromSize(size, superblock.BlockSize); |
| 543 | 542 | } |
| 544 | 543 | |
| ... | ... | @@ -553,7 +552,7 @@ const Msf = struct { |
| 553 | 552 | var blocks = try allocator.alloc(u32, size); |
| 554 | 553 | var j: u32 = 0; |
| 555 | 554 | while (j < size) : (j += 1) { |
| 556 | const block_id = try self.directory.stream.readIntLittle(u32); | |
| 555 | const block_id = try self.directory.inStream().readIntLittle(u32); | |
| 557 | 556 | const n = (block_id % superblock.BlockSize); |
| 558 | 557 | // 0 is for SuperBlock, 1 and 2 for FPMs. |
| 559 | 558 | if (block_id == 0 or n == 1 or n == 2 or block_id * superblock.BlockSize > try file.getEndPos()) |
| ... | ... | @@ -648,7 +647,7 @@ const MsfStream = struct { |
| 648 | 647 | fn readNullTermString(self: *MsfStream, allocator: *mem.Allocator) ![]u8 { |
| 649 | 648 | var list = ArrayList(u8).init(allocator); |
| 650 | 649 | while (true) { |
| 651 | const byte = try self.stream.readByte(); | |
| 650 | const byte = try self.inStream().readByte(); | |
| 652 | 651 | if (byte == 0) { |
| 653 | 652 | return list.toSlice(); |
| 654 | 653 | } |
| ... | ... | @@ -662,8 +661,7 @@ const MsfStream = struct { |
| 662 | 661 | var offset = self.pos % self.block_size; |
| 663 | 662 | |
| 664 | 663 | try self.in_file.seekTo(block * self.block_size + offset); |
| 665 | var file_stream = self.in_file.inStream(); | |
| 666 | const in = &file_stream.stream; | |
| 664 | const in = self.in_file.inStream(); | |
| 667 | 665 | |
| 668 | 666 | var size: usize = 0; |
| 669 | 667 | var rem_buffer = buffer; |
lib/std/special/build_runner.zig+4-4| ... | ... | @@ -42,8 +42,8 @@ pub fn main() !void { |
| 42 | 42 | |
| 43 | 43 | var targets = ArrayList([]const u8).init(allocator); |
| 44 | 44 | |
| 45 | const stderr_stream = &io.getStdErr().outStream().stream; | |
| 46 | const stdout_stream = &io.getStdOut().outStream().stream; | |
| 45 | const stderr_stream = io.getStdErr().outStream(); | |
| 46 | const stdout_stream = io.getStdOut().outStream(); | |
| 47 | 47 | |
| 48 | 48 | while (nextArg(args, &arg_idx)) |arg| { |
| 49 | 49 | if (mem.startsWith(u8, arg, "-D")) { |
| ... | ... | @@ -159,7 +159,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: var) !void { |
| 159 | 159 | try out_stream.print(" {s:22} {}\n", .{ name, top_level_step.description }); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | try out_stream.write( | |
| 162 | try out_stream.writeAll( | |
| 163 | 163 | \\ |
| 164 | 164 | \\General Options: |
| 165 | 165 | \\ --help Print this help and exit |
| ... | ... | @@ -184,7 +184,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: var) !void { |
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | try out_stream.write( | |
| 187 | try out_stream.writeAll( | |
| 188 | 188 | \\ |
| 189 | 189 | \\Advanced Options: |
| 190 | 190 | \\ --build-file [file] Override path to build.zig |
test/compare_output.zig+15-19| ... | ... | @@ -22,7 +22,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 22 | 22 | \\ |
| 23 | 23 | \\pub fn main() void { |
| 24 | 24 | \\ privateFunction(); |
| 25 | \\ const stdout = &getStdOut().outStream().stream; | |
| 25 | \\ const stdout = getStdOut().outStream(); | |
| 26 | 26 | \\ stdout.print("OK 2\n", .{}) catch unreachable; |
| 27 | 27 | \\} |
| 28 | 28 | \\ |
| ... | ... | @@ -37,7 +37,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 37 | 37 | \\// purposefully conflicting function with main.zig |
| 38 | 38 | \\// but it's private so it should be OK |
| 39 | 39 | \\fn privateFunction() void { |
| 40 | \\ const stdout = &getStdOut().outStream().stream; | |
| 40 | \\ const stdout = getStdOut().outStream(); | |
| 41 | 41 | \\ stdout.print("OK 1\n", .{}) catch unreachable; |
| 42 | 42 | \\} |
| 43 | 43 | \\ |
| ... | ... | @@ -63,7 +63,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 63 | 63 | tc.addSourceFile("foo.zig", |
| 64 | 64 | \\usingnamespace @import("std").io; |
| 65 | 65 | \\pub fn foo_function() void { |
| 66 | \\ const stdout = &getStdOut().outStream().stream; | |
| 66 | \\ const stdout = getStdOut().outStream(); | |
| 67 | 67 | \\ stdout.print("OK\n", .{}) catch unreachable; |
| 68 | 68 | \\} |
| 69 | 69 | ); |
| ... | ... | @@ -74,7 +74,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 74 | 74 | \\ |
| 75 | 75 | \\pub fn bar_function() void { |
| 76 | 76 | \\ if (foo_function()) { |
| 77 | \\ const stdout = &getStdOut().outStream().stream; | |
| 77 | \\ const stdout = getStdOut().outStream(); | |
| 78 | 78 | \\ stdout.print("OK\n", .{}) catch unreachable; |
| 79 | 79 | \\ } |
| 80 | 80 | \\} |
| ... | ... | @@ -106,7 +106,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 106 | 106 | \\pub const a_text = "OK\n"; |
| 107 | 107 | \\ |
| 108 | 108 | \\pub fn ok() void { |
| 109 | \\ const stdout = &io.getStdOut().outStream().stream; | |
| 109 | \\ const stdout = io.getStdOut().outStream(); | |
| 110 | 110 | \\ stdout.print(b_text, .{}) catch unreachable; |
| 111 | 111 | \\} |
| 112 | 112 | ); |
| ... | ... | @@ -124,7 +124,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 124 | 124 | \\const io = @import("std").io; |
| 125 | 125 | \\ |
| 126 | 126 | \\pub fn main() void { |
| 127 | \\ const stdout = &io.getStdOut().outStream().stream; | |
| 127 | \\ const stdout = io.getStdOut().outStream(); | |
| 128 | 128 | \\ stdout.print("Hello, world!\n{d:4} {x:3} {c}\n", .{@as(u32, 12), @as(u16, 0x12), @as(u8, 'a')}) catch unreachable; |
| 129 | 129 | \\} |
| 130 | 130 | , "Hello, world!\n 12 12 a\n"); |
| ... | ... | @@ -267,7 +267,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 267 | 267 | \\ var x_local : i32 = print_ok(x); |
| 268 | 268 | \\} |
| 269 | 269 | \\fn print_ok(val: @TypeOf(x)) @TypeOf(foo) { |
| 270 | \\ const stdout = &io.getStdOut().outStream().stream; | |
| 270 | \\ const stdout = io.getStdOut().outStream(); | |
| 271 | 271 | \\ stdout.print("OK\n", .{}) catch unreachable; |
| 272 | 272 | \\ return 0; |
| 273 | 273 | \\} |
| ... | ... | @@ -349,7 +349,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 349 | 349 | \\pub fn main() void { |
| 350 | 350 | \\ const bar = Bar {.field2 = 13,}; |
| 351 | 351 | \\ const foo = Foo {.field1 = bar,}; |
| 352 | \\ const stdout = &io.getStdOut().outStream().stream; | |
| 352 | \\ const stdout = io.getStdOut().outStream(); | |
| 353 | 353 | \\ if (!foo.method()) { |
| 354 | 354 | \\ stdout.print("BAD\n", .{}) catch unreachable; |
| 355 | 355 | \\ } |
| ... | ... | @@ -363,7 +363,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 363 | 363 | cases.add("defer with only fallthrough", |
| 364 | 364 | \\const io = @import("std").io; |
| 365 | 365 | \\pub fn main() void { |
| 366 | \\ const stdout = &io.getStdOut().outStream().stream; | |
| 366 | \\ const stdout = io.getStdOut().outStream(); | |
| 367 | 367 | \\ stdout.print("before\n", .{}) catch unreachable; |
| 368 | 368 | \\ defer stdout.print("defer1\n", .{}) catch unreachable; |
| 369 | 369 | \\ defer stdout.print("defer2\n", .{}) catch unreachable; |
| ... | ... | @@ -376,7 +376,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 376 | 376 | \\const io = @import("std").io; |
| 377 | 377 | \\const os = @import("std").os; |
| 378 | 378 | \\pub fn main() void { |
| 379 | \\ const stdout = &io.getStdOut().outStream().stream; | |
| 379 | \\ const stdout = io.getStdOut().outStream(); | |
| 380 | 380 | \\ stdout.print("before\n", .{}) catch unreachable; |
| 381 | 381 | \\ defer stdout.print("defer1\n", .{}) catch unreachable; |
| 382 | 382 | \\ defer stdout.print("defer2\n", .{}) catch unreachable; |
| ... | ... | @@ -393,7 +393,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 393 | 393 | \\ do_test() catch return; |
| 394 | 394 | \\} |
| 395 | 395 | \\fn do_test() !void { |
| 396 | \\ const stdout = &io.getStdOut().outStream().stream; | |
| 396 | \\ const stdout = io.getStdOut().outStream(); | |
| 397 | 397 | \\ stdout.print("before\n", .{}) catch unreachable; |
| 398 | 398 | \\ defer stdout.print("defer1\n", .{}) catch unreachable; |
| 399 | 399 | \\ errdefer stdout.print("deferErr\n", .{}) catch unreachable; |
| ... | ... | @@ -412,7 +412,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 412 | 412 | \\ do_test() catch return; |
| 413 | 413 | \\} |
| 414 | 414 | \\fn do_test() !void { |
| 415 | \\ const stdout = &io.getStdOut().outStream().stream; | |
| 415 | \\ const stdout = io.getStdOut().outStream(); | |
| 416 | 416 | \\ stdout.print("before\n", .{}) catch unreachable; |
| 417 | 417 | \\ defer stdout.print("defer1\n", .{}) catch unreachable; |
| 418 | 418 | \\ errdefer stdout.print("deferErr\n", .{}) catch unreachable; |
| ... | ... | @@ -429,7 +429,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 429 | 429 | \\const io = @import("std").io; |
| 430 | 430 | \\ |
| 431 | 431 | \\pub fn main() void { |
| 432 | \\ const stdout = &io.getStdOut().outStream().stream; | |
| 432 | \\ const stdout = io.getStdOut().outStream(); | |
| 433 | 433 | \\ stdout.print(foo_txt, .{}) catch unreachable; |
| 434 | 434 | \\} |
| 435 | 435 | , "1234\nabcd\n"); |
| ... | ... | @@ -448,9 +448,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 448 | 448 | \\ |
| 449 | 449 | \\pub fn main() !void { |
| 450 | 450 | \\ var args_it = std.process.args(); |
| 451 | \\ var stdout_file = io.getStdOut(); | |
| 452 | \\ var stdout_adapter = stdout_file.outStream(); | |
| 453 | \\ const stdout = &stdout_adapter.stream; | |
| 451 | \\ const stdout = io.getStdOut().outStream(); | |
| 454 | 452 | \\ var index: usize = 0; |
| 455 | 453 | \\ _ = args_it.skip(); |
| 456 | 454 | \\ while (args_it.next(allocator)) |arg_or_err| : (index += 1) { |
| ... | ... | @@ -489,9 +487,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 489 | 487 | \\ |
| 490 | 488 | \\pub fn main() !void { |
| 491 | 489 | \\ var args_it = std.process.args(); |
| 492 | \\ var stdout_file = io.getStdOut(); | |
| 493 | \\ var stdout_adapter = stdout_file.outStream(); | |
| 494 | \\ const stdout = &stdout_adapter.stream; | |
| 490 | \\ const stdout = io.getStdOut().outStream(); | |
| 495 | 491 | \\ var index: usize = 0; |
| 496 | 492 | \\ _ = args_it.skip(); |
| 497 | 493 | \\ while (args_it.next(allocator)) |arg_or_err| : (index += 1) { |
test/standalone/guess_number/main.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const io = std.io; |
| 4 | 4 | const fmt = std.fmt; |
| 5 | 5 | |
| 6 | 6 | pub fn main() !void { |
| 7 | const stdout = &io.getStdOut().outStream().stream; | |
| 7 | const stdout = io.getStdOut().outStream(); | |
| 8 | 8 | const stdin = io.getStdIn(); |
| 9 | 9 | |
| 10 | 10 | try stdout.print("Welcome to the Guess Number Game in Zig.\n", .{}); |
test/tests.zig+4-10| ... | ... | @@ -566,12 +566,9 @@ pub const StackTracesContext = struct { |
| 566 | 566 | } |
| 567 | 567 | child.spawn() catch |err| debug.panic("Unable to spawn {}: {}\n", .{ full_exe_path, @errorName(err) }); |
| 568 | 568 | |
| 569 | var stdout_file_in_stream = child.stdout.?.inStream(); | |
| 570 | var stderr_file_in_stream = child.stderr.?.inStream(); | |
| 571 | ||
| 572 | const stdout = stdout_file_in_stream.stream.readAllAlloc(b.allocator, max_stdout_size) catch unreachable; | |
| 569 | const stdout = child.stdout.?.inStream().readAllAlloc(b.allocator, max_stdout_size) catch unreachable; | |
| 573 | 570 | defer b.allocator.free(stdout); |
| 574 | const stderr = stderr_file_in_stream.stream.readAllAlloc(b.allocator, max_stdout_size) catch unreachable; | |
| 571 | const stderr = child.stderr.?.inStream().readAllAlloc(b.allocator, max_stdout_size) catch unreachable; | |
| 575 | 572 | defer b.allocator.free(stderr); |
| 576 | 573 | |
| 577 | 574 | const term = child.wait() catch |err| { |
| ... | ... | @@ -798,11 +795,8 @@ pub const CompileErrorContext = struct { |
| 798 | 795 | var stdout_buf = Buffer.initNull(b.allocator); |
| 799 | 796 | var stderr_buf = Buffer.initNull(b.allocator); |
| 800 | 797 | |
| 801 | var stdout_file_in_stream = child.stdout.?.inStream(); | |
| 802 | var stderr_file_in_stream = child.stderr.?.inStream(); | |
| 803 | ||
| 804 | stdout_file_in_stream.stream.readAllBuffer(&stdout_buf, max_stdout_size) catch unreachable; | |
| 805 | stderr_file_in_stream.stream.readAllBuffer(&stderr_buf, max_stdout_size) catch unreachable; | |
| 798 | child.stdout.?.inStream().readAllBuffer(&stdout_buf, max_stdout_size) catch unreachable; | |
| 799 | child.stderr.?.inStream().readAllBuffer(&stderr_buf, max_stdout_size) catch unreachable; | |
| 806 | 800 | |
| 807 | 801 | const term = child.wait() catch |err| { |
| 808 | 802 | debug.panic("Unable to spawn {}: {}\n", .{ zig_args.items[0], @errorName(err) }); |