7171 Commits

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
Andrew Kelley
b9f88c3552
fix compile errors for array sentinels mismatching 2019-11-24 20:25:14 -05:00
Andrew Kelley
ce96323ba1
update cli test 2019-11-24 19:24:52 -05:00
Andrew Kelley
7eb5acdc80
fix casting [N:x]T to [N]T memcpying too many bytes 2019-11-24 18:57:07 -05:00
Andrew Kelley
217a5090ff
fix compile error regressions 2019-11-24 18:10:31 -05:00
Andrew Kelley
8309b6188d
Merge pull request #3644 from daurnimator/bytefifo
Improvements to std.fifo
2019-11-24 17:33:53 -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
c96d565166
add compile error for incompatible pointer sentinels 2019-11-24 17:02:56 -05:00
Andrew Kelley
4018034708
add test cases for arbitrary pointer sentinels 2019-11-24 16:52:32 -05:00
Andrew Kelley
09ec720dab
fix comptime @ptrCast of pointers to arrays 2019-11-24 16:25:26 -05:00
Sahnvour
6ebd26f3db removed unnecessary backslashes in windows' libc paths 2019-11-24 21:33:58 +01:00
Sahnvour
696567d9d7 export: check variable type
also fixed existing occurrences
2019-11-24 21:33:58 +01:00
Sahnvour
912c1c24c3 simple test for exporting variables in static libs 2019-11-24 21:33:58 +01:00
Sahnvour
1bde3b6821 gen-h: register the need for stdbool.h and stdint.h when exploring types recursively
otherwise they wouldn't be included when only a struct contains them
2019-11-24 21:33:58 +01:00
Sahnvour
49156e3980 gen-h: add a pass for exported variables 2019-11-24 21:33:58 +01:00
Sahnvour
104b6f1629 refactored gen_h_file to improve maintainability and output
- extracted functions
- factorised extern "C" into a block containing all function prototypes instead of writing macros all over the place
- using intermediate buffers instead of writing directly to the output file
2019-11-24 21:33:58 +01:00
Andrew Kelley
f7574f44c1
add test for struct with var field 2019-11-24 15:20:15 -05: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
Andrew Kelley
2b1faa1f20
Merge pull request #3748 from Vexu/modernize-stage2
Updates and cleanup in self hosted compiler
2019-11-24 14:40:16 -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
Vexu
0cbf00a3ec
self hosted compiler: final small fixes to get it compiling 2019-11-24 10:24:47 +02:00
Andrew Kelley
4c7b52503b
all tests passing 2019-11-24 02:14:21 -05:00
MCRusher
17abb7ef7f
Adds initCapacity() to buffer and arraylist
array_list.zig:
- adds ArrayList.initCapacity(*Allocator,usize) to allow preallocation of a block at initialization to reduce future allocations.
- adds a test for ArrayList.initCapacity() that ensures ArrayList.len() is unchanged and that at least the requested amount is allocated for.
buffer.zig:
- adds Buffer.initCapacity(*Allocator,usize), based off of ArrayList.initCapacity(), to preallocate a buffer before use.
note: contrary to Buffer.initSize(0) and then Buffer.list.ensureCapacity(200) (the presumed current method), this only allocates once instead of twice.
- adds Buffer.capacity to check usable allocated space, not including the null byte.
note: returns 0 when Buffer has only a null byte or when initNull() was used before without resize()/replaceContents().
- adds a test "Buffer.initCapacity" which ensures that Buffer.append()'s with [added size <= Buffer.capacity()-Buffer.len()] do not cause a reallocation to occur.
- adds a test "Buffer.initSize" which ensures that Buffer.initSize() behaves as expected, also combined with Buffer.append().
- adds a doc comment to Buffer.initSize() that makes its function and distinction from Buffer.initCapacity() clearer.
2019-11-23 23:49:55 -05:00
MCRusher
d49e0a7b90
Added initCapacity, capacity, and 2 tests.
Added Buffer.initCapcity() to buffer to allow preallocation of a block of memory to reduce future allocations. Uses the added ArrayList.initCapacity() function to achieve this.

Added Buffer.capacity() to track current usable allocation size, not counting null byte, and returning 0 if empty or created with Buffer.initNull()

Added a test for initCapacity() that shows that no further allocation is performed for an append of size smaller than or equal to capacity when initCapacity is used.

Added a test for initSize(), since it did not exist already.

Also added a comment to better explain the difference between initSize() and initCapacity()

note: forgot in the first commit but thanks to mikdusan for helping me brainstorm, through the process, and for drawing up a draft diff which I tweaked.
2019-11-23 23:08:33 -05:00
MCRusher
10e6cde083
Added initCapacity and relevant test
Added ArrayList.initCapcity() as a way to preallocate a block of memory to reduce future allocations.

Added a test "std.ArrayList.initCapacity" that ensures initCapacity adds no elements and increases capacity by at least the requested amount
2019-11-23 22:54:33 -05:00
Andrew Kelley
2dd20aa04a
langref: update for sentinel-terminated types 2019-11-23 22:29:12 -05:00