aboutsummaryrefslogtreecommitdiff
path: root/std/std.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2015-12-14 23:10:18 -0700
committerAndrew Kelley <superjoe30@gmail.com>2015-12-14 23:10:18 -0700
commit83b68c9f13c90dfbbd2735cde4ef570ac50476c0 (patch)
treee662b59bea4462299688db4c103a6ea27fd35b25 /std/std.zig
parent52e19b4a9b6e6140bae3c20c6f1fef36dca20aa7 (diff)
downloadzig-83b68c9f13c90dfbbd2735cde4ef570ac50476c0.tar.gz
zig-83b68c9f13c90dfbbd2735cde4ef570ac50476c0.zip
add global variable support
closes #12
Diffstat (limited to 'std/std.zig')
-rw-r--r--std/std.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/std/std.zig b/std/std.zig
index 375eddc920..8b19628441 100644
--- a/std/std.zig
+++ b/std/std.zig
@@ -1,3 +1,6 @@
+const SYS_write : isize = 1;
+const stdout_fileno : isize = 1;
+
fn syscall3(number: isize, arg1: isize, arg2: isize, arg3: isize) -> isize {
var result : isize;
asm volatile ("
@@ -13,15 +16,12 @@ fn syscall3(number: isize, arg1: isize, arg2: isize, arg3: isize) -> isize {
return result;
}
-// TODO constants for SYS_write and stdout_fileno
pub fn write(fd: isize, buf: &const u8, count: usize) -> isize {
- const SYS_write : isize = 1;
return syscall3(SYS_write, fd, buf as isize, count as isize);
}
// TODO error handling
// TODO handle buffering and flushing
pub fn print_str(str : string) -> isize {
- const stdout_fileno : isize = 1;
return write(stdout_fileno, str.ptr, str.len);
}