lparameters lcCode clear _cliptext = "<b><pre>" *MH lcCode = ; *MH "*Make sure we have something" + chr(13) + ; *MH "if llVal" + chr(13) + ; *MH " ?lcString " + chr(38) + "&Bug" + chr(13) + ; *MH "endif.if" local laRWs[23] laRWs[1] = ' IF ' laRWs[2] = ' ENDIF ' laRWs[3] = ' LOCAL ' laRWs[4] = ' CLEAR ' laRWs[5] = ' _CLIPTEXT ' laRWs[6] = ' CHR ' laRWs[7] = ' ALINES ' laRWs[8] = ' FOR ' laRWs[9] = ' EACH ' laRWs[10] = ' IN ' laRWs[11] = ' UPPER ' laRWs[12] = ' ALLTRIM ' laRWs[13] = ' LOOP ' laRWs[14] = ' STUFF ' laRWs[15] = ' TO ' laRWs[16] = ' OCCURS ' laRWs[17] = ' AT ' laRWs[18] = ' ENDFOR ' laRWs[19] = ' LPARAMETERS ' laRWs[20] = ' TRIM ' laRWs[21] = ' LEN ' laRWs[22] = ' CHRTRAN ' laRWs[23] = ' STRTRAN ' lcCode = strtran(lcCode, chr(9), space(5)) lcCode = strtran(lcCode, '<', '<') lcCode = strtran(lcCode, '>', '>') local laLines[1] alines(laLines, lcCode) *suspend for each lcLine in laLines *Full Line Comments, first if upper(alltrim(lcLine)) = '*' or; upper(alltrim(lcLine)) = 'NOTE' lcLine = '<font color=green>' + ; lcLine + '</font>' *Print line here ?lcLine _cliptext = _cliptext + chr(13) + chr(10) + lcLine loop endif *Now end of the line comments local lcDoubleAmp, lnStartComment lcDoubleAmp = chr(38) + chr(38) lnStartComment = at(lcDoubleAmp, lcLine) if lnStartComment > 0 lcLine = stuff(lcLine, lnStartComment, 0, '<font color=green>') + ; '</font>' endif *Define vars ahead of time *So they do not always need to be *Calculated in the loops local lcFormat, lnFormatLength, lcFL, ; lcRW, lnRWLength, lnStartRW, lnOccurance lcFormat = '<font color=blue>' lnFormatLength = len(lcFormat) lcFL = ' '+ upper(trim(chrtran(lcLine, ':;./\<>+=-}]()', space(14)))) + ' ' for each lcRW in laRWs lnRWLength = len(lcRW) - 2 *For each occurance of an RW ... *MH for lnX = 1 to occurs(lcRW, lcFL) lnOccurance = 1 lnStartRW = at(lcRW, lcFL, 1) do while lnStartRW > 0 *Put in the format tags lcLine = stuff(lcLine, lnStartRW, 0, lcFormat) lcLine = stuff(lcLine, lnStartRW + lnFormatLength + lnRWLength, 0, '</font>') lcFL = ' '+ upper(trim(chrtran(lcLine, ':;./\<>+=-}]()', space(14)))) + ' ' *MH lcFL = stuff(lcFL, lnStartRW, 0, lcFormat) *MH lcFL = stuff(lcFL, lnStartRW + lnFormatLength + lnRWLength, 0, '</font>') lnOccurance = lnOccurance + 1 lnStartRW = at(lcRW, lcFL, lnOccurance) enddo endfor ?lcLine _cliptext = _cliptext + chr(13) + chr(10) + lcLine endfor _cliptext = _cliptext + '</pre><b>'