/* Rexx - Name this member PANEXIT */ /* */ /* Poor man's HILITE of REXX in Browse */ /* */ /* This will work in ISPF for OS/390 R10 or later. */ /* This can be downloaded from */ /* ftp://www.sillysot.com/ftp/panexit.txt */ /* */ /* Add the following lines to panel isrbroba: */ /* */ /*In the )attr section */ /* Y TYPE(CHAR) COLOR(YELLOW) */ /* G TYPE(CHAR) COLOR(GREEN) */ /* R TYPE(CHAR) COLOR(RED) */ /* W TYPE(CHAR) COLOR(WHITE) */ /* B TYPE(CHAR) COLOR(BLUE) */ /* */ /*At the end of the )init section and the beginning of the )reinit: */ /* */ /* &SHADOW=&ZDATA */ /* PANEXIT((ZDATA,SHADOW,ZWIDTH),REXX,%PANEXIT) */ /* */ /*In the )BODY section add a shadow variable called SHADOW by */ /* adding ,SHADOW after the word ZDATA */ /* */ /* (c) IBM Corp, 2000 - All rights reserved */ /*********************************************************************/ call isprexpx 'I' /* Set up variables passed in to the panel exit */ /* Specify keywords to hilight */ keywords='call overlay pos length do end while until words subword' keywords=keywords 'copies translate xrange if then by to substr' /* Set up translate table of valid keyword characters */ trtable='ABCDEFGHIJKLMNOPQRSTUVWXYZ$#@0123456789_' trtable=translate(xrange('00'x,'FF'x),,trtable,' ') /* Make a copy of zdata with only alphanumerics. This will be used */ /* as the reference string for finding keywords. */ zdatacopy=translate(zdata) zdatacopy=translate(zdatacopy,,trtable,' ') /* Remove non-Kwd chars */ /* Look at the copy, finding keywords and update shadow accordingly */ keywords=translate(keywords) shadow=copies('G',length(shadow)) do a = 1 to words(keywords) keyword=subword(keywords,a,1) wordlen=length(keyword) position=pos(keyword,zdatacopy) do while position>0 zdatacopy=overlay(' ',zdatacopy,position,wordlen) if substr(zdatacopy,position-1,1)=' ' & , substr(zdatacopy,position+wordlen,1)=' ' then shadow =overlay('R',shadow ,position,wordlen,'R') position=pos(keyword,zdatacopy) end end /* Now highlight quoted strings and comments. Multilevel comments */ /* are supported, but this example assumes no continuation of */ /* strings or comments off of the screen. */ squote=0 dquote=0 comment=0 do a = 1 to length(zdata) if squote+dquote>0 then shadow=overlay('W',shadow,a,1) else do if substr(zdata,a,2)='/*' then comment=comment+1 if comment>0 & substr(zdata,a,2)='*/' then do shadow=overlay('BB',shadow,a,2) comment=max(0,comment-1) end end if comment>0 then shadow=overlay('B',shadow,a,1) if comment=0 then if dquote=0 & substr(zdata,a,1)= "'" then squote=1-squote /* Turn on or off squote */ else if squote=0 & substr(zdata,a,1)= '"' then dquote=1-dquote /* Turn on or off dquote */ if squote+dquote>0 then shadow=overlay('W',shadow,a,1) if comment>0 then shadow=overlay('B',shadow,a,1) end /* Finally, turn the top of data and bottom of data to default color */ do a = 1 to length(zdata) by zwidth if substr(zdata,a,3)='***' then /* Assume this is top/Bot of data */ shadow=overlay(' ',shadow,a,zwidth,' ') end call isprexpx 'T' /* Send changes back to ispf */