From fc5a382661262b4dac085d75739c4ac0601574a7 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Wed, 29 Jun 2022 20:15:46 -0400 Subject: [TNSLC] General updates --- tnslc/copy.tnsl | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tnslc/copy.tnsl (limited to 'tnslc/copy.tnsl') diff --git a/tnslc/copy.tnsl b/tnslc/copy.tnsl new file mode 100644 index 0000000..953a7c8 --- /dev/null +++ b/tnslc/copy.tnsl @@ -0,0 +1,30 @@ +/# + Proof of concept that the language can copy any file. + + For testing with executibles to make sure that the language's current state + would be able to produce one from data alone. + + Seems to work. +#/ + +/; main ({}{}charp args) [int] + /; if (len args < 2) + ;tnsl.io.println("Usage: copy [file to copy] [path to copy to]") + ;return 1 + ;/ + + ;tnsl.io.File in = tnsl.io.readFile(args{0}) + ;tnsl.io.File out = tnsl.io.writeFile(args{1}) + + /; loop (int chk = in.read(); chk !< 0) [chk = in.read()] + ;uint8 write = chk + ;out.write(write) + ;/ + + ;tnsl.io.println("Copy complete.") + + ;in.close() + ;out.close() + + ;return 0 +;/ -- cgit v1.2.3