aboutsummaryrefslogtreecommitdiff
path: root/std/std.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-01-07 03:23:38 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-01-07 03:23:38 -0700
commita3c97081ca37a6f78732c9a5f2244cef5a11cb07 (patch)
treeaec69a113eacaa084039364b65ef803d695e0dd5 /std/std.zig
parent9b9fd5ad23e37d1e2b37b05b168abcfd53f4629d (diff)
downloadzig-a3c97081ca37a6f78732c9a5f2244cef5a11cb07.tar.gz
zig-a3c97081ca37a6f78732c9a5f2244cef5a11cb07.zip
add ?? maybe unwrapping binary operator
add null literal fix number literal / maybe interactions
Diffstat (limited to 'std/std.zig')
-rw-r--r--std/std.zig21
1 files changed, 21 insertions, 0 deletions
diff --git a/std/std.zig b/std/std.zig
index a53dbb6027..333896cadc 100644
--- a/std/std.zig
+++ b/std/std.zig
@@ -1,5 +1,6 @@
use "syscall.zig";
+const stdin_fileno : isize = 0;
const stdout_fileno : isize = 1;
const stderr_fileno : isize = 2;
@@ -38,6 +39,26 @@ pub fn print_i64(x: i64) -> isize {
return write(stdout_fileno, buf.ptr, len);
}
+/*
+// TODO error handling
+pub fn readline(buf: []u8) -> ?[]u8 {
+ var index = 0;
+ while (index < buf.len) {
+ // TODO unknown size array indexing operator
+ const err = read(stdin_fileno, &buf.ptr[index], 1);
+ if (err != 0) {
+ return null;
+ }
+ // TODO unknown size array indexing operator
+ if (buf.ptr[index] == '\n') {
+ return buf[0...index + 1];
+ }
+ index += 1;
+ }
+ return null;
+}
+*/
+
fn digit_to_char(digit: u64) -> u8 {
'0' + (digit as u8)
}