Anonymous user
Just in time processing on a character stream: Difference between revisions
Just in time processing on a character stream (view source)
Revision as of 23:07, 13 January 2018
, 6 years ago→{{header|REXX}}: added/deleted/changed statements, comments, and whitespace, used templates for INPUT and OUTPUT.
(Added D) |
(→{{header|REXX}}: added/deleted/changed statements, comments, and whitespace, used templates for INPUT and OUTPUT.) |
||
Line 210:
=={{header|REXX}}==
The input file used by this REXX program only contains one page;
<br>and the injection of ''FF'' characters into the file would be like putting pencil marks into a holy book. <big><big><big> ☺ </big></big></big>
<lang rexx>/*REXX
parse arg iFID /*obtain optional name of file (book).
if iFID=='' | iFID=="," then iFID="JIT.TXT"
$= 'abcdefghijklmnopqrstuvwxyz'; _=$; upper _; $= '0123456789'$ || _▼
▲$='abcdefghijklmnopqrstuvwxyz'; _=$; upper _; $= '0123456789'$ || _
▲ask='──────────enter four parameters (all positive integers) or QUIT'
do while
if pos(FF, _)\==0 then do; pag=pag+1; lin=1 /*bump page counter; reset line counter*/
@.pag.lin=_
lin=lin+1
end /*while lines···*/
?=
y=space( translate(y, $, $ || xrange() )) /*allow any separator the user wants. */
▲?= /*define the phrase to be null.*/
if words(y)>4 then do; say 'too many parameters entered.'
if datatype(a.
iterate ask
a.k=a.k / 1
end /*k*/
parse value
x=substr(
if x=='!' then leave /*if the stop char was found, done. */▼
say right(x
?=? || x
say '═════►' ?
▲ if x=='!' then leave /*if the stop char found, done.*/
▲ /*stick a fork in it, we're done.*/</lang>
▲'''input''' supplied to the console (terminal) by the user (the commas are optional):
<pre>
1, 133, 4, 5
Line 266 ⟶ 259:
1, 571, 4, 12
</pre>
<pre>
──────────enter four parameters (all positive integers) or QUIT
1, 133, 4, 5 ◄■■■■■■■■■ user input (first reponse).
s ◄─── a letter
──────────enter four parameters (all positive integers) or QUIT▼
∙ (some prompts and reponses elided.)
▲──────────enter four parameters (all positive integers) or QUIT
1, 571, 4, 12 ◄■■■■■■■■■ user input (ninth reponse).
═════► so─true.
</pre>
|