! BSLASH - Adjust backslash position ! ! Kelvin Smith, Financial Computer Systems, Inc., Stamford, CT 06902 ! ! ! ! This TECO macro reformats programs by taking lines with ! ! multiple statements and putting each statement on its own physical ! ! line. It also takes backslashes from the end of a physical line ! ! (even if followed by a comment) and putting them at the beginning of ! ! the next non-blank program line. ! ! This macro assumes that all backslashes are valid statement ! ! delimiters; if there are backslashes within comments or quoted ! ! strings, they will be (incorrectly) reformatted just as the rest are. ! ! Further, it assumes that backslashes separate all statements; if you ! ! need to convert from colons, use the macro CASE. ! !BSLASH! @^A%Warning--this macro converts all backslashes, including% 13^T 10^T @^A%any inside quoted strings and comments!!!% 13^T 10^T 1^X ! Don't count | as \ ! < @:S%\%; ! Find \; exit loop if no more ! -2A-10"E ! At beginning of line (just past )? ! F< ! Yes - leave it alone and find next ! ' -D ! Delete backslash ! .UP 0L ! Store tab/space combination at beg of line ! @::S%\% ^[ ! Skip any backslash ! @::S%^ES% ! Find the indentation ! "S ^YXT ! Keep for future use ! | @9^UT%% ! Default to one tab ! ' QPJ ! Back to normal business ! @::S%^ES% ! Jump over any following spaces and tabs ! 0A-^^!"E ! Just before a comment? ! @O!NL! ! Try next line ! | ! Otherwise... ! @FR%% ! Delete the spaces and tabs ! 0A-13"N ! At end of line? ! @13I%% @10I%% ! No - two stmts on one line--insert ! -1US ! We need indentation ! | ! Yes - put \ on next line ! !NL! L 0A-13"E ! Is line blank? ! @O!NL! ! Try next line ! ' @::S%^ES% ^[ @::S%!% ! Starts with comment? ! "S .-1UP ! Store position ! :@FB%!% ! Comment ends on this line? ! "S ! Yes ! 0A-13"N ! Not end of line ! 0A-^^\"E ! A redundant backslash ! F< ! Ignore one we're holding ! ' QP,.XS ! Store comment ! QP,.K ! and delete from current pos ! L 2R ! Move to end of line ! GS ! Replace comment ! | ! Comment alone on line ! @O!NL! ' | ! Comment alone on line ! @O!NL! ! Try next line ! ' ' ' 0L ! Back to beginning of line for \ ! @I%\% ! Insert backslash ! QS"N ! If no indentation ! GT ! then insert ours ! 0US ! Reset flag ! ' ' > J < :@S%^EL^ED^ED^ED^ED % ! Look for line number followed by space ! ; ! Exit loop when no more ! -D ! Delete space ! 9@I%% ! and replace with tab ! > ^N"E ! More pages to do ! P @O!BSLASH! ' !END! ]T ]S ]R ]P ]L ]C ]A @^A%Ending% 13^T 10^T