/ns .......|.......|.......|.......|.......|.......|.......|.......|......... ; ;      This glossary will reformat an entire file, assuming block ;structured paragraphs. ; ;      If you wish to have unformmatted or centered text, put a "u" or ;"c" in column 3 of the ruler.  For example: ; ;      ..u.....|........|.......|......|....... ;              this text is unformatted ; ;      ..c.....|........|.......|......|...... ;            this text will be centered ; ;      ........|........|.......|......|...... ;      this text will be reformatted ; ; ; ;*********************** ;*                     * ;* Format File         * ;*                     * ;*********************** ; 'key ^  Reformat File :goforit ;;;    display-off             ; comment out if you wish do see display 'home 'br loop2 :loop 'column 3 'ruler 'xchar 'range uu UU 'beq noformat 'xchar 'range cc CC 'beq center 'call reformat :loop2 'display-pos 'call nxtpar 'eof 'bne loop :loop9 'home 'rtn :noformat 'down 'putcol 'tab 'getcol 'eof 'beq loop9 'call dotcmd 'bne noformat 'down                    ; go past ruler 'br loop :center 'text ^s^c 'down 'eof 'beq loop9 'column 3 'ruler 'range cc CC 'beq center 'down 'br loop ;*********************** ;                      * ; Reformat from cursor * ; through next ruler   * ;                      * ;*********************** 'key R Reformat Til' Next Ruler 'display-off 'crt clear 'rulerflag=1 :rloop 'column > 'eof 'beq endrul 'eol 'beq rl1 'call dotcmd 'bne rl2 :rl1 'display-pos 'call nxtpar 'cmpnum rulerflag,0 'beq endrul 'eof 'beq endrul :rl2 'call reformat 'jmp rl1 :endrul 'display-page 'rtn ; ;*********************** ;*                     * ;* Reformat Paragraph  * ;*                     * ;*********************** ; ;    This macro reformats the paragraph the cursor is on.  Before ;formatting the paragraph it moves the left margin to the new left margin. ;It assumes you are useing block style paragraphs, with one or more blank ;lines between paragraphs. 'key F  Reformat Paragraph :reformat 'display-off             ; for speed :rfm0 'column 1                ; go to beginning of line 'cmp                     ; blank? 'beq rfm1                ; if not then advance to next line 'text ^w :rfm1 'putcol                  ; save our column address 'column >                ; move to left margin 'text ^s^u               ; and align our text there 'getcol                  ; return to old column address 'eof                     ; just align last line in file? 'beq rfm4                ; then go back up and reformat 'down                    ; check out the next line 'eol                     ; empty? 'beq rfm4                ; then go back up and reformat 'call dotcmd             ; see if this is a dot command 'beq rfm4                ; if so then go back up and reformat 'br rfm0                 ; else align this line ; go back to top of paragraph :rfm4 'up                      ; up one line 'bof                     ; beginning of file? 'beq rfm6 'call dotcmd             ; dot command? 'beq rfm5 'eol                     ; empty line? 'bne rfm4 :rfm5 'down                    ; get back to start of paragraph :rfm6 'display-line            ; re-enable output 'reformat                ; now reformat the paragraph 'rtn                     ; all done ; this routine tests to see if the current line is a dot command :dotcmd 'putcol                  ; save column address 'column 1                ; and go to column 1 'cmp .                   ; is this a dot command 'getcol                  ; restore original column 'rtn                     ; and return to the user ; ;*********************** ;*                     * ;*  Next Paragraph     * ;*                     * ;*********************** ; ;      This macro advances the cursor to the beginning of the next ;paragraph.  It assumes you are using block style paragraphs with one or ;more blank lines between paragraphs. 'key T  Next Paragraph :nxtpar 'column >                ; get to left margin 'down 'eof                     ; end of file 'req                     ;  yes, this is as far as we can go 'eol                     ; blank line? 'beq nxp2                ; then we must be out of this paragraph 'call dotcmd             ; dot command also terminates paragraph 'bne nxtpar 'cmpnum rulerflag,1      ; is this baby set for key R? 'ifeq (column 2 (range .. || $$ >>      ;a ruler? (bne nxp2 (col=1 (rulerflag=0 (rtn 'endif ; past end of first paragraph, so advance to next one :nxp2 'cr 'column >                ; in case margins changed 'call dotcmd             ; dot command does not start a paragraph 'bne n3 'cmpnum rulerflag,1      ; is this baby set for key R? 'ifeq (column 2 (range .. || $$ >>      ;a ruler? (bne nxp2 (col=1 (rulerflag=0 (rtn 'endif 'jmp nxp2 :n3 'eof                     ; quit if end of file 'req 'eol                     ; blank line? 'beq nxp2                ; then keep looking 'rtn                     ; we're there!! 'variable rulerflag,1