summaryrefslogtreecommitdiff
path: root/src/texec
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2021-11-22 21:41:08 -0500
committerKyle Gunger <kgunger12@gmail.com>2021-11-22 21:41:08 -0500
commit60dcc7c3c013a2492d8db1b04d28cb437921cced (patch)
tree0abd57ee7f5fa9a6b9f1b1bc9b305a75ba0b96ef /src/texec
parentfc650edf6a1ad7b043ccd92495d8e600fd094963 (diff)
[PARSE] Remove IsBlock
Diffstat (limited to 'src/texec')
-rw-r--r--src/texec/libtnsl.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/texec/libtnsl.go b/src/texec/libtnsl.go
index bff8d48..000af7d 100644
--- a/src/texec/libtnsl.go
+++ b/src/texec/libtnsl.go
@@ -46,6 +46,8 @@ var (
tFile = TType{Pre: []string{}, T: TArtifact{Path: []string{"tnsl", "io"}, Name: "File"}, Post: []string{}}
tString = TType{Pre: []string{"{}"}, T: TArtifact{Path: []string{}, Name:"charp"}, Post: []string{}}
tInt = TType{Pre: []string{}, T: TArtifact{Path: []string{}, Name:"int"}, Post: []string{}}
+ tByte = TType{Pre: []string{}, T: TArtifact{Path: []string{}, Name:"uint8"}, Post: []string{}}
+ tByteArray = TType{Pre: []string{"{}"}, T: TArtifact{Path: []string{}, Name:"uint8"}, Post: []string{}}
tFloat = TType{Pre: []string{}, T: TArtifact{Path: []string{}, Name:"float"}, Post: []string{}}
tCharp = TType{Pre: []string{}, T: TArtifact{Path: []string{}, Name:"charp"}, Post: []string{}}
tNull = TType{Pre: []string{}, T: TArtifact{Path: []string{}, Name: "null"}, Post: []string{}}
@@ -143,10 +145,14 @@ func tfile_read(file TVariable) TVariable {
// tnsl.io.File.write
func tfile_write(file, in TVariable) {
- b := []byte{0}
- if equateType(file.Type, tFile) && (equateType(in.Type, tCharp) || equateType(in.Type, tInt)) {
- b[0] = (in.Data).(byte)
- (file.Data).(*os.File).Write(b)
+ if equateType(file.Type, tFile) {
+ if equateType(in.Type, tCharp) || equateType(in.Type, tByte) {
+ b := []byte{0}
+ b[0] = (in.Data).(byte)
+ (file.Data).(*os.File).Write(b)
+ } else if equateType(in.Type, tByteArray) {
+ (file.Data).(*os.File).Write((in.Data).([]byte))
+ }
} else {
(file.Data).(*os.File).Close()
panic(fmt.Sprintf("Failed to write to file, attempted to use unsupported type (%v)\n", in.Type))