| 1 | #exe { |
| 2 | -Mroot=main.zig |
| 3 | #} |
| 4 | |
| 5 | #write main.zig { |
| 6 | const S = extern struct { x: u8, y: u8 }; |
| 7 | pub fn main() !void { |
| 8 | const val: S = .{ .x = 100, .y = 200 }; |
| 9 | try foo(&val); |
| 10 | } |
| 11 | fn foo(val: *const S) !void { |
| 12 | var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); |
| 13 | try stdout_writer.interface.print( |
| 14 | "{d} {d}\n", |
| 15 | .{ val.x, val.y }, |
| 16 | ); |
| 17 | } |
| 18 | const std = @import("std"); |
| 19 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 20 | #} |
| 21 | #update |
| 22 | #check stdout { |
| 23 | 100 200 |
| 24 | #} |
| 25 | |
| 26 | #write main.zig { |
| 27 | const S = extern struct { x: u32, y: u32 }; |
| 28 | pub fn main() !void { |
| 29 | const val: S = .{ .x = 100, .y = 200 }; |
| 30 | try foo(&val); |
| 31 | } |
| 32 | fn foo(val: *const S) !void { |
| 33 | var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); |
| 34 | try stdout_writer.interface.print( |
| 35 | "{d} {d}\n", |
| 36 | .{ val.x, val.y }, |
| 37 | ); |
| 38 | } |
| 39 | const std = @import("std"); |
| 40 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 41 | #} |
| 42 | #update "change struct layout" |
| 43 | #check stdout { |
| 44 | 100 200 |
| 45 | #} |
| 46 | |
| 47 | #write main.zig { |
| 48 | const S = extern struct { x: u32, y: u32 }; |
| 49 | pub fn main() !void { |
| 50 | const val: S = .{ .x = 1234, .y = 5678 }; |
| 51 | try foo(&val); |
| 52 | } |
| 53 | fn foo(val: *const S) !void { |
| 54 | var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); |
| 55 | try stdout_writer.interface.print( |
| 56 | "{d} {d}\n", |
| 57 | .{ val.x, val.y }, |
| 58 | ); |
| 59 | } |
| 60 | const std = @import("std"); |
| 61 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 62 | #} |
| 63 | #update "change values" |
| 64 | #check stdout { |
| 65 | 1234 5678 |
| 66 | #} |