summaryrefslogtreecommitdiff
path: root/src/texec/libtnsl.go
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2022-04-10 17:30:30 -0400
committerKyle Gunger <kgunger12@gmail.com>2022-04-10 17:30:30 -0400
commited2f9793fae7d1c018e3de463617339c68faa3c0 (patch)
tree241b65e29d9944873e1ac4825ef025bfdf222cd3 /src/texec/libtnsl.go
parentad84b1068494872db2166bd81ce1f3831ead2c6b (diff)
A few fixes
+ Fix an error with if statements inside loops + Fix a parser bug with boolean operators ~ Change libtnsl stub to return integers when reading a file ~ Change libtnsl stub to return -1 on EOF or file read error
Diffstat (limited to 'src/texec/libtnsl.go')
-rw-r--r--src/texec/libtnsl.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/texec/libtnsl.go b/src/texec/libtnsl.go
index 581d15e..bb0ce7d 100644
--- a/src/texec/libtnsl.go
+++ b/src/texec/libtnsl.go
@@ -176,8 +176,11 @@ func tfile_close(file TVariable) {
// tnsl.io.File.read
func tfile_read(file TVariable) TVariable {
b := []byte{1}
- (file.Data).(*os.File).Read(b)
- return TVariable{tCharp, b[0]}
+ _, err := (file.Data).(*os.File).Read(b)
+ if err != nil {
+ return TVariable{tInt, -1}
+ }
+ return TVariable{tInt, int(b[0])}
}
// tnsl.io.File.write