'set novalue on' /* force KEXX and its way of SIGNAL ON NOVALUE */ /* Usage: [MACRO] EIS [ANUM or search pattern] */ /* Example: EIS 60 looks for %I A000060 */ /* Purpose: Locate specified sequence in EIS??.TXT, or find */ /* specified target in EIS??.TXT */ /* Macro EIS uses file TAGS created in EIS path to */ /* locate sequences, resp. file TAGS.TMP to locate */ /* arbitrary targets (format compatible with KTAGS */ /* and other macros, lines = TAB path TAB target). */ /* Caveat: TAGS file for all sequences is big, about 3 MB. */ /* Bugs: I don't know how to specify the scanned files */ /* for GNU grep variants and paths with embedded */ /* blanks: `grep "this" "A:\L L\*"` doesn't work. */ /* UTLOS grep supports this, remove DOS = 'DOS' if */ /* you use UTLOS grep and blanks in the EIS path. */ /* Fatal: There are now already 79 (00..78) parts in EIS, */ /* and this script cannot handle more than 99. :-( */ /* Requires: Kedit 5.0, grep.exe, EIS??.TXT files */ BOX = 'e:\installed\netscape\mail\EIS' EIS = 'c:\etc\eis\' /* path of EIS00.txt .. EIS78.txt */ TMP = EIS || 'tags' /* temp. file used to grep sequence */ ALL = EIS || 'EIS??.txt' ; EIS = length( ALL ) + 1 PAT = words( arg( 1 )) ; parse upper source DOS . A DOS = 'DOS' /* remove this line for UTLOS grep */ if PAT = 0 then do /* no arg.: edit EIS related mails */ 'x "' || BOX || '"' ; exit rc end if PAT = 1 then do /* translate ANUM to "^%I A123456": */ parse upper value strip( arg( 1 )) with A 2 PAT if A <> 'A' then PAT = A || PAT if datatype( PAT, 'W' ) then exit EDIT( '%I A' || right( PAT, 6, 0 )) else PAT = arg( 1 ) /* no sequence number: use argument */ end else PAT = arg( 1 ) /* no sequence number: use argument */ 'kedit "' || TMP || '.tmp" (NOPROF NEW)' ; PAT = strip( PAT ) if rc = 0 then 'qquit' /* first quit any old grep results: */ if rc = 0 then do A = 'command dosq grep -n "' || PAT || '"' if DOS = 'DOS' then A ALL '>' TMP || '.tmp' else A '"' || ALL || '" > "' || TMP || '.tmp"' end if rc = 0 then 'kedit "' || TMP || '.tmp" (NOPROF)' if rc = 0 then do do A = 1 to size.1() /* supporting GNU and UTLOS format: */ 'next' ; parse value curline.3() with PATH =(EIS) STR if abbrev( STR, ':' ) then parse var STR ':' . ':' STR else parse var STR '(' . ') : ' STR 'replace' d2c( 9 ) || PATH || d2c( 9 ) || STR end /* remove line numbers from output */ A = size.1() ; 'ffile' end if rc <> 0 then exit rc /* any error message still visible */ if A = 0 then do /* show error message if no match */ 'emsg no "' || PAT || '" in' ALL ; exit 1 end if A = 1 then do /* if one hit edit source directly */ 'kedit "' || PATH || '"' if rc = 0 then 'tfind' delimit( STR ) if rc = 0 then 'refresh' if rc = 0 then say 'one "' || PAT || '" in' ALL ; exit rc end 'kedit "' || TMP || '.tmp"' if rc = 0 then 'v' EIS - 5 EIS - 4 EIS + 1 '*' ; exit rc EDIT: /* unique sequence, persistent tags */ arg PAT ; 'kedit "' || TMP || '" (NODEFEXT NOPROF)' A = size.1() ; if rc <> 0 then return rc if A = 0 then do 'qquit' ; A = 'command dosq grep -n "^%I A[0-9]"' if DOS = 'DOS' then A ALL '>' TMP else A '"' || ALL || '" > "' || TMP || '"' if rc <> 0 then return rc 'kedit "' || TMP || '" (NODEFEXT NOPROF)' if rc <> 0 then return rc do A = 1 to size.1() /* supporting GNU and UTLOS format: */ 'next' ; parse value curline.3() with PATH =(EIS) STR if abbrev( STR, ':' ) then parse var STR ':' . ':' STR else parse var STR '(' . ') : ' STR 'replace' d2c( 9 ) || PATH || d2c( 9 ) || STR end /* remove line numbers from output */ A = size.1() ; 'ssave' ; PATH = '' end 'nomsg :0 locate' delimit( PAT ) ; STR = d2c( 9 ) ; PATH = '' if rc = 0 then parse value curline.3() with . (STR) PATH (STR) . 'qquit' if PATH = '' then do 'emsg no' PAT 'in' ALL '(' || A 'sequences)' ; return 1 end 'kedit "' || PATH || '" (NODEFEXT)' if rc <> 0 then return rc ; 'nomsg :0 tfind' delimit( PAT ) if rc <> 0 then do 'refresh' ; 'cmsg erase' TMP 'emsg please delete' TMP 'to recreate EIS tags' ; return 1 end 'forward half' ; 'refresh' ; return 0