Commit Graph

203 Commits (8d3b7689ad9c2dd14d0f5cadf2b711ff1ab70054)

Author SHA1 Message Date
Andrew Kelley 8d3b7689ad
std.net: port the RFC 3484/6724 destination...
...address selection from musl libc
2019-10-29 16:10:14 -04:00
Andrew Kelley 9ade31faaf
implement CNAME expansion 2019-10-29 14:03:39 -04:00
Andrew Kelley 67058b9b70
basic DNS address resolution for linux without libc 2019-10-29 02:19:22 -04:00
Andrew Kelley d5865f5319
move libc/linux bits around 2019-10-28 15:29:50 -04:00
Andrew Kelley f4c244b3d0
partial no-libc implementation of std.net.getAddressList 2019-10-28 15:29:50 -04:00
Andrew Kelley 4b80e376e3
std.net.getAddressList 2019-10-28 15:29:50 -04:00
Andrew Kelley a3222b5ff1
remove dead tls code 2019-10-28 15:10:12 -04:00
Andrew Kelley b37c009683
Merge pull request #3541 from xackus/language_server
* fix json parser crashing on empty input

* make implicit cast of tagged unions to enums easier to find in docs
2019-10-28 15:08:33 -04:00
Timon Kruiper 03603ea353 Std docs: Fix a js error that would cause some function to be not rendered 2019-10-28 15:06:55 -04:00
Nathan Michaels 6fdeaac338 Add some documentation for standard library things. (#3540)
* Add some documentation for standard library things.

Added a bunch of descriptions for array_list.
Added some usage notes for failing_allocator.
Documented some of mem.Allocator.
2019-10-28 03:57:23 -04:00
xackus 36fa5fabc6 rename error and specify it in function 2019-10-27 21:52:28 +01:00
xackus eeb6536c85
better test name for empty string
Co-Authored-By: Andrew Kelley <andrew@ziglang.org>
2019-10-27 21:41:52 +01:00
Andrew Kelley 8af6c7e34c
Merge pull request #3522 from SebastianKeller/WriteJson
Added 'writeJson' to write_stream.zig:
2019-10-27 15:53:24 -04:00
Sebastian Keller 78b00c0b51 Added test for 'emitJson' 2019-10-27 20:49:42 +01:00
Sebastian Keller ac705a7bb6 Unified public api 2019-10-27 20:15:48 +01:00
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
xackus a0abd3be85 fix json parser crashing on empty input
remove unreachable code
2019-10-27 10:45:54 +01: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
Sebastian Keller 6257b4c596 Shortened switch statement 2019-10-24 22:44:12 +02:00
Sebastian Keller b82b6a7093 Added 'writeJson' to write_stream.zig:
Small addition to make writing a json value easier
2019-10-24 14:23:36 +02: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