diff --git a/README.md b/README.md index 5651a29..fae13b3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # zig-wayland -Zig 0.7.1 bindings and protocol scanner for libwayland. +Zig 0.8.0 bindings and protocol scanner for libwayland. ## Usage diff --git a/src/common_core.zig b/src/common_core.zig index f8eaec7..2afbaa7 100644 --- a/src/common_core.zig +++ b/src/common_core.zig @@ -118,7 +118,7 @@ test "Fixed" { { const initial: f64 = 10.5301837; const val = Fixed.fromDouble(initial); - try testing.expectApproxEqAbs(initial, val.toDouble(), 1 / 256.); + try testing.expectApproxEqAbs(initial, val.toDouble(), 1.0 / 256.0); try testing.expectEqual(@as(i24, 10), val.toInt()); } diff --git a/src/scanner.zig b/src/scanner.zig index bb91804..11549d9 100644 --- a/src/scanner.zig +++ b/src/scanner.zig @@ -33,10 +33,10 @@ pub fn scan(root_dir: fs.Dir, out_path: []const u8, wayland_xml: []const u8, pro var iter = scanner.client.iterator(); while (iter.next()) |entry| { - try writer.print("pub const {s} = struct {{", .{entry.key}); - if (mem.eql(u8, entry.key, "wl")) + try writer.print("pub const {s} = struct {{", .{entry.key_ptr.*}); + if (mem.eql(u8, entry.key_ptr.*, "wl")) try writer.writeAll("pub usingnamespace @import(\"wayland_client_core.zig\");\n"); - for (entry.value.items) |generated_file| + for (entry.value_ptr.items) |generated_file| try writer.print("pub usingnamespace @import(\"{s}\");", .{generated_file}); try writer.writeAll("};\n"); } @@ -53,10 +53,10 @@ pub fn scan(root_dir: fs.Dir, out_path: []const u8, wayland_xml: []const u8, pro var iter = scanner.server.iterator(); while (iter.next()) |entry| { - try writer.print("pub const {s} = struct {{", .{entry.key}); - if (mem.eql(u8, entry.key, "wl")) + try writer.print("pub const {s} = struct {{", .{entry.key_ptr.*}); + if (mem.eql(u8, entry.key_ptr.*, "wl")) try writer.writeAll("pub usingnamespace @import(\"wayland_server_core.zig\");\n"); - for (entry.value.items) |generated_file| + for (entry.value_ptr.items) |generated_file| try writer.print("pub usingnamespace @import(\"{s}\");", .{generated_file}); try writer.writeAll("};\n"); } @@ -70,8 +70,8 @@ pub fn scan(root_dir: fs.Dir, out_path: []const u8, wayland_xml: []const u8, pro var iter = scanner.common.iterator(); while (iter.next()) |entry| { - try writer.print("pub const {s} = struct {{", .{entry.key}); - for (entry.value.items) |generated_file| + try writer.print("pub const {s} = struct {{", .{entry.key_ptr.*}); + for (entry.value_ptr.items) |generated_file| try writer.print("pub usingnamespace @import(\"{s}\");", .{generated_file}); try writer.writeAll("};\n"); } @@ -108,7 +108,7 @@ const Scanner = struct { const client_file = try out_dir.createFile(client_filename, .{}); defer client_file.close(); try protocol.emitClient(client_file.writer()); - try (try scanner.client.getOrPutValue(protocol_namespace, .{})).value.append(gpa, client_filename); + try (try scanner.client.getOrPutValue(protocol_namespace, .{})).value_ptr.append(gpa, client_filename); } { @@ -116,7 +116,7 @@ const Scanner = struct { const server_file = try out_dir.createFile(server_filename, .{}); defer server_file.close(); try protocol.emitServer(server_file.writer()); - try (try scanner.server.getOrPutValue(protocol_namespace, .{})).value.append(gpa, server_filename); + try (try scanner.server.getOrPutValue(protocol_namespace, .{})).value_ptr.append(gpa, server_filename); } { @@ -124,7 +124,7 @@ const Scanner = struct { const common_file = try out_dir.createFile(common_filename, .{}); defer common_file.close(); try protocol.emitCommon(common_file.writer()); - try (try scanner.common.getOrPutValue(protocol_namespace, .{})).value.append(gpa, common_filename); + try (try scanner.common.getOrPutValue(protocol_namespace, .{})).value_ptr.append(gpa, common_filename); } } };