diff options
Diffstat (limited to 'tests/where.toc')
-rw-r--r-- | tests/where.toc | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/tests/where.toc b/tests/where.toc deleted file mode 100644 index 4223656..0000000 --- a/tests/where.toc +++ /dev/null @@ -1,30 +0,0 @@ -printf ::= #foreign("printf","libc.so.6") fn(#C &"const char", #C ..) #C int; - -tprintf_valid ::= fn(fmt :: []char, nargs: int) bool { - if fmt[fmt.len-1] != '\0' { - return false; - } - count := 0; - for x, i := fmt { - if x == '%' { - if i == fmt.len-1 { - count += 1; - } elif fmt[i+1] != '%' { - count += 1; - } else { - count -= 1; - } - } - } - count == nargs -}; - - -tprintf ::= fn(fmt :: []char, args: ..) where tprintf_valid(fmt, args.len) { - f := fmt; - printf(&f[0], args); -}; - -main ::= fn() { - tprintf("%d %d%%\n\0", 3, 4); -}; |