Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
18
Task/Input-loop/Ada/input-loop.adb
Normal file
18
Task/Input-loop/Ada/input-loop.adb
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
with Ada.Text_Io; use Ada.Text_Io;
|
||||
|
||||
procedure Read_Stream is
|
||||
Line : String(1..10);
|
||||
Length : Natural;
|
||||
begin
|
||||
while not End_Of_File loop
|
||||
Get_Line(Line, Length); -- read up to 10 characters at a time
|
||||
Put(Line(1..Length));
|
||||
-- The current line of input data may be longer than the string receiving the data.
|
||||
-- If so, the current input file column number will be greater than 0
|
||||
-- and the extra data will be unread until the next iteration.
|
||||
-- If not, we have read past an end of line marker and col will be 1
|
||||
if Col(Current_Input) = 1 then
|
||||
New_Line;
|
||||
end if;
|
||||
end loop;
|
||||
end Read_Stream;
|
||||
33
Task/Input-loop/COBOL/input-loop.cob
Normal file
33
Task/Input-loop/COBOL/input-loop.cob
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. input-loop.
|
||||
|
||||
ENVIRONMENT DIVISION.
|
||||
INPUT-OUTPUT SECTION.
|
||||
FILE-CONTROL.
|
||||
SELECT in-stream ASSIGN TO KEYBOARD *> or any other file/stream
|
||||
ORGANIZATION LINE SEQUENTIAL
|
||||
FILE STATUS in-stream-status.
|
||||
|
||||
DATA DIVISION.
|
||||
FILE SECTION.
|
||||
FD in-stream.
|
||||
01 stream-line PIC X(80).
|
||||
|
||||
WORKING-STORAGE SECTION.
|
||||
01 in-stream-status PIC 99.
|
||||
88 end-of-stream VALUE 10.
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
OPEN INPUT in-stream
|
||||
|
||||
PERFORM UNTIL EXIT
|
||||
READ in-stream
|
||||
AT END
|
||||
EXIT PERFORM
|
||||
END-READ
|
||||
DISPLAY stream-line
|
||||
END-PERFORM
|
||||
|
||||
CLOSE in-stream
|
||||
.
|
||||
END PROGRAM input-loop.
|
||||
3
Task/Input-loop/Crystal/input-loop-1.cr
Normal file
3
Task/Input-loop/Crystal/input-loop-1.cr
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
io.each_line do |line|
|
||||
puts line
|
||||
end
|
||||
3
Task/Input-loop/Crystal/input-loop-2.cr
Normal file
3
Task/Input-loop/Crystal/input-loop-2.cr
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
while (line = io.gets)
|
||||
puts line
|
||||
end
|
||||
10
Task/Input-loop/Euphoria/input-loop.eu
Normal file
10
Task/Input-loop/Euphoria/input-loop.eu
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
procedure process_line_by_line(integer fn)
|
||||
object line
|
||||
while 1 do
|
||||
line = gets(fn)
|
||||
if atom(line) then
|
||||
exit
|
||||
end if
|
||||
-- process the line
|
||||
end while
|
||||
end procedure
|
||||
4
Task/Input-loop/PowerShell/input-loop-1.ps1
Normal file
4
Task/Input-loop/PowerShell/input-loop-1.ps1
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
Get-Content c:\file.txt |
|
||||
ForEach-Object {
|
||||
$_
|
||||
}
|
||||
1
Task/Input-loop/PowerShell/input-loop-2.ps1
Normal file
1
Task/Input-loop/PowerShell/input-loop-2.ps1
Normal file
|
|
@ -0,0 +1 @@
|
|||
ForEach-Object -inputobject (get-content c:\file.txt) {$_}
|
||||
27
Task/Input-loop/REXX/input-loop.rexx
Normal file
27
Task/Input-loop/REXX/input-loop.rexx
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
-- 23 Aug 2025
|
||||
include Setting
|
||||
|
||||
say 'INPUT LOOP'
|
||||
say version
|
||||
say
|
||||
call Streaming
|
||||
call Pulling
|
||||
exit
|
||||
|
||||
Streaming:
|
||||
say 'Using LineIn and LineOut...'
|
||||
do until input = ''
|
||||
input=LineIn()
|
||||
call LineOut ,input
|
||||
end
|
||||
return 0
|
||||
|
||||
Pulling:
|
||||
say 'Using pull and say...'
|
||||
do until input = ''
|
||||
parse pull input
|
||||
say input
|
||||
end
|
||||
return 0
|
||||
|
||||
include Abend
|
||||
21
Task/Input-loop/Rebol/input-loop.rebol
Normal file
21
Task/Input-loop/Rebol/input-loop.rebol
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
Rebol [
|
||||
Title: "Basic Input Loop"
|
||||
URL: http://rosettacode.org/wiki/Basic_input_loop
|
||||
]
|
||||
|
||||
; Slurp the whole file in:
|
||||
x: read %file.txt
|
||||
|
||||
; Bring the file in by lines:
|
||||
x: read/lines %file.txt
|
||||
|
||||
; Read in first 10 lines:
|
||||
x: read/lines/part %file.txt 10
|
||||
|
||||
; Read data a line at a time:
|
||||
f: open/lines %file.txt
|
||||
while [not tail? f][
|
||||
print f/1
|
||||
f: next f ; Advance to next line.
|
||||
]
|
||||
close f
|
||||
12
Task/Input-loop/VBScript/input-loop.vbs
Normal file
12
Task/Input-loop/VBScript/input-loop.vbs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
filepath = "SPECIFY PATH TO TEXT FILE HERE"
|
||||
|
||||
Set objFSO = CreateObject("Scripting.FileSystemObject")
|
||||
Set objInFile = objFSO.OpenTextFile(filepath,1,False,0)
|
||||
|
||||
Do Until objInFile.AtEndOfStream
|
||||
line = objInFile.ReadLine
|
||||
WScript.StdOut.WriteLine line
|
||||
Loop
|
||||
|
||||
objInFile.Close
|
||||
Set objFSO = Nothing
|
||||
Loading…
Add table
Add a link
Reference in a new issue