Commit Graph

185 Commits

Author SHA1 Message Date
Henry Wu
f756d875b1 generated docs: vertically align fns with comments 2019-10-27 15:11:36 -04:00
Andrew Kelley
4a57913ca0
std.target: use mem instead of std.mem 2019-10-27 14:27:20 -04:00
Benoit Giannangeli
73c4a5f186 lib/std/target.zig: Added missing 'mem' constant 2019-10-27 14:26:25 -04:00
Luna
d4e41c5bc6 std: make addr_size parameter be a pointer to socklen_t
removes ptrCast
2019-10-26 22:05:17 -03:00
Luna
bf16fc210b fix std.os.accept4
- add WouldBlock to list of errors in AcceptError
 - ptrCast addr_size to the system's socklen_t, instead of assuming it's
    usize
2019-10-26 22:00:50 -03:00
Andrew Kelley
55c282ed51
os.dup2: handle EBAF 2019-10-24 21:13:05 -04:00
Andrew Kelley
60cd11bd4b
get rid of std.os.foo.is_the_target
It had the downside of running all the comptime blocks and resolving
all the usingnamespaces of each system, when just trying to discover if
the current system is a particular one.

For Darwin, where it's nice to use `std.Target.current.isDarwin()`, this
demonstrates the utility that #425 would provide.
2019-10-24 01:14:52 -04:00
Andrew Kelley
8591731f2b
refAllDecls in a test block to limit when it gets run 2019-10-24 00:32:18 -04:00
Andrew Kelley
17eb24a7e4
move types from builtin to std
* All the data types from `@import("builtin")` are moved to
  `@import("std").builtin`. The target-related types are moved
  to `std.Target`. This allows the data types to have methods, such as
  `std.Target.current.isDarwin()`.
 * `std.os.windows.subsystem` is moved to
   `std.Target.current.subsystem`.
 * Remove the concept of the panic package from the compiler
   implementation. Instead, `std.builtin.panic` is always the panic
   function. It checks for `@hasDecl(@import("root"), "panic")`,
   or else provides a default implementation.

This is an important step for multibuilds (#3028). Without this change,
the types inside the builtin namespace look like different types, when
trying to merge builds with different target settings. With this change,
Zig can figure out that, e.g., `std.builtin.Os` (the enum type) from one
compilation and `std.builtin.Os` from another compilation are the same
type, even if the target OS value differs.
2019-10-23 19:09:49 -04:00
Jonathan Marler
ef62452363 Handle TERM=dumb for stdout/stderr 2019-10-23 11:44:39 -04:00
Andrew Kelley
0dbdb6329f
Merge pull request #3503 from MasterQ32/markdown-renderer
Starts to implement markdown parser.
2019-10-22 15:26:42 -04:00
Felix Queißner
c71857703f Adds documentation for std.fmt.format grammar and customization. (#3474) 2019-10-22 14:58:27 -04:00
Felix Queißner
03f1ad5007 Merge branch 'master' of https://github.com/ziglang/zig into markdown-renderer 2019-10-22 20:29:25 +02:00
Andrew Kelley
e839250c51
Merge branch 'stratact-no-dir-allocators'
closes #2885
closes #2886
closes #2888
closes #3249
2019-10-21 23:54:29 -04:00
Andrew Kelley
a5cc758036
std.os.accept4: improve docs and integrate with evented I/O 2019-10-21 23:23:11 -04:00
Jonathan Marler
87b11617b5 Fix accept function API
The sockaddr pointer and size of the accept function points to a data structure that can only be determined at runtime.  The only requirement is that it must be large enough to hold 2 bytes for the address family value.  Typeical usage of the socket API is for UDP/TCP IPv4 and IPv6 sockets, which use sockaddr_in and sockaddr_in6.  And some sockets can actually support both simultaneously in which case the app may want to have access to the size of the returned sockaddr.  Operating systems can even support custom protocols where they use custom sockaddr data structures.  In this case the standard library would have no knowledge of the actual size of the sockaddr being passed into the accept function.  In this case the standard library should defer to the app to pass in the size of their structure.
2019-10-21 23:12:35 -04:00
Vexu
2550cb4638 remove pub syntax for container fields 2019-10-21 23:04:19 -04:00
Andrew Kelley
064377be9a
test runner: restore previous behavior of printing all tests passed 2019-10-21 22:21:18 -04:00
Andrew Kelley
fc6f84f3f0 fix os.unlinkatW implementation 2019-10-21 20:58:53 -04:00
Andrew Kelley
65165554d0
test runner: restore previous behavior when...
...stderr does not support ansi escape codes
2019-10-21 20:50:47 -04:00
Andrew Kelley
9a82f00a4f
add freebsd AT_* bits 2019-10-21 20:50:47 -04:00
Andrew Kelley
5917572e59
cleanup 2019-10-21 20:50:47 -04:00
Andrew Kelley
98c4365b66 darwin: add AT_* bits 2019-10-21 19:39:30 -04:00
Andrew Kelley
87f632b08a fs.Dir.openDir: use empty object name for "." on Windows 2019-10-21 19:19:49 -04:00
Andrew Kelley
859cbef8a4
test runner: refresh display before running test
This makes it so that when a test fails quickly, and writes output, it
will do so after the test name is printed.
2019-10-21 19:01:08 -04:00
Andrew Kelley
16a91e6a45
adjust test runner to print the test name when error occurs 2019-10-21 18:36:37 -04:00
Andrew Kelley
ef67c49785
[wip] use NtDll APIs on Windows to implement std.fs.Dir 2019-10-21 14:18:01 -04:00
Andrew Kelley
5b1a492012
breaking: improve std.fs directory handling API
* Added `std.c.unlinkat` and `std.os.unlinkat`.
 * Removed `std.fs.MAX_BUF_BYTES` (this declaration never made it to
   master branch)
 * Added `std.fs.Dir.deleteTree` to be used on an open directory handle.
 * `std.fs.deleteTree` has better behavior for both relative and
   absolute paths. For absolute paths, it opens the base directory
   and uses that handle for subsequent operations. For relative paths,
   it does a similar strategy, using the cwd handle.
 * The error set of `std.fs.deleteTree` is improved to no longer have
   these possible errors:
   - OutOfMemory
   - FileTooBig
   - IsDir
   - DirNotEmpty
   - PathAlreadyExists
   - NoSpaceLeft
 * Added `std.fs.Dir.posix_cwd` which is a statically initialized
   directory representing the current working directory.
 * The error set of `std.Dir.open` is improved to no longer have these
   possible errors:
   - FileTooBig
   - IsDir
   - NoSpaceLeft
   - PathAlreadyExists
   - OutOfMemory
 * Added more alternative functions to `std.fs` for when the path
   parameter is a null terminated string. This can sometimes be more
   effecient on systems which have an ABI based on  null terminated
   strings.
 * Added `std.fs.Dir.openDir`, `std.fs.Dir.deleteFile`, and
   `std.fs.Dir.deleteDir` which all operate on an open directory handle.
 * `std.fs.Walker.Entry` now has a `dir` field, which can be used to do
   operations directly on `std.fs.Walker.Entry.basename`, avoiding
   `error.NameTooLong` for deeply nested paths.
 * Added more docs to `std.os.OpenError`

This commit does the POSIX components for these changes. I plan to
follow up shortly with a commit for Windows.
2019-10-20 21:48:23 -04:00
Felix Queißner
5456eb1107 Starts to implement markdown parser. Implemented: strong, emphasis, strikethrough, underline, code blocks, ulist, olist, paragraphs, headings. Planned: Links, Images, internal references. 2019-10-20 11:49:28 +02:00
Andrew Kelley
6948d7fce7
Merge pull request #3429 from Rocknest/docs-local
Design suggestion for generated docs
2019-10-19 16:43:39 -04:00
stratact
e78d3750c5
Use 8192 sized buffers and remove allocator parameters 2019-10-19 14:04:51 -04:00
Nick Erdmann
c8dec5729c
std/build: make subsystem configurable 2019-10-18 20:11:28 +02:00
Nick Erdmann
8774b1d947
std/os/windows: remove subsystem detection for uefi 2019-10-18 19:49:02 +02:00
Andrew Kelley
2d5b2bf1c9
improve progress reporting
* use erase rest of line escape code.
 * use `stderr.supportsAnsiEscapeCodes` rather than `isTty`.
 * respect `--color off`
 * avoid unnecessary recursion
 * add `Progress.log`
 * disable the progress std lib test since it's noisy and uses
   `time.sleep()`.
 * enable/integrate progress printing with the default test runner
2019-10-17 21:55:49 -04:00
Andrew Kelley
299991019d
rework the progress module and integrate with stage1 2019-10-17 20:20:22 -04:00
Luna
a73c7bcaf9
add lib/std/progress.zig 2019-10-17 13:32:45 -04:00
Andrew Kelley
2aec35525d
mipsel: fix padding on stat struct 2019-10-17 13:20:30 -04:00
Andrew Kelley
88b9579488
update musl src to v1.1.24 2019-10-17 11:55:43 -04:00
Andrew Kelley
1135c9523b
update musl headers to v1.1.24 2019-10-17 11:47:57 -04:00
Andrew Kelley
f80c01f9d8
ref more math decls for better docs 2019-10-16 19:16:57 -04:00
Rocknest
40d53a7bc5
Merge branch 'master' into docs-local 2019-10-17 01:57:29 +03:00
Rocknest
c95a9e9785 Cleanup 2019-10-17 01:54:39 +03:00
Rocknest
1c5dfaaca9 Changes from master 2019-10-17 01:35:10 +03:00
Andrew Kelley
7598a579ff
turn comments into doc comments 2019-10-16 18:33:12 -04:00
Sebsatian Keller
1b07ff7be0
Add 'missing' consts to math.zig
The C library defines constants for log2e and sqrt2 etc. Those should also be available in zig.
2019-10-16 18:31:22 -04:00
Emeka Nkurumeh
700bb19a90 fix std.mem.AsBytesReturnType (#3442)
closes #3334
2019-10-16 18:15:52 -04:00
Andrew Kelley
45e5841281
Merge pull request #3464 from nrdmn/uefi
UEFI improvements
2019-10-16 18:14:32 -04:00
Andrew Kelley
09abd09ab8
add docs for std.fs.File.updateTimes 2019-10-16 18:13:40 -04:00
LemonBoy
6a549a7f0c Fix compilation of updateTimes on 32bit platforms
Add a test to avoid regressions.

Fixes #3412
2019-10-16 18:10:32 -04:00
Andrew Kelley
5181970807
improve docs and field names of Statx struct 2019-10-16 17:24:42 -04:00