Skip to content

Commit 992dde8

Browse files
committed
Source now compiles with Zig 0.15.1
1 parent b7a71ea commit 992dde8

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

tools/DacValues/build.zig

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ pub fn build(b: *std.Build) !void {
44

55
const exe = b.addExecutable(.{
66
.name = "dv",
7-
.root_source_file = b.path("src/main.zig"),
8-
.target = b.graph.host,
9-
.optimize = b.standardOptimizeOption(.{})
7+
.root_module = b.createModule(.{
8+
.root_source_file = b.path("src/main.zig"),
9+
.target = b.graph.host,
10+
.optimize = b.standardOptimizeOption(.{})
11+
}),
1012
});
1113
b.installArtifact(exe);
1214

@@ -15,8 +17,10 @@ pub fn build(b: *std.Build) !void {
1517
b.step("run", "Runs the application").dependOn(&run_exe.step);
1618

1719
const test_exe = b.addTest(.{
18-
.root_source_file = b.path("src/testmain.zig"),
19-
.target = b.graph.host
20+
.root_module = b.createModule(.{
21+
.root_source_file = b.path("src/testmain.zig"),
22+
.target = b.graph.host
23+
}),
2024
});
2125
const run_test = b.addRunArtifact(test_exe);
2226
run_test.skip_foreign_checks = true;

tools/DacValues/src/Dac.zig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ const std = @import("std");
22
const mem = std.mem;
33
const math = std.math;
44

5+
const U32ArrayList = std.array_list.Managed(u32);
6+
57
bits: u32,
68
max_value: f64,
79
length: f64,
@@ -20,7 +22,7 @@ pub fn new(bits: u32) Self {
2022
}
2123

2224
fn lin_interpol(allocator: mem.Allocator, dac_values: []const u32) ![]const u32 {
23-
var ret = std.ArrayList(u32).init(allocator);
25+
var ret = U32ArrayList.init(allocator);
2426
defer ret.deinit();
2527

2628
for (dac_values, 0..) |value, i| {
@@ -38,7 +40,7 @@ fn lin_interpol(allocator: mem.Allocator, dac_values: []const u32) ![]const u32
3840
}
3941

4042
pub fn transform_waveform(self: *const Self, allocator: mem.Allocator, waveform: []const f64, interpolate: bool, start_offset: f64) ![]const u32 {
41-
var ret = std.ArrayList(u32).init(allocator);
43+
var ret = U32ArrayList.init(allocator);
4244
defer ret.deinit();
4345

4446
const offset_dac_value = self.length * start_offset;

tools/DacValues/src/main.zig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ const Gen = @import("waves.zig");
44
const Waves = Gen.Waves;
55

66
const Allocator = std.mem.Allocator;
7-
const stdout = std.io.getStdOut().writer();
7+
var stdout_writer = std.fs.File.stdout().writer(&.{});
8+
const stdout = &stdout_writer.interface;
89

910
const ParsedArgResult = struct {
1011
mode: Waves,

tools/DacValues/src/waves.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const Dac = @import("Dac.zig");
44
const math = std.math;
55

66
const PI = math.pi;
7-
const F64ArrayList = std.ArrayList(f64);
7+
const F64ArrayList = std.array_list.Managed(f64);
88

99
allocator: Allocator,
1010
dac: Dac,

0 commit comments

Comments
 (0)