Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,22 @@
' FB 1.05.0 Win64
/'
input.txt contains:
The quick brown fox jumps over the lazy dog.
Empty vessels make most noise.
Too many chefs spoil the broth.
A rolling stone gathers no moss.
'/
Open "output.txt" For Output As #1
Open "input.txt" For Input As #2
Dim line_ As String ' note that line is a keyword
While Not Eof(2)
Line Input #2, line_
Print #1, line_
Wend
Close #2
Close #1

View file

@ -0,0 +1,13 @@
software {
var data = ""
var file = open("input.txt")
loop {
! data += file(256)
issues {
break
}
}
delete("output.txt")
file = open("output.txt")
file(data)
}

View file

@ -0,0 +1,34 @@
----------------------------------------
-- Returns file as ByteArray
-- @param {string} tFile
-- @return {byteArray|false}
----------------------------------------
on getBytes (tFile)
fp = xtra("fileIO").new()
fp.openFile(tFile, 1)
if fp.status() then return false
data = fp.readByteArray(fp.getLength())
fp.closeFile()
return data
end
----------------------------------------
-- Saves ByteArray to file
-- @param {string} tFile
-- @param {byteArray} tString
-- @return {bool} success
----------------------------------------
on putBytes (tFile, tByteArray)
fp = xtra("fileIO").new()
fp.openFile(tFile, 2)
err = fp.status()
if not (err) then fp.delete()
else if (err and not (err = -37)) then return false
fp.createFile(tFile)
if fp.status() then return false
fp.openFile(tFile, 2)
if fp.status() then return false
fp.writeByteArray(tByteArray)
fp.closeFile()
return true
end

View file

@ -0,0 +1,2 @@
data = getBytes("input.txt")
putBytes("output.txt", data)

View file

@ -0,0 +1,2 @@
import os
copyfile("input.txt", "output.txt")

View file

@ -0,0 +1,2 @@
let x = readFile("input.txt")
writeFile("output.txt", x)

View file

@ -0,0 +1,9 @@
var
i = open("input.txt")
o = open("output.txt", fmWrite)
for line in i.lines:
o.writeln(line)
i.close()
o.close()

View file

@ -0,0 +1,12 @@
const size = 4096
var
i = open("input.txt")
o = open("output.txt", fmWrite)
buf: array[size, char]
while i.readBuffer(buf.addr, size) > 0:
discard o.writeBuffer(buf.addr, size)
i.close()
o.close()

View file

@ -0,0 +1,11 @@
import memfiles
var
i = memfiles.open("input.txt")
o = system.open("output.txt", fmWrite)
var written = o.writeBuffer(i.mem, i.size)
assert(written == i.size)
i.close()
o.close()

View file

@ -0,0 +1,7 @@
: fcopy(in, out)
| f g |
File newMode(in, File.BINARY) dup open(File.READ) ->f
File newMode(out, File.BINARY) dup open(File.WRITE) ->g
while(f >> dup notNull) [ g addChar ] drop
f close g close ;

View file

@ -0,0 +1 @@
fcopy("input.txt", "output.txt")

View file

@ -0,0 +1,6 @@
integer fn = open("input.txt","rb")
string txt = get_text(fn)
close(fn)
fn = open("output.txt","wb")
puts(fn,txt)
close(fn)

View file

@ -0,0 +1,10 @@
integer infn = open("input.txt","r"),
outfn = open("output.txt","w")
object line
while 1 do
line = gets(infn)
if atom(line) then exit end if
puts(outfn,line)
end while
close(infn)
close(outfn)

View file

@ -0,0 +1,10 @@
integer byte,
infd = open("input.txt","rb"),
outfd = open("output.txt","wb")
while 1 do
byte = getc(infd)
if byte=-1 then exit end if
puts(outfd,byte)
end while
close(infd)
close(outfd)

View file

@ -0,0 +1,19 @@
fn1 = "ReadMe.txt"
fn2 = "ReadMe2.txt"
fp = fopen(fn1,"r")
str = fread(fp, getFileSize(fp))
fclose(fp)
fp = fopen(fn2,"w")
fwrite(fp, str)
fclose(fp)
see "OK" + nl
func getFileSize fp
c_filestart = 0
c_fileend = 2
fseek(fp,0,c_fileend)
nfilesize = ftell(fp)
fseek(fp,0,c_filestart)
return nfilesize

View file

@ -0,0 +1,6 @@
var in = %f'input.txt'.open_r;
var out = %f'output.txt'.open_w;
in.each { |line|
out.print(line);
};

View file

@ -0,0 +1,7 @@
decl file input output
decl string contents
input.open "input.txt"
output.create "output.txt"
output.open "output.txt"
set contents (input.readall)
out contents output

View file

@ -0,0 +1,4 @@
with infile "input.txt"
with outfile "output.txt"
whilet line (read_line)
prn line

View file

@ -0,0 +1 @@
jq -M --raw-input --raw-output '. as $line | $line' input.txt > output.txt

View file

@ -0,0 +1 @@
jq -M '. as $line | $line' input.txt > output.txt