1 .* ***********************************************************
  2 .* *                                                         *
  3 .* *                                                         *
  4 .* * Copyright, (C) Honeywell Information Systems Inc., 1981 *
  5 .* *                                                         *
  6 .* *                                                         *
  7 .* ***********************************************************
  8 .*                                      MACRO UTILITY
  9 .*                                      ENTRY VECTOR
 10 .ur .go %InputFileName%
 11 .*                                      OUTPUT
 12 .la output
 13 .srv FONT "l%LEVEL%font"
 14 .ts "%ENTRY%" = "exact"
 15 .srv FONT "l4exact"
 16 .ur .ur .tlh 0 0 |%%.fnt %FONT%%%%%Parameter%%%%.fnt%%|
 17 .rt
 18 .*                                      BOX SETUP
 19 .la setbox
 20 .ts %TITLEN% = 0                        ;.* is there a title?
 21 .rt
 22 .*
 23 .srv BOX_LENGTH 0
 24 .srv BOXI 1
 25 .la BOX_LOOP
 26 .ts %BOXI% = 1 & %FORM% < 5
 27 .ur .srv BOX_WORD1 "%%[before [ltrim [after "%TITLE1%" ":"]] ","]%%"
 28 .ts %BOXI% > 1 | %FORM% = 5
 29 .ur .srv BOX_WORD%BOXI% "%%TITLE%BOXI%%%"
 30 .ur .ur .ur .sr BOX_LENGTH %%%%%%[max %BOX_LENGTH% %%%%{Measure("%%BOX_WORD%BOXI%%%")}%%%%]%%%%%%
 31 .srv BOXI %BOXI% + 1
 32 .ts %BOXI% <= %TITLEN%
 33 .go BOX_LOOP
 34 .sr BOX_LINE "_____________________________________________X"(1,%BOX_LENGTH%)
 35 .rt
 36 .*                                      PROSE BOX OFF
 37 .la prose_box_off                       ;.* obsolete entry point
 38 .ifi set_page_header
 39 .rt
 40 .*                                      TOC ENTRY TITLE SPLITTER
 41 .la split_title
 42 .srv TOC_REF "  %PageNo%"
 43 .ts "%section%" = ""
 44 .go NO_SECTION
 45 .*
 46 .sr LSN Measure("%section%")
 47 .sr TOC_REF "   "(1,3-%LSN%)
 48 .sr TOC_REF "%TOC_REF%%PageNo%"
 49 .*
 50 .la NO_SECTION
 51 .ur .srv TITLE1 "%%[translate "%Parameter%" " " "!"]%%"
 52 .srv TITLEN 1
 53 .*
 54 .la PART_LOOP
 55 .ur .ts Measure("%%TITLE%TITLEN%%%") <= %LEVEL_SIZE%
 56 .rt
 57 .*
 58 .*.ur .ur .ur .ur .srv PART_LENGTH %LEVEL_SIZE% - %%%%%%%%%%[index "%%%%%%[reverse "%%%%[substr "%%TITLE%TITLEN%%%" 1 %LEVEL_SIZE%]%%%%"]%%%%%%" " "]%%%%%%%%%%
 59 .ur .ur .srv PART_LENGTH Wordl("%%TITLE%TITLEN%%%", %LEVEL_SIZE%)
 60 .ur .ur .srv TITLE%%{%TITLEN% + 1}%% "%%TITLE%TITLEN%%%"(%PART_LENGTH% + 1)
 61 .ur .srv TITLE%TITLEN% "%%TITLE%TITLEN%%%"(1,%PART_LENGTH%)
 62 .srv TITLEN %TITLEN% + 1
 63 .go PART_LOOP
 64 .*                                      TITLE BREAKER
 65 .la break_title
 66 .srv TITLE "%Parameter%"                ;.* copy input arg
 67 .srv TITLE1 "%Parameter%"               ;.* in case of no breaker
 68 .srv TITLEN 1                           ;.* title line counter
 69 .srv SCNDX 1                            ;.* line scanner
 70 .*
 71 .la BREAKER_LOOP
 72 .ur .ur .srv BRKR %%%%[index "%%{"%TITLE%"(%SCNDX%)}%%" "!"]%%%% ;.* find one
 73 .ts %BRKR% = 0                          ;.* no more, all done
 74 .rt
 75 .*                                      is it protected?
 76 .srv BRK_PROT "%TITLE%"(%SCNDX% + %BRKR% - 3,3)
 77 .ts "%BRK_PROT%" ^= "**!" & "%BRK_PROT%" ^= "¿*!" & "%BRK_PROT%"(2) = "*!"
 78 .go NO_BREAK                            ;.* yes
 79 .*
 80 .ur .srv TITLE%TITLEN% "%TITLE%"(%SCNDX%,%BRKR% - 1)
 81 .srv TITLEN %TITLEN% + 1
 82 .ur .srv TITLE%TITLEN%  "%TITLE%"(%SCNDX% + %BRKR%)
 83 .srv TITLE "%TITLE%"(1,%SCNDX% + %BRKR% - 2)" ""%TITLE%"(%SCNDX% + %BRKR%)
 84 .*
 85 .la NO_BREAK
 86 .srv SCNDX %SCNDX% + %BRKR%
 87 .go BREAKER_LOOP
 88 
 89 .la onecol
 90 .ts "%DeviceClass%" ^= "bitmap"         ;.* bitmap only
 91 .rt
 92 .srv LEFT_GUTTER 5
 93 .pd  66,70,0,5,60             ;.* sets 36pi on 42pi page w/ 3pi gutters both sides
 94 .srv COLWIDTH 60
 95 .rt
 96 
 97 .la twocol
 98 .srv LEFT_GUTTER 0
 99 .ts "%DeviceClass%" ^= "bitmap"
100 .go NOT_PHOTO
101 .pd 66,71,33,4,33             ;.* sets 2 x 19.8pi cols with 2.4pi gutter
102 .sr COLWIDTH 33
103 .rt
104 
105 .la NOT_PHOTO
106 .ur .srv GUTTER %%{3 + %MPM_SPACE%}%%
107 .ur .srv COLWIDTH %%{(%PageWidth% - %GUTTER%) / 2}%%
108 .ur .pdc %COLWIDTH%,%GUTTER%,%COLWIDTH%
109 .rt
110 
111 .la midbox
112 .la pagebox
113 .la prose_box                           ;.* obsolete entry point
114 .brb                                    ;.* clean up
115 .srv FORM 5                             ;.* this is an exact form
116 .srv FONT "l4exact"                     ;.* in roman font
117 .srv FONT_SIZE 12
118 .ur .ifi break_title "%Parameter%"
119 .*
120 .la mhbox
121 .la hbox
122 .ifi set_page_header                    ;.* clear page header
123 .ts "%Parameter%" = ""                  ;.* null title
124 .rt
125 .* set box stuff
126 .ifi setbox
127 .*
128 .ts "%InputFileName%" ^= "mhbox" & "%InputFileName%" ^= "midbox"
129 .go HBOX
130 .ur .ur .spt %%{2 + %MPM_SPACE%}%%      ;.* put in needed space
131 .ur .ur .brn %%{%TITLEN% + 3 * %MPM_SPACE% + %Widow% + 6}%%
132 .*
133 .ts (%PageLine% = 0) & (%Galley% = 0)   ;.* no mid-page box needed
134 .go HBOX
135 .srv PageBlock -1                       ;.* this is a page block
136 .tbb h                                  ;.* build the midpage box
137 .fif
138 .inl 0
139 .ur .fnt l4font %FONT_SIZE%
140 .ur |%BOX_LINE%||%BOX_LINE%|
141 .spf
142 .srv BOXI 1
143 .la BOX_LOOP_MHBOX
144 .ur .ur |%PAD%%%BOX_WORD%BOXI%%%||%PAD%%%BOX_WORD%BOXI%%%|
145 .srv BOXI %BOXI% + 1
146 .ts %BOXI% <= %TITLEN%
147 .go BOX_LOOP_MHBOX
148 .ur |%BOX_LINE%||%BOX_LINE%|
149 .ur .ur .spf %%{%LABELSPACE% + %MPM_SPACE%}%%
150 .fnt
151 .tbe
152 .srv PageBlock 0
153 .srv MHBOX -1                           ;.* set flag showing a midpage box
154 .*
155 .la HBOX
156 .hbb a                                  ;.* build the page head box
157 .fif
158 .inl 0
159 .ur .fnt %FONT% %FONT_SIZE%
160 .ur |%BOX_LINE%||%BOX_LINE%|
161 .spf
162 .srv BOXI 1
163 .la BOX_LOOP_HBOX
164 .ur .ur |%PAD%%%BOX_WORD%BOXI%%%||%PAD%%%BOX_WORD%BOXI%%%|
165 .srv BOXI %BOXI% + 1
166 .ts %BOXI% <= %TITLEN%
167 .go BOX_LOOP_HBOX
168 .ur |%BOX_LINE%||%BOX_LINE%|
169 .fnt
170 .hbe
171 .rt
172 .*                                       build page header
173 .la set_page_header
174 .hla
175 .ts %PAGE_HEADERN% = 0
176 .rt
177 .*
178 .ts %ParamPresent%
179 .ur .ifi break_title "%Parameter%"
180 .*.fnt l0font
181 .srv I 1
182 .la PAGE_HEADER_LOOP
183 .ur .ur .hla %I% ||%PAD%%%PAGE_HEADER%I%%%|
184 .srv I %I% + 1
185 .ts %I% <= %PAGE_HEADERN%
186 .go PAGE_HEADER_LOOP
187 .*.fnt
188 .rt