'set novalue on' /* force KEXX and its way of SIGNAL ON NOVALUE */ /* Usage: [MACRO] RXHELP [topic] */ /* Requires: Kedit 5.0 */ /* HELPMSG.EXE etc. if running under OS/2 or MDOS */ /* DOSREXX.INF etc. if running under PC DOS 7 */ /* RXHELP.REX etc. if using REXX/Personal for DOS */ /* Purpose: replacement for the 1991 RXHELP.KEX, which only */ /* supported REXX/Personal with RXHELP.REX. This */ /* new version supports context sensitive help in */ /* REXX-sources, but this of course only works if */ /* you assign RXHELP.KEX to an editor key like F1. */ /* Proposal: file extension(s) key C-H key F1 */ /* *.CMD *.REX khelp rxhelp */ /* *.KML *.KEX rxhelp khelp */ /* *.C *.H *.ASM khelp ktags */ /* otherwise ktags khelp */ /* :F1 */ /* if arg() then 'khelp' arg(1) /* compatible F1 key */ */ /* else 'macro C-H khelp ktags rxhelp' */ /* :C-H */ /* if arg() then do /* MACRO C-H called: */ */ /* parse arg F1 . /* default 1st word */ */ /* if wordpos( ft.1(), 'C H ASM' ) > 0 then */ /* parse arg . F1 . /* C-Help: 2nd word */ */ /* if wordpos( ft.1(), 'CMD REX' ) > 0 */ /* then parse arg . . F1 /* RxHelp: 3rd word */ */ /* if wordpos( ft.1(), 'KML KEX' ) > 0 */ /* then F1 = F1 focusword.1() /* KEX: khelp topic */ */ /* 'synex' F1 /* optional synonyms */ */ /* else /* do opposite of F1 */ */ /* if wordpos( ft.1(), 'KML KEX' ) = 0 */ /* then 'macro C-H ktags khelp khelp' */ /* else 'macro rxhelp' /* KEX: macro rxhelp */ */ TOPIC = space( arg( 1 )) if TOPIC = '' then do /* context help in REXX files */ XFILE = abbrev( ft.1(), 'R' ) | right( ft.1(), 1 ) = 'X' if XFILE | wordpos( ft.1(), 'BAT CMD KML' ) > 0 then do XFILE = word.1() ; 'word alpha' TOPIC = focusword.1() ; 'word' XFILE end end if opsys.1() == 'DOS' /* check if HELPMSG REXX okay */ then parse value opsys.2() with XFILE '.' else XFILE = ( opsys.1() == 'OS/2' ) * 20 if XFILE = 20 then do /* OS/2 or DOS VDM under OS/2 */ 'dosq helpmsg rexx' TOPIC ; exit rc end if opsys.1() <> 'DOS' then do 'emsg REXX help for' opsys.1() 'not implemented' ; exit 1 end if PATHFILE( 'dosrexx.inf' ) then do /* HELP REXX available: */ if TOPIC > '' then 'dosq help rexx' TOPIC else 'dosq view dosrexx' ; exit rc end if PATHFILE( 'rxhelp.rex' ) then do /* REXX RXHELP.REX REXX */ /* On my system REXX RXHELP crashes, because RXWINDOW does */ /* not support LIM 4.0 EMS without page frame. Workaround: */ /* load RXWINDOW /NX before starting REXX, unload it after */ /* return from REXX. This has to be done in a (temporary) */ /* batch file, as Kedit cannot swap itself back again if a */ /* TSR-program like RXWINDOW has been loaded within Kedit. */ XFILE = dosenv( 'TMP' ) /* look for scratch directory */ if XFILE = '' then XFILE = dosenv( 'TEMP' ) if XFILE = '' then XFILE = '.' if right( XFILE, 1 ) <> '\' then XFILE = XFILE || '\' XFILE = XFILE || 'kedittmp.bat' if rexx.0() > 0 then RX = '@rx' ; else RX = '@rexx' 'dosq echo @lh rxwindow /NX /Q >' || XFILE 'dosq echo' RX 'rxhelp.rex %1 %2 >>' || XFILE 'dosq echo @lh rxunload rxwindow >>' || XFILE 'dos' XFILE 'rexx' TOPIC /* RXHELP.REX ignores a TOPIC */ 'nomsg erase' XFILE ; exit rc end 'emsg REXX help not available - RXHELP.REX not found' ; exit 1 PATHFILE: procedure /* -------------------------- */ parse arg FILE PATH = dosenv( 'PATH' ) HERE = fileid.1() do while PATH > '' /* for all PATH directories: */ parse var PATH DIR ';' PATH if right( DIR, 1 ) <> '\' then DIR = DIR || '\' 'nomsg dir "' || DIR || FILE || '" (noprof' if rc <> 0 then iterate /* FILE not found in this DIR */ if ring.0() > 1 then 'quit' /* FILE found, quit DIR.DIR */ 'kedit "' || HERE || '" (new' /* edit caller's file again */ return 1 /* result 1 if FILE found */ end return 0 /* result 0 if FILE not found */