emekoi
d3bf267136
added dynamic library loading for windows
2018-09-30 01:05:13 -05:00
Andrew Kelley
9485043b3c
fix implicit casting to *c_void
...
closes #1588
also some small std lib changes regarding posix sockets
and one doc typo fix
2018-09-26 11:06:09 -04:00
Wink Saville
a170a64776
Fix typo in argsAlloc comment
...
Changed freeArgs to argsFree.
2018-09-23 13:12:57 -04:00
Andrew Kelley
15e59eb142
remove deprecated, unused windows functions
...
* `CryptAcquireContextA`
* `CryptReleaseContext`
* `CryptGenRandom`
See https://github.com/ziglang/zig/issues/534#issuecomment-422208368
2018-09-17 20:07:48 -04:00
Andrew Kelley
c06a61e9bf
remove this
. add @This()
.
...
closes #1283
2018-09-13 16:34:33 -04:00
Andrew Kelley
a757533386
fix zig fmt on windows
...
closes #1069
2018-09-12 14:26:21 -04:00
emekoi
54f7d58722
fixed WriteFile segfault
2018-09-12 07:01:48 -05:00
Andrew Kelley
7dd3c3814d
fix incorrect error union const value generation
...
closes #1442
zig needed to insert explicit padding into this structure before
it got bitcasted.
2018-09-11 15:16:50 -04:00
Shawn Landden
17cb69cebc
fix elf auxv handling
...
Auxillery vectors are not guaranteed to be in any order, this
just happens to work on x86_64.
2018-09-08 14:47:21 +00:00
Shawn Landden
cba0d76fbc
clone() on arm64
2018-09-08 03:52:28 +00:00
Shawn Landden
342cff28f5
initial arm64 support
2018-09-08 03:52:28 +00:00
Shawn Landden
4a8c992ef1
os: use less syscalls
...
these don't exist on new platforms (such as arm64)
also switch from the deprecated dirent to dirent64
2018-09-08 03:52:28 +00:00
Shawn Landden
d956d30167
this is not arch-specific
2018-09-08 03:52:28 +00:00
Andrew Kelley
92f7474359
switch most windows calls to use W versions instead of A
...
See #534
2018-09-02 23:25:04 -04:00
Andrew Kelley
832caefc2a
fix regressions
2018-09-02 18:35:32 -04:00
Andrew Kelley
98dc943c07
rework code to avoid duplicate operations
2018-09-02 15:58:08 -04:00
Andrew Kelley
686663239a
printing info from the ModuleInfo substream of DebugInfo
2018-08-29 19:00:24 -04:00
Andrew Kelley
f1b71053de
use RtlCaptureStackBackTrace on windows
2018-08-29 16:35:51 -04:00
Andrew Kelley
41723f842c
Merge branch 'windows-coff-issue721' of https://github.com/Sahnvour/zig into Sahnvour-windows-coff-issue721
2018-08-28 17:32:32 -04:00
Andrew Kelley
fb6d3859e8
zig fmt
2018-08-27 19:25:40 -04:00
Andrew Kelley
ac36f98e72
fix stack traces on linux
2018-08-25 03:07:37 -04:00
Andrew Kelley
478db39866
fix selfExePath on macosx
2018-08-21 20:52:21 -04:00
Andrew Kelley
ea1b21dbdb
fix linux
...
* error.BadFd is not a valid error code. it would always be a bug to
get this error code.
* merge error.Io with existing error.InputOutput
* merge error.PathNotFound with existing error.FileNotFound.
Not all OS's support both.
* add os.File.openReadC
* add error.BadPathName for windows file operations with invalid
characters
* add os.toPosixPath to help stack allocate a null terminating byte
* add some TODOs for other functions to investigate removing the
allocator requirement
* optimize some implementations to use the alternate functions when
a null byte is already available
* add a missing error.SkipZigTest
* os.selfExePath uses a non-allocating API
* os.selfExeDirPath uses a non-allocating API
* os.path.real uses a non-allocating API
* add os.path.realAlloc and os.path.realC
* convert many windows syscalls to use the W versions (See #534 )
2018-08-21 20:31:50 -04:00
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
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
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
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
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
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
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
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
72599d420b
self-hosted: find all libc paths; windows linker code
2018-07-24 00:06:34 -04:00
Andrew Kelley
5a919dd82d
Merge remote-tracking branch 'origin/master' into self-hosted-libc-hello-world
2018-07-23 14:32:13 -04:00
Andrew Kelley
d767fae47e
self-hosted: add first compare-output test
2018-07-23 00:35:53 -04:00
Andrew Kelley
20f286f22a
re-organize std lib darwin files
2018-07-22 00:04:24 -04:00
Sahnvour
2ec9a11646
Very much WIP base implementation for #721 .
...
Currently does:
- read COFF executable file
- locate and load corresponding .pdb file
- expose .pdb content as streams (PDB format)
2018-07-21 20:30:11 +02:00
kristopher tate
460c266216
std.os.posix: Add SOCK_* for darwin;
...
Tracking issue #1271 ;
2018-07-21 19:15:03 +09:00
kristopher tate
8062afcb31
std.os.posix: Add SYSPROTO_* for darwin;
...
Tracking issue #1271 ;
2018-07-21 19:14:40 +09:00
kristopher tate
7ef110b484
std.os.posix: Add AF_* for darwin;
...
Tracking issue #1271 ;
2018-07-21 19:14:14 +09:00
Andrew Kelley
58c5f94a99
self-hosted: share C++ code for finding libc on windows
2018-07-20 23:38:13 -04:00
Jimmi HC
1f4c7d5ebf
Fixed windows getPos
2018-07-20 23:05:53 +02:00
Andrew Kelley
0736e6aa34
std.os.File: add missing pub modifiers
2018-07-19 13:06:13 -04:00
Andrew Kelley
3e4a3fa5b7
self-hosted: find libc on linux
2018-07-18 17:43:36 -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
3bb00eac37
self-hosted: implement getAppDataDir for windows
2018-07-17 00:01:36 -04:00
Andrew Kelley
e9a03cccf3
all integer sizes are available as primitives
...
* fix wrong implicit cast for `@IntType` bit_count parameter.
* fix incorrect docs for `@IntType` bit_count parameter.
closes #1242
closes #745
closes #1240
2018-07-16 10:53:15 -04:00
Andrew Kelley
ac096c2949
zig fmt
2018-07-12 19:24:32 -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
626b73e8be
remove error to/from int casting syntax; add @errorToInt
/@intToError
...
See #1061
2018-06-18 18:48:29 -04:00
Andrew Kelley
a430853a48
standard library fixes
2018-06-18 17:43:01 -04:00
Andrew Kelley
1aafbae5be
remove []u8 casting syntax. add @bytesToSlice
and @sliceToBytes
...
See #1061
2018-06-18 17:25:29 -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
3ee4d23ebd
posix read can return error.IsDir
2018-06-16 19:54:16 -04:00
Sahnvour
f47655eb6d
pointer reform: missed change in windows specific code.
2018-06-16 23:47:51 +02: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
b11c5d8f82
fix std.os.windows.PathFileExists specified in the wrong DLL ( #1066 )
...
closes #1054
2018-06-06 15:36:47 -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
11e7e03139
Merge branch 'zig-custom-format' of https://github.com/tgschultz/zig into tgschultz-zig-custom-format
...
I removed the code that checks for type signature and type.
A function named `format` is enough for zig to give it a try.
2018-06-04 11:06:55 -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
e29d12d821
fix incorrect address-of syntax on windows
2018-06-01 01:29:34 -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
tgschultz
940a854448
Fix MacOS CI Timer test failing...?
2018-05-30 13:38:41 -05:00
Andrew Kelley
d172e3f3bb
fix AtomicFile for relative paths
...
closes #1017
2018-05-29 17:38:50 -04:00
Andrew Kelley
0c16cd2d0e
run zig fmt on the codebase
...
See #1003
2018-05-29 04:23:38 -04:00
Andrew Kelley
43085417be
update github.com/zig-lang to github.com/ziglang
2018-05-24 21:27:44 -04:00
Andrew Kelley
288fc3a8d3
convert more std lib files to postfix pointer deref
2018-05-16 00:43:28 -04:00
Andrew Kelley
86a352c45b
Merge branch 'master' into pointer-reform
2018-05-13 13:38:03 -04:00
Andrew Kelley
4277762b74
fix windows build system
...
broken by 6e821078f6
2018-05-11 23:04:41 -04:00
Andrew Kelley
4787127cf6
partial conversion to post-fix pointer deref using zig fmt
2018-05-10 00:29:49 -04:00
Andrew Kelley
6928badd85
Merge branch 'master' into pointer-reform
2018-05-09 23:43:07 -04:00
Andrew Kelley
86a428a4a5
windows threading: add missing call to CloseHandle
2018-05-02 10:03:58 -04:00
Andrew Kelley
ac4d55dec1
behavior tests passing with new pointer deref syntax
2018-05-01 01:53:04 -04:00
Andrew Kelley
e14db23661
run zig fmt on std/os/index.zig
2018-04-30 01:03:38 -04:00
Andrew Kelley
39befc35a8
update comment in std/os/index.zig
2018-04-29 22:31:42 -04:00
Andrew Kelley
f37e79e720
Merge pull request #963 from zig-lang/atomic-stack-and-queue
...
Atomic stack and queue
2018-04-29 12:29:40 -04:00
Andrew Kelley
c76b0a845f
fix std threads for linux
2018-04-29 02:56:59 -04:00
Andrew Kelley
b21bcbd775
fix std threads for macos
2018-04-29 02:52:04 -04:00
Andrew Kelley
6376d96824
support kernel threads for windows
...
* remove std.os.spawnThreadAllocator - windows does not support
an explicit stack, so using an allocator for a thread stack
space does not work.
* std.os.spawnThread - instead of accepting a stack argument, the
implementation will directly allocate using OS-specific APIs.
2018-04-29 02:40:22 -04:00
Andrew Kelley
bf8e419d2b
linux uses pthreads when linking against libc
2018-04-29 00:40:04 -04:00
Andrew Kelley
a425420993
make pthreads threads work on darwin
...
darwin pthreads adds a restriction that the stack start and end
must be page aligned
2018-04-29 00:07:32 -04:00
Andrew Kelley
998e25a01e
pthread support working
2018-04-28 23:47:39 -04:00
Andrew Kelley
a344cb03bc
*WIP* use pthreads when linking libc
2018-04-28 23:30:13 -04:00
Andrew Kelley
ec2a81a081
fix compiler-rt ABI for x86_64 windows
2018-04-28 22:03:07 -04:00
Andrew Kelley
21767144fc
linux: support VDSO for clock_gettime
...
also fix a compiler crash when using cmpxchg with nullable pointer
2018-04-22 18:11:50 -04:00
Andrew Kelley
da2af9c613
fixups
2018-04-22 13:36:26 -04:00
Andrew Kelley
0dcadc61b4
Merge branch 'std.os.time' of https://github.com/tgschultz/zig into tgschultz-std.os.time
2018-04-22 13:24:25 -04:00
tgschultz
ca4053ba49
Use std.os.errorUnexpectedPosix if timer initialization encounters unexpected error
2018-04-19 14:53:58 -05:00
tgschultz
89eade0548
Style cleanups, u64 casts, Timer.start returns error instead of unreachable on unexpected errno.
2018-04-19 10:01:41 -05:00
tgschultz
3c9b6f8cd5
Fixed another incorrect comment
2018-04-18 19:57:47 -05:00
tgschultz
fdebe38fa3
Added notes regarding CLOCK_MONOTONIC_RAW and made it easy to change our mind in the future.
...
Updated std.os imported tests' block with lazy declaration workaround and added time.zig.
Corrected some incorrect comments.
2018-04-18 19:48:19 -05:00
tgschultz
5c83d271a3
Fixed incorrect sign on epoch.clr
2018-04-18 18:50:28 -05:00
tgschultz
7cfe328a16
fixed typos.
2018-04-18 17:43:35 -05:00
tgschultz
bf9cf28322
Fixed compiler errors around darwin code.
2018-04-18 15:46:50 -05:00
tgschultz
8b66dd8c7d
Added unstaged changes.
2018-04-18 13:55:42 -05:00
tgschultz
c90f936eef
Added timestamp, high-perf. timer functions.
2018-04-18 13:52:25 -05:00
Andrew Kelley
b9360640ce
add @atomicLoad builtin
...
See #174
2018-04-15 18:12:00 -04:00
Andrew Kelley
b7af9edb8a
add std.os.createThread
...
this adds kernel thread support to the standard library for
linux.
See #174
2018-04-14 02:24:05 -04:00
Andrea Orru
06614b3fa0
Merge branch 'master' into zen_stdlib
2018-04-13 11:11:21 -07:00
Andrea Orru
d2c672ab0c
FIXME note
2018-04-13 11:10:36 -07:00
Marc Tiehuis
fe9489ad63
Fix windows access check
2018-04-13 22:50:57 +12:00
Marc Tiehuis
03bec631bd
Replace File.exists with File.access
2018-04-13 21:27:09 +12:00
Andrea Orru
c5f088e52c
Pass up to 5 arguments in Zen IPC
2018-04-12 22:24:57 -07:00