mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-03 14:19:05 +00:00
Update to Zig 0.16.0
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>
This commit is contained in:
@@ -146,8 +146,8 @@ inline fn invalidCodepoint(cp: anytype) bool {
|
||||
const Precompute = struct {
|
||||
const Key = packed struct(u13) {
|
||||
state: uucode.grapheme.BreakState,
|
||||
gb1: uucode.x.types.GraphemeBreakNoControl,
|
||||
gb2: uucode.x.types.GraphemeBreakNoControl,
|
||||
gb1: uucode.types.GraphemeBreakNoControl,
|
||||
gb2: uucode.types.GraphemeBreakNoControl,
|
||||
|
||||
fn index(self: Key) usize {
|
||||
return @intCast(@as(u13, @bitCast(self)));
|
||||
@@ -171,18 +171,18 @@ const Precompute = struct {
|
||||
};
|
||||
|
||||
@setEvalBranchQuota(10_000);
|
||||
const info = @typeInfo(uucode.x.types.GraphemeBreakNoControl).@"enum";
|
||||
const info = @typeInfo(uucode.types.GraphemeBreakNoControl).@"enum";
|
||||
for (0..max_state_int + 1) |state_int| {
|
||||
for (info.fields) |field1| {
|
||||
for (info.fields) |field2| {
|
||||
var state: uucode.grapheme.BreakState = @enumFromInt(state_int);
|
||||
|
||||
const key: Key = .{
|
||||
.gb1 = @field(uucode.x.types.GraphemeBreakNoControl, field1.name),
|
||||
.gb2 = @field(uucode.x.types.GraphemeBreakNoControl, field2.name),
|
||||
.gb1 = @field(uucode.types.GraphemeBreakNoControl, field1.name),
|
||||
.gb2 = @field(uucode.types.GraphemeBreakNoControl, field2.name),
|
||||
.state = state,
|
||||
};
|
||||
const v = uucode.x.grapheme.computeGraphemeBreakNoControl(
|
||||
const v = uucode.grapheme.computeGraphemeBreakNoControl(
|
||||
key.gb1,
|
||||
key.gb2,
|
||||
&state,
|
||||
|
||||
@@ -18,7 +18,7 @@ pub const Properties = packed struct {
|
||||
width_zero_in_grapheme: bool = false,
|
||||
|
||||
/// Grapheme break property.
|
||||
grapheme_break: uucode.x.types.GraphemeBreakNoControl = .other,
|
||||
grapheme_break: uucode.types.GraphemeBreakNoControl = .other,
|
||||
|
||||
/// Emoji VS compatibility
|
||||
emoji_vs_base: bool = false,
|
||||
|
||||
@@ -22,10 +22,8 @@ pub fn get(cp: u21) Properties {
|
||||
}
|
||||
|
||||
/// Runnable binary to generate the lookup tables and output to stdout.
|
||||
pub fn main() !void {
|
||||
var arena_state = std.heap.ArenaAllocator.init(std.heap.page_allocator);
|
||||
defer arena_state.deinit();
|
||||
const alloc = arena_state.allocator();
|
||||
pub fn main(init: std.process.Init) !void {
|
||||
const alloc = init.arena.allocator();
|
||||
|
||||
const gen: lut.Generator(
|
||||
Properties,
|
||||
@@ -48,7 +46,7 @@ pub fn main() !void {
|
||||
defer alloc.free(t.stage3);
|
||||
|
||||
var buf: [4096]u8 = undefined;
|
||||
var stdout = std.fs.File.stdout().writer(&buf);
|
||||
var stdout = std.Io.File.stdout().writer(init.io, &buf);
|
||||
try t.writeZig(&stdout.interface);
|
||||
// Use flush instead of end because stdout is a pipe when captured by
|
||||
// the build system, and pipes cannot be truncated (Windows returns
|
||||
|
||||
@@ -3,10 +3,8 @@ const uucode = @import("uucode");
|
||||
const lut = @import("lut.zig");
|
||||
|
||||
/// Runnable binary to generate the lookup tables and output to stdout.
|
||||
pub fn main() !void {
|
||||
var arena_state = std.heap.ArenaAllocator.init(std.heap.page_allocator);
|
||||
defer arena_state.deinit();
|
||||
const alloc = arena_state.allocator();
|
||||
pub fn main(init: std.process.Init) !void {
|
||||
const alloc = init.arena.allocator();
|
||||
|
||||
const gen: lut.Generator(
|
||||
bool,
|
||||
@@ -32,7 +30,7 @@ pub fn main() !void {
|
||||
defer alloc.free(t.stage3);
|
||||
|
||||
var buf: [4096]u8 = undefined;
|
||||
var stdout = std.fs.File.stdout().writer(&buf);
|
||||
var stdout = std.Io.File.stdout().writer(init.io, &buf);
|
||||
try t.writeZig(&stdout.interface);
|
||||
// Use flush instead of end because stdout is a pipe when captured by
|
||||
// the build system, and pipes cannot be truncated (Windows returns
|
||||
|
||||
Reference in New Issue
Block a user