Skip to content

Commit

Permalink
feat: Implement std::print for Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
quantumsheep committed Jul 19, 2020
1 parent e1d9a38 commit 57095fc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions std/io.sn
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import "./memory"
import "./string"

import "./linux/syscalls"

#[target_os = "darwin"]
namespace std {
extern fn printf(const i8*, ...) : i32;
Expand All @@ -13,6 +15,14 @@ namespace std {
alias scan = scanf;
}

#[target_os = "linux"]
namespace std {
fn print(str: i8*) {
linux::syscalls::write(1, str, std::strlen(str));
linux::syscalls::write(1, "\n", 1);
}
}

#[target_os = "windows"]
namespace std {
extern fn WriteConsoleA(i8*, i8*, u64, u64*, void*) : bool;
Expand Down

0 comments on commit 57095fc

Please sign in to comment.