3 % PostScript header for NASM documentation
6 % Avoid barfing on old PS implementations
8 {pop} {userdict /pdfmark /cleartomark load put} ifelse
10 {pop} {userdict /setpagedevice /pop load put} ifelse
16 % This asks the PostScript interpreter for the proper size paper
19 1 dict dup /PageSize [pagewidth pageheight] put setpagedevice
23 % Code to handle links
25 /min { 2 copy gt { exch } if pop } def
26 /max { 2 copy lt { exch } if pop } def
34 /lkxmarg 1 def % Extra space for link in x dir
35 /lkymarg 1 def % Extra space for link in y dir
56 % string spacepadding --
59 /lspad exch def /lss exch def
61 gsave lss true charpath flattenpath pathbbox grestore
64 lss spacecount lspad mul add /lkurx exch def
69 lkury max /lkury exch def
70 lss spacecount lspad mul add lkurx max /lkurx exch def
71 lklly min /lklly exch def
72 lkllx min /lkllx exch def
75 lspad 0 space lss widthshow
84 % << .. >> would be languagelevel 2 :(
85 2 dict dup /Subtype /URI put dup /URI lktarget put
90 /Rect [ lkllx lkxmarg sub
103 /View [ /XYZ currentpoint null ]
107 % A "fontset" is an array of fonts; a "stream" is an array of strings
108 % and numbers or procedures:
109 % [ 0 (Foo) ( ) (mani) ( ) 1 (padme) 0 ( ) (hum.) ]
110 % A number choses a font from the current fontset.
111 % A procedure is invoked as-is when printing the stream.
113 % When printing justified, an equal amount of space is added in
114 % between each string.
116 % string -- spacecount
117 % Count space characters in a string
120 space eq { 1 add } if
124 % stream fontset -- spacecount width
125 % Get the width of a stream in the given fontset, and the
126 % number of space characters in the stream
138 dup stringwidth pop w add /w exch def
139 spacecount s add /s exch def
141 /arraytype { pop } def
142 % The input stream is on the top of the stack now
151 % stream fontset spacer --
152 % Show the stream in the given fontset, but add a certain amount
153 % of space to each space character
168 % Now stream is on the top of the stack
176 % Show the stream in the given fontset, with no extra spacing
181 % stream fontset totalspace --
182 % Show the stream justified to fit into a certain number of pixels
185 /ts exch def /fs exch def /st exch def
187 st fs streamwidth ts exch sub exch
188 dup 0 gt { div } { pop } ifelse
193 /bullmarg lmarg bulladj add def
194 /lwidth pagewidth lmarg sub rmarg sub def
195 /bwidth lwidth bulladj sub def
198 % The various paragraph types
199 % The number at the end indicates start (1) of para, end (2) of para
202 currentpoint exch pop 10 sub lmarg exch moveto
203 0 setlinecap 3 setlinewidth
204 lwidth 0 rlineto stroke
207 /chap0 { lmarg exch moveto cfont lwidth showstreamjust } def
208 /chap1 { lmarg exch moveto cfont lwidth showstreamjust } def
209 /chap2 { lmarg exch moveto cfont showstream chapline } def
210 /chap3 { lmarg exch moveto cfont showstream chapline } def
217 % lbl ypos fontset -- ypos
219 3 -1 roll [exch ( )] exch % ypos strm fontset
220 2 copy % ypos strm fontset strm fontset
221 streamwidth % ypos strm fontset spccount width
222 lmarg exch sub % ypos strm fontset spccount xpos
223 4 index % ypos strm fontset spccount xpos ypos
224 moveto % ypos strm fontset spccount
225 pop % ypos strm fontset spccount
229 /head0 { lmarg exch moveto hfont lwidth showstreamjust } def
230 /head1 { hfont headlbl lmarg exch moveto hfont lwidth showstreamjust } def
231 /head2 { lmarg exch moveto hfont showstream } def
232 /head3 { hfont headlbl lmarg exch moveto hfont showstream } def
234 /subh0 { lmarg exch moveto sfont lwidth showstreamjust } def
235 /subh1 { sfont headlbl lmarg exch moveto sfont lwidth showstreamjust } def
236 /subh2 { lmarg exch moveto sfont showstream } def
237 /subh3 { sfont headlbl lmarg exch moveto sfont showstream } def
239 /norm0 { lmarg exch moveto tfont lwidth showstreamjust } def
240 /norm1 { lmarg exch moveto tfont lwidth showstreamjust } def
241 /norm2 { lmarg exch moveto tfont showstream } def
242 /norm3 { lmarg exch moveto tfont showstream } def
244 /code0 { lmarg exch moveto tfont showstream } def
245 /code1 { lmarg exch moveto tfont showstream } def
246 /code2 { lmarg exch moveto tfont showstream } def
247 /code3 { lmarg exch moveto tfont showstream } def
249 /bull0 { bullmarg exch moveto tfont bwidth showstreamjust } def
250 /bull1 { dup lmarg exch moveto [(\267)] tfont showstream
251 bullmarg exch moveto tfont bwidth showstreamjust } def
252 /bull2 { bullmarg exch moveto tfont showstream } def
253 /bull3 { dup lmarg exch moveto [(\267)] tfont showstream
254 bullmarg exch moveto tfont showstream } def
256 /tocw0 lwidth tocpnz sub def
257 /tocw1 tocw0 tocind sub def
258 /tocw2 tocw1 tocind sub def
261 /tocx1 tocx0 tocind add def
262 /tocx2 tocx1 tocind add def
268 /x s stringwidth pop pagewidth rmarg sub exch sub def
269 currentpoint /y exch def
270 lmarg sub tocdots div ceiling tocdots mul lmarg add
272 y moveto (.) 0 linkshow
274 x y moveto s 0 linkshow
279 /toc00 { tocx0 exch moveto 0 rmoveto tfont showstream } def
280 /toc01 { tocx0 exch moveto
281 linkbegin tfont0 setfont 0 linkshow tfont showstream } def
282 /toc02 { tocx0 exch moveto 3 1 roll
283 0 rmoveto tfont showstream tocpn } def
284 /toc03 { tocx0 exch moveto 4 1 roll
285 linkbegin tfont0 setfont 0 linkshow tfont showstream tocpn } def
287 /toc10 { tocx1 exch moveto 0 rmoveto tfont showstream } def
288 /toc11 { tocx1 exch moveto
289 linkbegin tfont0 setfont 0 linkshow tfont showstream } def
290 /toc12 { tocx1 exch moveto 3 1 roll
291 0 rmoveto tfont showstream tocpn } def
292 /toc13 { tocx1 exch moveto 4 1 roll
293 linkbegin tfont0 setfont 0 linkshow tfont showstream tocpn } def
295 /toc20 { tocx2 exch moveto 0 rmoveto tfont showstream } def
296 /toc21 { tocx2 exch moveto
297 linkbegin tfont0 setfont 0 linkshow tfont showstream } def
298 /toc22 { tocx2 exch moveto 3 1 roll
299 0 rmoveto tfont showstream tocpn } def
300 /toc23 { tocx2 exch moveto 4 1 roll
301 linkbegin tfont0 setfont 0 linkshow tfont showstream tocpn } def
306 /pagey botmarg pymarg sub def
307 /pagel lmarg plmarg sub def
308 /pager pagewidth rmarg sub prmarg add def
310 /pageeven { pagel pagey moveto sfont0 setfont show } def
311 /pageodd { sfont0 setfont dup stringwidth pop pager exch sub
312 pagey moveto show } def
315 % Functions invoked during parsing
318 /xl { linkbegin } def
319 /wl { linkbeginuri } def
325 [/PageMode /UseOutlines /DOCVIEW pdfmark % Display bookmarks