]oju}&gtj&Uxvngt&RumoiJV*.w"+7w   �7       4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;                                                              ; ;  Widow and Orphan Handler for SuperVUE                       ; ;  Copyright (C) 1987 UltraSoft Corp.                          ; ;                                                              ; ;  Donated to AMUS 11/87                                       ; ;                                                              ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;; ;  variables  ; ;;;;;;;;;;;;;;; variable pages,4 variable widows,4 variable orphans,4 variable lines,4 variable pass,4 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;  command to start processing is WIDOW  ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; do widow ;;;;;;;;;;;;;;;;;;;;;;;;;; ;  initialize variables  ; ;;;;;;;;;;;;;;;;;;;;;;;;;; widows = 0 orphans = 0 pass = 1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;  Two-pass logic: home cursor and being scanning each line.  ; ;  Pass 1 finds and corrects orphans.  Pass 2 fixes widows.   ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; repeat: "cmode "text "breaks^M" "dmode "pages = 1 "home "down "down "down ;;;;;;;;;;;;;;;;;;;; ;  scan each line  ; ;;;;;;;;;;;;;;;;;;;; 'cmpnum pass,1 'ifeq )flag O 'else )flag W 'endif 'loop 65535 )eof )ifeq +pop )else +call scan.line +next )endif 'pass = pass+1 'cmpnum pass,2 'ifeq )pop )jmp repeat 'endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;  end of processing - report number of corrections  ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 'flag 'cmode 'crt eos 'print 'print "Widow and Orphan Glossing Completed" 'print "===================================" 'print 'print "Pages scanned:     "; pages 'print "Orphans corrected: "; orphans 'print "Widows corrected:  "; widows 'print 'print "[press ESCAPE to continue editing]" 'stop ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;  scan a line for a widow or an orphan (depending on pass)  ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; scan.line: ;insert an X, check for it, and remove it ;if we are on a page break, we will not find the X 'text "^FX^H" 'cmp "X" 'ifeq )text "^D" 'else )pages = pages+1 )cmpnum pass,1 )ifeq +call check.orphan )else +call check.widow )endif 'endif 'down 'rtn ;we are on a page break ;check for an orphan check.orphan: 'up              ; point to last line on page 'cmp ""          ; is last line blank? 'ifeq            ;  yes - can't be an orphan )down          ;    go back to page break )down          ;    advance to next line )pop           ;    break out of if )rtn           ;    return 'else            ;  no - might be an orphan )up            ;    go to 2nd line before end of page )cmp ""        ;    is it blank? )ifeq          ;      yes - we have an orphan +orphans = orphans+1 +text "^B"   ;  get rid of the orphan line +home +cmode +text "breaks^M" +dmode +down +down )endif         ; )down          ; down to .-1 )down          ; back to page break )down          ; down to next line 'endif 'rtn ;we are on a page break ;check for a widow check.widow: 'down            ; point to first line on page 'cmp ""          ; is first line blank? 'ifeq            ;  yes - can't be a widow )up            ;        go back to page break )down          ;        advance to next line )pop           ;        break out of if )rtn           ;        return 'endif 'down          ; now on line 2 of page 'cmp ""        ; is 2nd line blank? 'ifne          ;  no - can't be a widow )up          ;       back to line 1 )pop         ;       break out of it )rtn         ;       return 'endif ;now check to see if last line of previous page was non blank. ;If is non-blank, then we truly have a widow here. 'up              ; back up to line 1 'up              ; back up to page break 'up              ; back up to last line of previous page 'cmp ""          ; blank? )ifeq          ;  yes - not a widow after all +down        ;        back to page break +down        ;        advance to next line +pop         ;        break out of it +rtn         ;        return )endif ;now it is time to count the number of lines making up the ;paragraph before the widow line )lines = 1 )loop 100 +up          ; back up a line +cmp ""      ; blank line? -ifeq      ;  yes - count is now valid /pop     ;        break out of if .else     ;  no - /lines = lines+1 /next .endif *widows = widows+1 *loop lines ,text "^B" ,next )home )cmode )text "breaks^M" )dmode )down )down )rtn