Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View 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;

View 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.

View file

@ -0,0 +1,3 @@
io.each_line do |line|
puts line
end

View file

@ -0,0 +1,3 @@
while (line = io.gets)
puts line
end

View 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

View file

@ -0,0 +1,4 @@
Get-Content c:\file.txt |
ForEach-Object {
$_
}

View file

@ -0,0 +1 @@
ForEach-Object -inputobject (get-content c:\file.txt) {$_}

View 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

View 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

View 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