summaryrefslogtreecommitdiff
path: root/test.toc
diff options
context:
space:
mode:
Diffstat (limited to 'test.toc')
-rw-r--r--test.toc15
1 files changed, 11 insertions, 4 deletions
diff --git a/test.toc b/test.toc
index 05f94ec..4b21d20 100644
--- a/test.toc
+++ b/test.toc
@@ -7,7 +7,7 @@ import ::= fn(x :: []char) &Package {
cputs :: fn(&char) i32 = #foreign "puts", "libc.so.6";
-puts ::= fn(s: []char) i32 {
+tocputs ::= fn(s: []char) i32 {
cstr := new(char, s.len + 1);
each i := 0..s.len-1 {
cstr[i] = s[i];
@@ -19,9 +19,9 @@ puts ::= fn(s: []char) i32 {
};
foo ::= fn() i32 {
- puts("Hi");
- puts("Hello");
- puts("Hey")
+ tocputs("Hi");
+ tocputs("Hello");
+ tocputs("Hey")
};
malloc :: fn(u64) &u8 = #foreign "malloc", "libc.so.6";
@@ -30,10 +30,17 @@ sqrt :: fn(f64) f64 = #foreign "sqrt", "libm.so.6";
cos :: fn(f64) f64 = #foreign "cos", "libm.so.6";
sin :: fn(f64) f64 = #foreign "sin", "libm.so.6";
+stderr :: &u8 = #foreign "stderr";
+fprintf :: fn(&u8, &char) = #foreign "fprintf";
+
+
main ::= fn() {
x ::= foo();
// y ::= malloc(10);
sq2 ::= sqrt(2);
cospi ::= cos(3.14159);
sinpi ::= sin(3.14159);
+ foo();
+ s := "Hello!\n\0";
+ fprintf(stderr, &s[0]);
}; \ No newline at end of file