update cli test zig platform to zig 13

This commit is contained in:
Luke Boswell 2024-07-28 15:41:03 +10:00
parent 2be2c02b60
commit 164243821f
No known key found for this signature in database
GPG key ID: F6DB3C9DB47377B0
7 changed files with 37 additions and 37 deletions

View file

@ -1,6 +1,6 @@
const std = @import("std"); const std = @import("std");
const builtin = @import("builtin"); const builtin = @import("builtin");
const str = @import("glue").str; const str = @import("glue/str.zig");
const RocStr = str.RocStr; const RocStr = str.RocStr;
const testing = std.testing; const testing = std.testing;
const expectEqual = testing.expectEqual; const expectEqual = testing.expectEqual;
@ -25,7 +25,7 @@ const DEBUG: bool = false;
export fn roc_alloc(size: usize, alignment: u32) callconv(.C) ?*anyopaque { export fn roc_alloc(size: usize, alignment: u32) callconv(.C) ?*anyopaque {
if (DEBUG) { if (DEBUG) {
var ptr = malloc(size); const ptr = malloc(size);
const stdout = std.io.getStdOut().writer(); const stdout = std.io.getStdOut().writer();
stdout.print("alloc: {d} (alignment {d}, size {d})\n", .{ ptr, alignment, size }) catch unreachable; stdout.print("alloc: {d} (alignment {d}, size {d})\n", .{ ptr, alignment, size }) catch unreachable;
return ptr; return ptr;
@ -97,13 +97,13 @@ fn roc_mmap(addr: ?*anyopaque, length: c_uint, prot: c_int, flags: c_int, fd: c_
comptime { comptime {
if (builtin.os.tag == .macos or builtin.os.tag == .linux) { if (builtin.os.tag == .macos or builtin.os.tag == .linux) {
@export(roc_getppid, .{ .name = "roc_getppid", .linkage = .Strong }); @export(roc_getppid, .{ .name = "roc_getppid", .linkage = .strong });
@export(roc_mmap, .{ .name = "roc_mmap", .linkage = .Strong }); @export(roc_mmap, .{ .name = "roc_mmap", .linkage = .strong });
@export(roc_shm_open, .{ .name = "roc_shm_open", .linkage = .Strong }); @export(roc_shm_open, .{ .name = "roc_shm_open", .linkage = .strong });
} }
if (builtin.os.tag == .windows) { if (builtin.os.tag == .windows) {
@export(roc_getppid_windows_stub, .{ .name = "roc_getppid", .linkage = .Strong }); @export(roc_getppid_windows_stub, .{ .name = "roc_getppid", .linkage = .strong });
} }
} }

View file

@ -1,6 +1,6 @@
const std = @import("std"); const std = @import("std");
const builtin = @import("builtin"); const builtin = @import("builtin");
const str = @import("glue").str; const str = @import("glue/str.zig");
const RocStr = str.RocStr; const RocStr = str.RocStr;
const testing = std.testing; const testing = std.testing;
const expectEqual = testing.expectEqual; const expectEqual = testing.expectEqual;
@ -22,7 +22,7 @@ const DEBUG: bool = false;
export fn roc_alloc(size: usize, alignment: u32) callconv(.C) ?*anyopaque { export fn roc_alloc(size: usize, alignment: u32) callconv(.C) ?*anyopaque {
if (DEBUG) { if (DEBUG) {
var ptr = malloc(size); const ptr = malloc(size);
const stdout = std.io.getStdOut().writer(); const stdout = std.io.getStdOut().writer();
stdout.print("alloc: {d} (alignment {d}, size {d})\n", .{ ptr, alignment, size }) catch unreachable; stdout.print("alloc: {d} (alignment {d}, size {d})\n", .{ ptr, alignment, size }) catch unreachable;
return ptr; return ptr;
@ -94,13 +94,13 @@ fn roc_mmap(addr: ?*anyopaque, length: c_uint, prot: c_int, flags: c_int, fd: c_
comptime { comptime {
if (builtin.os.tag == .macos or builtin.os.tag == .linux) { if (builtin.os.tag == .macos or builtin.os.tag == .linux) {
@export(roc_getppid, .{ .name = "roc_getppid", .linkage = .Strong }); @export(roc_getppid, .{ .name = "roc_getppid", .linkage = .strong });
@export(roc_mmap, .{ .name = "roc_mmap", .linkage = .Strong }); @export(roc_mmap, .{ .name = "roc_mmap", .linkage = .strong });
@export(roc_shm_open, .{ .name = "roc_shm_open", .linkage = .Strong }); @export(roc_shm_open, .{ .name = "roc_shm_open", .linkage = .strong });
} }
if (builtin.os.tag == .windows) { if (builtin.os.tag == .windows) {
@export(roc_getppid_windows_stub, .{ .name = "roc_getppid", .linkage = .Strong }); @export(roc_getppid_windows_stub, .{ .name = "roc_getppid", .linkage = .strong });
} }
} }
@ -125,7 +125,7 @@ pub export fn main() u8 {
numbers[i] = @mod(@as(i64, @intCast(i)), 12); numbers[i] = @mod(@as(i64, @intCast(i)), 12);
} }
var roc_list = RocList{ .elements = numbers, .length = NUM_NUMS, .capacity = NUM_NUMS }; const roc_list = RocList{ .elements = numbers, .length = NUM_NUMS, .capacity = NUM_NUMS };
var timer = std.time.Timer.start() catch unreachable; var timer = std.time.Timer.start() catch unreachable;
@ -134,7 +134,7 @@ pub export fn main() u8 {
// stdout the result // stdout the result
const length = @min(20, callresult.length); const length = @min(20, callresult.length);
var result = callresult.elements[0..length]; const result = callresult.elements[0..length];
const nanos = timer.read(); const nanos = timer.read();
const seconds = (@as(f64, @floatFromInt(nanos)) / 1_000_000_000.0); const seconds = (@as(f64, @floatFromInt(nanos)) / 1_000_000_000.0);

View file

@ -1,6 +1,6 @@
const std = @import("std"); const std = @import("std");
const builtin = @import("builtin"); const builtin = @import("builtin");
const str = @import("./glue/src/str.zig"); const str = @import("glue/str.zig");
const RocStr = str.RocStr; const RocStr = str.RocStr;
const testing = std.testing; const testing = std.testing;
const expectEqual = testing.expectEqual; const expectEqual = testing.expectEqual;

View file

@ -1,6 +1,6 @@
const std = @import("std"); const std = @import("std");
const builtin = @import("builtin"); const builtin = @import("builtin");
const str = @import("glue").str; const str = @import("glue/str.zig");
const RocStr = str.RocStr; const RocStr = str.RocStr;
const testing = std.testing; const testing = std.testing;
const expectEqual = testing.expectEqual; const expectEqual = testing.expectEqual;
@ -17,7 +17,7 @@ const DEBUG: bool = false;
export fn roc_alloc(size: usize, alignment: u32) callconv(.C) ?*anyopaque { export fn roc_alloc(size: usize, alignment: u32) callconv(.C) ?*anyopaque {
if (DEBUG) { if (DEBUG) {
var ptr = malloc(size); const ptr = malloc(size);
const stdout = std.io.getStdOut().writer(); const stdout = std.io.getStdOut().writer();
stdout.print("alloc: {d} (alignment {d}, size {d})\n", .{ ptr, alignment, size }) catch unreachable; stdout.print("alloc: {d} (alignment {d}, size {d})\n", .{ ptr, alignment, size }) catch unreachable;
return ptr; return ptr;
@ -87,14 +87,14 @@ fn roc_mmap(addr: ?*anyopaque, length: c_uint, prot: c_int, flags: c_int, fd: c_
comptime { comptime {
if (builtin.os.tag == .macos or builtin.os.tag == .linux) { if (builtin.os.tag == .macos or builtin.os.tag == .linux) {
@export(roc_getppid, .{ .name = "roc_getppid", .linkage = .Strong }); @export(roc_getppid, .{ .name = "roc_getppid", .linkage = .strong });
@export(roc_mmap, .{ .name = "roc_mmap", .linkage = .Strong }); @export(roc_mmap, .{ .name = "roc_mmap", .linkage = .strong });
@export(roc_send_signal, .{ .name = "roc_send_signal", .linkage = .Strong }); @export(roc_send_signal, .{ .name = "roc_send_signal", .linkage = .strong });
@export(roc_shm_open, .{ .name = "roc_shm_open", .linkage = .Strong }); @export(roc_shm_open, .{ .name = "roc_shm_open", .linkage = .strong });
} }
if (builtin.os.tag == .windows) { if (builtin.os.tag == .windows) {
@export(roc_getppid_windows_stub, .{ .name = "roc_getppid", .linkage = .Strong }); @export(roc_getppid_windows_stub, .{ .name = "roc_getppid", .linkage = .strong });
} }
} }

View file

@ -1,6 +1,6 @@
const std = @import("std"); const std = @import("std");
const builtin = @import("builtin"); const builtin = @import("builtin");
const str = @import("glue").str; const str = @import("glue/str.zig");
const RocStr = str.RocStr; const RocStr = str.RocStr;
const testing = std.testing; const testing = std.testing;
const expectEqual = testing.expectEqual; const expectEqual = testing.expectEqual;
@ -79,13 +79,13 @@ fn roc_mmap(addr: ?*anyopaque, length: c_uint, prot: c_int, flags: c_int, fd: c_
comptime { comptime {
if (builtin.os.tag == .macos or builtin.os.tag == .linux) { if (builtin.os.tag == .macos or builtin.os.tag == .linux) {
@export(roc_getppid, .{ .name = "roc_getppid", .linkage = .Strong }); @export(roc_getppid, .{ .name = "roc_getppid", .linkage = .strong });
@export(roc_mmap, .{ .name = "roc_mmap", .linkage = .Strong }); @export(roc_mmap, .{ .name = "roc_mmap", .linkage = .strong });
@export(roc_shm_open, .{ .name = "roc_shm_open", .linkage = .Strong }); @export(roc_shm_open, .{ .name = "roc_shm_open", .linkage = .strong });
} }
if (builtin.os.tag == .windows) { if (builtin.os.tag == .windows) {
@export(roc_getppid_windows_stub, .{ .name = "roc_getppid", .linkage = .Strong }); @export(roc_getppid_windows_stub, .{ .name = "roc_getppid", .linkage = .strong });
} }
} }

View file

@ -1,6 +1,6 @@
const std = @import("std"); const std = @import("std");
const builtin = @import("builtin"); const builtin = @import("builtin");
const str = @import("glue").str; const str = @import("glue/str.zig");
const RocStr = str.RocStr; const RocStr = str.RocStr;
const testing = std.testing; const testing = std.testing;
const expectEqual = testing.expectEqual; const expectEqual = testing.expectEqual;
@ -79,13 +79,13 @@ fn roc_mmap(addr: ?*anyopaque, length: c_uint, prot: c_int, flags: c_int, fd: c_
comptime { comptime {
if (builtin.os.tag == .macos or builtin.os.tag == .linux) { if (builtin.os.tag == .macos or builtin.os.tag == .linux) {
@export(roc_getppid, .{ .name = "roc_getppid", .linkage = .Strong }); @export(roc_getppid, .{ .name = "roc_getppid", .linkage = .strong });
@export(roc_mmap, .{ .name = "roc_mmap", .linkage = .Strong }); @export(roc_mmap, .{ .name = "roc_mmap", .linkage = .strong });
@export(roc_shm_open, .{ .name = "roc_shm_open", .linkage = .Strong }); @export(roc_shm_open, .{ .name = "roc_shm_open", .linkage = .strong });
} }
if (builtin.os.tag == .windows) { if (builtin.os.tag == .windows) {
@export(roc_getppid_windows_stub, .{ .name = "roc_getppid", .linkage = .Strong }); @export(roc_getppid_windows_stub, .{ .name = "roc_getppid", .linkage = .strong });
} }
} }

View file

@ -1,6 +1,6 @@
const std = @import("std"); const std = @import("std");
const builtin = @import("builtin"); const builtin = @import("builtin");
const str = @import("glue").str; const str = @import("glue/str.zig");
const RocStr = str.RocStr; const RocStr = str.RocStr;
const testing = std.testing; const testing = std.testing;
const expectEqual = testing.expectEqual; const expectEqual = testing.expectEqual;
@ -79,13 +79,13 @@ fn roc_mmap(addr: ?*anyopaque, length: c_uint, prot: c_int, flags: c_int, fd: c_
comptime { comptime {
if (builtin.os.tag == .macos or builtin.os.tag == .linux) { if (builtin.os.tag == .macos or builtin.os.tag == .linux) {
@export(roc_getppid, .{ .name = "roc_getppid", .linkage = .Strong }); @export(roc_getppid, .{ .name = "roc_getppid", .linkage = .strong });
@export(roc_mmap, .{ .name = "roc_mmap", .linkage = .Strong }); @export(roc_mmap, .{ .name = "roc_mmap", .linkage = .strong });
@export(roc_shm_open, .{ .name = "roc_shm_open", .linkage = .Strong }); @export(roc_shm_open, .{ .name = "roc_shm_open", .linkage = .strong });
} }
if (builtin.os.tag == .windows) { if (builtin.os.tag == .windows) {
@export(roc_getppid_windows_stub, .{ .name = "roc_getppid", .linkage = .Strong }); @export(roc_getppid_windows_stub, .{ .name = "roc_getppid", .linkage = .strong });
} }
} }