Anonymous user
$T.REX: Difference between revisions
m
→$T.REX: elided duplicated code (from cut-n-paste).
m (→$T.REX: changed whitespace and some wording.) |
m (→$T.REX: elided duplicated code (from cut-n-paste).) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 62:
REXX programs not included are '''$H''' which shows '''help''' and other documentation.
<lang rexx>
/* There be many dragons below. */
Line 290:
if ?.block\==0 then tLL= 12 + max(LL - 1, 0) * (12 + ?.bs)
else tLL= LL
bline= strip(indent || x1 || copies(?.ab, tLL+4*boxing)x2, 'T')▼
if boxing then call ms bx.1 || copies(bx.2, LLx + tLL + 2)bx.3▼
caLL VEReb ?.e,?.eb▼
Line 523 ⟶ 528:
do abs(_) while _<99
▲bline= strip(indent || x1 || copies(?.ab, tLL+4*boxing)x2, 'T')
▲if boxing then call ms bx.1 || copies(bx.2, LLx + tLL + 2)bx.3
▲caLL VEReb ?.e,?.eb
call wit bline
end /*abs*/
Line 939:
if m | f=='*' then do
_= (word(d H L sw(), 1)) / word(1 2, m + 1)substr(_, 2)
if \datatype(_,"N") then interpret '_=' translate(_,"%",'/')
?.z= _
Line 946:
if datatype(_, "N") then ?.z= _ / 1
if \datatype(_, left(t"W", 1) ) then call er 53, _ '.'z"="
if L\=='' then if _<L | _>H
return _
/*──────────────────────────────────────────────────────────────────────────────────────*/
wr: parse
if ?.f=='' then return /*Nothing to write? Then skip it.*/
if highL & ahics\=='' then wr= translate(wr, , ahics)
if !cms | !tso then 'EXECIO 1 DISKW' ?.f "(FINIS STRING" wr
Line 962:
/*══════════════════════════════════════════════════════════════════════════════════════*/
!all: !!=!;!=space(!);upper !;call !fid;!nt=right(!var('OS'),2)=='NT';!cls=word('CLS VMFCLEAR CLRSCREEN',1+!cms+!tso*2);if arg(1)\==1 then return 0;if wordpos(!,'? ?SAMPLES ?AUTHOR ?FLOW')==0 then return 0;!call=']$H';call '$H' !fn !;!call=; return 1
!cal: if symbol('!CALL')\=="VAR" then !call=; return !call
!env: !env='ENVIRONMENT'; if !sys==
!fid: parse upper source !sys !fun !fid . 1 . . !fn !ft !fm .; call !sys; if !dos then do; _= lastpos('\', !fn); !fm= left(!fn, _); !fn= substr(!fn, _+1); parse var !fn !fn '.' !ft; end; return word(0 !fn !ft !fm, 1 +('0'arg(1)))
!rex: parse upper version !ver !vernum !verdate .; !brexx= 'BY'==!vernum; !kexx= 'KEXX'==!ver; !pcrexx= 'REXX/PERSONAL'==!ver | 'REXX/PC'==!ver; !r4= 'REXX-R4'==!ver; !regina= 'REXX-REGINA'==left(!ver,11); !roo= 'REXX-ROO'==!ver; call !env; return
!sys: !cms= !sys=='CMS'; !os2= !sys==
!var: call !fid; if !kexx then return space( dosenv(arg(1) ) ); return space( value(arg(1), , !env) )
$block: !call= '$BLOCK'; call
$mkdir: !call= '$MKDIR'; call
$scale: !call= '$SCALE'; call
cp: "EXECIO" '0'arg(2) "CP(STEM CP. STRING" arg(1); return rc
er: parse arg _1,_2; call '$ERR' "14"p(_1) p(word(_1,2) !fid(1)) _2; if _1<0 then return _1; exit result
p: return word( arg(1), 1)
halt: call er .1
kw: parse arg kw; return kw c2x(?.kw)
lower: return translate( arg(1), @abc, @abcu)
noValue: !sigl= sigl; call er 17,!fid(2) !fid(3) !sigl condition('D') sourceline(!sigl)
proper: procedure; arg f 2; parse arg 2 r; return f || r
sd: if ?.scrdepth=='' then parse value scrsize() with ?.scrdepth ?.linesize .; return ?.scrdepth
sw: if ?.linesize=='' then ?.linesize= linesize(); return ?.linesize
syntax: !sigl= sigl; call er 13,!fid(2) !fid(3) !sigl !cal() condition('D') sourceline(!sigl)
wit: call dsay arg(1); call wr arg(1); return</lang>
Programming note: this REXX program makes use of '''DELAY''' BIF which delays (sleeps) for a specified amount of seconds.
<br>Some REXXes don't have a '''DELAY''' BIF, so one is included here ──► [[DELAY.REX]].
|