From 1184d39f79a341bfa6c1642dc1ae246113186155 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Wed, 22 Jan 2020 17:02:14 -0500 Subject: new std/io --- std/io.toc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'std') diff --git a/std/io.toc b/std/io.toc index 68e9744..ea45ce9 100644 --- a/std/io.toc +++ b/std/io.toc @@ -1,14 +1,10 @@ pkg "io"; -#export puti ::= fn(x: int) { - #C("printf(\"%ld\\n\", (long)x)"); -}; - -#export putf ::= fn(x: float) { - #C("printf(\"%f\\n\", (double)x)"); -}; +c_putchar :: fn(i32) = #foreign "putchar", "libc.so.6"; #export puts ::= fn(x: []char) { - #C("fwrite(x.data, 1, x.n, stdout)"); - #C("printf(\"\\n\")"); + each c := x { + c_putchar(c as i32); + }; + c_putchar('\n' as i32); }; \ No newline at end of file -- cgit v1.2.3