authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-12-21 23:34:14-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-12-21 23:34:14-05:00
logb55efe5fabc5e743406d62bf5b1c2ebfcc8fc5b0
tree2786bbab71399b3ed6d581e721cfdc7aee9653a8
parent43be6ccb03e6ce32f78c69129b61d49cae2b747d

update more std library to new zig


9 files changed, 34 insertions(+), 34 deletions(-)

std/darwin.zig+3-3
......@@ -1,7 +1,7 @@
11
22const arch = switch (@compileVar("arch")) {
3 x86_64 => @import("darwin_x86_64.zig"),
4 else => @compile_err("unsupported arch"),
3 Arch.x86_64 => @import("darwin_x86_64.zig"),
4 else => @compileError("unsupported arch"),
55};
66
77const errno = @import("errno.zig");
......@@ -88,7 +88,7 @@ pub fn fstat(fd: i32, stat_buf: &stat) -> usize {
8888 arch.syscall2(arch.SYS_fstat, usize(fd), usize(stat_buf))
8989}
9090
91pub error Unexpected;
91error Unexpected;
9292
9393pub fn getrandom(buf: &u8, count: usize) -> usize {
9494 const rr = open_c(c"/dev/urandom", O_LARGEFILE | O_RDONLY, 0);
std/darwin_x86_64.zig+4-4
......@@ -57,7 +57,7 @@ pub inline fn syscall3(number: usize, arg1: usize, arg2: usize, arg3: usize) ->
5757
5858
5959
60export struct stat {
60pub const stat = extern struct {
6161 dev: u32,
6262 mode: u16,
6363 nlink: u16,
......@@ -78,9 +78,9 @@ export struct stat {
7878 lspare: i32,
7979 qspare: [2]u64,
8080
81}
81};
8282
83export struct timespec {
83pub const timespec = extern struct {
8484 tv_sec: isize,
8585 tv_nsec: isize,
86}
86};
std/debug.zig+7-7
......@@ -5,9 +5,9 @@ const elf = @import("elf.zig");
55const DW = @import("dwarf.zig");
66const List = @import("list.zig").List;
77
8pub error MissingDebugInfo;
9pub error InvalidDebugInfo;
10pub error UnsupportedDebugInfo;
8error MissingDebugInfo;
9error InvalidDebugInfo;
10error UnsupportedDebugInfo;
1111
1212pub fn assert(b: bool) {
1313 if (!b) @unreachable()
......@@ -20,7 +20,7 @@ pub fn printStackTrace() -> %void {
2020
2121pub fn writeStackTrace(out_stream: &io.OutStream) -> %void {
2222 switch (@compileVar("object_format")) {
23 elf => {
23 ObjectFormat.elf => {
2424 var stack_trace = ElfStackTrace {
2525 .self_exe_stream = undefined,
2626 .elf = undefined,
......@@ -57,13 +57,13 @@ pub fn writeStackTrace(out_stream: &io.OutStream) -> %void {
5757 maybe_fp = *(&const ?&const u8)(fp);
5858 }
5959 },
60 coff => {
60 ObjectFormat.coff => {
6161 out_stream.write("(stack trace unavailable for COFF object format)\n");
6262 },
63 macho => {
63 ObjectFormat.macho => {
6464 %return out_stream.write("(stack trace unavailable for Mach-O object format)\n");
6565 },
66 unknown => {
66 ObjectFormat.unknown => {
6767 out_stream.write("(stack trace unavailable for unknown object format)\n");
6868 },
6969 }
std/elf.zig+1-1
......@@ -4,7 +4,7 @@ const math = @import("math.zig");
44const mem = @import("mem.zig");
55const debug = @import("debug.zig");
66
7pub error InvalidFormat;
7error InvalidFormat;
88
99pub const SHT_NULL = 0;
1010pub const SHT_PROGBITS = 1;
std/index.zig+2-2
......@@ -10,11 +10,11 @@ pub const hash_map = @import("hash_map.zig");
1010pub const mem = @import("mem.zig");
1111pub const debug = @import("debug.zig");
1212pub const linux = switch(@compileVar("os")) {
13 linux => @import("linux.zig"),
13 Os.linux => @import("linux.zig"),
1414 else => null_import,
1515};
1616pub const darwin = switch(@compileVar("os")) {
17 darwin => @import("darwin.zig"),
17 Os.darwin => @import("darwin.zig"),
1818 else => null_import,
1919};
2020const null_import = @import("empty.zig");
std/linux.zig+3-3
......@@ -456,9 +456,9 @@ pub fn accept4(fd: i32, noalias addr: &sockaddr, noalias len: &socklen_t, flags:
456456 arch.syscall4(arch.SYS_accept4, usize(fd), usize(addr), usize(len), flags)
457457}
458458
459// pub error NameTooLong;
460// pub error SystemResources;
461// pub error Io;
459// error NameTooLong;
460// error SystemResources;
461// error Io;
462462//
463463// pub fn if_nametoindex(name: []u8) -> %u32 {
464464// var ifr: ifreq = undefined;
std/mem.zig+1-1
......@@ -5,7 +5,7 @@ const io = @import("io.zig");
55
66pub const Cmp = math.Cmp;
77
8pub error NoMem;
8error NoMem;
99
1010pub type Context = u8;
1111pub const Allocator = struct {
std/net.zig+10-10
......@@ -3,15 +3,15 @@ const errno = @import("errno.zig");
33const assert = @import("debug.zig").assert;
44const endian = @import("endian.zig");
55
6pub error SigInterrupt;
7pub error Unexpected;
8pub error Io;
9pub error TimedOut;
10pub error ConnectionReset;
11pub error ConnectionRefused;
12pub error NoMem;
13pub error NotSocket;
14pub error BadFd;
6error SigInterrupt;
7error Unexpected;
8error Io;
9error TimedOut;
10error ConnectionReset;
11error ConnectionRefused;
12error NoMem;
13error NotSocket;
14error BadFd;
1515
1616const Connection = struct {
1717 socket_fd: i32,
......@@ -139,7 +139,7 @@ pub fn connect(hostname: []const u8, port: u16) -> %Connection {
139139 return connectAddr(main_addr, port);
140140}
141141
142pub error InvalidIpLiteral;
142error InvalidIpLiteral;
143143
144144pub fn parseIpLiteral(buf: []const u8) -> %Address {
145145 switch (parseIp4(buf)) {
std/os.zig+3-3
......@@ -1,11 +1,11 @@
11const system = switch(@compileVar("os")) {
2 linux => @import("linux.zig"),
3 darwin => @import("darwin.zig"),
2 Os.linux => @import("linux.zig"),
3 Os.darwin => @import("darwin.zig"),
44 else => @compileError("Unsupported OS"),
55};
66const errno = @import("errno.zig");
77
8pub error Unexpected;
8error Unexpected;
99
1010pub fn getRandomBytes(buf: []u8) -> %void {
1111 while (true) {