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
62 % string spacepadding --
65 /lspad exch def /lss exch def
67 gsave lss true charpath flattenpath pathbbox grestore
70 lss spacecount lspad mul add /lkurx exch def
75 lkury max /lkury exch def
76 lss spacecount lspad mul add lkurx max /lkurx exch def
77 lklly min /lklly exch def
78 lkllx min /lkllx exch def
81 lspad 0 space lss widthshow
93 % << .. >> would be languagelevel 2 :(
94 2 dict dup /Subtype /URI put dup /URI lktarget put
97 % /Page lktarget /View [ /XYZ 0 pageheight null ]
101 /Rect [ lkllx lkxmarg sub
114 /View [ /XYZ currentpoint null ]
118 % A "fontset" is an array of fonts; a "stream" is an array of strings
119 % and numbers or procedures:
120 % [ 0 (Foo) ( ) (mani) ( ) 1 (padme) 0 ( ) (hum.) ]
121 % A number choses a font from the current fontset.
122 % A procedure is invoked as-is when printing the stream.
124 % When printing justified, an equal amount of space is added in
125 % between each string.
127 % string -- spacecount
128 % Count space characters in a string
131 space eq { 1 add } if
135 % stream fontset -- spacecount width
136 % Get the width of a stream in the given fontset, and the
137 % number of space characters in the stream
149 dup stringwidth pop w add /w exch def
150 spacecount s add /s exch def
152 /arraytype { pop } def
153 % The input stream is on the top of the stack now
162 % stream fontset spacer --
163 % Show the stream in the given fontset, but add a certain amount
164 % of space to each space character
179 % Now stream is on the top of the stack
187 % Show the stream in the given fontset, with no extra spacing
192 % stream fontset totalspace --
193 % Show the stream justified to fit into a certain number of pixels
196 /ts exch def /fs exch def /st exch def
198 st fs streamwidth ts exch sub exch
199 dup 0 gt { div } { pop } ifelse
204 /bullmarg lmarg bulladj add def
205 /lwidth pagewidth lmarg sub rmarg sub def
206 /bwidth lwidth bulladj sub def
209 % The various paragraph types
210 % The number at the end indicates start (1) of para, end (2) of para
213 currentpoint exch pop 10 sub lmarg exch moveto
214 0 setlinecap 3 setlinewidth
215 lwidth 0 rlineto stroke
218 /chap0 { lmarg exch moveto cfont lwidth showstreamjust } def
219 /chap1 { lmarg exch moveto cfont lwidth showstreamjust } def
220 /chap2 { lmarg exch moveto cfont showstream chapline } def
221 /chap3 { lmarg exch moveto cfont showstream chapline } def
228 % lbl ypos fontset -- ypos
230 3 -1 roll [exch ( )] exch % ypos strm fontset
231 2 copy % ypos strm fontset strm fontset
232 streamwidth % ypos strm fontset spccount width
233 lmarg exch sub % ypos strm fontset spccount xpos
234 4 index % ypos strm fontset spccount xpos ypos
235 moveto % ypos strm fontset spccount
236 pop % ypos strm fontset spccount
240 /head0 { lmarg exch moveto hfont lwidth showstreamjust } def
241 /head1 { hfont headlbl lmarg exch moveto hfont lwidth showstreamjust } def
242 /head2 { lmarg exch moveto hfont showstream } def
243 /head3 { hfont headlbl lmarg exch moveto hfont showstream } def
245 /subh0 { lmarg exch moveto sfont lwidth showstreamjust } def
246 /subh1 { sfont headlbl lmarg exch moveto sfont lwidth showstreamjust } def
247 /subh2 { lmarg exch moveto sfont showstream } def
248 /subh3 { sfont headlbl lmarg exch moveto sfont showstream } def
250 /norm0 { lmarg exch moveto tfont lwidth showstreamjust } def
251 /norm1 { lmarg exch moveto tfont lwidth showstreamjust } def
252 /norm2 { lmarg exch moveto tfont showstream } def
253 /norm3 { lmarg exch moveto tfont showstream } def
255 /code0 { lmarg exch moveto tfont showstream } def
256 /code1 { lmarg exch moveto tfont showstream } def
257 /code2 { lmarg exch moveto tfont showstream } def
258 /code3 { lmarg exch moveto tfont showstream } def
260 /bull0 { bullmarg exch moveto tfont bwidth showstreamjust } def
261 /bull1 { dup lmarg exch moveto [(\267)] tfont showstream
262 bullmarg exch moveto tfont bwidth showstreamjust } def
263 /bull2 { bullmarg exch moveto tfont showstream } def
264 /bull3 { dup lmarg exch moveto [(\267)] tfont showstream
265 bullmarg exch moveto tfont showstream } def
267 /tocw0 lwidth tocpnz sub def
268 /tocw1 tocw0 tocind sub def
269 /tocw2 tocw1 tocind sub def
272 /tocx1 tocx0 tocind add def
273 /tocx2 tocx1 tocind add def
279 /x s stringwidth pop pagewidth rmarg sub exch sub def
280 currentpoint /y exch def
281 lmarg sub tocdots div ceiling tocdots mul lmarg add
283 y moveto (.) 0 linkshow
285 x y moveto s 0 linkshow
290 /toc00 { tocx0 exch moveto 0 rmoveto tfont showstream } def
291 /toc01 { tocx0 exch moveto
292 linkbegindest tfont0 setfont 0 linkshow tfont showstream } def
293 /toc02 { tocx0 exch moveto 3 1 roll
294 0 rmoveto tfont showstream tocpn } def
295 /toc03 { tocx0 exch moveto 4 1 roll
296 linkbegindest tfont0 setfont 0 linkshow tfont showstream tocpn } def
298 /toc10 { tocx1 exch moveto 0 rmoveto tfont showstream } def
299 /toc11 { tocx1 exch moveto
300 linkbegindest tfont0 setfont 0 linkshow tfont showstream } def
301 /toc12 { tocx1 exch moveto 3 1 roll
302 0 rmoveto tfont showstream tocpn } def
303 /toc13 { tocx1 exch moveto 4 1 roll
304 linkbegindest tfont0 setfont 0 linkshow tfont showstream tocpn } def
306 /toc20 { tocx2 exch moveto 0 rmoveto tfont showstream } def
307 /toc21 { tocx2 exch moveto
308 linkbegindest tfont0 setfont 0 linkshow tfont showstream } def
309 /toc22 { tocx2 exch moveto 3 1 roll
310 0 rmoveto tfont showstream tocpn } def
311 /toc23 { tocx2 exch moveto 4 1 roll
312 linkbegindest tfont0 setfont 0 linkshow tfont showstream tocpn } def
314 % Spacing between index columns
315 /indexcolumn pagewidth lmarg sub rmarg sub idxgutter add idxcolumns div def
316 % Width of an individual index column
317 /indexcolwid indexcolumn idxgutter sub def
321 indexcolumn mul lmarg add
322 /x exch def /y exch def x y moveto
323 exch tfont showstream
324 dup tfont streamwidth
325 x indexcolwid add exch sub exch pop y moveto
336 /pagey botmarg pymarg sub def
337 /pagel lmarg plmarg sub def
338 /pager pagewidth rmarg sub prmarg add def
340 /pageeven { pagel pagey moveto sfont0 setfont show } def
341 /pageodd { sfont0 setfont dup stringwidth pop pager exch sub
342 pagey moveto show } def
345 % Functions invoked during parsing
348 /pa { 0 pageheight moveto linkdest } def
349 /xl { linkbegindest } def
350 /wl { linkbeginuri } def
351 /pl { linkbeginpage } def
357 [/PageMode /UseOutlines /DOCVIEW pdfmark % Display bookmarks