diff --git a/build.zig b/build.zig index 8fd1daf..f0fdb85 100644 --- a/build.zig +++ b/build.zig @@ -73,7 +73,7 @@ pub fn build(b: *std.Build) void { .optimize = optimize, }); - const lib_module = &lib.root_module; + const lib_module = lib.root_module; _ = b.addModule("zigplotlib", .{ .root_source_file = b.path("src/root.zig"), diff --git a/build.zig.zon b/build.zig.zon index 09f8213..cb1aa34 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,7 +1,8 @@ .{ - .name = "zigplotlib", - .version = "0.1.4", - .minimum_zig_version = "0.13.0", + .name = .zigplotlib, + .version = "0.1.5", + .fingerprint = 0x1220c9f9f0e0ce2a, + .minimum_zig_version = "0.14.0", .dependencies = .{}, .paths = .{ diff --git a/example/scatter.zig b/example/scatter.zig index 2def7c4..2e882e8 100644 --- a/example/scatter.zig +++ b/example/scatter.zig @@ -14,7 +14,7 @@ pub fn main() !void { defer _ = gpa.deinit(); const allocator = gpa.allocator(); - var xoshiro = std.rand.Xoshiro256.init(100); + var xoshiro = std.Random.Xoshiro256.init(100); var rand = xoshiro.random(); var x: [28]f32 = undefined; @@ -65,4 +65,4 @@ pub fn main() !void { defer file.close(); try svg.writeTo(file.writer()); -} \ No newline at end of file +} diff --git a/readme.md b/readme.md index f2a4a4d..7f47a30 100644 --- a/readme.md +++ b/readme.md @@ -5,7 +5,7 @@ The Zig Plot Lib is a library for plotting data in Zig. It is designed to be eas **Note:** This library is still in development and is not yet ready for production use. -I'm developping this library with version 0.13.0. +I'm developping this library with version 0.14.1. ## Installation You can install the library by adding it to the `build.zig.zon` file, either manually like so: diff --git a/src/core/intf.zig b/src/core/intf.zig index 23f0ddc..870a1b7 100644 --- a/src/core/intf.zig +++ b/src/core/intf.zig @@ -13,32 +13,32 @@ fn checkFunctionImplementation( const Function = Field.type; const function = @typeInfo(Function); - if (function != .Fn) @compileError("The Interface should only contains functions (as field)"); - if (function.Fn.is_generic) @compileError("Generic functions are not supported!"); - if (function.Fn.is_var_args) @compileError("Variadic functions are not supported!"); + if (function != .@"fn") @compileError("The Interface should only contains functions (as field)"); + if (function.@"fn".is_generic) @compileError("Generic functions are not supported!"); + if (function.@"fn".is_var_args) @compileError("Variadic functions are not supported!"); const actual = @typeInfo(Actual); - if (actual != .Struct) @compileError(comptimePrint("'{s}' should be a struct that implements '{s}'", .{ + if (actual != .@"struct") @compileError(comptimePrint("'{s}' should be a struct that implements '{s}'", .{ @typeName(Actual), @typeName(Interface), })); - inline for (actual.Struct.decls) |decl| { + inline for (actual.@"struct".decls) |decl| { if (comptime std.mem.eql(u8, decl.name, Field.name)) { const decl_ = @field(Actual, decl.name); const Decl = @TypeOf(decl_); const decl_info = @typeInfo(Decl); - if (decl_info != .Fn) @compileError(comptimePrint("Invalid Type for '{s}', should be {s}", .{ + if (decl_info != .@"fn") @compileError(comptimePrint("Invalid Type for '{s}', should be {s}", .{ Field.name, @typeName(Function), })); - if (decl_info.Fn.is_generic or decl_info.Fn.is_var_args) @compileError(comptimePrint("Invalid Type for '{s}', should be {s}", .{ + if (decl_info.@"fn".is_generic or decl_info.@"fn".is_var_args) @compileError(comptimePrint("Invalid Type for '{s}', should be {s}", .{ Field.name, @typeName(Function), })); - inline for (function.Fn.params, decl_info.Fn.params, 0..) |expected_param, actual_param, i| { + inline for (function.@"fn".params, decl_info.@"fn".params, 0..) |expected_param, actual_param, i| { if (i == 0) { if (expected_param.type == *const anyopaque) { if (actual_param.type != *const Actual) @compileError(comptimePrint("'self' (the 1st argument) should be of type '*const {s}'\nDefinition for '{s}':\n{s}", .{ @@ -66,7 +66,7 @@ fn checkFunctionImplementation( })); } - if (function.Fn.return_type != decl_info.Fn.return_type) @compileError(comptimePrint("Invalid return type for '{s}', should be {s}\nDefinition for '{s}':\n{s}", .{ + if (function.@"fn".return_type != decl_info.@"fn".return_type) @compileError(comptimePrint("Invalid return type for '{s}', should be {s}\nDefinition for '{s}':\n{s}", .{ Field.name, @typeName(Function), Field.name, @@ -93,9 +93,9 @@ pub fn ensureImplement( ) void { const interface = @typeInfo(Interface); - if (interface != .Struct) @compileError("The Interface should be a struct containing the functions as fields"); + if (interface != .@"struct") @compileError("The Interface should be a struct containing the functions as fields"); - inline for (interface.Struct.fields) |field| { + inline for (interface.@"struct".fields) |field| { checkFunctionImplementation(Interface, field, Actual); } -} \ No newline at end of file +} diff --git a/src/svg/SVG.zig b/src/svg/SVG.zig index 0338962..6502cd3 100644 --- a/src/svg/SVG.zig +++ b/src/svg/SVG.zig @@ -1,5 +1,6 @@ const std = @import("std"); const Allocator = std.mem.Allocator; +const File = std.fs.File; pub const Line = @import("Line.zig"); pub const Rect = @import("Rect.zig"); @@ -81,7 +82,7 @@ pub fn addPath(self: *SVG, options: Path.Options) !void { } /// The header of the SVG -const SVG_HEADER = +const SVG_HEADER: []const u8 = \\ \\ \\ @@ -89,7 +90,7 @@ const SVG_HEADER = ; /// Write the SVG to the given writer -pub fn writeTo(self: *const SVG, writer: anytype) anyerror!void { +pub fn writeTo(self: *const SVG, writer: File.Writer) anyerror!void { // Write the header try writer.print(SVG_HEADER, .{ self.width, diff --git a/src/util/range.zig b/src/util/range.zig index cb86b66..06eaec4 100644 --- a/src/util/range.zig +++ b/src/util/range.zig @@ -18,7 +18,7 @@ pub fn Range(comptime T: type) type { /// Initialize a range with the minimum and maximum values set to the same value. [-∞; ∞] pub fn inf() Self { - if (@typeInfo(T) != .Float) @compileError("Only floating point types can have infinite ranges"); + if (@typeInfo(T) != .float) @compileError("Only floating point types can have infinite ranges"); return Self{ .min = -std.math.inf(T), @@ -28,7 +28,7 @@ pub fn Range(comptime T: type) type { /// Initialize a range with the minimum and maximum values set to the same value. [∞; -∞] pub fn invInf() Self { - if (@typeInfo(T) != .Float) @compileError("Only floating point types can have infinite ranges"); + if (@typeInfo(T) != .float) @compileError("Only floating point types can have infinite ranges"); return Self{ .min = std.math.inf(T),