blob: 4ff43ed8e8f5099d3b027b36bfda5402d0088e6e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
const std = @import("std");
pub usingnamespace @import("strings.zig");
pub const Output = struct {
pub const source = comptime {
if (std.builtin.os.tag == .wasi) {
return @import("./output_wasi.zig");
} else if (std.builtin.target.isWasm()) {
return @import("./output_wasm.zig");
} else {
return @import("./output_native.zig");
}
};
pub fn print(comptime fmt: string, args: anytype) void {
if (comptime std.builtin.target.isWasm()) {
std.fmt.format(source.writer, fmt, args) catch unreachable;
} else {
std.fmt.format(source.writer orelse unreachable, fmt, args) catch unreachable;
}
}
pub fn printError(comptime fmt: string, args: anytype) void {
if (comptime std.builtin.target.isWasm()) {
std.fmt.format(source.writer, fmt, args) catch unreachable;
} else {
std.fmt.format(source.writer orelse unreachable, fmt, args) catch unreachable;
}
}
};
pub const Global = struct {
pub fn panic(comptime fmt: string, args: anytype) noreturn {
if (comptime std.builtin.target.isWasm()) {
@panic(fmt);
} else {
std.debug.panic(fmt, args);
}
}
};
|