diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-05-03 19:04:04 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-05-03 19:04:04 -0400 |
commit | f0c6f08beac2ad6699af7707c51f9049db1b18c1 (patch) | |
tree | 6771d09818287f0bcdd519ef81efe2446ac000df /std | |
parent | 9661c9839d6635181b81e0a1061dfa566f7660fe (diff) |
got tests to work on windows (fixed some problems with them)
Diffstat (limited to 'std')
-rw-r--r-- | std/io.toc | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -1,13 +1,22 @@ +/* TODO: use write / WriteFile */ + #include "std/base.toc"; putchar ::= #foreign("putchar", libc) fn(#C int) #C int; toc_putchar ::= fn(x: char) { putchar(x as #C int); } -fwrite ::= #foreign("fwrite", libc) fn(#C &"const void", #C size_t, #C size_t, #C &"FILE") #C size_t; + +/* +unfortunately, we can't use fwrite because MSVC doesn't like it when you +use a file handle that's not from the DLL. (i.e. you can't pass your stdout +to the imported version of fwrite) +*/ writes ::= fn(x: []char) { - fwrite(&x[0], 1, x.len as #C size_t, #builtin("stdout")); + for c := x { + toc_putchar(c); + } } puts ::= fn(x: []char) { |