Commit graph

11107 commits

Author SHA1 Message Date
Andrew Kelley
4d93545ded chicken out and allow ascii string alignment 2025-07-09 15:17:07 -07:00
Andrew Kelley
2468766a89 std: forbid alignment formatting options sometimes 2025-07-09 15:07:45 -07:00
Andrew Kelley
51a9a6aab6 std: replace formatInteger with formatNumber 2025-07-09 14:54:54 -07:00
Andrew Kelley
bc2cf0c173 eliminate all uses of std.io.Writer.count except for CBE 2025-07-09 09:32:07 -07:00
Andrew Kelley
d345a10054 std.os.freebsd.copy_file_range: add missing error.Unexpected 2025-07-08 16:53:02 -07:00
Andrew Kelley
81b0c99915 std.zig.system.linux: update API usage 2025-07-08 15:15:21 -07:00
Andrew Kelley
1dcb20d27e std.fmt: refactor to remove cacheString
when this kind of trick is needed, do it inline
2025-07-08 11:07:23 -07:00
Andrew Kelley
fc335a3a48 update format strings in os/windows/test.zig 2025-07-08 08:46:31 -07:00
Andrew Kelley
83c4000319 std: revert big int test to master branch
oops, it depends on usize
2025-07-08 08:36:04 -07:00
Andrew Kelley
5955ba4f53 std.fs.File.Writer: implement positional writing for Windows 2025-07-07 23:09:14 -07:00
Andrew Kelley
043079d765 std.io.Writer.VectorWrapper: fix vtable not being a unique addr 2025-07-07 22:43:53 -07:00
Andrew Kelley
d8e26275f2 update standalone and incremental tests to new API 2025-07-07 22:43:53 -07:00
Andrew Kelley
e97a0ffb60 std.Build.Step.CheckObject: mostly revert to master branch
the updated code to use new std.io API is crashing
2025-07-07 22:43:53 -07:00
Andrew Kelley
f2ad3bcc1c fix 32-bit compilation 2025-07-07 22:43:53 -07:00
Andrew Kelley
b077e2979c std.io.Reader: fix peekByte 2025-07-07 22:43:53 -07:00
Andrew Kelley
a7387f0047 fix std.io.Writer.VectorWrapper mechanism
previous implementation erroneously attempted to detect whether vector
API was used via the buffer pointer. This implementation has an explicit
flag.
2025-07-07 22:43:53 -07:00
Andrew Kelley
9903587a63 std.Build.Step.Options: fix build failure 2025-07-07 22:43:53 -07:00
Andrew Kelley
fd7feed04b std.fs.File.Writer: implement positional writing 2025-07-07 22:43:53 -07:00
Andrew Kelley
7e2a26c0c4 std.io.Writer.printValue: rework logic
Alignment and fill options only apply to numbers.

Rework the implementation to mainly branch on the format string rather
than the type information. This is more straightforward to maintain and
more straightforward for comptime evaluation.

Enums support being printed as decimal, hexadecimal, octal, and binary.

`formatInteger` is another possible format method that is
unconditionally called when the value type is struct and one of the
integer-printing format specifiers are used.
2025-07-07 22:43:53 -07:00
Andrew Kelley
5378fdb153 std.fmt: fully remove format string from format methods
Introduces `std.fmt.alt` which is a helper for calling alternate format
methods besides one named "format".
2025-07-07 22:43:53 -07:00
Andrew Kelley
4ccc6f2b57 compiler: fix remaining build failures 2025-07-07 22:43:53 -07:00
Andrew Kelley
6489907662 std.zip: work around deprecated API 2025-07-07 22:43:53 -07:00
Andrew Kelley
f4720e1407 std.testing: update to new std.io API 2025-07-07 22:43:53 -07:00
Andrew Kelley
9c8aef55b4 std.fmt.format: use {t} for tag name rather than {s}
prevents footgun when formatted type changes from string to enum
2025-07-07 22:43:52 -07:00
Andrew Kelley
30c2921eb8 compiler: update a bunch of format strings 2025-07-07 22:43:52 -07:00
Andrew Kelley
d5c97fded5 compiler: fix a bunch of format strings 2025-07-07 22:43:52 -07:00
Andrew Kelley
3afc6fbac6 std.zig.llvm.Builder: update format API 2025-07-07 22:43:52 -07:00
Andrew Kelley
cce32bd1d5 fix build runner 2025-07-07 22:43:52 -07:00
Andrew Kelley
756a2dbf1a compiler: upgrade various std.io API usage 2025-07-07 22:43:52 -07:00
Andrew Kelley
f71d97e4cb update compiler source to new APIs 2025-07-07 22:43:52 -07:00
Andrew Kelley
fac5fe57be std.io.Writer.Allocating: rename interface to writer 2025-07-07 22:43:52 -07:00
Andrew Kelley
fc310ee7bc std.io.Reader: fix appendRemaining 2025-07-07 22:43:52 -07:00
Andrew Kelley
4bca5faca6 std.Build.Cache: write manifest without heap allocating
Now that the buffered writing interface is not generic.
2025-07-07 22:43:52 -07:00
Andrew Kelley
d6ac04c478 std.Build.Step.CheckObject: fix the TODO 2025-07-07 22:43:52 -07:00
Andrew Kelley
87f32bec26 std.io.Reader: finish implementing the unit tests 2025-07-07 22:43:52 -07:00
Andrew Kelley
49093a659f std.debug: lil buffer for this guy 2025-07-07 22:43:52 -07:00
Andrew Kelley
8f4229158b std.io.Writer.Allocating: extra ensure byte
So that when returning from drain there is always capacity for at least
one more byte.
2025-07-07 22:43:52 -07:00
Andrew Kelley
d03d273117 std.io.Reader: fix fill implementation
now it avoids writing to buffer in the case of fixed
2025-07-07 22:43:52 -07:00
Andrew Kelley
1e1f026c83 std.mem.byteSwapAllFields: support slices 2025-07-07 22:43:52 -07:00
Andrew Kelley
1ee403ce93 std.io.Reader: add doctest for streamDelimiterLimit 2025-07-07 22:43:51 -07:00
Andrew Kelley
435ccf706d std.fs.File.Writer: fix drain implementation
it didn't account for data.len can no longer be zero
2025-07-07 22:43:51 -07:00
Andrew Kelley
77e839e283 std.io.Reader: fix streamDelimiter and streamDelimiterEnding 2025-07-07 22:43:51 -07:00
Andrew Kelley
1d763c8b29 std: formatted printing no longer prints type names
for structs, enums, and unions.

auto untagged unions are no longer printed as pointers; instead they are
printed as "{ ... }".

extern and packed untagged unions have each field printed, similar to
what gdb does.

also fix bugs in delimiter based reading
2025-07-07 22:43:51 -07:00
Andrew Kelley
0e37ff0d59 std.fmt: breaking API changes
added adapter to AnyWriter and GenericWriter to help bridge the gap
between old and new API

make std.testing.expectFmt work at compile-time

std.fmt no longer has a dependency on std.unicode. Formatted printing
was never properly unicode-aware. Now it no longer pretends to be.

Breakage/deprecations:
* std.fs.File.reader -> std.fs.File.deprecatedReader
* std.fs.File.writer -> std.fs.File.deprecatedWriter
* std.io.GenericReader -> std.io.Reader
* std.io.GenericWriter -> std.io.Writer
* std.io.AnyReader -> std.io.Reader
* std.io.AnyWriter -> std.io.Writer
* std.fmt.format -> std.fmt.deprecatedFormat
* std.fmt.fmtSliceEscapeLower -> std.ascii.hexEscape
* std.fmt.fmtSliceEscapeUpper -> std.ascii.hexEscape
* std.fmt.fmtSliceHexLower -> {x}
* std.fmt.fmtSliceHexUpper -> {X}
* std.fmt.fmtIntSizeDec -> {B}
* std.fmt.fmtIntSizeBin -> {Bi}
* std.fmt.fmtDuration -> {D}
* std.fmt.fmtDurationSigned -> {D}
* {} -> {f} when there is a format method
* format method signature
  - anytype -> *std.io.Writer
  - inferred error set -> error{WriteFailed}
  - options -> (deleted)
* std.fmt.Formatted
  - now takes context type explicitly
  - no fmt string
2025-07-07 22:43:51 -07:00
Andrew Kelley
0b3f0124dc std.io: move getStdIn, getStdOut, getStdErr functions to fs.File
preparing to rearrange std.io namespace into an interface

how to upgrade:

std.io.getStdIn() -> std.fs.File.stdin()
std.io.getStdOut() -> std.fs.File.stdout()
std.io.getStdErr() -> std.fs.File.stderr()
2025-07-07 22:43:51 -07:00
Nameless
7c42517151 os: fix missing and incorrect msghdr definitions
Macos uses the BSD definition of msghdr

All linux architectures share a single msghdr definition. Many
architectures had manually inserted padding fields that were endian
specific and some had fields with different integers. This unifies all
architectures to use a single correct msghdr definition.
2025-07-07 22:43:51 -07:00
Andrew Kelley
9f27d770a1 std.io: deprecated Reader/Writer; introduce new API 2025-07-07 22:43:51 -07:00
Andrew Kelley
34f64432b0 remove usingnamespace from the language
closes #20663
2025-07-07 13:39:48 -07:00
Andrew Kelley
aa52bb8327 zig fmt 2025-07-07 13:39:16 -07:00
Andrew Kelley
40d11cc25a remove async and await keywords
Also remove `@frameSize`, closing #3654.

While the other machinery might remain depending on #23446, it is
settled that there will not be `async`/ `await` keywords in the
language.
2025-07-07 13:39:16 -07:00