106 Commits

Author SHA1 Message Date
Lee Cannon
f598245836 Make zig fmt happy with multiline arguments for readAllArrayListAligned 2020-12-03 10:24:49 +00:00
Lee Cannon
76f3921544 Add readUntilDelimiterOrEofArrayList & readUntilDelimiterOrEofAlloc 2020-12-02 12:55:54 +00:00
christian-stephen
abc729a5f9 Add readAllArrayListAligned to Reader which can accept an arbitrary alignment 2020-11-27 17:00:50 -08:00
Tadeo Kondrak
25ec2dbc1e Add builtin.Signedness, use it instead of is_signed 2020-11-19 18:59:21 +02:00
Veikka Tuominen
6d5b76a75d
Merge pull request #7005 from jshholland/deprecate-span
Remove ArrayList.span
2020-11-18 13:14:48 +02:00
Josh Holland
c25b157dda remove deprecated uses of ArrayList.span 2020-11-07 11:15:44 +00:00
xackus
5c8f7f81cd change debug.assert to testing.expect in tests 2020-11-06 22:48:54 +01:00
LemonBoy
dc872a221d std: Fix syscall stubs passing 64bit offsets for BE targets 2020-11-02 12:11:07 +01:00
Frank Denis
74a1175d9d std/*: add missing MIT license headers 2020-10-26 17:41:29 +01:00
Jan Prudil
aadccc4206 Make std.meta.Int accept a signedness parameter 2020-10-17 14:09:59 +02:00
Tadeo Kondrak
771f35c593
Use less inefficient method of replacing TypeInfo.UnionField.enum_field 2020-09-07 06:23:27 -06:00
Tadeo Kondrak
ac19ccf595
Update standard library for removal of TypeInfo.UnionField.enum_field 2020-09-07 06:23:26 -06:00
Vexu
1df0f3ac24
update uses of deprecated type field access 2020-09-03 18:10:40 +03:00
Lachlan Easton
bb848dbeee zig fmt: Patch rename stream to ais (auto indenting stream) & other small refactors 2020-09-02 20:16:28 +10:00
Lachlan Easton
bc24b86d82 zig fmt: Fix regression not covered by testing 2020-09-01 13:19:34 +10:00
Lachlan Easton
029ec456bc zig fmt: Set indent_delta to 2 when rendering inline asm 2020-08-31 23:39:50 +10:00
Lachlan Easton
5aca3baea6 zig fmt: Remove dynamic stack from auto-indenting-stream 2020-08-31 23:39:50 +10:00
Lachlan Easton
50c8a53188 Use ArrayList instead of fixed array for auto_indenting_stream 2020-08-30 10:32:21 +10:00
Lachlan Easton
7d950210a6 zig fmt review comments 2020-08-30 10:28:17 +10:00
Lachlan Easton
a72b9d403d Refactor zig fmt indentation. Remove indent from rendering code and have a stream handle automatic indentation 2020-08-29 13:35:00 +10:00
joachimschmidt557
3750cc06fd Improve io.Reader.skipBytes and add tests 2020-08-28 19:42:36 +02:00
Andrew Kelley
4a69b11e74 add license header to all std lib files
add SPDX license identifier
copyright ownership is zig contributors
2020-08-20 16:07:04 -04:00
Vexu
be1507a7af
update compile error tests and some doc comments 2020-07-12 00:54:07 +03:00
Vexu
e85fe13e44
run zig fmt on std lib and self hosted 2020-07-11 20:41:19 +03:00
Jakub Konka
923c0feda1 Add std.fs.File.readAllAlloc tests
This commit adds some unit tests for `std.fs.File.readAllAlloc`
function. It also updates the docs of `Reader.readNoEof`
which were outdated, and swaps `inStream()` for  `reader()` in
`File.readAllAlloc` with the former being deprecated.
2020-06-22 20:03:21 -04:00
Andrew Kelley
da549a72e1 zig fmt 2020-06-20 18:39:15 -04:00
Jonathan Marler
a282ac7a91 Support Reader for InStream 2020-06-09 13:36:17 -04:00
Jonathan Marler
7481582774 support Writer instead of OutStream
Start implementing https://github.com/ziglang/zig/issues/4917 which is to rename instream/outstream to reader/writer.  This first change allows code to use Writer/writer instead of OutStream/outStream, but still maintains the old outstream names with "Deprecated" comments.
2020-06-08 22:59:28 -04:00
Andrew Kelley
dd05f2be80 run zig fmt on std lib 2020-05-24 10:04:09 -04:00
Jakub Konka
2a59ecd7ec Integrate getTestDir with tmpDir logic 2020-05-18 17:10:49 +02:00
Jakub Konka
d43c08a3e5 Add/fix missing WASI functionality to pass libstd tests
This rather large commit adds/fixes missing WASI functionality
in `libstd` needed to pass the `libstd` tests. As such, now by
default tests targeting `wasm32-wasi` target are enabled in
`test/tests.zig` module. However, they can be disabled by passing
the `-Dskip-wasi=true` flag when invoking the `zig build test`
command. When the flag is set to `false`, i.e., when WASI tests are
included, `wasmtime` with `--dir=.` is used as the default testing
command.

Since the majority of `libstd` tests were relying on `fs.cwd()`
call to get current working directory handle wrapped in `Dir`
struct, in order to make the tests WASI-friendly, `fs.cwd()`
call was replaced with `testing.getTestDir()` function which
resolved to either `fs.cwd()` for non-WASI targets, or tries to
fetch the preopen list from the WASI runtime and extract a
preopen for '.' path.

The summary of changes introduced by this commit:
* implement `Dir.makeDir` and `Dir.openDir` targeting WASI
* implement `Dir.deleteFile` and `Dir.deleteDir` targeting WASI
* fix `os.close` and map errors in `unlinkat`
* move WASI-specific `mkdirat` and `unlinkat` from `std.fs.wasi`
  to `std.os` module
* implement `lseek_{SET, CUR, END}` targeting WASI
* implement `futimens` targeting WASI
* implement `ftruncate` targeting WASI
* implement `readv`, `writev`, `pread{v}`, `pwrite{v}` targeting WASI
* make sure ANSI escape codes are _not_ used in stderr or stdout
  in WASI, as WASI always sanitizes stderr, and sanitizes stdout if
  fd is a TTY
* fix specifying WASI rights when opening/creating files/dirs
* tweak `AtomicFile` to be WASI-compatible
* implement `os.renameatWasi` for WASI-compliant `os.renameat` function
* implement sleep() targeting WASI
* fix `process.getEnvMap` targeting WASI
2020-05-18 16:09:49 +02:00
Veikka Tuominen
2a5c0ef7f0
Merge pull request #5164 from daurnimator/in_stream-helpers
A couple of helpers for streams that I've found helpful
2020-05-17 22:02:10 +03:00
Vexu
092f726eec
Merge pull request #5175 from daurnimator/multi-out-stream
std: add io.MultiOutStream
2020-05-16 13:43:50 +03:00
daurnimator
277d088558
std: use async for MultiOutStream 2020-05-03 18:33:04 +10:00
Tadeo Kondrak
350b2adacd
std.meta.IntType -> std.meta.Int 2020-04-28 19:11:31 -06:00
Andrew Kelley
41e17106cd zig fmt: still print the relative path
The previous commit made zig fmt print absolute paths; this commit keeps
the absolute path resolution but still prints the relative paths to
stdout.
2020-04-27 13:38:19 -04:00
daurnimator
122b992a95
std: add io.MultiOutStream 2020-04-27 02:50:32 +10:00
daurnimator
1d6e53756b
std: add in_stream.isBytes 2020-04-25 20:42:13 +10:00
daurnimator
b531c0e676
std: add instream.readBytesNoEof function 2020-04-25 20:38:46 +10:00
Timon Kruiper
c829f2f7b7 Add mips support to standard library 2020-04-24 15:28:55 -04:00
daurnimator
d29ed2a785 std: fix StreamSource to disallow writing to a const buffer 2020-04-13 13:26:13 -04:00
xackus
7a28c644aa new ArrayList API: fix everything else 2020-04-02 16:12:08 +02:00
xackus
dd570dbc0d new ArrayList API, fix enough std lib to test 2020-04-02 15:14:18 +02:00
Andrew Kelley
2e806682f4
(breaking) std.Buffer => std.ArrayListSentineled(u8, 0)
This new name (and the fact that it is a function returning a type) will
make it more clear which use cases are better suited for ArrayList and
which are better suited for ArrayListSentineled.

Also for consistency with ArrayList,
 * `append` => `appendSlice`
 * `appendByte` => `append`

Thanks daurnimator for pointing out the confusion of std.Buffer.
2020-04-01 13:30:07 -04:00
Andrew Kelley
d23f9a164e
Remove unneeeded address-of operator 2020-04-01 10:21:17 -04:00
Vincent Rischmann
748b2c72a3
io: fix COutStream test 2020-04-01 13:13:47 +02:00
Vincent Rischmann
f46121b8fc
io: fix serialization compilation and tests 2020-04-01 12:37:02 +02:00
Vincent Rischmann
eddf491bf4
io: fix PeekStream compilation 2020-04-01 12:26:49 +02:00
Andrew Kelley
9e7ae06249
std lib API deprecations for the upcoming 0.6.0 release
See #3811
2020-03-30 14:23:22 -04:00
Luna
2028b4ce91 Fix typo in Serializer declaration 2020-03-28 12:01:29 -04:00