Skip to content

Upgrade zig 0.16.0 - #2

Merged
tammoippen merged 8 commits into
masterfrom
upgrade-zig-0.16.0
Aug 3, 2026
Merged

Upgrade zig 0.16.0#2
tammoippen merged 8 commits into
masterfrom
upgrade-zig-0.16.0

Conversation

@tammoippen

Copy link
Copy Markdown
Owner

Highlights

  • std.io is gone - formatting now goes through std.Io. Writer (.fixed buffers, w.print) instead of fixed buffer streams and std.fmt.format.
  • ArrayList lost its default field values and writer() helper: empty initialisation and list.print(gpa, …).
  • build.zig - libc is a module property in 0.16, so linkLibc() moved to .link_libo = true on the module.
  • Examples adopt 0.16's pub fn main(init: std. process.Init), taking io, the arena, args, and the environment from init; stdout is buffered and flushed.

Breaking change

std. posix.isatty and the global env-var helpers were removed, so terminal detection needs I/0 and the environment passed in:

try TermInfo. detect(allocator); // before
try TermInfo.detect(io, environ, allocator); // now

The exported C API signatures are unchanged - get_terminfo sources both internally.

tammoippen and others added 7 commits July 31, 2026 17:51
Zig 0.16 removed `Compile.linkLibC()`; libc is now a module property, so
set `.link_libc = true` on the `plotille-c` module instead of calling it
on the static and shared library artifacts.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Zig 0.16 removed `std.io`. Replace `std.io.fixedBufferStream` with
`std.Io.Writer.fixed` and `std.fmt.format(w, ...)` with `w.print(...)`;
`getWritten`/`pos`/`reset` become `buffered()`/`end`.

`ArrayList` lost its default field values and its `writer()` helper, so
initialise with `.empty` and print via `list.print(gpa, ...)`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Zig 0.16 removed `std.posix.isatty` and the global env-var helpers, so
`TermInfo.detect` can no longer reach stdout or the environment on its
own.

BREAKING CHANGE: `TermInfo.detect(allocator)` becomes
`TermInfo.detect(io, environ, allocator)`. Callers pass `init.io` and
`init.minimal.environ` from `std.process.Init`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Write into a `std.Io.Writer.fixed` buffer instead of a fixed buffer
stream, and swap the removed `GeneralPurposeAllocator` for the c
allocator.

`get_terminfo` has no `std.process.Init` to draw from, so it uses the
hardcoded single-threaded `Io` and reads the environment block from
libc. The exported C signatures are unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Zig 0.16 hands I/O, the arena, args and the environment to `main` via
`std.process.Init`, replacing `argsAlloc` and the hand-rolled arena.
stdout becomes a buffered `Io.File.Writer` that is flushed on exit, and
stdin is read through `readerStreaming` + `allocRemaining`.

In lookup.zig, drop the per-call throwaway stdout writers and reuse the
single writer; with buffering they would interleave incorrectly.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Bump the version badge and show the new `TermInfo.detect` signature.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Comment thread build.zig.zon Outdated
Comment thread zig-examples/build.zig.zon Outdated
@tammoippen
tammoippen merged commit 652ed42 into master Aug 3, 2026
4 checks passed
@tammoippen
tammoippen deleted the upgrade-zig-0.16.0 branch August 3, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant