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 @@
"somefile.txt" f:slurp >s

View file

@ -0,0 +1,10 @@
' FB 1.05.0 Win64
Open "input.txt" For Input Encoding "ascii" As #1
Dim fileLen As LongInt = Lof(1) '' get file length in bytes
Dim buffer As String = Space(fileLen) '' allocate a string of size 'fileLen' bytes
Get #1, 1, buffer '' read all data from start of file into the buffer
Print buffer '' print to console
buffer = "" '' release memory used by setting buffer to empty
Close #1
Sleep

View file

@ -0,0 +1,27 @@
include "ConsoleWindow"
local fn ReadTextFile
dim as CFURLRef fileRef
dim as Handle h
dim as CFStringRef cfStr : cfStr = NULL
dim as long fileLen
if ( files$( _CFURLRefOpen, "TEXT", "Select text file...", @fileRef ) )
open "i", 2, fileRef
fileLen = lof( 2, 1 )
h = fn NewHandleClear( fileLen )
if ( h )
read file 2, [h], fileLen
close #2
cfStr = fn CFStringCreateWithBytes( _kCFAllocatorDefault, #[h], fn GetHandleSize(h), _kCFStringEncodingMacRoman, _false )
fn DisposeH( h )
end if
else
// User canceled
end if
fn HIViewSetText( sConsoleHITextView, cfStr )
CFRelease( cfStr )
end fn
fn ReadTextFile

View file

@ -0,0 +1 @@
(set `#(ok ,data) (file:read_file "myfile.txt"))

View file

@ -0,0 +1,2 @@
local(f) = file('foo.txt')
#f->readString

View file

@ -0,0 +1,13 @@
----------------------------------------
-- Reads whole file, returns string
-- @param {string} tFile
-- @return {string|false}
----------------------------------------
on readFile (tFile)
fp = xtra("fileIO").new()
fp.openFile(tFile, 1)
if fp.status() then return false
res = fp.readFile()
fp.closeFile()
return res
end

View file

@ -0,0 +1,2 @@
put URL "file:///usr/share/dict/words" into tVar
put the number of lines of tVar

View file

@ -0,0 +1,6 @@
local tFile,tLinecount
put "/usr/share/dict/words" into tFile
open file tFile for text read
read from file tFile until EOF
put the number of lines of it -- file contents held in "it" variable
close file tFile

View file

@ -0,0 +1 @@
readFile(filename)

View file

@ -0,0 +1 @@
file:readme.txt .text

View file

@ -0,0 +1,4 @@
constant fn = open(command_line()[2],"rb")
?get_text(fn)
close(fn)
{} = wait_key()

View file

@ -0,0 +1,4 @@
# Read the file
cStr = read("myfile.txt")
# print the file content
See cStr

View file

@ -0,0 +1 @@
cStr = read("myfile.txt") See cStr

View file

@ -0,0 +1 @@
See read("myfile.txt")

View file

@ -0,0 +1,3 @@
var file = File.new(__FILE__);
var content = file.open_r.slurp;
print content;

View file

@ -0,0 +1,3 @@
var file = File(__FILE__)
var content = file.read(:utf8)
print content

View file

@ -0,0 +1 @@
let contents = readfile("foo.txt");

View file

@ -0,0 +1,6 @@
import Foundation
let path = "~/input.txt".stringByExpandingTildeInPath
if let string = String(contentsOfFile: path, encoding: NSUTF8StringEncoding) {
println(string) // print contents of file
}

View file

@ -0,0 +1,4 @@
decl string contents
decl file f
f.open "filename.txt"
set contents (f.readall)

View file

@ -0,0 +1,4 @@
with infile "x"
with outstring
whilet line (read_line)
prn line

View file

@ -0,0 +1 @@
jq -R -s . input.txt

View file

@ -0,0 +1 @@
jq -R . input.txt | jq -s .

View file

@ -0,0 +1 @@
jq -R -s 'split("\n")' input.txt