summaryrefslogtreecommitdiff
path: root/std/io.toc
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-07-12 15:33:02 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2020-07-12 15:33:02 -0400
commita919e1dbe7919a40945aa68fd05c4a658cd168a6 (patch)
tree7935d6f60832dbaa6e8ae552c5a746db94e7e713 /std/io.toc
parent07982dd332c739a8135305d22994caaa2fe340ca (diff)
fixed bin op problems, added testing types for equality
Diffstat (limited to 'std/io.toc')
-rw-r--r--std/io.toc27
1 files changed, 16 insertions, 11 deletions
diff --git a/std/io.toc b/std/io.toc
index c61d174..10ec1d3 100644
--- a/std/io.toc
+++ b/std/io.toc
@@ -151,7 +151,6 @@ MODE_WRITE :: FileMode = 2;
IO_DEBUG ::= base.DEBUG;
-// @TODO: flush for read files -- discard buffer
// @TODO: error flag
// @TODO: locking?
File ::= struct {
@@ -247,12 +246,12 @@ fputs ::= fn(f: &File, s: []char) err : FileError {
}
}
-writes ::= fn(s: []char) FileError {
- return fwrites(&std_out, s);
+writes ::= fn(s: []char) {
+ fwrites(&std_out, s);
}
-puts ::= fn(s: []char) FileError {
- return fputs(&std_out, s);
+puts ::= fn(s: []char) {
+ fputs(&std_out, s);
}
fwritei ::= fn(use f: &File, x: int) err : FileError {
@@ -306,14 +305,20 @@ fwritei ::= fn(use f: &File, x: int) err : FileError {
}
}
-writei ::= fn(x: int) FileError {
- return fwritei(&std_out, x);
+writei ::= fn(x: int) {
+ fwritei(&std_out, x);
}
-puti ::= fn(x: int) err : FileError {
- err = writei(x);
- if !err {
- err = writes("\n");
+puti ::= fn(x: int) {
+ writei(x);
+ writes("\n");
+}
+
+putb ::= fn(x: bool) {
+ if x {
+ writes("true\n");
+ } else {
+ writes("false\n");
}
}