tgschultz
fa955f0024
fixed handling of [*]u8 when no format specifier is set
...
If fmt was called on with a [*]u8 or [*]const u8 argument, but the fmt string did not specify 's' to treat it as a string, it produced a compile error due to accessing index 1 of a 0 length slice.
2018-08-14 12:56:41 -05:00
Shawn Landden
64a71be5c3
rb: some style fixes
...
avoid @import("std") as is the custom
compare function name
2018-08-10 21:46:30 -07:00
Andrew Kelley
c4b9466da7
Merge pull request #1294 from ziglang/async-fs
...
introduce std.event.fs for async file system functions
2018-08-10 15:51:17 -04:00
Andrew Kelley
598e80957e
windows: call CancelIo when canceling an fs watch
2018-08-10 13:19:07 -04:00
Andrew Kelley
23af36c54f
windows fs watching: fix not initializing table value
2018-08-09 21:48:25 -04:00
Andrew Kelley
26a842c264
windows: only create io completion port once
2018-08-09 20:12:46 -04:00
Andrew Kelley
b219feb3f1
initial windows implementation of std.event.fs.Watch
2018-08-09 16:48:44 -04:00
Andrew Kelley
c63ec9886a
std.event.fs.preadv windows implementation
2018-08-08 16:55:19 -04:00
Andrew Kelley
8b456927be
std.event.fs.pwritev windows implementation
...
also fix 2 bugs where the function didn't call allocator.shrink:
* std.mem.join
* std.os.path.resolve
2018-08-08 15:06:32 -04:00
Andrew Kelley
ac12f0df71
fix linux regressions
2018-08-07 22:23:26 -04:00
Andrew Kelley
60955feab8
std.event.fs.Watch distinguishes between Delete and CloseWrite on darwin
...
TODO: after 1 event emitted for a deleted file, the file is no longer
watched
2018-08-07 22:14:30 -04:00
Andrew Kelley
5cbfe392be
implement std.event.fs.Watch for macos
2018-08-07 21:06:21 -04:00
Shawn Landden
a583beb76c
mem: use pub on Compare ( #1352 )
...
fixes rb
/home/shawn/git/zig/std/rb.zig:133:37: error: 'Compare' is private
compare_fn: fn(*Node, *Node) mem.Compare,
2018-08-07 19:15:11 -04:00
Andrew Kelley
034363a86c
Merge pull request #1338 from shawnl/master
...
std: add red-black tree implementation
2018-08-07 12:47:28 -04:00
Shawn Landden
bbbb26f4d3
mem: add mem.compare(), and use it for mem.lessThan()
2018-08-07 05:30:54 -07:00
Shawn Landden
86b512c5cd
mem: move enum Compare from rb to mem
2018-08-07 04:57:41 -07:00
Shawn Landden
5d2abf4402
std: add red-black tree implementation
...
This is to be used with @fieldParentPtr();
Example:
const rb = @import("std").rb;
const Number = struct {
node: rb.Node,
value: i32,
};
fn number(node: *rb.Node) *Number {
@fieldParentPtr(Number, "node", node);
}
fn compare(l: *rb.Node, r: *rb.Node) rb.Compare {
var left = number(l);
var right = number(r);
if (left.value < right.value) {
return rb.Compare.LessThan;
} else if (left.value == right.value) {
return rb.Compare.Equal;
} else if (left.value > right.value) {
return rb.Compare.GreaterThan;
}
unreachable;
}
--
A version that caches rb.Tree.first() could be added in the future.
2018-08-06 22:18:44 -07:00
Andrew Kelley
1a28f09684
fix hash map test
2018-08-07 00:54:19 -04:00
Andrew Kelley
fd50a6896b
std.event.fs support for macos
...
The file I/O stuff is working, but the fs watching
stuff is not yet.
2018-08-07 00:49:09 -04:00
Andrew Kelley
2c9ed664dd
merge @kristate's std lib changes to darwin
2018-08-06 19:36:31 -04:00
Andrew Kelley
97be8debab
std.HashMap.autoHash: use xor instead of wrapping mult
2018-08-06 19:09:22 -04:00
Andrew Kelley
24d74cbf44
fix Thread impl on Linux and add docs
2018-08-06 17:31:52 -04:00
Andrew Kelley
d2dd29e80c
separate os.Thread.Id and os.Thread.Handle because of windows
2018-08-06 17:25:24 -04:00
Andrew Kelley
0a3ae9dc6e
fix std.os.Thread.getCurrentId for linux
2018-08-06 16:48:49 -04:00
Andrew Kelley
647fd0f4f1
Merge branch 'threadid' of https://github.com/mdsteele/zig into mdsteele-threadid
2018-08-06 16:12:37 -04:00
Andrea Orru
79d77faebf
More type cast fixes
2018-08-06 02:42:12 -04:00
Andrea Orru
641066d82e
Fix casts
2018-08-06 02:29:11 -04:00
Andrea Orru
d2f5e57b68
Merge branch 'master' into zen_stdlib
2018-08-06 01:43:19 -04:00
Matthew D. Steele
7a2401ef1e
Don't compare ?Thread.Id == Thread.Id in the test
...
It doesn't work, because of issue #1332 .
2018-08-04 21:47:13 -04:00
kristopher tate
a25824e033
zig/std/os/index.zig: clean-up thread id; ( #1 )
...
Ref #1316 #1330
2018-08-04 14:38:51 -04:00
Matthew D. Steele
86d1cc8e2f
Add thread ID support to std.os.Thread ( fixes #1316 )
2018-08-03 21:36:04 -04:00
Andrew Kelley
2680f9ab48
Merge remote-tracking branch 'origin/master' into async-fs
2018-08-03 18:47:30 -04:00
Andrew Kelley
c5f1925bc8
when decls don't change, don't regenerate them
2018-08-03 17:59:11 -04:00
Andrew Kelley
5dfcd09e49
self-hosted: watch files and trigger a rebuild
2018-08-03 17:22:17 -04:00
Matthew D. Steele
dcaaa241df
Fix a type error in std.os.linux.getpid() ( #1326 )
...
syscall0() returns usize, but we were trying to @bitCast to i32.
2018-08-03 11:45:23 -04:00
Matthew D. Steele
c2a08d7c51
Fix the start-less-than-end assertion in std.rand.Random.range ( #1325 )
...
The function returns a value in [start, end), but was asserting
start <= end instead of start < end. With this fix, range(1, 1)
will now assertion error instead of dividing by zero.
2018-08-03 11:44:39 -04:00
Andrew Kelley
7f6e97cb26
fixups from the merge
2018-08-02 17:36:08 -04:00
Andrew Kelley
65140b2fba
Merge remote-tracking branch 'origin/master' into async-fs
2018-08-02 17:29:31 -04:00
Andrew Kelley
821805aa92
WIP: Channel.getOrNull
2018-08-02 17:04:17 -04:00
Andrew Kelley
895f262a55
pull request fixups
...
* clean up parser code
* fix stage2 parse and render code
* remove redundant test
* make stage1 compile tests leaner
2018-08-02 14:15:31 -04:00
Andrew Kelley
44fd3045ce
Merge branch 'handle-builtin-issue1296' of https://github.com/kristate/zig into kristate-handle-builtin-issue1296
2018-08-02 13:37:24 -04:00
Andrew Kelley
729f2aceb0
fix API of RtlGenRandom
2018-08-02 13:34:31 -04:00
Andrew Kelley
cbca434cf0
Merge branch 'windows-RtlGenRandom-issue1318' of https://github.com/kristate/zig into pr-1319
2018-08-02 13:26:02 -04:00
kristopher tate
782043e2e6
std/os/windows/util.zig: SKIP instead of PASS on non-windows systems;
...
Tracking Issue #1318 ;
2018-08-03 02:16:49 +09:00
kristopher tate
dde7eb45c5
std/os/index.zig: call getRandomBytes() twice and compare;
...
Tracking Issue #1318 ;
2018-08-03 02:16:19 +09:00
kristopher tate
c44653f40f
std/os/index.zig: swap CryptGetRandom() with RtlGenRandom();
...
Tracking Issue #1318 ;
2018-08-03 02:14:52 +09:00
kristopher tate
22fd359e2c
std/os/windows/advapi32.zig: add SystemFunction036;
...
Tracking Issue #1318 ;
2018-08-03 02:14:06 +09:00
kristopher tate
432b7685bf
std/os/index.zig: use "hw.logicalcpu" instead of "hw.ncpu" in macOS; ( #1317 )
...
Tracking Issue #1252 ;
hw.ncpu was deprecated in macOS. Among 4 new options available (hw.{physicalcpu, physicalcpu_max, logicalcpu, logicalcpu_max}), hw.logicalcpu was chosen because it actually reflects the number of logical cores the OS sees.
2018-08-02 12:59:59 -04:00
kristopher tate
96a94e7da9
std/event: directly return @handle();
...
Tracking Issue #1296 ;
2018-08-02 17:52:40 +09:00
kristopher tate
bc032a89cc
std/zig/parser_test.zig: update test to reflect that the promise symbol is no in scope with suspend;
...
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00