! CASE.TES - Upper/lower case converter ! ! Kelvin Smith, Financial Computer Systems, Inc., Stamford, CT 06902 ! ! ! ! This TECO macro will convert any alphabetic characters within the ! ! scope of the "command line" from upper to lower or vice versa. It ! ! skips any characters within matching quotes, and also skips any ! ! characters in a comment. Note that it will not avoid converting ! ! REM statements. It will, however, ignore any exclamation points ! ! within a quoted string. ! [A [C [L [P [R [S [T .UP ! Where do we start? ! J ET&2"F @^UR/ -1A^T/ ! Hard-copy delete ! | @^UR/ 8^T 32^T 8^T/ ! Scope delete ! ' @^US/ ! Input routine ! < ^TUT QT-127"E ."G MR -D ' | QT- 27"E 13^T 10^T 1; | QT- 21"E ET&2"F 13^T 10^T | .+2' HK | QT- 13"E ^T; | QT@I%% '''' >/ !QUES! @^A%(1) Upper to lower case, (2) Lower to upper case, (3) Colon to backslash, (4) 1 + 3, (5) 2 + 3? % MS ! Get response ! @I/~/ ! Mark end ! J \UT J @S/~/ 0,.K ! Erase response ! QT"> QT-5"< QT-2"> ! 3,4,5 ! -1UL ! Switch colons ! QT-3 UT ! Just leave 1 or 2 ! | 0UL ' QPJ ! Reposition ourselves ! @O!BEG! ' ' 7^T ! If not in 1-3 range ! @O!QUES! !BEG! -1UA !ST! %AA"< ! We're at end of page ! @O!PAG! ! Get next page ! ' QAA-10"E ! End of line ! L ! Go to next line and reset flag ! @O!BEG! ' QAA-33"E ! Start of comment ! QA+1C ! Skip to start of it ! @:FB/!/ ! Does it end before end of line? ! "U ! No--skip to next line ! L ' ! Else continue ! @O!BEG! ' QAA-34"E ! Start of quoted string ! QA+1C @:FB/"/ ! Look for end ! "U @^A/?Unmatched " char/ @O!END! | @O!BEG! ' ' QAA-39"E ! Start of quoted string ! QA+1C @:FB/'/ ! Look for end ! "U @^A/?Unmatched ' char/ @O!END! | @O!BEG! ' ' QT-1"E ! Converting upper to lower case ! QAA"W ! Is character upper case letter? ! QAC ! Yes - move to it ! 0AUC D QC#32@I// ! Replace with lower case ! @O!BEG! | @O!COL! ' ' QT-2"E ! Converting lower to upper case ! QAA"V ! Is character lower case? ! QAC ! Move to it ! 0AUC D QC&95@I// ! Replace with upper case ! @O!BEG! ' ' !COL! QL"N ! Also converting colons ! QAA-58"E ! Found a colon ! QAC D ! Remove the colon ! .UP 0L @::S/^ES/"S .+1-QP"> ! If colon is at beginning of ! 0L ! line (just spaces ahead), ! @I/\/ ! put the backslash at the ! QP+1J ! start of the line. ! @O!BEG! ' ' QPJ ! Go back to the colon position ! @I/\/ ! Put in the backslash ! @O!BEG! ' ' @O!ST! !PAG! ^N"E ! More pages to do ! ^E"T ! Need to append a form feed ! PW ! Push out what's done ! | B,ZPW ! No form feed ! ' 1:A ! Get one line only ! @O!BEG! ' !END! ]T ]S ]R ]P ]L ]C ]A @^A%Ending% 13^T 10^T