Andrew Kelley
2c7a2aefbf
Revert "Use eventfd in ChildProcess on Linux"
...
This reverts commit b169f7b0d5
.
This caused `integer cast truncated bits` at
std/child_process.zig:801:12
Can be reproduced on my machine simply by running `make`.
2019-12-16 01:39:41 -05:00
LemonBoy
b169f7b0d5
Use eventfd in ChildProcess on Linux
...
Closes #819
2019-12-15 14:43:37 -05:00
LemonBoy
19ddbd9e9e
Make sure the address is aligned for intToPtr ops
...
Closes #773
2019-12-15 14:41:05 -05:00
Vexu
e57e3602e7
translate-c-2 implement enums
2019-12-14 23:24:47 +02:00
Vexu
1a967db083
add default initializers to all ast.Node base values
2019-12-14 20:40:56 +02:00
Vexu
1f84586836
translate-c-2 avoid collisions with zig keywords
2019-12-14 17:00:10 +02:00
Vexu
4dae70e702
translate-c-2 container aliases
2019-12-14 13:40:33 +02:00
Vexu
e4ca1f441b
translate-c-2 record type
2019-12-14 02:00:01 +02:00
Andrew Kelley
fff3c1fff4
un-special-case startup code in the std lib
...
Previously, the compiler had special logic to determine whether to
include the startup code, which was in `std/special/start.zig`. Now,
the file is moved to `std/start.zig`, and there is no special logic
in the compiler. Instead, the standard library unconditionally imports
the `start.zig` file, which then has a `comptime` block that does the
logic of determining what, if any, start symbols to export. Instead of
`start.zig` being in its own special package, it is just another normal
file that is part of the standard library.
`std.builtin.TestFn` is now part of the standard library rather than
specially generated by the compiler.
2019-12-12 18:33:44 -05:00
Christine Dodrill
b37acc4d68
allow custom OS entrypoint
...
Also:
* Expose `std.start.callMain`.
* Other fixes added to fix issues found in development.
2019-12-12 16:00:23 -05:00
Andrew Kelley
d08dc21116
Merge pull request #3886 from kavika13/master
...
Add function params, parens handling, and some infix operators to self-hosted translate-c
2019-12-11 18:40:35 -05:00
Christine Dodrill
b375f6e027
lib/std/io: let the bring-your-own OS package handle stdio ( #3887 )
2019-12-11 18:37:52 -05:00
Merlyn Morgan-Graham
5e8186a8ce
Fix access of undefined field when calling ast.Tree.dump
2019-12-10 23:52:40 -08:00
Andrew Kelley
7c1dbfab72
self-hosted: manually parse args
2019-12-11 02:08:33 -05:00
Andrew Kelley
c3d8b1ffeb
remove iterator API from std.ArrayList
...
This is not a meaningful abstraction. Use a for loop on the result
of `toSlice` or `toSliceConst`.
An iterator can be implemented on top of ArrayList by applications which
want additional functionality, such as removing elements while
iterating.
Closes #3037 .
2019-12-10 15:08:10 -05:00
frmdstryr
f30af12bea
Add hotpath for BufferedOutStream ( #3858 )
...
* Add hotpath for BufferedOutStream
2019-12-10 13:44:59 -05:00
Heppokoyuki
5ada11449a
fix con_in difinition and add EFI_SIMPLE_TEXT_INPUT_PROTOCOL difinition
2019-12-10 13:25:28 -05:00
Andrew Kelley
fdc3132126
fix windows dynamic lib loading test
2019-12-10 13:21:37 -05:00
Andrew Kelley
3ef8460d06
fix load dynamic library API when linking libc
2019-12-10 12:56:05 -05:00
Andrew Kelley
80882bda59
load dynamic library test: update API usage code
2019-12-10 12:48:10 -05:00
Andrew Kelley
fd6b7b160d
improve dynamic library API
2019-12-10 12:28:28 -05:00
emekoi
29fd727b79
fixed windows dynamic library loading and added loading for darwin
2019-12-10 11:41:54 -05:00
Robin Voetter
8c096707b7
Additional replacements of @typeOf with @TypeOf
2019-12-10 11:09:41 -05:00
Robin Voetter
4b4fbe3887
Replace @typeOf with @TypeOf in all zig source
...
This change was mostly made with `zig fmt` and this also modified some whitespace. Note that in some files, `zig fmt` produced incorrect code, so the change was made manually.
2019-12-10 11:09:41 -05:00
Robin Voetter
d568db2386
Remove misplaced dot
2019-12-10 11:09:29 -05:00
Robin Voetter
23b901d45a
Add typeOf/TypeOf render test
2019-12-10 11:09:29 -05:00
Robin Voetter
20a3011def
Add typeOf/TypeOf substition in zig fmt
2019-12-10 11:09:29 -05:00
Andrew Kelley
cd4d638d10
Merge pull request #3830 from fengb/wasm-page-allocator
...
WasmPageAllocator
2019-12-10 10:58:50 -05:00
xackus
c27d06596b
fix integers parsed as floats
2019-12-10 10:30:41 -05:00
dbandstra
3388c777fa
print call in build.zig needs to use a tuple argument
2019-12-10 10:18:57 -05:00
Andrew Kelley
e6c01e49d8
remove no-longer-needed workaround for var args
...
See #557
2019-12-09 16:21:16 -05:00
Andrew Kelley
a3f6a58c77
remove var args from the language
...
closes #208
2019-12-09 15:27:27 -05:00
Andrew Kelley
f205d23e65
implement async function call with `@call`
...
this removes the last usage of var args in zig std lib
2019-12-09 15:27:26 -05:00
Andrew Kelley
5d82744f1c
ability to give comptime and non-comptime types to same parameter
2019-12-09 13:30:53 -05:00
Andrew Kelley
d571fad20e
update tests to new format API
2019-12-09 00:05:21 -05:00
Andrew Kelley
03396b3caa
update docs to new fmt API
2019-12-08 23:46:50 -05:00
Andrew Kelley
5f9467d78f
update formatted printing when linking libc
2019-12-08 23:39:30 -05:00
Andrew Kelley
7a4f704258
windows-specific fixes
2019-12-08 23:26:19 -05:00
Andrew Kelley
8b2622cdd5
std.fmt.format: tuple parameter instead of var args
2019-12-08 22:53:51 -05:00
Benjamin Feng
608d36ad8c
Rewrite WasmPageAllocator tests to be less flaky on environment
2019-12-08 21:22:07 -06:00
Andrew Kelley
64d700bfa6
zig fmt: support comptime fields
2019-12-08 12:26:20 -05:00
Josh Wolfe
05fc4d34a9
documentation for mutable HashMap KV pointers
2019-12-07 13:22:23 -05:00
Benjamin Feng
e91522b875
Add back comptime check for wasm
2019-12-06 17:27:11 -06:00
data-man
80a72c225c
Crypto benchmark fixes
2019-12-06 17:14:10 -05:00
data-man
008e42f483
getStdOut fixes
2019-12-06 16:41:02 -05:00
Benjamin Feng
5a004ed834
Actually use `const conventional` as the comment indicates
2019-12-06 15:16:07 -06:00
Andrew Kelley
525b1e8fb4
Merge pull request #3856 from ziglang/builtin-call
...
introduce `@call` and remove other builtin calls
2019-12-06 15:49:47 -05:00
Andrew Kelley
656cc33f8d
allow calling with a new stack to regress a bit
...
Calling with a new stack, with a runtime-known stack pointer (e.g.
not a global variable) is regressed with this branch. It is now a
compile-error, due to the Runtime Hint system not being smart enough
to mix a compile-time modifier field with a runtime stack field.
I'm OK with this regression because this feature is flawed (see #3268 )
and may be deleted from the language.
2019-12-06 15:25:00 -05:00
Andrew Kelley
71b7f4b47f
remove `@newStackCall` from zig
2019-12-06 14:52:09 -05:00
Andrew Kelley
343987cd05
remove `@inlineCall` from zig
2019-12-06 14:12:01 -05:00
Benjamin Feng
eb495d934b
Add WasmPageAllocator tests
2019-12-05 21:54:57 -06:00
Andrew Kelley
105ef560b3
Merge pull request #3853 from xackus/doc-fixes
...
Docs: assembly example printing garbage and minor html fixes
2019-12-05 20:43:10 -05:00
Benjamin Feng
f2b0dbea74
Resolve tests to work with or skip WasmPageAllocator
2019-12-05 19:31:49 -06:00
Benjamin Feng
694616adb5
Standardize around bigger slices
2019-12-05 18:43:51 -06:00
Benjamin Feng
7d1c4fe4dc
Switch bitmask to enums
2019-12-05 18:01:49 -06:00
Andrew Kelley
ef83358eb6
remove `@noInlineCall` from zig
2019-12-05 17:37:29 -05:00
Andrew Kelley
1f602fe8c5
implement `@call`
...
closes #3732
2019-12-05 17:07:15 -05:00
xackus
71354498c9
docs: add html lang and minor fixes
2019-12-05 22:40:58 +01:00
Vexu
bfb15f1c9f
fix casts
2019-12-05 15:47:06 -05:00
frmdstryr
1baaf9a503
Increase io.BufferedInStream readByte speed by ~75%
2019-12-05 10:16:50 -05:00
Vexu
d40ad92668
use enum literals in render.zig
2019-12-05 14:50:51 +02:00
Vexu
10cc8cad86
fix zig fmt of c pointers
2019-12-05 14:50:46 +02:00
Benjamin Feng
30da6d49f4
Fix freeing memory across bounds
2019-12-04 22:43:02 -06:00
Benjamin Feng
86ae75363e
Strip out an unnecessary memset
2019-12-04 21:41:01 -06:00
Benjamin Feng
5784985bb8
Use raw PackedIo to shave ~150b
2019-12-04 21:22:36 -06:00
Benjamin Feng
a910a6c871
Rejuggle how offsets are calculated
2019-12-04 18:12:25 -06:00
Andrew Kelley
bef3769bb7
std.fmt.ParseUnsignedError is now public
2019-12-04 18:44:22 -05:00
Andrew Kelley
10e172b1d7
add `other` OS and fix regression in build-exe for freestanding
2019-12-04 14:42:40 -05:00
Andrew Kelley
44e896f613
Merge pull request #3844 from Snektron/sort-improvements
...
Small sort improvements
2019-12-04 14:25:00 -05:00
Vexu
137cb32f5e
add docs for function parameters
2019-12-04 14:14:47 -05:00
Robin Voetter
841a37ab59
Add std.sort.argMax and std.sort.argMin
2019-12-04 18:20:55 +01:00
Robin Voetter
0159fa284a
Make std.sort.min and std.sort.max return ?T
2019-12-04 18:10:20 +01:00
Robin Voetter
65f57e4499
Make std.sort.max accept const slices and add tests
2019-12-04 16:42:18 +01:00
Robin Voetter
6bb0ee0bc4
Add std.sort.isSorted
2019-12-04 16:41:32 +01:00
Benjamin Feng
a6f838aab2
Remove redundant alloc
2019-12-04 00:10:37 -06:00
Benjamin Feng
01e73bba8d
Tighten recycled search
2019-12-04 00:08:09 -06:00
Benjamin Feng
baffaf7986
Extract setBits
2019-12-04 00:07:52 -06:00
Benjamin Feng
b33211ed51
Implement block-based skipping
2019-12-03 17:24:50 -06:00
Andrew Kelley
521744bb91
correct the calling convention of WinMainCRTStartup
2019-12-03 16:55:27 -05:00
Andrew Kelley
8db4d2332e
correct startup logic for exporting libc main
2019-12-03 13:10:26 -05:00
Andrew Kelley
a91f552393
WinMainCRTStartup implies defaulting to console subsystem
2019-12-03 12:52:28 -05:00
Andrew Kelley
6a046c1bcd
activate start code when pub main exists
...
and rename LinkType->LinkMode, OutType->OutputMode
2019-12-03 12:50:42 -05:00
Vexu
621c08e692
exported main must be pub
2019-12-03 12:50:42 -05:00
Vexu
a0ca30ce01
move more startup code to std lib
2019-12-03 12:50:18 -05:00
Benjamin Feng
45e0441278
Fix bugs
2019-12-02 22:04:09 -06:00
LemonBoy
26c8930b95
Accept comptime-known expression for asm
2019-12-02 19:53:06 -05:00
Andrew Kelley
b7be57766b
Merge pull request #3715 from daurnimator/towards-afd
...
Misc windows additions+fixes
2019-12-02 16:12:55 -05:00
Andrew Kelley
55202a021a
add missing license files
2019-12-02 16:02:03 -05:00
Andrew Kelley
6a36c549a8
add extra LICENSE file for clarification
2019-12-02 15:11:11 -05:00
Andrew Kelley
ad214c7aa0
bring your own OS layer in the std lib
...
closes #3784
2019-12-02 15:02:17 -05:00
Andrew Kelley
dcbd5ad155
remove upstream support for Zen hobby OS
...
The new plan to support hobby operating systems is #3784 .
And what kind of name is "Zen" anyway? There's already a
[Zen programming language](http://zenlang.sourceforge.net/ )
and that's just confusing.
2019-12-02 12:01:49 -05:00
Benjamin Feng
f32555aa08
Work around __heap_base for now
2019-12-02 09:59:20 -06:00
Benjamin Feng
ba38a6d122
Get stuff vaguely working
2019-12-02 09:59:20 -06:00
Benjamin Feng
eb1628b033
Initialize memory segments
2019-12-02 09:59:20 -06:00
Benjamin Feng
eff926b454
Brain dump new wasm allocator
2019-12-02 09:59:20 -06:00
Andrew Kelley
b6127b0fe9
add some null-termination annotations
...
closes #3797
2019-12-02 01:13:46 -05:00
Andrew Kelley
3644e85091
fix regressions on windows
2019-12-01 21:31:00 -05:00
Andrew Kelley
4af5c38674
fixes for self-hosted compiler
2019-12-01 19:22:03 -05:00
Andrew Kelley
b36c07a95a
Merge remote-tracking branch 'origin/master' into remove-array-type-coercion
2019-12-01 09:56:01 -05:00
Andrew Kelley
951dc451d6
Merge pull request #3808 from LemonBoy/i386-for-ya
...
linux-i386 support
2019-11-30 22:00:00 -05:00
Andrew Kelley
2e7350140d
further clarify std.fs function docs
2019-11-30 18:36:47 -05:00
Andrew Kelley
034ccb4e4e
add missing error code handling on Windows
2019-11-30 16:58:32 -05:00
Andrew Kelley
413f9a5cfc
move `std.fs.Dir.cwd` to `std.fs.cwd`
...
update to non-deprecated std.fs APIs throughout the codebase
Related: #3811
2019-11-30 15:35:27 -05:00
Andrew Kelley
d039fed831
introduce std.fs.Dir.openFile and std.fs.Dir.createFile
...
These functions have flags parameters which cover all the use cases. The
other functions are now deprecated.
2019-11-30 13:32:11 -05:00
LemonBoy
e1e06e6766
linux-i386 support
2019-11-30 16:13:33 +01:00
Andrew Kelley
b220be7a33
more test regression fixes
2019-11-29 23:04:19 -05:00
Andrew Kelley
d87b13f2f7
fix windows std lib regressions
2019-11-29 21:55:27 -05:00
Andrew Kelley
2ab7f31e99
std.math: remove constants that should be expressions
...
All four of these can be represented in fewer characters with
expressions, which will be guaranteed to happen at compile-time, and
have the same or better precision.
The other math constants here which depend on function calls could be
similarly removed if and when #425 is solved. However I left them for
now since Zig does not eagerly evaluate functions with comptime parameters.
2019-11-29 10:48:46 -05:00
Quetzal Bradley
a6c9c5f767
implement correct buffer wrapping logic in std.event.Channel
2019-11-27 23:09:24 -05:00
Michael Dusan
ca61a5f0b7
Windows: fix test/standalone/shared_library
...
- on Windows use first found env var { "Path", "PATH" }
Bug Description: `build test` results in the following error on in
a msys64 shell with "PATH" env var instead of "Path":
error while loading shared libraries: mathtest.dll:
cannot open shared object file: No such file or directory
2019-11-27 19:24:06 -05:00
Felix Queißner
f0d6447569
Implements std.testing.expectEqual for tagged unions. ( #3773 )
2019-11-27 16:35:32 -05:00
Andrew Kelley
0f2a9af4aa
Merge pull request #3769 from MCRusher/initcapacity-for-buffer-arraylist
...
Add initCapacity for buffer & arraylist
2019-11-27 13:40:39 -05:00
Andrew Kelley
83c664eaa0
Merge pull request #3780 from Vexu/stage2-async-review
...
Update use of async functions in self hosted compiler
2019-11-27 13:38:49 -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
Vexu
4d8a8e65df
add more workarounds
2019-11-27 10:17:37 +02:00
daurnimator
8a71f77c4a
std: lie about windows socklen_t signed-ness
2019-11-27 13:01:34 +11:00
daurnimator
edc84e7ef7
std: add more winsock functions
2019-11-27 13:01:33 +11:00
daurnimator
19f26578c0
std: windows sockaddr constants come from ws2_32
2019-11-27 13:01:32 +11:00
daurnimator
8aa3d6019c
std: add windows.USHORT definition
2019-11-27 13:01:30 +11:00
daurnimator
254c79125b
std: fix WSAIoctl definition
...
zig automatically passes functions as pointers
2019-11-27 13:01:28 +11:00
daurnimator
d99f0a2b8f
std: IO_STATUS_BLOCK's status member is an NTSTATUS; add union
2019-11-27 13:01:10 +11:00
daurnimator
1537d4701e
std: fix definition of NtDeviceIoControlFile
2019-11-27 13:01:09 +11:00
daurnimator
a453c99ba9
std: add comments for some nt status codes
2019-11-27 13:01:08 +11:00
daurnimator
2c6788d7de
std: add windows.closesocket
2019-11-27 13:01:07 +11:00
daurnimator
6b5b0e6cd6
std: fix windows.GetOverlappedResult
2019-11-27 13:01:05 +11:00
daurnimator
ce9966a39b
std: improved windows.DeviceIoControl
2019-11-27 13:01:04 +11:00
daurnimator
b05a5a3e52
std: add CreateEvent for windows
2019-11-27 13:01:03 +11:00
daurnimator
78c0d33eb7
std: add WaitForMultipleObjects for windows
2019-11-27 13:01:02 +11:00
daurnimator
21ca54f560
std: add alertable argument for windows.WaitForSingleObject
2019-11-27 13:00:59 +11:00
kprotty
ff445814cb
remove wait timeout test cases
2019-11-26 20:40:28 -05:00
kprotty
056b5a26c9
ResetEvent: get abstime based on std.time
2019-11-26 20:40:28 -05:00
kprotty
ca2d566ec8
replace ThreadParker with ResetEvent + WordLock mutex
2019-11-26 20:40:27 -05:00
kprotty
a0955990dc
fix ResetEvent windows bugs
2019-11-26 20:40:04 -05:00
kprotty
ef208fee3c
Definition fixups & ResetEvent test cases
2019-11-26 20:40:04 -05:00
kprotty
9bce97a479
Start on ResetEvent
2019-11-26 20:40:04 -05:00
syscall0
a6ef83cccf
Fix build system crash when compiling windows dll
2019-11-26 15:40:31 -05:00
Andrew Kelley
7de138ad7c
std.elf: breaking improvements to the API
...
and also integration with std.Target.Arch
2019-11-26 14:25:35 -05:00
Benjamin Feng
aca1367533
Optimize binary search algorithm
2019-11-26 13:09:58 -05:00
Vexu
128034481a
solve recursion in self hosted
2019-11-26 18:25:29 +02:00
Jonathan S
ec569ff26a
Or in O_DIRECTORY in openDirFlagsC to capture the fact that it is intended for opening directories
2019-11-25 23:46:48 -05:00
Jonathan S
8baf226d69
Add missing shortening of os.windows.
2019-11-25 23:46:48 -05:00
Jonathan S
4014a8e4b4
Avoid deprecated cwd-based functions for opening directories, preferring to open explicitly relative to `Dir.cwd()`.
2019-11-25 23:46:48 -05:00
Jonathan S
001334266a
Don't pass `FILE_LIST_DIRECTORY` in `openDirTraverseW`.
2019-11-25 23:46:48 -05:00
Jonathan S
51c5740879
Use a specific access mask in `Dir.openDirListW` instead of a generic one. Untested.
...
The actual desired access mask in this case seems quite confusing and badly documented. The previous combination of `GENERIC_READ` and `SYNCHRONIZE` seems both illegal and redundant according to the [`ntifs.h` documentation](https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-ntcreatefile ), which specifies that `GENERIC_READ` should not be used for directories and includes `SYNCHRONIZE`. `winnt.h` contains a number of relevant-sounding flags such as `FILE_ADD_FILE`, `FILE_ADD_SUBDIRECTORY`, and `FILE_DELETE_CHILD` that do not show up in documentation at all. These are equal in value to file-specific flags that are documented as flags you should not specify when opening a directory.
2019-11-25 23:46:47 -05:00
Jonathan S
07120c8745
Use `O_PATH` where available in `std.fs.Dir.openPathTraverse`.
2019-11-25 23:46:47 -05:00
Jonathan S
17bc1f62a5
Split `std.fs.Dir.openDir` into `openDirList` and `openDirTraverse` to clarify what directories can be iterated. Closes ziglang/zig#3741 .
...
The Windows-inspired nomenclature of "List" and "Traverse" was chosen over POSIX-style "Read" and "Path" (from `O_PATH`) for clarity. Using "Path" makes it look like the function is manipulating strings, and the generic "Read" ending isn't useful when there is no generic read method. Even in implementation details, `read` is never used.
Actual exploitation of the difference between the two functions will come in a later commit.
2019-11-25 23:46:47 -05:00
daurnimator
c0cb676745
std: refactor std/debug.zig DwarfInfo operations to be methods
2019-11-25 22:49:46 -05:00
Andrew Kelley
f8a2dec243
docs: update references to wasm_allocator
2019-11-25 19:30:41 -05:00
Andrew Kelley
4261fa3c49
move logic to the appropriate layers; add new compile error
2019-11-25 18:46:17 -05:00
Andrew Kelley
659c1bdeee
Merge branch 'wasi-run-tests' of https://github.com/fengb/zig into fengb-wasi-run-tests
2019-11-25 17:53:26 -05:00
Andrew Kelley
cb38bd0a14
rename std.heap.direct_allocator to std.heap.page_allocator
...
std.heap.direct_allocator is still available for now but it is marked
deprecated.
2019-11-25 17:25:06 -05:00
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
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
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
Benjamin Feng
0f0d01a037
Replace magic numbers with named constants
2019-11-21 18:41:02 -06: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
Benjamin Feng
d27721f58c
Add .enable_wasmtime build flag
2019-11-20 12:06:21 -06:00
Benjamin Feng
218f9ff34e
Work around WASI's nonexistent @returnAddress()
2019-11-19 20:55:55 -06:00
Benjamin Feng
b88bb93af3
WASI isatty
2019-11-19 20:17:00 -06:00
Benjamin Feng
14e9c7d1f2
WASI clock functions
2019-11-19 19:44:19 -06:00
Benjamin Feng
c3d93cd9f2
WASI time_t / timespec
2019-11-19 16:12:26 -06:00
Benjamin Feng
747529e96b
Use wasm_allocator
2019-11-19 00:31:40 -06: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
Andrew Kelley
4dd3f42972
Merge pull request #3695 from daurnimator/towards-afd
...
Windows definitions
2019-11-17 23:17:48 +00:00
Andrew Kelley
57b8614a5a
Merge pull request #3697 from Vexu/container-docs
...
Implement container level doc comments
2019-11-17 22:31:12 +00:00
Andrew Kelley
8e3370367b
Merge pull request #3705 from daurnimator/fix-std.valgrind
...
std: fix outdated valgrind module
2019-11-17 22:29:17 +00:00
Vexu
6cddf9d723
properly parse anon literal in array
2019-11-17 22:24:21 +00:00
daurnimator
d870a68e68
std: add a couple of tests to valgrind module
2019-11-17 14:16:09 +11:00
daurnimator
7d582d0a00
std: fix missing @ptrToInt in valgrind.memcheck
2019-11-17 14:14:57 +11:00
daurnimator
41c72bb54c
std: fix use of old syntax in std.valgrind.memcheck
2019-11-17 14:14:57 +11:00
daurnimator
cc76494c42
std: use enum literals in valgrind module
2019-11-17 14:14:57 +11:00
daurnimator
4a3bb557f1
std: fix outdated valgrind module
2019-11-17 14:14:57 +11:00
Vexu
977b613881
add container doc comments to generated docs
2019-11-15 15:17:59 +02:00
daurnimator
431eeb5e20
std: add pieces for WSAIoctl on windows
2019-11-15 10:31:52 +11:00
daurnimator
3b8afe31a0
std: add NtDeviceIoControlFile definition for windows
2019-11-15 10:31:51 +11:00
daurnimator
6469900e79
std: add WSAStartup and WSACleanup for windows
2019-11-15 10:31:47 +11:00
Vexu
b92f42d1f4
implemented container doc comments in stage 2
2019-11-14 16:25:06 +02:00
daurnimator
4cf535a01b
std: add WSASocketW for windows
2019-11-14 17:09:22 +11:00
daurnimator
d9d3268cc1
std: add DeviceIoControl and GetOverlappedResult for windows
2019-11-14 17:09:21 +11:00
daurnimator
f4c6cc3270
std: add winsock some definitions
2019-11-14 17:09:19 +11:00
daurnimator
a832b35c19
std: add windows socket constants
...
Taken from https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw
2019-11-14 17:09:17 +11:00
daurnimator
be86e41d97
std: add CTL_CODE function for windows
2019-11-14 17:09:16 +11:00
daurnimator
4830415071
std: add FILE_ANY_ constants for windows
2019-11-14 17:00:09 +11:00
daurnimator
0270545edb
std: add windows ioctl transfer types
2019-11-14 17:00:07 +11:00
daurnimator
ef6cec983c
std: add windows FILE_DEVICE_ defines
2019-11-14 17:00:05 +11:00
Andrew Kelley
0237e7a701
std.io.getStdOut and related fns no longer can error
...
Thanks to the Windows Process Environment Block, it is possible to
obtain handles to the standard input, output, and error streams without
possibility of failure.
2019-11-13 04:01:40 +00:00
Andrew Kelley
8bae70454d
Merge pull request #3675 from Vexu/atomic-store
...
Add @atomicStore builtin
2019-11-13 03:06:55 +00:00
Andrew Kelley
37318bf151
fn parameters participate in result location semantics
...
See #3665
2019-11-12 18:55:17 -05:00
Vexu
f0c94d95dd
use @atomicStore in std lib
2019-11-13 00:52:15 +02:00
Sahnvour
956ba8b0e7
Merge pull request #3447 from Sahnvour/vcpkg
...
build: initial support for using vcpkg libraries
2019-11-12 20:16:01 +01:00
Vexu
5194fc57d1
use enum with atomics in std lib
2019-11-12 17:55:54 +02:00
xackus
6d3b95a708
Stricter tests for non-streaming parser
2019-11-11 23:41:53 +01:00
xackus
f9b7d6d75d
Fix bugs in JSON parser
...
Make comments into documentation where appropriate
2019-11-11 23:25:54 +01:00
xackus
371747d8fb
json: surrogate pair support
...
test json.Parser with tests used for json.Streaming parser
(some don't pass yet)
2019-11-11 22:06:00 +01:00
Andrew Kelley
d4e6a6d5e2
zig fmt: support anon struct and anon list init syntax
2019-11-11 13:12:45 -05:00
Andrew Kelley
5b27943498
implement anon struct literal syntax
...
This implements stage1 parser support for anonymous struct literal
syntax (see #685 ), as well as semantic analysis support for anonymous
struct literals and anonymous list literals (see #208 ). The semantic
analysis works when there is a type coercion in the result location;
inferring the struct type based on the values in the literal is not
implemented yet. Also remaining to do is zig fmt support for this new
syntax and documentation updates.
2019-11-11 13:11:58 -05:00
xackus
739f716108
minor fixes
2019-11-11 19:06:35 +01:00
Andrew Kelley
ae0a219d1f
stop accepting deprecated `use` keyword
...
closes #2591
2019-11-11 13:02:39 -05:00
Felix Queißner
cd5c9c8998
Fix missing @as cast in std.fmt.formatInt ( #3650 )
2019-11-10 23:08:24 +00:00
xackus
f6d124418f
Fix and document
2019-11-10 22:26:42 +01:00
xackus
6d0cdf7cd7
Unescape JSON strings
2019-11-10 22:05:03 +01:00
Andrew Kelley
d44a69689e
std.ChildProcess.spawn has a consistent error set
...
across targets. Also fix detection of pkg-config not
installed on Windows when using zig build.
2019-11-10 15:40:27 -05:00
Andrew Kelley
891e2149b0
Merge pull request #3635 from lun-4/unify-unix-sockets
...
std.net: add unix socket support to Address and StreamServer
2019-11-10 20:40:19 +00:00