2 % PostScript header for NASM documentation
5 % Avoid barfing on old PS implementations
7 {pop} {userdict /pdfmark /cleartomark load put} ifelse
9 {pop} {userdict /setpagedevice /pop load put} ifelse
15 % This asks the PostScript interpreter for the proper size paper
18 1 dict dup /PageSize [pagewidth pageheight] put setpagedevice
22 % Code to handle links
24 /min { 2 copy gt { exch } if pop } def
25 /max { 2 copy lt { exch } if pop } def
33 /lkxmarg 1 def % Extra space for link in x dir
34 /lkymarg 1 def % Extra space for link in y dir
43 colorlinks { 0 0 0.4 setrgbcolor } if
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
89 /Action 2 dict dup /Subtype /URI put dup /URI lktarget put
94 /Rect [ lkllx lkxmarg sub
101 colorlinks { 0 setgray } if
108 /View [ /XYZ currentpoint null ]
112 % A "fontset" is an array of fonts; a "stream" is an array of strings
113 % and numbers or procedures:
114 % [ 0 (Foo) ( ) (mani) ( ) 1 (padme) 0 ( ) (hum.) ]
115 % A number choses a font from the current fontset.
116 % A procedure is invoked as-is when printing the stream.
118 % When printing justified, an equal amount of space is added in
119 % between each string.
121 % string -- spacecount
122 % Count space characters in a string
125 space eq { 1 add } if
129 % stream fontset -- spacecount width
130 % Get the width of a stream in the given fontset, and the
131 % number of space characters in the stream
143 dup stringwidth pop w add /w exch def
144 spacecount s add /s exch def
146 /arraytype { pop } def
147 % The input stream is on the top of the stack now
156 % stream fontset spacer --
157 % Show the stream in the given fontset, but add a certain amount
158 % of space to each space character
173 % Now stream is on the top of the stack
181 % Show the stream in the given fontset, with no extra spacing
186 % stream fontset totalspace --
187 % Show the stream justified to fit into a certain number of pixels
190 /ts exch def /fs exch def /st exch def
192 st fs streamwidth ts exch sub exch
193 dup 0 gt { div } { pop } ifelse
198 /bullmarg lmarg bulladj add def
199 /lwidth pagewidth lmarg sub rmarg sub def
200 /bwidth lwidth bulladj sub def
203 % The various paragraph types
204 % The number at the end indicates start (1) of para, end (2) of para
207 currentpoint exch pop 10 sub lmarg exch moveto
208 0 setlinecap 3 setlinewidth
209 lwidth 0 rlineto stroke
212 /chap0 { lmarg exch moveto cfont lwidth showstreamjust } def
213 /chap1 { lmarg exch moveto cfont lwidth showstreamjust } def
214 /chap2 { lmarg exch moveto cfont showstream chapline } def
215 /chap3 { lmarg exch moveto cfont showstream chapline } def
222 % lbl ypos fontset -- ypos
224 3 -1 roll [exch ( )] exch % ypos strm fontset
225 2 copy % ypos strm fontset strm fontset
226 streamwidth % ypos strm fontset spccount width
227 lmarg exch sub % ypos strm fontset spccount xpos
228 4 index % ypos strm fontset spccount xpos ypos
229 moveto % ypos strm fontset spccount
230 pop % ypos strm fontset spccount
234 /head0 { lmarg exch moveto hfont lwidth showstreamjust } def
235 /head1 { hfont headlbl lmarg exch moveto hfont lwidth showstreamjust } def
236 /head2 { lmarg exch moveto hfont showstream } def
237 /head3 { hfont headlbl lmarg exch moveto hfont showstream } def
239 /subh0 { lmarg exch moveto sfont lwidth showstreamjust } def
240 /subh1 { sfont headlbl lmarg exch moveto sfont lwidth showstreamjust } def
241 /subh2 { lmarg exch moveto sfont showstream } def
242 /subh3 { sfont headlbl lmarg exch moveto sfont showstream } def
244 /norm0 { lmarg exch moveto bfont lwidth showstreamjust } def
245 /norm1 { lmarg exch moveto bfont lwidth showstreamjust } def
246 /norm2 { lmarg exch moveto bfont showstream } def
247 /norm3 { lmarg exch moveto bfont showstream } def
249 /code0 { lmarg exch moveto bfont showstream } def
250 /code1 { lmarg exch moveto bfont showstream } def
251 /code2 { lmarg exch moveto bfont showstream } def
252 /code3 { lmarg exch moveto bfont showstream } def
254 /bull0 { bullmarg exch moveto bfont bwidth showstreamjust } def
255 /bull1 { dup lmarg exch moveto bullet bfont showstream
256 bullmarg exch moveto bfont bwidth showstreamjust } def
257 /bull2 { bullmarg exch moveto bfont showstream } def
258 /bull3 { dup lmarg exch moveto bullet bfont showstream
259 bullmarg exch moveto bfont showstream } def
261 /tocw0 lwidth tocpnz sub def
262 /tocw1 tocw0 tocind sub def
263 /tocw2 tocw1 tocind sub def
266 /tocx1 tocx0 tocind add def
267 /tocx2 tocx1 tocind add def
273 /x s stringwidth pop pagewidth rmarg sub exch sub def
274 currentpoint /y exch def
275 lmarg sub tocdots div ceiling tocdots mul lmarg add
277 y moveto (.) 0 linkshow
279 x y moveto s 0 linkshow
284 /toc00 { tocx0 exch moveto 0 rmoveto bfont showstream } def
285 /toc01 { tocx0 exch moveto
286 linkbegindest bfont0 setfont 0 linkshow bfont showstream } def
287 /toc02 { tocx0 exch moveto 3 1 roll
288 0 rmoveto bfont showstream tocpn } def
289 /toc03 { tocx0 exch moveto 4 1 roll
290 linkbegindest bfont0 setfont 0 linkshow bfont showstream tocpn } def
292 /toc10 { tocx1 exch moveto 0 rmoveto bfont showstream } def
293 /toc11 { tocx1 exch moveto
294 linkbegindest bfont0 setfont 0 linkshow bfont showstream } def
295 /toc12 { tocx1 exch moveto 3 1 roll
296 0 rmoveto bfont showstream tocpn } def
297 /toc13 { tocx1 exch moveto 4 1 roll
298 linkbegindest bfont0 setfont 0 linkshow bfont showstream tocpn } def
300 /toc20 { tocx2 exch moveto 0 rmoveto bfont showstream } def
301 /toc21 { tocx2 exch moveto
302 linkbegindest bfont0 setfont 0 linkshow bfont showstream } def
303 /toc22 { tocx2 exch moveto 3 1 roll
304 0 rmoveto bfont showstream tocpn } def
305 /toc23 { tocx2 exch moveto 4 1 roll
306 linkbegindest bfont0 setfont 0 linkshow bfont showstream tocpn } def
308 % Spacing between index columns
309 /indexcolumn pagewidth lmarg sub rmarg sub idxgutter add idxcolumns div def
310 % Width of an individual index column
311 /indexcolwid indexcolumn idxgutter sub def
315 indexcolumn mul lmarg add
316 /x exch def /y exch def x y moveto
317 exch bfont showstream
318 dup bfont streamwidth
319 x indexcolwid add exch sub exch pop y moveto
329 indexcolumn mul lmarg add idxindent add
330 /x exch def /y exch def x y moveto
331 exch bfont showstream
332 dup bfont streamwidth
333 x indexcolwid idxindent sub add exch sub exch pop y moveto
344 /pagey botmarg pymarg sub def
345 /pagel lmarg plmarg sub def
346 /pager pagewidth rmarg sub prmarg add def
348 /pageeven { pagel pagey moveto bfont1 setfont show } def
349 /pageodd { bfont1 setfont dup stringwidth pop pager exch sub
350 pagey moveto show } def
353 % Functions invoked during parsing
356 /pa { 0 pageheight moveto linkdest } def
357 /xl { linkbegindest } def
358 /wl { linkbeginuri } def
359 /pl { linkbeginpage } def
365 [/PageMode /UseOutlines /DOCVIEW pdfmark % Display bookmarks
368 % Functions to include EPS
371 /Before_EPSF_State save def
372 /dict_count countdictstack def
373 /op_count count 1 sub def
376 0 setgray 0 setlinecap
377 1 setlinewidth 0 setlinejoin
378 10 setmiterlimit [ ] 0 setdash newpath
383 false setstrokeadjust false setoverprint
388 count op_count sub {pop} repeat
389 countdictstack dict_count sub {end} repeat
390 Before_EPSF_State restore