Commit Graph

40 Commits

Author SHA1 Message Date
Veikka Tuominen
fd77f2cfed std: update usage of std.testing 2021-05-08 15:15:30 +03:00
ducdetronquito
0aef1faa82 std.fifo.LinearFifo - Expose reader and writer type. 2021-02-22 00:22:46 +02:00
rgreenblatt
f9be7471bc fix readable slice bug (and add tests) 2021-02-21 11:48:38 +02:00
Jay Petacat
1595ce273e Remove deprecated stream aliases 2021-01-08 16:54:56 -05:00
LemonBoy
dd973fb365 std: Use {s} instead of {} when printing strings 2021-01-02 17:12:57 -07:00
Frank Denis
6c2e0c2046 Year++ 2020-12-31 15:45:24 -08:00
Veikka Tuominen
a6470088c6
Merge pull request #6434 from daurnimator/fifo.pump
std: add LinearFifo(...).pump(src_reader, dest_writer)
2020-11-18 16:35:13 +02:00
Ian Simonson
eab51b7785 Make LinearFifo not crash when discarding from empty buffer
Previously if a LinearFifo was empty and discard was called
an unsigned overflow would occur. However it is safe to perform
this overflow as a bitwise & operation with 0xFFFFFFFFFFFFFF is a noop
2020-09-27 05:46:39 -04:00
daurnimator
a1abbb8eac
std: add LinearFifo(...).pump(src_reader, dest_writer) 2020-09-27 14:43:44 +10: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
frmdstryr
fa4a9ab51f Use writer for LinearFifo instead of deprecated outStream 2020-07-27 17:05:39 +03:00
Jonathan Marler
a282ac7a91 Support Reader for InStream 2020-06-09 13:36:17 -04:00
Andrew Kelley
0986dcf1cf self-hosted: fix codegen and resolve some analysis bugs 2020-05-14 13:20:27 -04:00
daurnimator
34524a1792
std: add LinearFifo().inStream 2020-04-02 21:14:15 +11:00
daurnimator
2a031c8825
std: LinearFifo matches ArrayList in always having outStream method 2020-04-02 21:07:44 +11:00
Tetralux
d57b5205c6 Fix std.fifo.LinearFifo
- Fix undeclared variable in 'writeItem'
- Clarify docs of `read` regarding bytes vs. items
- Normalize 'writeable' to 'writable' (the more common parlance)
2020-03-31 10:18:58 -04:00
Andrew Kelley
4905102901
fix all the TODOs from the pull request
* `std.Buffer.print` is removed; use `buffer.outStream().print`
 * `std.fmt.count` returns a `u64`
 * `std.Fifo.print` is removed; use `fifo.outStream().print`
 * `std.fmt.bufPrint` error is renamed from `BufferTooSmall`
   to `NoSpaceLeft` to match `std.os.write`.
 * `std.io.FixedBufferStream.getWritten` returns mutable buffer
   if the buffer is mutable.
2020-03-13 12:02:58 -04:00
Benjamin Feng
786216ca5a Slap in workaround for Fifo 2020-03-12 10:41:09 -05:00
xackus
783e8ad031 remove @bytesToSlice, @sliceToBytes from std lib 2020-02-21 19:46:53 +01:00
Benjamin Feng
b077f3ab7d Promoted "leak_count_allocator" to the main testing.allocator 2020-01-29 22:22:00 -06:00
Benjamin Feng
aa9caf5064 Create leak_count_allocator 2020-01-29 14:37:01 -06:00
Benjamin Feng
4d134a01f5 Move debug.global_allocator to testing.allocator 2020-01-29 12:21:29 -06:00
Andrew Kelley
8b2622cdd5
std.fmt.format: tuple parameter instead of var args 2019-12-08 22:53:51 -05:00
Andrew Kelley
bf3ac66150
remove type coercion from array values to references
* Implements #3768. This is a sweeping breaking change that requires
   many (trivial) edits to Zig source code. Array values no longer
   coerced to slices; however one may use `&` to obtain a reference to
   an array value, which may then be coerced to a slice.

 * Adds `IrInstruction::dump`, for debugging purposes. It's useful to
   call to inspect the instruction when debugging Zig IR.

 * Fixes bugs with result location semantics. See the new behavior test
   cases, and compile error test cases.

 * Fixes bugs with `@typeInfo` not properly resolving const values.

 * Behavior tests are passing but std lib tests are not yet. There
   is more work to do before merging this branch.
2019-11-27 03:37:50 -05:00
Andrew Kelley
bdf3680be1
zig fmt 2019-11-25 13:53:13 -05:00
daurnimator
1a84bcefb6
std: fix mismatched doc-comment/argument names in fifo.rewind 2019-11-25 09:26:33 +11:00
daurnimator
94485b2a58
std: clean up fifo.readableSliceMut 2019-11-25 09:26:33 +11:00
daurnimator
b4091e3aec
std: fifo.deinit didn't need to take a pointer 2019-11-25 09:26:33 +11:00
daurnimator
3062e0e932
std: add fifo.writeItem 2019-11-25 09:26:33 +11:00
daurnimator
c393969a20
std: fix bug in fifo.unget if rewinding doesn't wrap around 2019-11-25 09:26:33 +11:00
daurnimator
61179a4d52
std: follow zig standard library convention and have fifo.read number of items 2019-11-25 09:26:33 +11:00
daurnimator
6037f89212
std: fifo rename from FixedSizeFifo to LinearFifo 2019-11-25 09:26:33 +11:00
daurnimator
cd749e0416
std: fifo now has 3 modes: Static, Slice and Dynamic 2019-11-25 09:26:32 +11:00
daurnimator
c0e47cb645
std: fix fifo for non-u8 types 2019-11-25 09:26:32 +11:00
daurnimator
e810f485ab
std: add optimization to fifo if size is power of two 2019-11-25 09:26:32 +11:00
daurnimator
01b2a56225
std: move auto_align constant to top of comptime function
At a later point in time this might be made into a parameter
2019-11-25 09:26:32 +11:00
daurnimator
52645d06e1
std: fix unfinished doc-comment in fifo 2019-11-25 09:26:32 +11:00
schroffl
6109e49c5b Fix FixedSizeFifo buffer type
Update the `.buf` property to be a slice of the type that is given as a parameter.
2019-11-24 14:42:56 -05:00
Andrew Kelley
e0db54e89d
update the codebase to use @as 2019-11-08 15:57:24 -05:00
daurnimator
1657bead46 std: Add fifo useful for buffers 2019-11-04 17:44:01 -05:00