Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,18 @@
/*REXX program reads a file and displays it to the screen (with word wrap). */
parse arg iFID width . /*obtain optional arguments from the CL*/
if iFID=='' | iFID=="," then iFID='LAWS.TXT' /*Not specified? Then use the default.*/
if width=='' | width=="," then width=linesize() /* " " " " " " */
@= /*number of words in the file (so far).*/
do while lines(iFID)\==0 /*read from the file until End-Of-File.*/
@=@ linein(iFID) /*get a record (line of text). */
end /*while*/
$=word(@,1) /*initialize $ with the first word. */
do k=2 for words(@)-1; x=word(@,k) /*parse until text (@) exhausted. */
_=$ x /*append it to the $ list and test. */
if length(_)>=width then do; say $ /*this word a bridge too far? > w. */
_=x /*assign this word to the next line. */
end
$=_ /*new words (on a line) are OK so far.*/
end /*m*/
if $\=='' then say $ /*handle any residual words (overflow).*/
/*stick a fork in it, we're all done. */

View file

@ -0,0 +1,42 @@
/*REXX program reads a file and displays it to the screen (with word wrap). */
parse arg iFID width kind _ . /*obtain optional arguments from the CL*/
if iFID=='' | iFID=="," then iFID = 'LAWS.TXT' /*Not specified? Then use the default.*/
if width=='' |width=="," then width= linesize() /* " " " " " " */
if right(width, 1) =='%' then width= linesize() * translate(width, , "%") % 100
if kind=='' | kind=="," then kind= 'Left' /*Default? Then use the default: LEFT */
just= left(kind, 1); upper just /*use 1st char of JUSTIFY, uppercased.*/
if pos(just, 'BCLR')==0 then call err "KIND (3rd arg) is illegal:" kind
if _\=='' then call err "too many arguments specified." _
if \datatype(width,'W') then call err "WIDTH (2nd arg) isn't an integer:" width
n=0 /*the number of words in the file. */
do j=0 while lines(iFID)\==0 /*read from the file until End-Of-File.*/
_=linein(iFID) /*get a record (line of text). */
do until _==''; n= n + 1 /*extract some words (or maybe not). */
parse var _ @.n _ /*obtain and assign next word in text. */
end /*until*/ /*parse 'til the line of text is null. */
end /*j*/
if j==0 then call err 'file' iFID "not found."
if n==0 then call err 'file' iFID "is empty (or has no words)"
$=@.1 /*initialize $ string with first word*/
do m=2 for n-1; x= @.m /*parse until text (@) is exhausted. */
_= $ x /*append it to the $ string and test.*/
if length(_)>= width then call tell /*this word a bridge too far? > w */
$= _ /*the new words are OK (so far). */
end /*m*/
call tell /*handle any residual words (if any). */
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
err: say; say '***error***'; say; say arg(1); say; say; exit 13
/*──────────────────────────────────────────────────────────────────────────────────────*/
tell: if $=='' then return /* [↓] the first word may be too long.*/
w=max(width, length($) ) /*don't truncate long words (> w). */
select
when just=='L' then $= strip($) /*left ◄──────── */
when just=='R' then $= right($, w) /*──────► right */
when just=='B' then $=justify($, w) /*◄────both────► */
when just=='C' then $= center($, w) /* ◄centered► */
end /*select*/
say $ /*display the line of words to terminal*/
_= x /*handle any word overflow. */
return /*go back and keep truckin'. */

View file

@ -0,0 +1,28 @@
/* REXX ***************************************************************
* 20.08.2013 Walter Pachl "my way"
* 23.08.2013 Walter Pachl changed to use lastpos bif
**********************************************************************/
Parse Arg w
oid=w'.xxx'; 'erase' oid
Call o left(copies('123456789.',20),w)
s='She should have died hereafter;' ,
'There would have been a time for such a word.' ,
'Tomorrow, and tomorrow, and tomorrow, and so on'
Call ow s
Exit
ow:
Parse Arg s
s=s' '
Do While length(s)>w
i=lastpos(' ',s,w+1) /* instead of loop */
If i=0 Then
p=pos(' ',s)
Else
p=i
Call o left(s,p)
s=substr(s,p+1)
End
If s>'' Then
Call o s
Return
o:Return lineout(oid,arg(1))