mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-31 20:59:02 +00:00
This commit represents the majority of the work necessary to upgrade Ghostty to use Zig 0.16.0. Key parts: * In addition to its previous responsibilities, the global state now houses state for global I/O implementations and the process environment. It is now also utilized in the main application along with the C library. Where necessary, global state is isolated from key parts of the implementation (e.g., in libghostty subsystems), and it's expected that this list will grow. * We currently manage our own C translation layer where necessary. In these cases, cImport has been removed in favor of the new external translate-c package. Due to fixes that have needed be made to properly translate the dependencies that were swapped out, as mentioned, we have had to backport fixes from the current translate-c package (and the upstream Arocc dependency). We will host this ourselves until Zig 0.17.0 is released with these fixes. * Where necessary (only a small number of cases), some stdlib code from 0.15.2 (and even from 0.17.0) has been taken, adopted, and vendored in lib/compat. Co-authored-by: Leah Amelia Chen <hi@pluie.me>
36 lines
1010 B
Zig
36 lines
1010 B
Zig
const builtin = @import("builtin");
|
|
const std = @import("std");
|
|
|
|
pub const png = @import("png.zig");
|
|
pub const jpeg = @import("jpeg.zig");
|
|
pub const swizzle = @import("swizzle.zig");
|
|
pub const Error = @import("error.zig").Error;
|
|
|
|
/// The maximum image size, based on the 4G limit of Ghostty's
|
|
/// `image-storage-limit` config.
|
|
pub const maximum_image_size = 4 * 1024 * 1024 * 1024;
|
|
|
|
pub const ImageData = struct {
|
|
width: u32,
|
|
height: u32,
|
|
data: []u8,
|
|
};
|
|
|
|
test {
|
|
refAllDeclsRecursive(@This());
|
|
}
|
|
|
|
/// Copied from 0.15.2 stdlib (MIT license).
|
|
fn refAllDeclsRecursive(comptime T: type) void {
|
|
if (!builtin.is_test) return;
|
|
inline for (comptime std.meta.declarations(T)) |decl| {
|
|
if (@TypeOf(@field(T, decl.name)) == type) {
|
|
switch (@typeInfo(@field(T, decl.name))) {
|
|
.@"struct", .@"enum", .@"union", .@"opaque" => refAllDeclsRecursive(@field(T, decl.name)),
|
|
else => {},
|
|
}
|
|
}
|
|
_ = &@field(T, decl.name);
|
|
}
|
|
}
|