Commit Graph

386 Commits (35d65cceb8aa4360accc0db30b2b1448159e7d26)

Author SHA1 Message Date
Andrew Kelley bdf3680be1
zig fmt 2019-11-25 13:53:13 -05:00
Andrew Kelley 8a4c2d3b07
zig fmt fixes for sentinel-terminated pointers
closes #3771
2019-11-25 13:53:06 -05:00
Andrew Kelley a061ef42c1
Merge pull request #3761 from Vexu/event.fs
Update event.fs to new event loop
2019-11-25 12:31:23 -05:00
Vexu 7dba5ea9cf
update event.fs.watch 2019-11-25 17:57:44 +02:00
Andrew Kelley 5a98dd42b3
Merge pull request #3728 from ziglang/null-terminated-pointers
sentinel-terminated pointers
2019-11-25 02:20:08 -05:00
daurnimator 69b780647a std: update for linux 5.4 2019-11-25 02:07:23 -05:00
Andrew Kelley 321726465d
fix freebsd regression 2019-11-25 02:00:47 -05:00
Andrew Kelley d2cb740dd9 add missing null terminator in windows file path helper function 2019-11-25 01:10:30 -05:00
Andrew Kelley 29e438fd1f
more sentinel-terminated pointers std lib integration
See #3767
2019-11-25 00:43:36 -05:00
Andrew Kelley 15d415e10b
make std.mem.toSlice use null terminated pointers
and fix the fallout
2019-11-24 21:21:05 -05:00
Andrew Kelley 34b1ebefaa
Merge remote-tracking branch 'origin/master' into null-terminated-pointers 2019-11-24 20:28:46 -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
Andrew Kelley 44b1dc6db8
add type coercion: [:x]T to [*:x]T 2019-11-24 15:17:55 -05:00
syscall0 eea8b10463 Call DllMain entry point if declared 2019-11-24 14:46:22 -05: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
Vexu 20f5f56986
uncomment event.fs.watch 2019-11-24 17:42:20 +02:00
Vexu ab534cc9f1
update event.fs to use global event loop 2019-11-24 17:39:08 +02:00
Andrew Kelley 00878a15d7
zig fmt: support sentinel-terminated pointer syntax 2019-11-23 22:21:25 -05:00
Andrew Kelley f25182f46d
structs can have fields with type `var`
behavior tests passing now
2019-11-23 17:51:37 -05:00
Vexu 89310dad56
Merge branch 'master' into modernize-stage2 2019-11-23 23:01:28 +02:00
Vexu b9ef36094c
re-enable stage2 tests 2019-11-23 22:57:34 +02:00
Vexu 6c64f079fa
add workaround to child_process.zig 2019-11-23 22:06:51 +02:00
Vexu 7fa59565d3 fix small regressions in std.event 2019-11-23 14:01:00 -05:00
Andrew Kelley 7597735bad
update the stage1 implementation to the new proposal
See #3731
2019-11-23 04:45:35 -05:00
Vexu 4e6c1b676b
add cast to not hit #2561 2019-11-21 23:21:51 -05:00
Vexu 0e8a53514e
add missing error set to ChildProsess.SpawnError 2019-11-21 23:21:14 -05:00
Andrew Kelley fd6020c4e2
update tests, better error messages, update self-hosted tokenizer 2019-11-21 20:43:41 -05:00
Andrew Kelley cf2fe2536e
better error message when null termination does not match 2019-11-21 20:43:41 -05:00
Andrew Kelley 47f06be369
string literals are now null terminated
this also deletes C string literals from the language, and then makes
the std lib changes and compiler changes necessary to get the behavior
tests and std lib tests passing again.
2019-11-21 20:43:41 -05:00
Andrew Kelley 21f344b3b9
add null terminated pointers and arrays to self-hosted
as well as `@typeInfo` and `@Type`
2019-11-21 20:43:41 -05:00
Andrew Kelley 1aa978f32e
implement null terminated pointers 2019-11-21 20:43:41 -05:00
Andrew Kelley cd5f4de2a6
std: remove O_LARGEFILE from OS bits when the OS does not define it 2019-11-21 20:34:55 -05:00
Andrew Kelley bf1cbebea1 improve std.fs.selfExePath and related functions on Windows 2019-11-21 18:51:12 -05:00
Andrew Kelley cd37c1a377
add std.fs.Dir.openRead
This is progress towards file system APIs that encourage avoiding
Time Of Check, Time Of Use bugs.
2019-11-21 17:07:29 -05:00
Andrew Kelley 874b34a30f
self-hosted tokenizer handles \r in string literals 2019-11-20 21:03:17 -05:00
Andrew Kelley ed619245e9
remove dead code shebang support from self-hosted tokenizer 2019-11-20 20:18:19 -05:00
Johan Bolmsjö ad77e93415 std.testing.expectEqual: show differing pointer values
Show differing pointer values when comparing pointers instead of the
content they point to.

It's confusing for a test to say "expected S{.x = 1}, found S{.x = 1}"
as illustrated below when it was the pointers that differed.

There seems to be different rules for when a pointer is dereferenced by
the printing routine depending on its type. I don't fully grok this but
it's also illustrated below.

    const std = @import("std");

    const S = struct { x: u32 };

    // before: ...expected S{ .x = 1 }, found S{ .x = 1 }
    // after:  ...expected S@7ffcd20b7798, found S@7ffcd20b7790
    test "compare_ptr_to_struct" {
        var a = S{.x = 1};
        var b = S{.x = 1};
        std.testing.expectEqual(&a, &b);
    }

    // before: ...expected u32@7fff316ba31c, found u32@7fff316ba318
    // after:  ...expected u32@7ffecec622dc, found u32@7ffecec622d8
    test "compare_ptr_to_scalar" {
        var a: u32 = 1;
        var b: u32 = 1;
        std.testing.expectEqual(&a, &b);
    }
2019-11-19 06:22:34 +00:00
dbandstra b3539b40a6 add `std.math.tau` constant (equivalent to 2 * pi) 2019-11-19 06:20:20 +00:00
frmdstryr aa4e92f3b3 Make StreamServer return address of accecpted client 2019-11-19 01:06:04 +00:00