Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
5
Task/File-size/Axe/file-size.axe
Normal file
5
Task/File-size/Axe/file-size.axe
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
If GetCalc("appvINPUT")→I
|
||||
Disp {I-2}ʳ▶Dec,i
|
||||
Else
|
||||
Disp "NOT FOUND",i
|
||||
End
|
||||
6
Task/File-size/FreeBASIC/file-size.freebasic
Normal file
6
Task/File-size/FreeBASIC/file-size.freebasic
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
#include "file.bi"
|
||||
|
||||
Print FileLen("input.txt"), FileLen(Environ("SystemRoot") + "\input.txt")
|
||||
Sleep
|
||||
9
Task/File-size/Lasso/file-size.lasso
Normal file
9
Task/File-size/Lasso/file-size.lasso
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// local to current directory
|
||||
local(f = file('input.txt'))
|
||||
handle => { #f->close }
|
||||
#f->size
|
||||
|
||||
// file at file system root
|
||||
local(f = file('//input.txt'))
|
||||
handle => { #f->close }
|
||||
#f->size
|
||||
13
Task/File-size/Lingo/file-size.lingo
Normal file
13
Task/File-size/Lingo/file-size.lingo
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
----------------------------------------
|
||||
-- Returns file size
|
||||
-- @param {string} filename
|
||||
-- @return {integer}
|
||||
----------------------------------------
|
||||
on getFileSize (filename)
|
||||
fp = xtra("fileIO").new()
|
||||
fp.openFile(filename, 1)
|
||||
if fp.status() then return 0
|
||||
len = fp.getLength()
|
||||
fp.closeFile()
|
||||
return len
|
||||
end
|
||||
20
Task/File-size/LiveCode/file-size.livecode
Normal file
20
Task/File-size/LiveCode/file-size.livecode
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// root folder
|
||||
set the defaultfolder to "/"
|
||||
repeat for each line fline in (the detailed files)
|
||||
if item 1 of fline is "input.txt" then
|
||||
put item 2 of fline --bytes
|
||||
exit repeat
|
||||
end if
|
||||
end repeat
|
||||
|
||||
// current working dir of stack
|
||||
put the effective filename of this stack into tPath
|
||||
set the itemDelimiter to slash
|
||||
delete last item of tPath
|
||||
set the defaultfolder to tPath
|
||||
repeat for each line fline in (the detailed files)
|
||||
if item 1 of fline is "input.txt" then
|
||||
put item 2 of fline
|
||||
exit repeat
|
||||
end if
|
||||
end repeat
|
||||
3
Task/File-size/Nim/file-size.nim
Normal file
3
Task/File-size/Nim/file-size.nim
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import os
|
||||
echo getFileSize "input.txt"
|
||||
echo getFileSize "/input.txt"
|
||||
2
Task/File-size/Oforth/file-size.oforth
Normal file
2
Task/File-size/Oforth/file-size.oforth
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
File new("input.txt") size println
|
||||
File new("/input.txt") size println
|
||||
17
Task/File-size/Phix/file-size.phix
Normal file
17
Task/File-size/Phix/file-size.phix
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
function file_size(sequence file_name)
|
||||
object d = dir(file_name)
|
||||
if atom(d) or length(d)!=1 then return -1 end if
|
||||
return d[1][D_SIZE]
|
||||
end function
|
||||
|
||||
procedure test(sequence file_name)
|
||||
integer size = file_size(file_name)
|
||||
if size<0 then
|
||||
printf(1,"%s file does not exist.\n",{file_name})
|
||||
else
|
||||
printf(1,"%s size is %d.\n",{file_name,size})
|
||||
end if
|
||||
end procedure
|
||||
|
||||
test("input.txt") -- in the current working directory
|
||||
test("/input.txt") -- in the file system root
|
||||
2
Task/File-size/Ring/file-size.ring
Normal file
2
Task/File-size/Ring/file-size.ring
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
See len(read('input.txt')) + nl
|
||||
see len(read('/input.txt')) + nl
|
||||
2
Task/File-size/Sidef/file-size.sidef
Normal file
2
Task/File-size/Sidef/file-size.sidef
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
say (Dir.cwd + %f'input.txt' -> size);
|
||||
say (Dir.root + %f'input.txt' -> size);
|
||||
9
Task/File-size/Ursa/file-size.ursa
Normal file
9
Task/File-size/Ursa/file-size.ursa
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
decl file f
|
||||
|
||||
f.open "input.txt"
|
||||
out (size f) endl console
|
||||
f.close
|
||||
|
||||
f.open "/input.txt"
|
||||
out (size f) endl console
|
||||
f.close
|
||||
3
Task/File-size/jq/file-size.jq
Normal file
3
Task/File-size/jq/file-size.jq
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
jq -Rs length input.txt
|
||||
|
||||
jq -Rs length /input.txt
|
||||
Loading…
Add table
Add a link
Reference in a new issue