Commit Graph

191 Commits (51852d2587b931767a12d42ce39d5c191eea10ea)

Author SHA1 Message Date
Andrew Kelley 51852d2587 fix windows 2018-08-21 16:07:28 -04:00
Andrew Kelley bda5539e9d *WIP* std.os assumes comptime-known max path size
this allows us to remove the requirement of allocators for a lot
of functions

See #1392
2018-08-21 00:46:42 -04:00
Andrew Kelley 302936309a Merge branch 'path_max' of https://github.com/shawnl/zig into shawnl-path_max 2018-08-20 17:57:49 -04:00
Andrew Kelley 9e9dce76ff refactor std.os.makePath to use a switch instead of if 2018-08-20 17:57:03 -04:00
Shawn Landden bb93886791 do not use an allocator when we don't need to because of the existance of PATH_MAX 2018-08-19 21:42:48 -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 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 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
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 65140b2fba Merge remote-tracking branch 'origin/master' into async-fs 2018-08-02 17:29:31 -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 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 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
Andrew Kelley 3c8d4e04ea std: file system watching for linux 2018-07-30 13:46:09 -04:00
Andrew Kelley cc45527333 introduce std.event.fs for async file system functions
only works on linux so far
2018-07-30 13:44:36 -04:00
Andrew Kelley 20f286f22a re-organize std lib darwin files 2018-07-22 00:04:24 -04:00
Andrew Kelley cd488c9da5 fix std.os.getAppDataDir test on linux 2018-07-18 10:45:17 -04:00
Andrew Kelley a8a1b5af07 fix build on windows
* move getAppDataDir and utf16leToUtf8 from self-hosted to std lib
 * fix std.event.Loop on windows
2018-07-18 10:07:22 -04:00
Andrew Kelley 3f4d0ecd7e Merge remote-tracking branch 'origin/master' into m-n-threading 2018-07-09 17:14:42 -04:00
Andrew Kelley 9462852433 std.event.Loop multithreading for windows using IOCP 2018-07-09 16:49:46 -04:00
Andrew Kelley caa0085057 implement std.os.cpuCount for windows 2018-07-09 13:19:11 -04:00
Andrew Kelley 05f1ea33d2 ZIG_DEBUG_COLOR=1 overrides tty detection for runtime stack traces 2018-07-09 12:12:37 -04:00
Andrew Kelley a0c564d762 zig fmt 2018-07-09 01:23:47 -04:00
Andrew Kelley 04d3da4bd1 std.os.cpuCount implementation for macos 2018-07-09 01:08:33 -04:00
Andrew Kelley 50d70d5f49 tests passing with kqueue on macos 2018-07-08 02:46:10 -04:00
Andrew Kelley c15a6fa9d0 add std.os.cpuCount and have std.event.Loop use it for thread pool size 2018-07-07 01:23:18 -04:00
Andrew Kelley eb326e1553 M:N threading
* add std.atomic.QueueMpsc.isEmpty
 * make std.debug.global_allocator thread-safe
 * std.event.Loop: now you have to choose between
   - initSingleThreaded
   - initMultiThreaded
 * std.event.Loop multiplexes coroutines onto kernel threads
 * Remove std.event.Loop.stop. Instead the event loop run() function
   returns once there are no pending coroutines.
 * fix crash in ir.cpp for calling methods under some conditions
 * small progress self-hosted compiler, analyzing top level declarations
 * Introduce std.event.Lock for synchronizing coroutines
 * introduce std.event.Locked(T) for data that only 1 coroutine should
   modify at once.
 * make the self hosted compiler use multi threaded event loop
 * make std.heap.DirectAllocator thread-safe

See #174

TODO:
 * call sched_getaffinity instead of hard coding thread pool size 4
 * support for Windows and MacOS
 * #1194
 * #1197
2018-07-07 00:32:19 -04:00
Andrew Kelley 85f928f8bf remove std.mem.Allocator.construct and other fixups 2018-06-20 17:33:29 -04:00
Andrew Kelley e891f9cd9d zig fmt 2018-06-20 17:16:27 -04:00
kristopher tate 71db8df548 std: update stdlib to match updated allocator create signature; ref #733 2018-06-21 00:40:21 +09:00
Andrew Kelley a430853a48 standard library fixes 2018-06-18 17:43:01 -04:00
Andrew Kelley 7912061226 remove integer and float casting syntax
* add `@intCast`
 * add `@floatCast`
 * add `@floatToInt`
 * add `@intToFloat`

See #1061
2018-06-17 02:57:07 -04:00
Andrew Kelley 48de57d824 add basic std lib code for loading dynamic libraries
this is going to only work for very basic libraries;
I plan to slowly add more features over time to support more
complicated libraries
2018-06-16 17:01:23 -04:00
Andrew Kelley cdf1e366f9 fix build on windows, broken by previous commit 2018-06-14 16:36:07 -04:00
Andrew Kelley 6943cefebf std.os.path.dirname: return null instead of empty slice
for when there is no directory component. Makes it harder
to write bugs.

closes #1017
2018-06-14 16:15:32 -04:00
Andrew Kelley 7580e39b38 zig fmt 2018-06-12 02:18:11 -04:00
Andrew Kelley 3dd9af9948 implement std.os.Dir for windows
improve std.os.File.access so that it does not depend on shlwapi.dll

closes #1084
2018-06-12 01:57:09 -04:00
Andrew Kelley 77678b2cbc
breaking syntax change: orelse keyword instead of ?? (#1096)
use the `zig-fmt-optional-default` branch to have zig fmt
automatically do the changes.

closes #1023
2018-06-10 01:13:51 -04:00
Andrew Kelley ec1b6f6673
breaking syntax change: ??x to x.? (#1095)
See #1023

This also renames Nullable/Maybe to Optional
2018-06-09 23:42:14 -04:00
Andrew Kelley 652f4bdf62 disallow unknown-length pointer to opaque
This also means that translate-c has to detect when a pointer to
opaque is happening, and use `*` instead of `[*]`.

See #1059
2018-06-05 18:03:21 -04:00
Andrew Kelley e53b683bd3
Pointer Reform: proper slicing and indexing (#1053)
* enable slicing for single-item ptr to arrays
 * disable slicing for other single-item pointers
 * enable indexing for single-item ptr to arrays
 * disable indexing for other single-item pointers

see #770
closes #386
2018-06-04 22:11:14 -04:00
Andrew Kelley 96164ce613 disallow single-item pointer indexing
add pointer arithmetic for unknown length pointer
2018-06-04 01:39:57 -04:00
Andrew Kelley fcbb7426fa use * for pointer type instead of &
See #770

To help automatically translate code, see the
zig-fmt-pointer-reform-2 branch.

This will convert all & into *. Due to the syntax
ambiguity (which is why we are making this change),
even address-of & will turn into *, so you'll have
to manually fix thes instances. You will be guaranteed
to get compile errors for them - expected 'type', found 'foo'
2018-05-31 17:28:07 -04:00
Andrew Kelley ea58f4a5a9 run zig fmt on the codebase 2018-05-30 16:09:11 -04:00