/* REXX DEHELP Prepare canonical HELP text for revision. Hide everything except the HELP paragraph. Within HELP, hide everything except active HELP-text and strip the 'say' portion and the trailing quote from all lines containing actual text. . This should be useful when HELP text is first generated, since there will be no extraneous characters left to interfere with typing. Written by Frank Clarke rexxhead@yahoo.com 20161027 Impact Analysis . ... ... Modification History 20230313 fxc adjust where the end of HELP-text is; reset labels; */ address ISREDIT "MACRO (opts)" parse value "0 0 0 0 0 0 0 0" with, sw. branch , . upper opts parse var opts "TRACE" tv . parse value tv "N" with tv . rc = Trace("O"); rc = Trace(tv) sw.0All = WordPos( "ALL",opts ) > 0 call A_SKINNY /* find HELP and expose */ call B_PREP /* remove 'say' */ exit /*@ DEHELP */ /* Hide eveything. Find the HELP section. Expose the start- and end-points. . ----------------------------------------------------------------- */ A_SKINNY: /*@ */ address ISREDIT "RESET ALL" "X ALL" "SEEK 'HELP:' 1 FIRST" if rc > 0 then do zedsmsg = "No HELP section" zedlmsg = "No HELP label found in column 1 anywhere" address ISPEXEC "SETMSG MSG(ISRZ000)" exit end /* no HELP */ "XSTATUS .zcsr = NX" /* show this line */ "LABEL .zcsr = .HS 0" /* HELP start */ "(start) = LINENUM .zcsr" start = start + 0 if sw.0All then, "SEEK 'exit' 1 " else, "SEEK 'Debugging' " "(finis) = LINENUM .zcsr" finis = finis - 1 "LABEL" finis "= .HE 0" /* HELP end */ return /*@ A_SKINNY */ /* Remove 'say' and quotes from beginning and end of the lines EXCEPT for lines which say nothing. Expose all lines of active HELP-text. . ----------------------------------------------------------------- */ B_PREP: /*@ */ address ISREDIT do zz = start to finis /* each HELP line */ "(text) = LINE " zz /* capture text */ if Left(text,4) <> 'say' then iterate /* not interested */ "XSTATUS (zz) = NX" /* show this line */ text = " "Substr(text,6,81) /* snips the 'say' */ text = Strip(text,'T',' ') /* snip trailing blank */ text = Strip(text,'T','"') /* snip trailing quote */ if text = '' then iterate /* leave as-is */ "LINE (zz) = (text)" /* replace the text */ end /* zz */ /* push any remaining quotes out to column 80 */ rc = Trace("O"); rc = Trace(tv) do forever "C ALL '7f40'x '407f'x 70 80 .hs .he" if rc > 0 then leave end /* forever */ "F 'HELP' 1 FIRST" "RESET LABELS" return /*@ B_PREP */